From d74320439c400672de0519b6475b0b96eeb075e2 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Mon, 25 Dec 2023 19:31:44 +0100 Subject: [PATCH 001/126] install linux dependencies in a single step to speed up installation --- azure-pipelines.yml | 90 ++++++++++++++++++++++----------------------- 1 file changed, 44 insertions(+), 46 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index ba8fc2d810..f0b407fcc7 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -6,33 +6,32 @@ jobs: steps: - script: | sudo apt update - sudo apt install -y software-properties-common - wget -q https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb - sudo dpkg -i packages-microsoft-prod.deb + sudo apt install --yes software-properties-common + wget --quiet https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb + sudo dpkg --install packages-microsoft-prod.deb sudo apt update - sudo apt install cmake build-essential ninja-build ccache -y - sudo apt install bison autoconf automake -y - sudo apt install libpng-dev -y - sudo apt install libjpeg-dev -y - sudo apt install libgif-dev libfreetype6-dev -y - sudo apt install freeglut3-dev -y - sudo apt install liblua5.2-dev libluabind-dev libcpptest-dev -y - sudo apt install libogg-dev libvorbis-dev libopenal-dev -y - sudo apt install libavcodec-dev libavformat-dev libavdevice-dev libswscale-dev libpostproc-dev -y - sudo apt install libmysqlclient-dev -y - sudo apt install libxml2-dev -y - sudo apt install libcurl4-openssl-dev libssl-dev -y - sudo apt install libsquish-dev -y - sudo apt install liblzma-dev -y - sudo apt install libgsf-1-dev -y - sudo apt install qtbase5-dev qttools5-dev qttools5-dev-tools - sudo apt install libmsquic + sudo apt install --yes \ + cmake build-essential ninja-build ccache \ + bison autoconf automake \ + libpng-dev \ + libjpeg-dev \ + libgif-dev libfreetype6-dev \ + freeglut3-dev \ + liblua5.2-dev libluabind-dev libcpptest-dev \ + libogg-dev libvorbis-dev libopenal-dev \ + libavcodec-dev libavformat-dev libavdevice-dev libswscale-dev libpostproc-dev \ + libmysqlclient-dev \ + libxml2-dev \ + libcurl4-openssl-dev libssl-dev \ + libsquish-dev \ + liblzma-dev \ + libgsf-1-dev \ + qtbase5-dev qttools5-dev qttools5-dev-tools \ + libmsquic wget https://raw.githubusercontent.com/microsoft/msquic/main/src/inc/msquic.h wget https://raw.githubusercontent.com/microsoft/msquic/main/src/inc/msquic_posix.h wget https://raw.githubusercontent.com/microsoft/msquic/main/src/inc/quic_sal_stub.h - sudo mv msquic.h /usr/include/msquic.h - sudo mv msquic_posix.h /usr/include/msquic_posix.h - sudo mv quic_sal_stub.h /usr/include/quic_sal_stub.h + sudo mv msquic.h msquic_posix.h quic_sal_stub.h /usr/include/ displayName: 'Dependencies' - script: | mkdir build @@ -62,33 +61,32 @@ jobs: steps: - script: | sudo apt update - sudo apt install -y software-properties-common - wget -q https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb - sudo dpkg -i packages-microsoft-prod.deb + sudo apt install --yes software-properties-common + wget --quiet https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb + sudo dpkg --install packages-microsoft-prod.deb sudo apt update - sudo apt install cmake build-essential ninja-build ccache -y - sudo apt install bison autoconf automake -y - sudo apt install libpng-dev -y - sudo apt install libjpeg-dev -y - sudo apt install libgif-dev libfreetype6-dev -y - sudo apt install freeglut3-dev -y - sudo apt install liblua5.2-dev libluabind-dev libcpptest-dev -y - sudo apt install libogg-dev libvorbis-dev libopenal-dev -y - sudo apt install libavcodec-dev libavformat-dev libavdevice-dev libswscale-dev libpostproc-dev -y - sudo apt install libmysqlclient-dev -y - sudo apt install libxml2-dev -y - sudo apt install libcurl4-openssl-dev libssl-dev -y - sudo apt install libsquish-dev -y - sudo apt install liblzma-dev -y - sudo apt install libgsf-1-dev -y - sudo apt install qtbase5-dev qttools5-dev qttools5-dev-tools - sudo apt install libmsquic + sudo apt install --yes \ + cmake build-essential ninja-build ccache \ + bison autoconf automake \ + libpng-dev \ + libjpeg-dev \ + libgif-dev libfreetype6-dev \ + freeglut3-dev \ + liblua5.2-dev libluabind-dev libcpptest-dev \ + libogg-dev libvorbis-dev libopenal-dev \ + libavcodec-dev libavformat-dev libavdevice-dev libswscale-dev libpostproc-dev \ + libmysqlclient-dev \ + libxml2-dev \ + libcurl4-openssl-dev libssl-dev \ + libsquish-dev \ + liblzma-dev \ + libgsf-1-dev \ + qtbase5-dev qttools5-dev qttools5-dev-tools \ + libmsquic wget https://raw.githubusercontent.com/microsoft/msquic/main/src/inc/msquic.h wget https://raw.githubusercontent.com/microsoft/msquic/main/src/inc/msquic_posix.h wget https://raw.githubusercontent.com/microsoft/msquic/main/src/inc/quic_sal_stub.h - sudo mv msquic.h /usr/include/msquic.h - sudo mv msquic_posix.h /usr/include/msquic_posix.h - sudo mv quic_sal_stub.h /usr/include/quic_sal_stub.h + sudo mv msquic.h msquic_posix.h quic_sal_stub.h /usr/include/ displayName: 'Dependencies' - script: | mkdir build From a6339a237eb0fe62e078cec267472725f9c13d83 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Wed, 27 Dec 2023 22:09:45 +0100 Subject: [PATCH 002/126] convert readme to UTF-8 add option to configure FarBank to zviewer adjust tile texture names based on FarBank to be able to load seasons don't update position in zviewer on mouse event --- nel/tools/3d/zviewer/move_listener.cpp | 4 +-- nel/tools/3d/zviewer/move_listener.h | 11 ++++++++ nel/tools/3d/zviewer/readme.txt | 38 +++++++++++++------------- nel/tools/3d/zviewer/zviewer.cpp | 37 +++++++++++++++---------- 4 files changed, 53 insertions(+), 37 deletions(-) diff --git a/nel/tools/3d/zviewer/move_listener.cpp b/nel/tools/3d/zviewer/move_listener.cpp index a4f74b2cc8..fc9c3f674a 100644 --- a/nel/tools/3d/zviewer/move_listener.cpp +++ b/nel/tools/3d/zviewer/move_listener.cpp @@ -69,7 +69,7 @@ CMoveListener::CMoveListener() \****************************************************************/ void CMoveListener::changeViewMatrix() { - float time = (sint64)(_CurrentTime-_LastTime)*0.001f; + const float time(deltaTimeInSeconds()); // Forward if(CNELU::AsyncListener.isKeyDown(KeyUP)) @@ -204,8 +204,6 @@ void CMoveListener::operator()(const CEvent& event) _Scene->getDriver()->setMousePos(0.5,0.5); } } - - changeViewMatrix(); } diff --git a/nel/tools/3d/zviewer/move_listener.h b/nel/tools/3d/zviewer/move_listener.h index 7d7fe81369..0986459572 100644 --- a/nel/tools/3d/zviewer/move_listener.h +++ b/nel/tools/3d/zviewer/move_listener.h @@ -198,6 +198,17 @@ public : _CurrentTime = time; } + sint64 deltaTimeInMilliseconds() const + { + return _CurrentTime - _LastTime; + } + + float deltaTimeInSeconds() const + { + return deltaTimeInMilliseconds() * 0.001f; + } + + void changeControlMode() { _MouseFree = ! _MouseFree; diff --git a/nel/tools/3d/zviewer/readme.txt b/nel/tools/3d/zviewer/readme.txt index 436b211399..38e7d81380 100644 --- a/nel/tools/3d/zviewer/readme.txt +++ b/nel/tools/3d/zviewer/readme.txt @@ -4,18 +4,18 @@ ==================== -ZVIEWER permet de visioner une ou plusieurs zones exportées depuis 3DSMax +ZVIEWER permet de visioner une ou plusieurs zones exportées depuis 3DSMax au format de NeL, en utilisant le moteur. 1. Le fichier zviewer.cfg ----------------------- -Le répertoire d'où est exécuté le programme doit contenir le fichier ZVIEWER.CFG -qui contient les paramètres de configuration. Sans ce fichier aucune zone ne sera -affichée. -Lorsqu'il n'y a pas de fichier de configuration à l'execution un fichier type est -généré. +Le répertoire d'où est exécuté le programme doit contenir le fichier ZVIEWER.CFG +qui contient les paramètres de configuration. Sans ce fichier aucune zone ne sera +affichée. +Lorsqu'il n'y a pas de fichier de configuration à l'execution un fichier type est +généré. Exemple de config : @@ -57,8 +57,8 @@ Depth : nombre de couleurs (32bits,24bits,...). Position : -position initiale (x,y,z). Correspond aux coordonnées dans Max (Generic Units). -La position est automatiquement snapée au sol quelque soit la coordonnée en z. +position initiale (x,y,z). Correspond aux coordonnées dans Max (Generic Units). +La position est automatiquement snapée au sol quelque soit la coordonnée en z. EyesHeight : hauteur des yeux pour le mode Walk. @@ -73,7 +73,7 @@ LandscapeTileNear : valeur du near. Plus cette valeur est grande, plus la zone du near est grande. LandscapeThreshold : -seuil utilisé pour la subdivision adaptative. Quand la valeur augmente, la qualité +seuil utilisé pour la subdivision adaptative. Quand la valeur augmente, la qualité de la subdivision diminue (reduit le temps de calcul). Mis au minimum par defaut (0.001). BanksPath : @@ -89,18 +89,18 @@ Zones : liste des noms des zones -2. Les déplacements +2. Les déplacements ---------------- -Les déplacements se font à l'aide de la combinaison clavier/souris. -Il existe 2 modes de déplacement : FreeLook et Walk (defaut). +Les déplacements se font à l'aide de la combinaison clavier/souris. +Il existe 2 modes de déplacement : FreeLook et Walk (defaut). -- Le mode FreeLook permet de se déplacer dans la direction du regard(idem cstrike). -- Dans le mode Walk le déplacement se fait au niveau du sol, à hauteur des yeux. - L'utilisateur reste collé au sol. +- Le mode FreeLook permet de se déplacer dans la direction du regard(idem cstrike). +- Dans le mode Walk le déplacement se fait au niveau du sol, à hauteur des yeux. + L'utilisateur reste collé au sol. La souris permet d'orienter le regard dans toutes les directions -Le clavier permet de se déplacer. +Le clavier permet de se déplacer. 3. Les touches @@ -110,11 +110,11 @@ F1 : Afficher/Masquer les infos F3 : basculer entre le mode plein et le mode fil de fer F12 : faire un screenshot ESPACE : basculer entre les modes Walk et Free-Look -RETURN : libérer ou capturer la souris +RETURN : libérer ou capturer la souris UP : avancer DOWN : reculer -LEFT : déplacement latéral à gauche -RIGHT : déplacement latéral à droite +LEFT : déplacement latéral à gauche +RIGHT : déplacement latéral à droite SHIFT : augmenter l'altitude CTRL : baisser d'altitude 1 : 5 km/h diff --git a/nel/tools/3d/zviewer/zviewer.cpp b/nel/tools/3d/zviewer/zviewer.cpp index 8502110434..9b39587d08 100644 --- a/nel/tools/3d/zviewer/zviewer.cpp +++ b/nel/tools/3d/zviewer/zviewer.cpp @@ -89,6 +89,7 @@ struct CViewerConfig string ShapePath; string MapsPath; string Bank; + string FarBank; string FontPath; CTextContext TextContext; CFontManager FontManager; @@ -375,7 +376,7 @@ void displayZones() nlerror (tmp.c_str()); } - if ((Landscape->Landscape.TileBank.getAbsPath ().empty())&&(!ViewerCfg.TilesPath.empty())) + if (!ViewerCfg.TilesPath.empty()) Landscape->Landscape.TileBank.setAbsPath (ViewerCfg.TilesPath + "/"); if (ViewerCfg.UseDDS) @@ -389,6 +390,10 @@ void displayZones() string::size_type idx = ViewerCfg.Bank.find("."); string farBank = ViewerCfg.Bank.substr(0,idx); farBank += "_su.farbank"; + if (!ViewerCfg.FarBank.empty()) + { + farBank = ViewerCfg.FarBank; + } try { @@ -405,7 +410,10 @@ void displayZones() { nlwarning( "You need to recompute bank.farbank for the far textures" ); } - + string seasonPostfix = farBank.substr(idx,3); + Landscape->Landscape.TileBank.postfixTileFilename (seasonPostfix.c_str()); + Landscape->Landscape.TileBank.postfixTileVegetableDesc (seasonPostfix.c_str()); + // Init light color CNELU::clearBuffers(CRGBA(0,0,0)); ViewerCfg.TextContext.printfAt(0.5f,0.5f,"Initializing Light..."); @@ -445,7 +453,7 @@ void displayZones() CZone zone; try { - CIFile file(CPath::lookup(ViewerCfg.Zones[i])); + CIFile file(CPath::lookup(ViewerCfg.ZonesPath + "/" + ViewerCfg.Zones[i])); zone.serial(file); file.close(); @@ -528,26 +536,22 @@ void displayZones() CNELU::Camera->setFrustum(left, right, bottom, top, znear, zfar); + // Time mgt. + //========== + sint64 ts(0); do { - // Time mgt. - //========== - static sint64 t0 = (sint64)CTime::getLocalTime(); - static sint64 t1 = (sint64)CTime::getLocalTime(); - static sint64 ts = 0; - - t0 = t1; - t1 = (sint64)CTime::getLocalTime(); - sint64 dt64 = t1-t0; + + MoveListener.setLocalTime(CTime::getLocalTime()); + sint64 dt64 = MoveListener.deltaTimeInMilliseconds(); ts += dt64; - float dt= ((float)dt64)*0.001f; + float dt(MoveListener.deltaTimeInSeconds()); CNELU::EventServer.pump(); // Manage movement and collision - MoveListener.setLocalTime(CTime::getLocalTime()); CVector oldpos = MoveListener.getPos(); MoveListener.changeViewMatrix(); if(MoveListener.getMode()==CMoveListener::WALK) @@ -698,7 +702,7 @@ void displayZones() ViewerCfg.TextContext.printfAt(0.3f,0.01f,"Zone : %s",zoneName.c_str()); // Position - ViewerCfg.TextContext.printfAt(0.1f,0.01f,"Position : %d %d %d",(sint)pos.x,(sint)pos.y,(sint)pos.z); + ViewerCfg.TextContext.printfAt(0.1f,0.01f,"Position : %.2f %.2f %.2f", pos.x, pos.y, pos.z); // Eyes height ViewerCfg.TextContext.printfAt(0.7f,0.01f,"Eyes : %.2f m",ViewerCfg.EyesHeight.z); @@ -881,6 +885,9 @@ void initViewerConfig(const char * configFileName) CConfigFile::CVar &cvBank = cf.getVar("Bank"); ViewerCfg.Bank = cvBank.asString(); + CConfigFile::CVar &cvFarBank = cf.getVar("FarBank"); + ViewerCfg.FarBank = cvFarBank.asString(); + CConfigFile::CVar &cvZonesPath = cf.getVar("ZonesPath"); ViewerCfg.ZonesPath = cvZonesPath.asString(); CPath::addSearchPath(cvZonesPath.asString()); From a97e1bbc4f4d8c3ffc85d5979d5dd803a36aa268 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Thu, 28 Dec 2023 22:13:50 +0100 Subject: [PATCH 003/126] replace deprecated cmake subdirs command with add_subdirectory --- nel/include/CMakeLists.txt | 3 +- nel/include/nel/CMakeLists.txt | 18 ++--- nel/tools/3d/CMakeLists.txt | 80 +++++++++---------- nel/tools/logic/CMakeLists.txt | 3 +- nel/tools/memory/CMakeLists.txt | 2 +- nel/tools/misc/CMakeLists.txt | 18 ++--- .../misc/log_analyser_plug_ins/CMakeLists.txt | 2 +- 7 files changed, 60 insertions(+), 66 deletions(-) diff --git a/nel/include/CMakeLists.txt b/nel/include/CMakeLists.txt index b234f8fdeb..62534522c4 100644 --- a/nel/include/CMakeLists.txt +++ b/nel/include/CMakeLists.txt @@ -1,2 +1 @@ -SUBDIRS(nel) - +add_subdirectory(nel) \ No newline at end of file diff --git a/nel/include/nel/CMakeLists.txt b/nel/include/nel/CMakeLists.txt index fda0ddbe92..8e50f3e7ef 100644 --- a/nel/include/nel/CMakeLists.txt +++ b/nel/include/nel/CMakeLists.txt @@ -1,7 +1,7 @@ -SUBDIRS(misc) +ADD_SUBDIRECTORY(misc) IF(WITH_3D) - SUBDIRS(3d) + ADD_SUBDIRECTORY(3d) ENDIF() IF(WITH_WEB OR WITH_GUI) @@ -13,29 +13,29 @@ IF(WITH_GUI) ENDIF() IF(WITH_GEORGES) - SUBDIRS(georges) + ADD_SUBDIRECTORY(georges) ENDIF() IF(WITH_LIGO) - SUBDIRS(ligo) + ADD_SUBDIRECTORY(ligo) ENDIF() IF(WITH_LOGIC) - SUBDIRS(logic) + ADD_SUBDIRECTORY(logic) ENDIF() IF(WITH_NET) - SUBDIRS(net) + ADD_SUBDIRECTORY(net) ENDIF() IF(WITH_SOUND) - SUBDIRS(sound) + ADD_SUBDIRECTORY(sound) ENDIF() IF(WITH_PACS) - SUBDIRS(pacs) + ADD_SUBDIRECTORY(pacs) ENDIF() IF(WITH_NEL_CEGUI) - SUBDIRS(cegui) + ADD_SUBDIRECTORY(cegui) ENDIF() diff --git a/nel/tools/3d/CMakeLists.txt b/nel/tools/3d/CMakeLists.txt index 8bf56b6c81..bad0382bf8 100644 --- a/nel/tools/3d/CMakeLists.txt +++ b/nel/tools/3d/CMakeLists.txt @@ -2,52 +2,48 @@ IF(WITH_NEL_TOOLS) IF(WITH_3D) IF(WITH_ASSIMP) - SUBDIRS( - mesh_utils - mesh_export) + ADD_SUBDIRECTORY(mesh_utils) + ADD_SUBDIRECTORY(mesh_export) ENDIF() IF(WITH_LIBGSF) - SUBDIRS( - pipeline_max - pipeline_max_dump - pipeline_max_rewrite_assets) + ADD_SUBDIRECTORY(pipeline_max) + ADD_SUBDIRECTORY(pipeline_max_dump) + ADD_SUBDIRECTORY(pipeline_max_rewrite_assets) ENDIF() - SUBDIRS( - anim_builder - animation_set_builder - build_clod_bank - build_clodtex - build_coarse_mesh - build_far_bank - build_shadow_skin - build_smallbank - cluster_viewer - file_info - ig_add - ig_elevation - ig_info - ig_lighter - lightmap_optimizer - zone_dependencies - zone_ig_lighter - zone_lighter - zone_welder - unbuild_elevation - zone_elevation - shapes_exporter - shape2obj - zone_check_bind - zone_dump - zviewer) + ADD_SUBDIRECTORY(anim_builder) + ADD_SUBDIRECTORY(animation_set_builder) + ADD_SUBDIRECTORY(build_clod_bank) + ADD_SUBDIRECTORY(build_clodtex) + ADD_SUBDIRECTORY(build_coarse_mesh) + ADD_SUBDIRECTORY(build_far_bank) + ADD_SUBDIRECTORY(build_shadow_skin) + ADD_SUBDIRECTORY(build_smallbank) + ADD_SUBDIRECTORY(cluster_viewer) + ADD_SUBDIRECTORY(file_info) + ADD_SUBDIRECTORY(ig_add) + ADD_SUBDIRECTORY(ig_elevation) + ADD_SUBDIRECTORY(ig_info) + ADD_SUBDIRECTORY(ig_lighter) + ADD_SUBDIRECTORY(lightmap_optimizer) + ADD_SUBDIRECTORY(zone_dependencies) + ADD_SUBDIRECTORY(zone_ig_lighter) + ADD_SUBDIRECTORY(zone_lighter) + ADD_SUBDIRECTORY(zone_welder) + ADD_SUBDIRECTORY(unbuild_elevation) + ADD_SUBDIRECTORY(zone_elevation) + ADD_SUBDIRECTORY(shapes_exporter) + ADD_SUBDIRECTORY(shape2obj) + ADD_SUBDIRECTORY(zone_check_bind) + ADD_SUBDIRECTORY(zone_dump) + ADD_SUBDIRECTORY(zviewer) ENDIF() - SUBDIRS( - build_interface - unbuild_interface - get_neighbors - textures_optimizer - textures_tool - tga_cut - tga_resize) + ADD_SUBDIRECTORY(build_interface) + ADD_SUBDIRECTORY(unbuild_interface) + ADD_SUBDIRECTORY(get_neighbors) + ADD_SUBDIRECTORY(textures_optimizer) + ADD_SUBDIRECTORY(textures_tool) + ADD_SUBDIRECTORY(tga_cut) + ADD_SUBDIRECTORY(tga_resize) ENDIF() # For tools selection of only max plugins diff --git a/nel/tools/logic/CMakeLists.txt b/nel/tools/logic/CMakeLists.txt index 0f65ab8f67..520a057702 100644 --- a/nel/tools/logic/CMakeLists.txt +++ b/nel/tools/logic/CMakeLists.txt @@ -1,3 +1,4 @@ IF(MFC_FOUND) - SUBDIRS(logic_editor_dll logic_editor_exe) + ADD_SUBDIRECTORY(logic_editor_dll) + ADD_SUBDIRECTORY(logic_editor_exe) ENDIF() diff --git a/nel/tools/memory/CMakeLists.txt b/nel/tools/memory/CMakeLists.txt index 458a4cc668..66dc4b6e8d 100644 --- a/nel/tools/memory/CMakeLists.txt +++ b/nel/tools/memory/CMakeLists.txt @@ -1 +1 @@ -SUBDIRS(memlog) +ADD_SUBDIRECTORY(memlog) diff --git a/nel/tools/misc/CMakeLists.txt b/nel/tools/misc/CMakeLists.txt index dbe814d3fc..c1f6bdfb7e 100644 --- a/nel/tools/misc/CMakeLists.txt +++ b/nel/tools/misc/CMakeLists.txt @@ -4,16 +4,14 @@ IF(WITH_QT OR WITH_QT5) ENDIF() IF(WITH_NEL_TOOLS) - SUBDIRS( - bnp_make - snp_make - disp_sheet_id - extract_filename - lock - make_sheet_id - xml_packer - utf_generator - ) + ADD_SUBDIRECTORY(bnp_make) + ADD_SUBDIRECTORY(snp_make) + ADD_SUBDIRECTORY(disp_sheet_id) + ADD_SUBDIRECTORY(extract_filename) + ADD_SUBDIRECTORY(lock) + ADD_SUBDIRECTORY(make_sheet_id) + ADD_SUBDIRECTORY(xml_packer) + ADD_SUBDIRECTORY(utf_generator) IF(WITH_QT OR WITH_QT5) ADD_SUBDIRECTORY(words_dic_qt) diff --git a/nel/tools/misc/log_analyser_plug_ins/CMakeLists.txt b/nel/tools/misc/log_analyser_plug_ins/CMakeLists.txt index c773742110..a6ffad5815 100644 --- a/nel/tools/misc/log_analyser_plug_ins/CMakeLists.txt +++ b/nel/tools/misc/log_analyser_plug_ins/CMakeLists.txt @@ -1 +1 @@ -SUBDIRS(extract_warnings) +ADD_SUBDIRECTORY(extract_warnings) From ba35e6a6a8684bc097ed7b98d3dde091442a71f6 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Mon, 15 Jan 2024 17:17:51 +0100 Subject: [PATCH 004/126] add github workflows as alternative to azure pipeline --- .github/workflows/build-client.yml | 113 +++++++++++++++++++++ .github/workflows/cmake-multi-platform.yml | 105 +++++++++++++++++++ 2 files changed, 218 insertions(+) create mode 100644 .github/workflows/build-client.yml create mode 100644 .github/workflows/cmake-multi-platform.yml diff --git a/.github/workflows/build-client.yml b/.github/workflows/build-client.yml new file mode 100644 index 0000000000..a013f76eab --- /dev/null +++ b/.github/workflows/build-client.yml @@ -0,0 +1,113 @@ +name: build client on multiple platforms + +on: + push: + branches: [ "core4", "feature/*" ] + pull_request: + branches: [ "core4" ] + +jobs: + build: + runs-on: ${{ matrix.os }} + + strategy: + fail-fast: false + + matrix: + os: [ubuntu-22.04, ubuntu-20.04, windows-latest, windows-2019, macos-latest, macos-11] + include: + - os: windows-latest + cmake_options: -DWITH_DRIVER_DIRECT3D=ON -DWITH_DRIVER_XAUDIO2=ON + - os: windows-2019 + cmake_options: -DWITH_DRIVER_DIRECT3D=ON -DWITH_DRIVER_XAUDIO2=ON + - os: ubuntu-latest + ubuntu_version: 22.04 + - os: ubuntu-20.04 + ubuntu_version: 20.04 + - os: macos-latest + cmake_options: -DWITH_LIBXML2_ICONV=OFF -GXcode + - os: macos-11 + cmake_options: -DWITH_LIBXML2_ICONV=OFF -GXcode + + steps: + - uses: actions/checkout@v3 + - name: Set reusable strings + # Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file. + id: strings + shell: bash + run: | + echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" + echo "hunter-dir=${{ github.workspace }}/.hunter" >> "$GITHUB_OUTPUT" + echo "cmake-version=3.27.9" >> "$GITHUB_OUTPUT" + echo "cmake-install-dir=/opt/cmake-3.27.9" >> "$GITHUB_OUTPUT" + + - name: Dependencies Linux + if: runner.os == 'Linux' + run: | + wget --quiet https://packages.microsoft.com/config/ubuntu/${{ matrix.ubuntu_version }}/packages-microsoft-prod.deb + sudo dpkg -i packages-microsoft-prod.deb + sudo apt update + sudo apt remove --yes man-db + sudo apt update + sudo apt install -y --no-install-recommends \ + libasound2-dev \ + libgl1-mesa-dev \ + libjack-dev \ + libpulse-dev \ + libxrandr-dev \ + libxrender-dev \ + libxxf86vm-dev \ + libmsquic + wget https://raw.githubusercontent.com/microsoft/msquic/main/src/inc/msquic.h + wget https://raw.githubusercontent.com/microsoft/msquic/main/src/inc/msquic_posix.h + wget https://raw.githubusercontent.com/microsoft/msquic/main/src/inc/quic_sal_stub.h + sudo mv msquic.h msquic_posix.h quic_sal_stub.h /usr/include/ + wget --output-document=/tmp/cmake.sh https://github.com/Kitware/CMake/releases/download/v${{ steps.strings.outputs.cmake-version }}/cmake-${{ steps.strings.outputs.cmake-version }}-linux-x86_64.sh + sudo mkdir ${{ steps.strings.outputs.cmake-install-dir }} + sudo sh /tmp/cmake.sh --skip-license --prefix=${{ steps.strings.outputs.cmake-install-dir }} + sudo ln --symbolic --force ${{ steps.strings.outputs.cmake-install-dir }}/bin/cmake /usr/local/bin/cmake + + - name: Cache Hunter Dependencies + uses: actions/cache@v3.3.2 + with: + path: ${{ steps.strings.outputs.hunter-dir }} + key: ${{ matrix.os }}-hunter-cache + + - name: Cache Chocolatey Dependencies + if: runner.os == 'Windows' + uses: actions/cache@v3.3.2 + with: + path: C:\Users\runneradmin\AppData\Local\Temp\chocolatey + key: ${{ runner.os }}-chocolatey-cache + + - name: Dependencies Windows + if: runner.os == 'Windows' + run: > + choco install directx-sdk + + - name: Configure CMake + # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. + # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type + run: > + cmake --version; + cmake -B ${{ steps.strings.outputs.build-output-dir }} + ${{ matrix.cmake_options }} + -DCMAKE_CONFIGURATION_TYPES=Release + -DFINAL_VERSION=OFF + -DHUNTER_CONFIGURATION_TYPES=Release + -DHUNTER_ENABLED=ON + -DHUNTER_ROOT=${{ steps.strings.outputs.hunter-dir }} + -DWITH_DRIVER_OPENAL=ON + -DWITH_DRIVER_OPENGL=ON + -DWITH_INSTALL_LIBRARIES=OFF + -DWITH_NEL_SAMPLES=OFF + -DWITH_NEL_TESTS=OFF + -DWITH_NEL_TOOLS=OFF + -DWITH_RYZOM_CLIENT=ON + -DWITH_RYZOM_SERVER=OFF + -DWITH_RYZOM_TOOLS=OFF + -S ${{ github.workspace }} + + - name: Build + # Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator). + run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config Release diff --git a/.github/workflows/cmake-multi-platform.yml b/.github/workflows/cmake-multi-platform.yml new file mode 100644 index 0000000000..ff306692b9 --- /dev/null +++ b/.github/workflows/cmake-multi-platform.yml @@ -0,0 +1,105 @@ +name: CMake on multiple platforms + +on: + push: + branches: [ "core4", "feature/*" ] + pull_request: + branches: [ "core4" ] + +jobs: + build: + runs-on: ${{ matrix.os }} + + strategy: + # Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable. + fail-fast: false + + matrix: + os: [ubuntu-22.04, ubuntu-20.04] + build_type: [Release] + c_compiler: [gcc] + include: + - os: ubuntu-22.04 + c_compiler: gcc + cpp_compiler: g++ + ubuntu_version: 22.04 + - os: ubuntu-20.04 + c_compiler: gcc + cpp_compiler: g++ + ubuntu_version: 20.04 + + steps: + - uses: actions/checkout@v3 + - name: Set reusable strings + # Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file. + id: strings + shell: bash + run: | + echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" + + - name: Dependencies + run: | + sudo apt update + sudo apt install --yes software-properties-common + wget --quiet https://packages.microsoft.com/config/ubuntu/${{ matrix.ubuntu_version }}/packages-microsoft-prod.deb + sudo dpkg --install packages-microsoft-prod.deb + sudo apt update + sudo apt install --yes \ + cmake build-essential ninja-build ccache \ + bison autoconf automake \ + libpng-dev \ + libjpeg-dev \ + libgif-dev libfreetype6-dev \ + freeglut3-dev \ + liblua5.2-dev libluabind-dev libcpptest-dev \ + libogg-dev libvorbis-dev libopenal-dev \ + libavcodec-dev libavformat-dev libavdevice-dev libswscale-dev libpostproc-dev \ + libmysqlclient-dev \ + libxml2-dev \ + libcurl4-openssl-dev libssl-dev \ + libsquish-dev \ + liblzma-dev \ + libgsf-1-dev \ + qtbase5-dev qttools5-dev qttools5-dev-tools \ + libmsquic + wget https://raw.githubusercontent.com/microsoft/msquic/main/src/inc/msquic.h + wget https://raw.githubusercontent.com/microsoft/msquic/main/src/inc/msquic_posix.h + wget https://raw.githubusercontent.com/microsoft/msquic/main/src/inc/quic_sal_stub.h + sudo mv msquic.h msquic_posix.h quic_sal_stub.h /usr/include/ + + - name: Configure CMake + # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. + # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type + run: > + cmake -B ${{ steps.strings.outputs.build-output-dir }} + -G "Ninja" + -DCMAKE_SUPPRESS_REGENERATION=ON + -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} + -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} + -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} + -DWITH_STATIC=ON + -DWITH_NEL_TESTS=ON + -DWITH_NEL_SAMPLES=ON + -DWITH_LUA51=OFF + -DWITH_LUA52=ON + -DWITH_RYZOM=ON + -DWITH_RYZOM_SERVER=ON + -DWITH_RYZOM_CLIENT=ON + -DWITH_RYZOM_TOOLS=ON + -DWITH_NEL_TOOLS=ON + -DWITH_NELNS=ON + -DWITH_NELNS_LOGIN_SYSTEM=ON + -DWITH_NELNS_SERVER=ON + -DWITH_QT5=ON + -DWITH_LIBGSF=ON + -S ${{ github.workspace }} + + - name: Build + # Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator). + run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} + + - name: Unit Tests + working-directory: ${{ steps.strings.outputs.build-output-dir }} + # Execute tests defined by the CMake configuration. Note that --build-config is needed because the default Windows generator is a multi-config generator (Visual Studio generator). + # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail + run: ctest --build-config ${{ matrix.build_type }} From fad53c1f2c305508c6fc80f3ca66e7fb6f338f01 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Mon, 15 Jan 2024 18:02:34 +0100 Subject: [PATCH 005/126] use specific ubuntu versions --- .github/workflows/build-client.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-client.yml b/.github/workflows/build-client.yml index a013f76eab..24a600f486 100644 --- a/.github/workflows/build-client.yml +++ b/.github/workflows/build-client.yml @@ -20,7 +20,7 @@ jobs: cmake_options: -DWITH_DRIVER_DIRECT3D=ON -DWITH_DRIVER_XAUDIO2=ON - os: windows-2019 cmake_options: -DWITH_DRIVER_DIRECT3D=ON -DWITH_DRIVER_XAUDIO2=ON - - os: ubuntu-latest + - os: ubuntu-22.04 ubuntu_version: 22.04 - os: ubuntu-20.04 ubuntu_version: 20.04 From f5e2f6f613948a450e9ae8499e48d019c76106b5 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Sun, 21 Jan 2024 16:27:57 +0100 Subject: [PATCH 006/126] cross compilation toolchain for win32 --- .github/workflows/cross-compile-client.yml | 87 +++++++++++++++++++ CMakeLists.txt | 6 +- CMakeModules/GetRevision.cmake | 2 - CMakeModules/nel.cmake | 6 +- CMakeModules/toolchain-mingw.cmake | 35 ++++++++ nel/include/nel/misc/log.h | 6 +- nel/include/nel/misc/types_nl.h | 1 + nel/src/gui/lua_helper.cpp | 2 +- nel/src/gui/lua_ihm.cpp | 2 +- nel/src/gui/stdpch.h | 2 +- nel/src/logic/stdlogic.h | 4 +- nel/src/misc/CMakeLists.txt | 4 + nel/src/misc/common.cpp | 2 +- nel/src/misc/log.cpp | 10 +-- nel/src/misc/stdmisc.h | 4 +- nel/src/misc/system_info.cpp | 2 +- nel/src/misc/system_utils.cpp | 6 +- nel/src/misc/time_nl.cpp | 2 +- nel/src/net/stdnet.h | 6 +- nel/src/pipeline/project_config.cpp | 2 +- .../sound/driver/fmod/sound_driver_fmod.cpp | 2 +- nel/src/web/stdweb.h | 4 +- .../3d/object_viewer_widget/src/stdpch.h | 2 +- nel/tools/nel_unit_test/nel_unit_test.cpp | 2 +- ryzom/client/src/client.cpp | 2 +- ryzom/client/src/stdpch.h | 2 +- ryzom/common/src/game_share/stdpch.h | 4 +- .../src/monitor_service/service_main.cpp | 4 +- ryzom/server/src/server_share/mysql_wrapper.h | 4 +- snowballs2/client/src/snowballs_client.cpp | 2 +- snowballs2/server/chat/src/main.cpp | 2 +- .../collision/src/collision_service.cpp | 2 +- snowballs2/server/frontend/src/main.cpp | 2 +- snowballs2/server/position/src/main.cpp | 2 +- 34 files changed, 179 insertions(+), 48 deletions(-) create mode 100644 .github/workflows/cross-compile-client.yml create mode 100644 CMakeModules/toolchain-mingw.cmake diff --git a/.github/workflows/cross-compile-client.yml b/.github/workflows/cross-compile-client.yml new file mode 100644 index 0000000000..fa335158a5 --- /dev/null +++ b/.github/workflows/cross-compile-client.yml @@ -0,0 +1,87 @@ +name: build 32-Bit windows client + +on: + push: + branches: [ "core4", "feature/*" ] + pull_request: + branches: [ "core4" ] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Set reusable strings + # Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file. + id: strings + shell: bash + run: | + echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" + echo "hunter-dir=${{ github.workspace }}/.hunter" >> "$GITHUB_OUTPUT" + echo "cmake-version=3.27.9" >> "$GITHUB_OUTPUT" + echo "cmake-install-dir=/opt/cmake-3.27.9" >> "$GITHUB_OUTPUT" + COMMIT_HASH=${{ github.sha }} + echo "version=sha.${COMMIT_HASH:0:8}" >> "$GITHUB_OUTPUT" + + - name: Dependencies + run: | + sudo apt update + sudo apt install --yes \ + libasound2-dev \ + libgl1-mesa-dev \ + libjack-dev \ + libpulse-dev \ + libxrandr-dev \ + libxrender-dev \ + libxxf86vm-dev \ + mingw-w64 \ + mingw-w64-tools \ + ninja-build + wget --output-document=/tmp/cmake.sh https://github.com/Kitware/CMake/releases/download/v${{ steps.strings.outputs.cmake-version }}/cmake-${{ steps.strings.outputs.cmake-version }}-linux-x86_64.sh + sudo mkdir ${{ steps.strings.outputs.cmake-install-dir }} + sudo sh /tmp/cmake.sh --skip-license --prefix=${{ steps.strings.outputs.cmake-install-dir }} + sudo ln --symbolic --force ${{ steps.strings.outputs.cmake-install-dir }}/bin/cmake /usr/local/bin/cmake + git clone --depth 1 --branch openssl-3.0.12 https://github.com/openssl/openssl.git + cd openssl + ./Configure mingw --cross-compile-prefix=i686-w64-mingw32- --prefix=/usr/i686-w64-mingw32 + make + sudo make install + + - name: Cache Hunter Dependencies + uses: actions/cache@v3.3.2 + with: + path: ${{ steps.strings.outputs.hunter-dir }} + key: ubuntu-latest-hunter-cache + + - name: Configure CMake + # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. + # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type + run: > + cmake --version; + cmake -B ${{ steps.strings.outputs.build-output-dir }} + -G Ninja + -DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/CMakeModules/toolchain-mingw.cmake + -DCMAKE_CONFIGURATION_TYPES=Release + -DFINAL_VERSION=OFF + -DHUNTER_CONFIGURATION_TYPES=Release + -DHUNTER_ENABLED=ON + -DHUNTER_ROOT=${{ steps.strings.outputs.hunter-dir }} + -DWITH_DRIVER_OPENAL=ON + -DWITH_DRIVER_OPENGL=ON + -DWITH_INSTALL_LIBRARIES=OFF + -DWITH_NEL_SAMPLES=OFF + -DWITH_NEL_TESTS=OFF + -DWITH_NEL_TOOLS=OFF + -DWITH_RYZOM_CLIENT=ON + -DWITH_RYZOM_SERVER=OFF + -DWITH_RYZOM_TOOLS=OFF + -S ${{ github.workspace }} + + - name: Build + run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config Release + + - uses: actions/upload-artifact@v4 + with: + name: ryzom-client-win32-${{ steps.strings.outputs.version }} + path: ${{ steps.strings.outputs.build-output-dir }}/bin diff --git a/CMakeLists.txt b/CMakeLists.txt index 3f4f994e39..21603dfb91 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,6 +18,8 @@ # * To build binary archive, use the 'package' target. # To build source archive, use the 'package_source' target. +CMAKE_MINIMUM_REQUIRED(VERSION 3.22) + #----------------------------------------------------------------------------- # Load some macros. SET(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules;${CMAKE_MODULE_PATH}") @@ -39,6 +41,7 @@ ENDIF() # Downloads and install Hunger into HUNTER_ROOT directory. OPTION(HUNTER_ENABLED "Enable Hunter package manager" OFF) IF(HUNTER_ENABLED) + cmake_minimum_required(VERSION 3.24) INCLUDE("CMakeModules/HunterGate.cmake") HunterGate( URL "https://github.com/cpp-pm/hunter/archive/v0.25.3.tar.gz" @@ -79,7 +82,6 @@ ELSE() SET(CURRENT_YEAR "2019") ENDIF() -CMAKE_MINIMUM_REQUIRED(VERSION 2.6) PROJECT(RyzomCore CXX C) SET(NL_VERSION_MAJOR 4) SET(NL_VERSION_MINOR 1) @@ -184,7 +186,7 @@ IF(HUNTER_ENABLED) FIND_PACKAGE(libxml2 CONFIG REQUIRED) SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} libxml2::libxml2) - HUNTER_ADD_PACKAGE(OpenSSL) +# HUNTER_ADD_PACKAGE(OpenSSL) FIND_PACKAGE(OpenSSL REQUIRED) # TODO: is OpenSSL::Crypto only needed for WIN32? SET(OPENSSL_LIBRARIES OpenSSL::SSL OpenSSL::Crypto) diff --git a/CMakeModules/GetRevision.cmake b/CMakeModules/GetRevision.cmake index 1455b39317..418cc74b27 100644 --- a/CMakeModules/GetRevision.cmake +++ b/CMakeModules/GetRevision.cmake @@ -1,5 +1,3 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.6.3) - # ROOT_DIR should be set to root of the repository (where to find the .svn or .hg directory) # SOURCE_DIR should be set to root of your code (where to find CMakeLists.txt) # BINARY_DIR should be set to root of your build directory diff --git a/CMakeModules/nel.cmake b/CMakeModules/nel.cmake index ecc3f5b52c..98610c9d6a 100644 --- a/CMakeModules/nel.cmake +++ b/CMakeModules/nel.cmake @@ -1052,7 +1052,9 @@ MACRO(NL_SETUP_BUILD) ENDIF() # Fix undefined reference to `__stack_chk_fail' error - ADD_PLATFORM_LINKFLAGS("-lc") + IF(NOT MINGW) + ADD_PLATFORM_LINKFLAGS("-lc") + ENDIF() IF(NOT APPLE) ADD_PLATFORM_LINKFLAGS("-Wl,--no-undefined -Wl,--as-needed") @@ -1062,7 +1064,7 @@ MACRO(NL_SETUP_BUILD) ENDIF() ENDIF() - IF(NOT APPLE) + IF(NOT APPLE AND NOT MINGW) # hardening ADD_PLATFORM_LINKFLAGS("-Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now") ENDIF() diff --git a/CMakeModules/toolchain-mingw.cmake b/CMakeModules/toolchain-mingw.cmake new file mode 100644 index 0000000000..8b3051cc62 --- /dev/null +++ b/CMakeModules/toolchain-mingw.cmake @@ -0,0 +1,35 @@ +set(CMAKE_SYSTEM_NAME Windows) + +set(CMAKE_C_COMPILER_TARGET i686-w64-mingw32) +set(CMAKE_CXX_COMPILER_TARGET i686-w64-mingw32) +set(CMAKE_RC_COMPILER_TARGET i686-w64-mingw32) + +set(CMAKE_CROSSCOMPILING TRUE) +set(CMAKE_CROSSCOMPILING_EMULATOR wine) + +set(CMAKE_FIND_ROOT_PATH /usr/i686-w64-mingw32) +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) + +# Prefer posix gcc variant for gtest pthread support +find_program(C_COMPILER_FULL_PATH NAMES + ${CMAKE_C_COMPILER_TARGET}-gcc-posix + ${CMAKE_C_COMPILER_TARGET}-gcc) +if(NOT C_COMPILER_FULL_PATH) + message(FATAL_ERROR "Cross-compiler for ${CMAKE_C_COMPILER_TARGET} not found") +endif() +set(CMAKE_C_COMPILER ${C_COMPILER_FULL_PATH}) + +find_program(CXX_COMPILER_FULL_PATH NAMES + ${CMAKE_CXX_COMPILER_TARGET}-g++-posix + ${CMAKE_CXX_COMPILER_TARGET}-g++) +if(CXX_COMPILER_FULL_PATH) + set(CMAKE_CXX_COMPILER ${CXX_COMPILER_FULL_PATH}) +endif() + +find_program(RC_COMPILER_FULL_PATH NAMES + ${CMAKE_RC_COMPILER_TARGET}-windres) +if(RC_COMPILER_FULL_PATH) + set(CMAKE_RC_COMPILER ${RC_COMPILER_FULL_PATH}) +endif() diff --git a/nel/include/nel/misc/log.h b/nel/include/nel/misc/log.h index 19939fc36a..cee41e9bbb 100644 --- a/nel/include/nel/misc/log.h +++ b/nel/include/nel/misc/log.h @@ -93,9 +93,11 @@ class CLog { /// Find the process name if nobody call setProcessName before static void setDefaultProcessName (); +#if defined(NL_OS_WINDOWS) && !defined(__GNUC__) +#define USE_LOG_CHECK_TYPES +#endif -#ifdef NL_OS_WINDOWS - +#ifdef USE_LOG_CHECK_TYPES #define CHECK_TYPES2(__a,__b) \ inline __a(const char *fmt) { __b(fmt); } \ template __a(const char *fmt, A a) { _check(a); __b(fmt, a); } \ diff --git a/nel/include/nel/misc/types_nl.h b/nel/include/nel/misc/types_nl.h index 012728cbf0..f23cf36807 100644 --- a/nel/include/nel/misc/types_nl.h +++ b/nel/include/nel/misc/types_nl.h @@ -502,6 +502,7 @@ extern void operator delete[](void *p) throw(); #elif defined(NL_ISO_CPP0X_AVAILABLE) || (defined(NL_COMP_VC) && (NL_COMP_VC_VERSION >= 100)) # include # include +# include # define CHashMap ::std::unordered_map # define CHashSet ::std::unordered_set # define CHashMultiMap ::std::unordered_multimap diff --git a/nel/src/gui/lua_helper.cpp b/nel/src/gui/lua_helper.cpp index b06a0a088e..cb10174ccd 100644 --- a/nel/src/gui/lua_helper.cpp +++ b/nel/src/gui/lua_helper.cpp @@ -53,7 +53,7 @@ #include #ifdef NL_OS_WINDOWS -#include +#include #endif using namespace std; diff --git a/nel/src/gui/lua_ihm.cpp b/nel/src/gui/lua_ihm.cpp index d37474fbe1..dcf3b31172 100644 --- a/nel/src/gui/lua_ihm.cpp +++ b/nel/src/gui/lua_ihm.cpp @@ -32,7 +32,7 @@ #endif #ifdef NL_OS_WINDOWS -#include +#include #endif // Warning: cannot use namespace std, when using luabind diff --git a/nel/src/gui/stdpch.h b/nel/src/gui/stdpch.h index 4b4a1a99eb..1d8cb27bf4 100644 --- a/nel/src/gui/stdpch.h +++ b/nel/src/gui/stdpch.h @@ -48,7 +48,7 @@ #ifndef NL_COMP_MINGW # define NOMINMAX #endif - #include + #include #include #endif diff --git a/nel/src/logic/stdlogic.h b/nel/src/logic/stdlogic.h index cdfe3f6f75..a537d3eb63 100644 --- a/nel/src/logic/stdlogic.h +++ b/nel/src/logic/stdlogic.h @@ -47,8 +47,8 @@ # define WINVER 0x0500 # define NOMINMAX # endif -# include -# include +# include +# include #endif #endif // NL_STDMISC_H diff --git a/nel/src/misc/CMakeLists.txt b/nel/src/misc/CMakeLists.txt index 79fe5ed844..b08278f213 100644 --- a/nel/src/misc/CMakeLists.txt +++ b/nel/src/misc/CMakeLists.txt @@ -217,6 +217,10 @@ ELSE() TARGET_LINK_LIBRARIES(nelmisc ${PNG_LIBRARY}) ENDIF() +IF(WIN32) + TARGET_LINK_LIBRARIES(nelmisc winmm.lib dbghelp) +ENDIF() + #TODO: needed for hunter aswell? IF(UNIX) TARGET_LINK_LIBRARIES(nelmisc -lc -ldl) diff --git a/nel/src/misc/common.cpp b/nel/src/misc/common.cpp index 2342cf3b9f..80b254cff0 100644 --- a/nel/src/misc/common.cpp +++ b/nel/src/misc/common.cpp @@ -23,7 +23,7 @@ #include "nel/misc/common.h" #ifdef NL_OS_WINDOWS -# include +# include # include # include diff --git a/nel/src/misc/log.cpp b/nel/src/misc/log.cpp index c47aae04b9..cdd0178399 100644 --- a/nel/src/misc/log.cpp +++ b/nel/src/misc/log.cpp @@ -342,7 +342,7 @@ void CLog::displayString (const char *str) /* * Display the string with decoration and final new line to all attached displayers */ -#ifdef NL_OS_WINDOWS +#ifdef USE_LOG_CHECK_TYPES void CLog::_displayNL (const char *format, ...) #else void CLog::displayNL (const char *format, ...) @@ -367,7 +367,7 @@ void CLog::displayNL (const char *format, ...) /* * Display the string with decoration to all attached displayers */ -#ifdef NL_OS_WINDOWS +#ifdef USE_LOG_CHECK_TYPES void CLog::_display (const char *format, ...) #else void CLog::display (const char *format, ...) @@ -461,7 +461,7 @@ void CLog::displayRawString (const char *str) /* * Display a string (and nothing more) to all attached displayers */ -#ifdef NL_OS_WINDOWS +#ifdef USE_LOG_CHECK_TYPES void CLog::_displayRawNL( const char *format, ... ) #else void CLog::displayRawNL( const char *format, ... ) @@ -486,7 +486,7 @@ void CLog::displayRawNL( const char *format, ... ) /* * Display a string (and nothing more) to all attached displayers */ -#ifdef NL_OS_WINDOWS +#ifdef USE_LOG_CHECK_TYPES void CLog::_displayRaw( const char *format, ... ) #else void CLog::displayRaw( const char *format, ... ) @@ -504,7 +504,7 @@ void CLog::displayRaw( const char *format, ... ) } -#ifdef NL_OS_WINDOWS +#ifdef USE_LOG_CHECK_TYPES void CLog::_forceDisplayRaw (const char *format, ...) #else void CLog::forceDisplayRaw (const char *format, ...) diff --git a/nel/src/misc/stdmisc.h b/nel/src/misc/stdmisc.h index f5cc506b3e..8f227ab2b7 100644 --- a/nel/src/misc/stdmisc.h +++ b/nel/src/misc/stdmisc.h @@ -69,8 +69,8 @@ # define WINVER 0x0500 # define NOMINMAX # endif -# include -# include +# include +# include #endif #endif // NL_STDMISC_H diff --git a/nel/src/misc/system_info.cpp b/nel/src/misc/system_info.cpp index c0b626f8ac..4bad388460 100644 --- a/nel/src/misc/system_info.cpp +++ b/nel/src/misc/system_info.cpp @@ -22,7 +22,7 @@ #include "nel/misc/system_info.h" #ifdef NL_OS_WINDOWS -# include +# include # include # include # define nlcpuid(regs, idx) __cpuid(regs, idx) diff --git a/nel/src/misc/system_utils.cpp b/nel/src/misc/system_utils.cpp index 8c01b227c6..9a6945242e 100644 --- a/nel/src/misc/system_utils.cpp +++ b/nel/src/misc/system_utils.cpp @@ -55,11 +55,11 @@ #endif #include #include -#include -# include +#include +# include # ifdef _WIN32_WINNT_WIN7 // only supported by Windows 7 Platform SDK -# include +# include # define TASKBAR_PROGRESS 1 # endif #elif defined(NL_OS_UNIX) && !defined(NL_OS_MAC) diff --git a/nel/src/misc/time_nl.cpp b/nel/src/misc/time_nl.cpp index cca6f14aab..58d1a911ab 100644 --- a/nel/src/misc/time_nl.cpp +++ b/nel/src/misc/time_nl.cpp @@ -24,7 +24,7 @@ #include "nel/misc/thread.h" #ifdef NL_OS_WINDOWS -# include +# include #elif defined (NL_OS_UNIX) # include # include diff --git a/nel/src/net/stdnet.h b/nel/src/net/stdnet.h index 677206ec26..b7a71b1fbf 100644 --- a/nel/src/net/stdnet.h +++ b/nel/src/net/stdnet.h @@ -75,9 +75,9 @@ # define NOMINMAX # endif # endif -# include -# include -# include +# include +# include +# include #endif #endif diff --git a/nel/src/pipeline/project_config.cpp b/nel/src/pipeline/project_config.cpp index 1dd149313b..c4af296978 100644 --- a/nel/src/pipeline/project_config.cpp +++ b/nel/src/pipeline/project_config.cpp @@ -23,7 +23,7 @@ #include "nel/pipeline/project_config.h" #ifdef NL_OS_WINDOWS -# include +# include #else # include #endif diff --git a/nel/src/sound/driver/fmod/sound_driver_fmod.cpp b/nel/src/sound/driver/fmod/sound_driver_fmod.cpp index a473b5bd91..bac0ca080b 100644 --- a/nel/src/sound/driver/fmod/sound_driver_fmod.cpp +++ b/nel/src/sound/driver/fmod/sound_driver_fmod.cpp @@ -23,7 +23,7 @@ #include "buffer_fmod.h" #ifdef NL_OS_WINDOWS -#include +#include #endif #ifdef DEBUG_NEW diff --git a/nel/src/web/stdweb.h b/nel/src/web/stdweb.h index 1399a3318d..c726d4dfd6 100644 --- a/nel/src/web/stdweb.h +++ b/nel/src/web/stdweb.h @@ -67,8 +67,8 @@ # define WINVER 0x0500 # define NOMINMAX # endif -# include -# include +# include +# include # include # ifdef X509_NAME # undef X509_NAME diff --git a/nel/tools/3d/object_viewer_widget/src/stdpch.h b/nel/tools/3d/object_viewer_widget/src/stdpch.h index 588d8a8986..d1dd781d7e 100644 --- a/nel/tools/3d/object_viewer_widget/src/stdpch.h +++ b/nel/tools/3d/object_viewer_widget/src/stdpch.h @@ -52,7 +52,7 @@ along with this program. If not, see . #if defined(NL_OS_WINDOWS) #define NOMINMAX -#include +#include #elif defined(NL_OS_MAC) #else #include diff --git a/nel/tools/nel_unit_test/nel_unit_test.cpp b/nel/tools/nel_unit_test/nel_unit_test.cpp index d716fef98a..2451dffb9d 100644 --- a/nel/tools/nel_unit_test/nel_unit_test.cpp +++ b/nel/tools/nel_unit_test/nel_unit_test.cpp @@ -34,7 +34,7 @@ using namespace std; #ifdef _MSC_VER -#include +#include /** A special stream buffer that output in the 'output debug string' feature of windows. */ diff --git a/ryzom/client/src/client.cpp b/ryzom/client/src/client.cpp index 5fb236ad94..ec240c603b 100644 --- a/ryzom/client/src/client.cpp +++ b/ryzom/client/src/client.cpp @@ -123,7 +123,7 @@ NLMISC::CCmdArgs Args; // enable optimus for NVIDIA cards extern "C" { - _declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001; + __declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001; } void pump () diff --git a/ryzom/client/src/stdpch.h b/ryzom/client/src/stdpch.h index a17f627fb2..33ec186d92 100644 --- a/ryzom/client/src/stdpch.h +++ b/ryzom/client/src/stdpch.h @@ -137,7 +137,7 @@ # ifndef NL_COMP_MINGW # define NOMINMAX # endif -# include +# include # include #endif // NL_OS_WINDOWS diff --git a/ryzom/common/src/game_share/stdpch.h b/ryzom/common/src/game_share/stdpch.h index a5c29704d8..483335a8a8 100644 --- a/ryzom/common/src/game_share/stdpch.h +++ b/ryzom/common/src/game_share/stdpch.h @@ -84,8 +84,8 @@ # ifndef NL_COMP_MINGW # define NOMINMAX # endif -# include -# include +# include +# include #endif #endif diff --git a/ryzom/server/src/monitor_service/service_main.cpp b/ryzom/server/src/monitor_service/service_main.cpp index dd60290b64..7f8f331812 100644 --- a/ryzom/server/src/monitor_service/service_main.cpp +++ b/ryzom/server/src/monitor_service/service_main.cpp @@ -34,8 +34,8 @@ # ifndef NL_COMP_MINGW # define NOMINMAX # endif -# include -# include +# include +# include typedef unsigned long ulong; #endif // NL_OS_WINDOWS diff --git a/ryzom/server/src/server_share/mysql_wrapper.h b/ryzom/server/src/server_share/mysql_wrapper.h index ee0d8386ce..96822e4734 100644 --- a/ryzom/server/src/server_share/mysql_wrapper.h +++ b/ryzom/server/src/server_share/mysql_wrapper.h @@ -29,8 +29,8 @@ #include "nel/net/module_common.h" #include "game_share/utils.h" #ifdef NL_OS_WINDOWS -# include -# include +# include +# include typedef unsigned long ulong; #endif #ifdef NL_OS_MAC diff --git a/snowballs2/client/src/snowballs_client.cpp b/snowballs2/client/src/snowballs_client.cpp index 0d18b53610..7a109eea78 100644 --- a/snowballs2/client/src/snowballs_client.cpp +++ b/snowballs2/client/src/snowballs_client.cpp @@ -77,7 +77,7 @@ #include "game_time.h" #ifdef NL_OS_WINDOWS -#include +#include #endif using namespace std; diff --git a/snowballs2/server/chat/src/main.cpp b/snowballs2/server/chat/src/main.cpp index 42a13d92a6..d2128e8e24 100644 --- a/snowballs2/server/chat/src/main.cpp +++ b/snowballs2/server/chat/src/main.cpp @@ -37,7 +37,7 @@ #include #ifdef NL_OS_WINDOWS -#include +#include #endif using namespace std; diff --git a/snowballs2/server/collision/src/collision_service.cpp b/snowballs2/server/collision/src/collision_service.cpp index e421186012..bea829870f 100644 --- a/snowballs2/server/collision/src/collision_service.cpp +++ b/snowballs2/server/collision/src/collision_service.cpp @@ -18,7 +18,7 @@ #include #ifdef NL_OS_WINDOWS -#include +#include #endif using namespace SBSERVICE; diff --git a/snowballs2/server/frontend/src/main.cpp b/snowballs2/server/frontend/src/main.cpp index 4d9d94ae96..da68d9d602 100644 --- a/snowballs2/server/frontend/src/main.cpp +++ b/snowballs2/server/frontend/src/main.cpp @@ -42,7 +42,7 @@ #include #ifdef NL_OS_WINDOWS -#include +#include #endif using namespace NLMISC; diff --git a/snowballs2/server/position/src/main.cpp b/snowballs2/server/position/src/main.cpp index a1ea5ceddf..a52a0f623e 100644 --- a/snowballs2/server/position/src/main.cpp +++ b/snowballs2/server/position/src/main.cpp @@ -42,7 +42,7 @@ #include "physics.h" #ifdef NL_OS_WINDOWS -#include +#include #endif using namespace NLMISC; From e784b6536f2a4ef7a65d849e619070369da6a1c6 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Sun, 21 Jan 2024 16:40:26 +0100 Subject: [PATCH 007/126] set policy for using Documentation.cmake --- CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 21603dfb91..26b10ccb80 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,6 +34,9 @@ IF(COMMAND cmake_policy) IF(POLICY CMP0020) CMAKE_POLICY(SET CMP0020 NEW) ENDIF() + + # allow usage of Documentation.cmake + cmake_policy(SET CMP0106 OLD) ENDIF() From ef1c206efcb56da9fa0c6127bf972c7d63fc6c11 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Sun, 21 Jan 2024 16:56:58 +0100 Subject: [PATCH 008/126] remove deprecated cmake module --- CMakeLists.txt | 4 ---- 1 file changed, 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 26b10ccb80..1d319cf6ce 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,9 +34,6 @@ IF(COMMAND cmake_policy) IF(POLICY CMP0020) CMAKE_POLICY(SET CMP0020 NEW) ENDIF() - - # allow usage of Documentation.cmake - cmake_policy(SET CMP0106 OLD) ENDIF() @@ -71,7 +68,6 @@ ENDIF() INCLUDE(nel) INCLUDE(ConfigureChecks) INCLUDE(CheckDepends) -INCLUDE(${CMAKE_ROOT}/Modules/Documentation.cmake OPTIONAL) # Force out of source builds. CHECK_OUT_OF_SOURCE() From 1d78df9e8c9d78ed5b53ef38f68fe07c105037d7 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Sun, 21 Jan 2024 17:30:59 +0100 Subject: [PATCH 009/126] set opengl reference legacy apis as newer cmake versions use different ones by default --- nel/src/3d/driver/opengl/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/nel/src/3d/driver/opengl/CMakeLists.txt b/nel/src/3d/driver/opengl/CMakeLists.txt index e9f4a2a7ed..8b73799f61 100644 --- a/nel/src/3d/driver/opengl/CMakeLists.txt +++ b/nel/src/3d/driver/opengl/CMakeLists.txt @@ -1,3 +1,4 @@ +SET(OpenGL_GL_PREFERENCE "LEGACY") IF(NOT WIN32) IF(APPLE) FIND_LIBRARY(CARBON NAMES Carbon) From 42262cc4b58b7e520dd337a7c0f93ab15e846e75 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Sun, 21 Jan 2024 21:01:51 +0100 Subject: [PATCH 010/126] use existing openssl package over hunter if available --- CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1d319cf6ce..35019eb9b4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -185,7 +185,11 @@ IF(HUNTER_ENABLED) FIND_PACKAGE(libxml2 CONFIG REQUIRED) SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} libxml2::libxml2) -# HUNTER_ADD_PACKAGE(OpenSSL) + # cross compiling doesn't quite work on the hunter openssl package therefor compile it separately and use it + FIND_PACKAGE(OpenSSL QUIET) + if(NOT OpenSSL_FOUND) + HUNTER_ADD_PACKAGE(OpenSSL) + endif() FIND_PACKAGE(OpenSSL REQUIRED) # TODO: is OpenSSL::Crypto only needed for WIN32? SET(OPENSSL_LIBRARIES OpenSSL::SSL OpenSSL::Crypto) From 818956ba2db0931d140c07d362d868defa4025a8 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Mon, 22 Jan 2024 18:08:20 +0100 Subject: [PATCH 011/126] only use hunter package when not cross compiling --- CMakeLists.txt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 35019eb9b4..23cf7ef867 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -186,10 +186,9 @@ IF(HUNTER_ENABLED) SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} libxml2::libxml2) # cross compiling doesn't quite work on the hunter openssl package therefor compile it separately and use it - FIND_PACKAGE(OpenSSL QUIET) - if(NOT OpenSSL_FOUND) + IF(NOT CMAKE_CROSSCOMPILING) HUNTER_ADD_PACKAGE(OpenSSL) - endif() + ENDIF() FIND_PACKAGE(OpenSSL REQUIRED) # TODO: is OpenSSL::Crypto only needed for WIN32? SET(OPENSSL_LIBRARIES OpenSSL::SSL OpenSSL::Crypto) From b1478571a4d3b17aa4fac9a80410e5899af2c9ee Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Wed, 24 Jan 2024 19:32:51 +0100 Subject: [PATCH 012/126] add devcontainer --- .devcontainer/Dockerfile | 78 +++++++++++++++++++++++++++++++++ .devcontainer/devcontainer.json | 34 ++++++++++++++ docker-compose.yaml | 4 ++ 3 files changed, 116 insertions(+) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json create mode 100644 docker-compose.yaml diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000000..66eb020007 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,78 @@ +FROM ubuntu:22.04 + +RUN apt update;\ + apt install --yes software-properties-common; \ + apt update +RUN DEBIAN_FRONTEND=noninteractive apt install --yes \ + autoconf \ + automake \ + bison \ + build-essential \ + ccache \ + clang-15 \ + freeglut3-dev \ + libavcodec-dev \ + libavdevice-dev \ + libavformat-dev \ + libcpptest-dev \ + libcurl4-openssl-dev \ + libfreetype6-dev \ + libgif-dev \ + libgsf-1-dev \ + libjpeg-dev \ + liblua5.2-dev \ + libluabind-dev \ + liblzma-dev \ + libmysqlclient-dev \ + libogg-dev \ + libopenal-dev \ + libpng-dev \ + libpostproc-dev \ + libsquish-dev \ + libssl-dev \ + libswscale-dev \ + libvorbis-dev \ + libxml2-dev \ + mingw-w64 \ + mingw-w64-tools \ + ninja-build \ + qtbase5-dev \ + qttools5-dev \ + qttools5-dev-tools \ + libqtpropertybrowser-dev \ + qt6-base-dev \ + qt6-l10n-tools \ + qt6-tools-dev \ + qt6-tools-dev-tools + + +RUN apt install --yes \ + doxygen \ + gdb \ + git \ + graphviz \ + libxrandr-dev \ + wget + +# work arround as there is no debug version available +RUN cp /lib/x86_64-linux-gnu/libcpptest.so /lib/x86_64-linux-gnu/libcpptestd.so + +RUN wget --output-document=/tmp/cmake.sh https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-linux-x86_64.sh \ + && mkdir --parents "$CMAKE_INSTALL_DIR" \ + && sh /tmp/cmake.sh --skip-license --prefix="$CMAKE_INSTALL_DIR" \ + && ln --symbolic --force "$CMAKE_INSTALL_DIR/bin/cmake" /usr/local/bin/cmake + +ARG CMAKE_VERSION=3.27.9 +ARG CMAKE_INSTALL_DIR=/opt/cmake-$CMAKE_VERSION +ARG USERNAME=ryzom +ARG USER_UID=1000 +ARG USER_GID=$USER_UID + +RUN groupadd --gid $USER_GID $USERNAME \ + && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \ + && apt-get update \ + && apt-get install --yes sudo \ + && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \ + && chmod 0440 /etc/sudoers.d/$USERNAME + +USER $USERNAME diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000000..38abcc0097 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,34 @@ +{ + "build": { + "dockerfile": "Dockerfile" + }, + "containerUser": "ryzom", + "customizations": { + "vscode": { + "extensions": [ + "ms-vscode.cpptools-extension-pack" + ], + "settings": { + "cmake.configureArgs": [ + "-DWITH_STATIC=ON", + "-DWITH_NEL_TESTS=OFF", + "-DWITH_NEL_SAMPLES=ON", + "-DWITH_LUA51=OFF", + "-DWITH_LUA52=ON", + "-DWITH_RYZOM=ON", + "-DWITH_RYZOM_SERVER=ON", + "-DWITH_RYZOM_CLIENT=ON", + "-DWITH_RYZOM_TOOLS=ON", + "-DWITH_NEL_TOOLS=ON", + "-DWITH_NELNS=ON", + "-DWITH_NELNS_LOGIN_SYSTEM=ON", + "-DWITH_NELNS_SERVER=ON", + "-DWITH_QT5=ON", + "-DWITH_LIBGSF=ON", + "-DWITH_MONGODB=OFF", + "-DWITH_PCH=OFF" + ] + } + } + } +} \ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000000..023fe9df5e --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,4 @@ +services: + devcontainer: + image: "ryzomcore/devcontainer" + build: ./.devcontainer From d11b716b4e3e8bf97de43e87f84bf975531594d0 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Mon, 29 Jan 2024 17:14:46 +0100 Subject: [PATCH 013/126] adjust devcontainer --- .devcontainer/Dockerfile | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 66eb020007..cf9ba3f2be 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,9 +1,8 @@ FROM ubuntu:22.04 -RUN apt update;\ - apt install --yes software-properties-common; \ - apt update -RUN DEBIAN_FRONTEND=noninteractive apt install --yes \ +RUN apt update; \ + DEBIAN_FRONTEND=noninteractive \ + apt install --yes \ autoconf \ automake \ bison \ @@ -57,10 +56,6 @@ RUN apt install --yes \ # work arround as there is no debug version available RUN cp /lib/x86_64-linux-gnu/libcpptest.so /lib/x86_64-linux-gnu/libcpptestd.so -RUN wget --output-document=/tmp/cmake.sh https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-linux-x86_64.sh \ - && mkdir --parents "$CMAKE_INSTALL_DIR" \ - && sh /tmp/cmake.sh --skip-license --prefix="$CMAKE_INSTALL_DIR" \ - && ln --symbolic --force "$CMAKE_INSTALL_DIR/bin/cmake" /usr/local/bin/cmake ARG CMAKE_VERSION=3.27.9 ARG CMAKE_INSTALL_DIR=/opt/cmake-$CMAKE_VERSION @@ -68,6 +63,11 @@ ARG USERNAME=ryzom ARG USER_UID=1000 ARG USER_GID=$USER_UID +RUN wget --output-document=/tmp/cmake.sh https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-linux-x86_64.sh \ + && mkdir --parents "$CMAKE_INSTALL_DIR" \ + && sh /tmp/cmake.sh --skip-license --prefix="$CMAKE_INSTALL_DIR" \ + && ln --symbolic --force "$CMAKE_INSTALL_DIR/bin/cmake" /usr/local/bin/cmake + RUN groupadd --gid $USER_GID $USERNAME \ && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \ && apt-get update \ From dc28187530a24f49077cc11b564fdc80c3dd48ef Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Tue, 6 Feb 2024 17:33:27 +0100 Subject: [PATCH 014/126] Feature/studio qt5 (#703) migrate studio to qt5 --- .github/workflows/build-studio.yml | 57 ++++++++ CMakeModules/FindQtPropertyBrowser.cmake | 43 ++++++ CMakeModules/nel.cmake | 2 +- studio/src/3rdparty/README.md | 2 + studio/src/CMakeLists.txt | 30 ++++- studio/src/extension_system/iplugin.h | 1 + studio/src/extension_system/plugin_spec.cpp | 2 +- .../libqtpropertybrowser-text/CMakeLists.txt | 32 +++++ .../QtTextEditWidget.cpp | 126 ++++++++++++++++++ .../QtTextEditWidget.h | 42 ++++++ .../QtTextEditorFactory.cpp | 105 +++++++++++++++ .../QtTextEditorFactory.h | 43 ++++++ .../QtTextPropertyManager.cpp | 27 ++++ .../QtTextPropertyManager.h | 25 ++++ studio/src/main.cpp | 9 +- studio/src/plugins/bnp_manager/CMakeLists.txt | 6 +- .../bnp_manager/bnp_dirtree_dialog.cpp | 1 - .../plugins/bnp_manager/bnp_dirtree_dialog.h | 1 - .../bnp_manager/bnp_filelist_dialog.cpp | 5 +- .../plugins/bnp_manager/bnp_filelist_dialog.h | 1 - .../bnp_manager/bnp_filesystem_model.h | 2 +- .../bnp_manager/bnp_manager_plugin.cpp | 4 +- .../plugins/bnp_manager/bnp_manager_plugin.h | 1 + .../plugins/bnp_manager/bnp_manager_window.h | 8 +- .../plugins/bnp_manager/plugin-metadata.json | 6 + studio/src/plugins/core/CMakeLists.txt | 8 +- .../plugins/core/Nel3DWidget/nel3d_widget.cpp | 5 +- .../plugins/core/Nel3DWidget/nel3d_widget.h | 5 +- studio/src/plugins/core/context_manager.cpp | 4 +- studio/src/plugins/core/core_plugin.cpp | 12 +- studio/src/plugins/core/core_plugin.h | 1 + .../plugins/core/general_settings_page.cpp | 10 +- studio/src/plugins/core/main_window.cpp | 7 +- studio/src/plugins/core/main_window.h | 6 +- studio/src/plugins/core/menu_manager.h | 6 +- studio/src/plugins/core/plugin-metadata.json | 6 + .../src/plugins/core/plugin_view_dialog.cpp | 4 +- .../core/search_paths_settings_page.cpp | 4 +- studio/src/plugins/core/settings_dialog.cpp | 4 +- .../src/plugins/disp_sheet_id/CMakeLists.txt | 4 +- .../disp_sheet_id/disp_sheet_id_plugin.cpp | 12 +- .../disp_sheet_id/disp_sheet_id_plugin.h | 1 + .../disp_sheet_id/plugin-metadata.json | 6 + .../plugins/disp_sheet_id/sheet_id_view.cpp | 4 +- .../src/plugins/disp_sheet_id/sheet_id_view.h | 2 +- studio/src/plugins/example/CMakeLists.txt | 4 +- studio/src/plugins/example/example_plugin.cpp | 20 +-- studio/src/plugins/example/example_plugin.h | 1 + .../plugins/example/example_settings_page.cpp | 2 +- .../src/plugins/example/plugin-metadata.json | 6 + studio/src/plugins/example/qnel_widget.cpp | 8 +- studio/src/plugins/example/qnel_widget.h | 3 +- studio/src/plugins/example/simple_viewer.cpp | 6 +- studio/src/plugins/example/simple_viewer.h | 2 +- .../src/plugins/georges_editor/CMakeLists.txt | 12 +- studio/src/plugins/georges_editor/actions.cpp | 4 +- studio/src/plugins/georges_editor/actions.h | 2 +- .../plugins/georges_editor/browser_ctrl.cpp | 4 +- .../georges_editor/browser_ctrl_pvt.cpp | 7 +- .../plugins/georges_editor/browser_ctrl_pvt.h | 1 + .../georges_editor/dfn_browser_ctrl.cpp | 8 +- .../filepath_property_manager.h | 2 +- .../georges_editor/georges_dfn_dialog.cpp | 2 + .../georges_editor/georges_dirtree_dialog.cpp | 2 +- .../georges_editor/georges_dirtree_dialog.h | 2 +- .../georges_editor/georges_dock_widget.cpp | 2 + .../georges_editor/georges_editor_form.cpp | 1 + .../georges_editor/georges_editor_form.h | 2 +- .../georges_editor/georges_editor_plugin.cpp | 2 - .../georges_editor/georges_editor_plugin.h | 1 + .../georges_editor/georges_filesystem_model.h | 2 +- .../georges_treeview_dialog.cpp | 17 +-- .../georges_editor/georges_treeview_dialog.h | 6 +- .../georges_editor/georges_typ_dialog.cpp | 3 + .../georges_editor/georgesform_model.h | 1 + .../georges_editor/plugin-metadata.json | 6 + .../georges_editor/typ_browser_ctrl.cpp | 8 +- studio/src/plugins/gui_editor/CMakeLists.txt | 8 +- .../gui_editor/action_property_manager.h | 2 +- .../plugins/gui_editor/gui_editor_plugin.cpp | 2 - .../plugins/gui_editor/gui_editor_plugin.h | 1 + .../plugins/gui_editor/gui_editor_window.cpp | 6 +- .../plugins/gui_editor/gui_editor_window.h | 2 +- .../plugins/gui_editor/plugin-metadata.json | 6 + .../gui_editor/property_browser_ctrl.cpp | 8 +- .../gui_editor/texture_property_manager.h | 2 +- .../plugins/landscape_editor/CMakeLists.txt | 6 +- .../plugins/landscape_editor/builder_zone.cpp | 4 +- .../plugins/landscape_editor/builder_zone.h | 6 +- .../landscape_editor/builder_zone_base.cpp | 4 +- .../landscape_editor/builder_zone_base.h | 4 +- .../landscape_editor/landscape_actions.h | 6 +- .../landscape_editor_plugin.cpp | 1 - .../landscape_editor_plugin.h | 3 +- .../landscape_editor_window.cpp | 8 +- .../landscape_editor_window.h | 8 +- .../landscape_editor/landscape_scene.cpp | 14 +- .../landscape_editor/landscape_scene.h | 4 +- .../landscape_editor/landscape_scene_base.cpp | 6 +- .../landscape_editor/landscape_scene_base.h | 4 +- .../plugins/landscape_editor/landscape_view.h | 4 +- .../landscape_editor/list_zones_model.cpp | 2 +- .../landscape_editor/list_zones_model.h | 2 +- .../landscape_editor/list_zones_widget.cpp | 2 +- .../landscape_editor/pixmap_database.cpp | 8 +- .../landscape_editor/pixmap_database.h | 2 +- .../landscape_editor/plugin-metadata.json | 6 + .../project_settings_dialog.cpp | 4 +- .../landscape_editor/snapshot_dialog.cpp | 2 +- .../landscape_editor/zone_region_editor.cpp | 2 +- studio/src/plugins/log/CMakeLists.txt | 4 +- studio/src/plugins/log/log_plugin.cpp | 15 +-- studio/src/plugins/log/log_plugin.h | 3 +- studio/src/plugins/log/log_settings_page.cpp | 4 +- studio/src/plugins/log/plugin-metadata.json | 6 + .../plugins/mission_compiler/CMakeLists.txt | 6 +- .../mission_compiler_main_window.cpp | 4 +- .../mission_compiler_main_window.h | 2 +- .../mission_compiler_plugin.cpp | 14 +- .../mission_compiler_plugin.h | 1 + .../mission_compiler_settings_page.cpp | 8 +- .../mission_compiler/plugin-metadata.json | 6 + .../mission_compiler/validation_file.cpp | 2 +- .../src/plugins/object_viewer/CMakeLists.txt | 6 +- .../object_viewer/graphics_settings_page.cpp | 4 +- .../object_viewer/graphics_viewport.cpp | 12 +- .../src/plugins/object_viewer/main_window.cpp | 4 +- .../src/plugins/object_viewer/main_window.h | 6 +- .../object_viewer/object_viewer_plugin.cpp | 2 - .../object_viewer/object_viewer_plugin.h | 1 + .../particle_system/attrib_widget.cpp | 2 +- .../particle_system/attrib_widget.h | 2 +- .../particle_system/bin_op_dialog.h | 12 +- .../particle_system/curve_dialog.h | 8 +- .../particle_system/direction_widget.cpp | 6 +- .../particle_system/emitter_page.cpp | 2 +- .../particle_system/follow_path_dialog.h | 12 +- .../particle_system/located_page.cpp | 4 +- .../particle_system/mesh_widget.cpp | 6 +- .../particle_system/morph_mesh_dialog.cpp | 2 +- .../particle_system/particle_force_page.cpp | 2 +- .../particle_link_skeleton_dialog.cpp | 2 +- .../particle_property_dialog.h | 10 +- .../particle_system/particle_sound_page.cpp | 10 +- .../particle_system/particle_system_page.cpp | 8 +- .../particle_texture_widget.cpp | 4 +- .../particle_workspace_dialog.cpp | 8 +- .../particle_workspace_page.cpp | 6 +- .../particle_system/spinner_dialog.h | 6 +- .../particle_system/value_blender_dialog.h | 10 +- .../value_from_emitter_dialog.h | 8 +- .../particle_system/value_gradient_dialog.cpp | 2 +- .../particle_system/value_gradient_dialog.h | 20 +-- .../object_viewer/plugin-metadata.json | 6 + .../scene/animation_set_dialog.cpp | 2 +- .../object_viewer/scene/camera_control.h | 14 +- .../object_viewer/scene/setup_fog_dialog.cpp | 6 +- .../scene/skeleton_scale_dialog.cpp | 4 +- .../scene/slot_manager_dialog.cpp | 2 +- .../object_viewer/scene/slot_manager_dialog.h | 5 +- .../object_viewer/sound_settings_page.cpp | 6 +- .../plugins/object_viewer/sound_system.cpp | 6 +- .../vegetable/vegetable_appearance_page.cpp | 6 +- .../vegetable/vegetable_density_page.cpp | 4 +- .../vegetable/vegetable_dialog.cpp | 4 +- .../vegetable/vegetable_editor.cpp | 10 +- .../object_viewer/vegetable_settings_page.cpp | 8 +- .../widgets/color_edit_widget.cpp | 6 +- .../object_viewer/widgets/hoverpoints.cpp | 2 + .../object_viewer/widgets/hoverpoints.h | 3 +- .../plugins/ovqt_sheet_builder/CMakeLists.txt | 2 +- .../ovqt_sheet_builder/ovqt_sheet_builder.cpp | 14 +- .../ovqt_sheet_builder/ovqt_sheet_builder.h | 3 +- .../ovqt_sheet_builder/plugin-metadata.json | 6 + .../plugins/ovqt_sheet_builder/sheetbuilder.h | 3 +- studio/src/plugins/tile_editor/CMakeLists.txt | 6 +- .../plugins/tile_editor/plugin-metadata.json | 6 + .../tile_editor/tile_editor_main_window.cpp | 6 +- .../tile_editor/tile_editor_main_window.h | 2 +- .../tile_editor/tile_editor_plugin.cpp | 14 +- .../plugins/tile_editor/tile_editor_plugin.h | 1 + .../tile_editor/tile_item_delegate.cpp | 1 + .../plugins/tile_editor/tile_item_delegate.h | 2 +- .../translation_manager/CMakeLists.txt | 4 +- .../translation_manager/editor_phrase.cpp | 16 +-- .../translation_manager/editor_phrase.h | 22 +-- .../translation_manager/editor_worksheet.cpp | 14 +- .../translation_manager/editor_worksheet.h | 14 +- .../translation_manager/ftp_selection.cpp | 6 +- .../translation_manager/ftp_selection.h | 14 +- .../translation_manager/plugin-metadata.json | 6 + .../translation_manager/source_selection.cpp | 2 +- .../translation_manager/source_selection.h | 8 +- .../translation_manager_editor.h | 12 +- .../translation_manager_main_window.h | 16 +-- .../translation_manager_plugin.cpp | 16 +-- .../translation_manager_plugin.h | 5 +- .../translation_manager_settings_page.cpp | 8 +- .../src/plugins/world_editor/CMakeLists.txt | 13 +- .../const_string_array_property.h | 2 +- .../plugins/world_editor/plugin-metadata.json | 6 + .../plugins/world_editor/primitives_view.cpp | 4 +- .../plugins/world_editor/primitives_view.h | 8 +- .../world_editor/project_settings_dialog.cpp | 4 +- .../world_editor/property_editor_widget.cpp | 3 + .../world_editor/property_editor_widget.h | 6 +- .../world_editor/world_editor_actions.h | 8 +- .../world_editor/world_editor_plugin.cpp | 2 - .../world_editor/world_editor_plugin.h | 3 +- .../world_editor/world_editor_scene.cpp | 6 +- .../plugins/world_editor/world_editor_scene.h | 2 +- .../world_editor/world_editor_scene_item.cpp | 2 +- .../world_editor/world_editor_scene_item.h | 10 +- .../world_editor_settings_page.cpp | 2 +- .../world_editor/world_editor_window.cpp | 6 +- .../world_editor/world_editor_window.h | 4 +- .../src/plugins/zone_painter/CMakeLists.txt | 6 +- .../plugins/zone_painter/plugin-metadata.json | 6 + studio/src/plugins/zone_painter/qnel_widget.h | 4 +- .../zone_painter/zone_painter_main_window.h | 2 +- .../zone_painter/zone_painter_plugin.cpp | 2 - .../zone_painter/zone_painter_plugin.h | 1 + studio/src/splash_screen.cpp | 2 +- 223 files changed, 1161 insertions(+), 528 deletions(-) create mode 100644 .github/workflows/build-studio.yml create mode 100644 CMakeModules/FindQtPropertyBrowser.cmake create mode 100644 studio/src/3rdparty/README.md create mode 100644 studio/src/libqtpropertybrowser-text/CMakeLists.txt create mode 100644 studio/src/libqtpropertybrowser-text/libqtpropertybrowser-text/QtTextEditWidget.cpp create mode 100644 studio/src/libqtpropertybrowser-text/libqtpropertybrowser-text/QtTextEditWidget.h create mode 100644 studio/src/libqtpropertybrowser-text/libqtpropertybrowser-text/QtTextEditorFactory.cpp create mode 100644 studio/src/libqtpropertybrowser-text/libqtpropertybrowser-text/QtTextEditorFactory.h create mode 100644 studio/src/libqtpropertybrowser-text/libqtpropertybrowser-text/QtTextPropertyManager.cpp create mode 100644 studio/src/libqtpropertybrowser-text/libqtpropertybrowser-text/QtTextPropertyManager.h create mode 100644 studio/src/plugins/bnp_manager/plugin-metadata.json create mode 100644 studio/src/plugins/core/plugin-metadata.json create mode 100644 studio/src/plugins/disp_sheet_id/plugin-metadata.json create mode 100644 studio/src/plugins/example/plugin-metadata.json create mode 100644 studio/src/plugins/georges_editor/plugin-metadata.json create mode 100644 studio/src/plugins/gui_editor/plugin-metadata.json create mode 100644 studio/src/plugins/landscape_editor/plugin-metadata.json create mode 100644 studio/src/plugins/log/plugin-metadata.json create mode 100644 studio/src/plugins/mission_compiler/plugin-metadata.json create mode 100644 studio/src/plugins/object_viewer/plugin-metadata.json create mode 100644 studio/src/plugins/ovqt_sheet_builder/plugin-metadata.json create mode 100644 studio/src/plugins/tile_editor/plugin-metadata.json create mode 100644 studio/src/plugins/translation_manager/plugin-metadata.json create mode 100644 studio/src/plugins/world_editor/plugin-metadata.json create mode 100644 studio/src/plugins/zone_painter/plugin-metadata.json diff --git a/.github/workflows/build-studio.yml b/.github/workflows/build-studio.yml new file mode 100644 index 0000000000..fff2ed94e6 --- /dev/null +++ b/.github/workflows/build-studio.yml @@ -0,0 +1,57 @@ +name: build studio + +on: + push: + branches: [ "core4", "feature/*" ] + pull_request: + branches: [ "core4" ] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Set reusable strings + id: strings + shell: bash + run: | + echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" + + - name: Dependencies + run: | + sudo apt update + sudo apt install --yes software-properties-common + sudo apt update + sudo apt install --yes \ + cmake build-essential ninja-build ccache \ + bison autoconf automake \ + libpng-dev \ + libjpeg-dev \ + libgif-dev libfreetype6-dev \ + freeglut3-dev \ + liblua5.2-dev libluabind-dev libcpptest-dev \ + libogg-dev libvorbis-dev libopenal-dev \ + libavcodec-dev libavformat-dev libavdevice-dev libswscale-dev libpostproc-dev \ + libmysqlclient-dev \ + libxml2-dev \ + libcurl4-openssl-dev libssl-dev \ + libsquish-dev \ + liblzma-dev \ + libgsf-1-dev \ + qtbase5-dev qttools5-dev qttools5-dev-tools libqtpropertybrowser-dev + + - name: Configure CMake + run: > + cmake -B ${{ steps.strings.outputs.build-output-dir }} + -G "Ninja" + -DWITH_QT5=ON + -DWITH_STUDIO=ON + -DWITH_RYZOM=OFF + -DWITH_NEL_TOOLS=OFF + -DWITH_NEL_SAMPLES=OFF + -DWITH_NEL_TESTS=OFF + -S ${{ github.workspace }} + + - name: Build + run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --target studio diff --git a/CMakeModules/FindQtPropertyBrowser.cmake b/CMakeModules/FindQtPropertyBrowser.cmake new file mode 100644 index 0000000000..27b0fefd9b --- /dev/null +++ b/CMakeModules/FindQtPropertyBrowser.cmake @@ -0,0 +1,43 @@ +# Locate QtPropertyBrowser library +# This module defines +# QtPropertyBrowser_FOUND, if false, do not try to link to QtPropertyBrowser +# QtPropertyBrowser_LIBRARY +# QtPropertyBrowser_INCLUDE_DIR, where to find qtpropertybrowser.h +# QtPropertyBrowser_DIR - Can be set to QtPropertyBrowser install path or Windows build path + +find_path(QtPropertyBrowser_INCLUDE_DIR qtpropertybrowser.h + HINTS ${QTPROPERTYBROWSER_DIR} + PATH_SUFFIXES include QtPropertyBrowser qtpropertybrowser + PATHS + ~/Library/Frameworks + /Library/Frameworks + /usr/local + /usr + /sw # Fink + /opt/local # DarwinPorts + /opt/csw # Blastwave + /opt +) + +find_library(QtPropertyBrowser_LIBRARY + NAMES QtPropertyBrowser qtpropertybrowser + HINTS ${QTPROPERTYBROWSER_DIR} + PATH_SUFFIXES lib64 lib + PATHS + ~/Library/Frameworks + /Library/Frameworks + /usr/local + /usr + /sw + /opt/local + /opt/csw + /opt +) + +include(FindPackageHandleStandardArgs) +# handle the QUIETLY and REQUIRED arguments and set QtPropertyBrowser_FOUND to TRUE if +# all listed variables are TRUE +FIND_PACKAGE_HANDLE_STANDARD_ARGS(QtPropertyBrowser DEFAULT_MSG QtPropertyBrowser_LIBRARY QtPropertyBrowser_INCLUDE_DIR) + +mark_as_advanced(QtPropertyBrowser_INCLUDE_DIR QtPropertyBrowser_LIBRARY) + diff --git a/CMakeModules/nel.cmake b/CMakeModules/nel.cmake index 98610c9d6a..ffefe398a1 100644 --- a/CMakeModules/nel.cmake +++ b/CMakeModules/nel.cmake @@ -234,7 +234,7 @@ Remove the CMakeCache.txt file and try again from another folder, e.g.: ENDMACRO(CHECK_OUT_OF_SOURCE) MACRO(NL_SETUP_DEFAULT_OPTIONS) - IF(WITH_QT) + IF(WITH_QT5) OPTION(WITH_STUDIO "Build Core Studio" OFF ) ENDIF() diff --git a/studio/src/3rdparty/README.md b/studio/src/3rdparty/README.md new file mode 100644 index 0000000000..033680332c --- /dev/null +++ b/studio/src/3rdparty/README.md @@ -0,0 +1,2 @@ +also see: +https://github.com/greenjava/QtPropertyBrowser \ No newline at end of file diff --git a/studio/src/CMakeLists.txt b/studio/src/CMakeLists.txt index 6083805f82..81c3eee110 100644 --- a/studio/src/CMakeLists.txt +++ b/studio/src/CMakeLists.txt @@ -1,7 +1,6 @@ -ADD_SUBDIRECTORY(3rdparty) +#ADD_SUBDIRECTORY(3rdparty) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${NEL_INCLUDE_DIR} ${QT_INCLUDES}) -INCLUDE( ${QT_USE_FILE} ) CONFIGURE_FILE(translations/translations.qrc ${CMAKE_CURRENT_BINARY_DIR}/translations.qrc COPYONLY) @@ -31,10 +30,10 @@ IF(WIN32) SET(STUDIO_RC studio.rc) ENDIF() -QT4_ADD_TRANSLATION(STUDIO_QM ${STUDIO_TS}) -QT4_ADD_RESOURCES( STUDIO_RC_SRCS ${STUDIO_RCS}) -QT4_WRAP_CPP( STUDIO_MOC_SRCS ${STUDIO_HDR} ) -QT4_WRAP_UI( STUDIO_PLUGIN_UI_HDRS ${STUDIO_PLUGIN_UIS}) +QT5_ADD_TRANSLATION(STUDIO_QM ${STUDIO_TS}) +QT5_ADD_RESOURCES( STUDIO_RC_SRCS ${STUDIO_RCS}) +QT5_WRAP_CPP( STUDIO_MOC_SRCS ${STUDIO_HDR} ) +QT5_WRAP_UI( STUDIO_PLUGIN_UI_HDRS ${STUDIO_PLUGIN_UIS}) SOURCE_GROUP(QtResources FILES ${STUDIO_RCS} ${STUDIO_PLUGIN_UIS} ) SOURCE_GROUP(QtGeneratedMocQrcSrc FILES ${STUDIO_MOC_SRCS} ${STUDIO_RC_SRCS}) @@ -55,6 +54,25 @@ ADD_DEFINITIONS(-DQT_NO_KEYWORDS ${QT_DEFINITIONS}) NL_DEFAULT_PROPS(studio "Tools: Studio") NL_ADD_RUNTIME_FLAGS(studio) +ADD_SUBDIRECTORY(libqtpropertybrowser-text) ADD_SUBDIRECTORY(plugins) +add_dependencies(studio + studio_plugin_bnp_manager + studio_plugin_core + studio_plugin_disp_sheet_id + studio_plugin_example + studio_plugin_georges_editor + studio_plugin_gui_editor + studio_plugin_landscape_editor + studio_plugin_log + studio_plugin_mission_compiler + studio_plugin_object_viewer + studio_plugin_sheet_builder + studio_plugin_tile_editor +# studio_plugin_translation_manager # requires QFtp which is removed in qt5 + studio_plugin_world_editor +# studio_plugin_zone_painter +) + INSTALL(TARGETS studio RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT runtime BUNDLE DESTINATION /Applications) diff --git a/studio/src/extension_system/iplugin.h b/studio/src/extension_system/iplugin.h index 01f337df1d..ba41cec3bd 100644 --- a/studio/src/extension_system/iplugin.h +++ b/studio/src/extension_system/iplugin.h @@ -100,6 +100,7 @@ class IPlugin }; //namespace ExtensionSystem +#define IPlugin_iid "dev.ryzom.com.ObjectViewerQt.IPlugin/0.9.2" Q_DECLARE_INTERFACE(ExtensionSystem::IPlugin, "dev.ryzom.com.ObjectViewerQt.IPlugin/0.9.2") #endif // IPLUGIN_H diff --git a/studio/src/extension_system/plugin_spec.cpp b/studio/src/extension_system/plugin_spec.cpp index 53250cebeb..85c61245c5 100644 --- a/studio/src/extension_system/plugin_spec.cpp +++ b/studio/src/extension_system/plugin_spec.cpp @@ -429,7 +429,7 @@ void PluginSpec::kill() bool b = loader->unload(); if( !b ) { - nlinfo( "Plugin %s couldn't be unloaded.", this->m_name.toAscii().data() ); + nlinfo( "Plugin %s couldn't be unloaded.", this->m_name.toLatin1().data() ); } //delete m_plugin; diff --git a/studio/src/libqtpropertybrowser-text/CMakeLists.txt b/studio/src/libqtpropertybrowser-text/CMakeLists.txt new file mode 100644 index 0000000000..c35020dabb --- /dev/null +++ b/studio/src/libqtpropertybrowser-text/CMakeLists.txt @@ -0,0 +1,32 @@ +FIND_PACKAGE(QtPropertyBrowser REQUIRED) + +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +set(CMAKE_AUTOMOC ON) + +set(SRC + libqtpropertybrowser-text/QtTextEditorFactory.cpp + libqtpropertybrowser-text/QtTextEditWidget.cpp + libqtpropertybrowser-text/QtTextPropertyManager.cpp +) + +SOURCE_GROUP("" FILES ${SRC}) + +ADD_LIBRARY(QtPropertyBrowserText ${SRC}) + +ADD_LIBRARY(QtPropertyBrowser::Text ALIAS QtPropertyBrowserText) + +TARGET_LINK_LIBRARIES(QtPropertyBrowserText ${QT_LIBRARIES} ${QtPropertyBrowser_LIBRARY}) + +INCLUDE_DIRECTORIES( + ${CMAKE_CURRENT_SOURCE_DIR} + ${QT_INCLUDES} + ${QtPropertyBrowser_INCLUDE_DIR} +) + +TARGET_INCLUDE_DIRECTORIES(QtPropertyBrowserText + INTERFACE + $ + $ +) diff --git a/studio/src/libqtpropertybrowser-text/libqtpropertybrowser-text/QtTextEditWidget.cpp b/studio/src/libqtpropertybrowser-text/libqtpropertybrowser-text/QtTextEditWidget.cpp new file mode 100644 index 0000000000..10267c23a4 --- /dev/null +++ b/studio/src/libqtpropertybrowser-text/libqtpropertybrowser-text/QtTextEditWidget.cpp @@ -0,0 +1,126 @@ +#include +#include +#include +#include +#include + +#include + +#if defined(Q_CC_MSVC) +# pragma warning(disable: 4786) /* MS VS 6: truncating debug info after 255 characters */ +#endif + +#if QT_VERSION >= 0x040400 +QT_BEGIN_NAMESPACE +#endif + + +QtTextEditWidget::QtTextEditWidget(QWidget *parent) : + QWidget(parent), + m_lineEdit(new QLineEdit), + m_defaultButton(new QToolButton), + m_button(new QToolButton) +{ + QHBoxLayout *lt = new QHBoxLayout(this); + lt->setContentsMargins(0, 0, 0, 0); + lt->setSpacing(0); + lt->addWidget(m_lineEdit); + m_lineEdit->setReadOnly(true); + + m_button->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Ignored); + m_button->setFixedWidth(20); + m_button->setText(tr("...")); + m_button->installEventFilter(this); + + setFocusProxy(m_button); + setFocusPolicy(m_button->focusPolicy()); + + m_defaultButton->setIcon(QIcon(":/trolltech/qtpropertybrowser/images/resetproperty.png")); + m_defaultButton->setMaximumWidth(16); + + connect(m_button, SIGNAL(clicked()), this, SLOT(buttonClicked())); + connect(m_defaultButton, SIGNAL(clicked()), this, SIGNAL(resetProperty())); + lt->addWidget(m_button); + lt->addWidget(m_defaultButton); + m_defaultButton->setEnabled(false); +} + +void QtTextEditWidget::setValue(const QString &value) +{ + if (m_lineEdit->text() != value) + m_lineEdit->setText(value); +} + +void QtTextEditWidget::setStateResetButton(bool enabled) +{ + m_defaultButton->setEnabled(enabled); +} + +void QtTextEditWidget::buttonClicked() +{ + QGridLayout *gridLayout; + QPlainTextEdit *plainTextEdit; + QDialogButtonBox *buttonBox; + QDialog *dialog; + + dialog = new QDialog(this); + dialog->resize(400, 300); + gridLayout = new QGridLayout(dialog); + plainTextEdit = new QPlainTextEdit(dialog); + + gridLayout->addWidget(plainTextEdit, 0, 0, 1, 1); + + buttonBox = new QDialogButtonBox(dialog); + buttonBox->setOrientation(Qt::Horizontal); + buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok); + + gridLayout->addWidget(buttonBox, 1, 0, 1, 1); + + QObject::connect(buttonBox, SIGNAL(accepted()), dialog, SLOT(accept())); + QObject::connect(buttonBox, SIGNAL(rejected()), dialog, SLOT(reject())); + + plainTextEdit->textCursor().insertText(m_lineEdit->text()); + + dialog->setModal(true); + dialog->show(); + int result = dialog->exec(); + + if (result == QDialog::Accepted) + { + QString newText = plainTextEdit->document()->toPlainText(); + + setValue(newText); + if (plainTextEdit->document()->isModified()) + Q_EMIT valueChanged(newText); + } + + delete dialog; +} + +bool QtTextEditWidget::eventFilter(QObject *obj, QEvent *ev) +{ + if (obj == m_button) { + switch (ev->type()) { + case QEvent::KeyPress: + case QEvent::KeyRelease: { // Prevent the QToolButton from handling Enter/Escape meant control the delegate + switch (static_cast(ev)->key()) { + case Qt::Key_Escape: + case Qt::Key_Enter: + case Qt::Key_Return: + ev->ignore(); + return true; + default: + break; + } + } + break; + default: + break; + } + } + return QWidget::eventFilter(obj, ev); +} + +#if QT_VERSION >= 0x040400 +QT_END_NAMESPACE +#endif diff --git a/studio/src/libqtpropertybrowser-text/libqtpropertybrowser-text/QtTextEditWidget.h b/studio/src/libqtpropertybrowser-text/libqtpropertybrowser-text/QtTextEditWidget.h new file mode 100644 index 0000000000..cfcd666194 --- /dev/null +++ b/studio/src/libqtpropertybrowser-text/libqtpropertybrowser-text/QtTextEditWidget.h @@ -0,0 +1,42 @@ +#ifndef LIBQTPROPERTYMANAGER_TEXT_EDIT_WIDGET_H +#define LIBQTPROPERTYMANAGER_TEXT_EDIT_WIDGET_H + +#include +#include +#include + +#if QT_VERSION >= 0x040400 +QT_BEGIN_NAMESPACE +#endif + +class QtTextEditWidget : public QWidget +{ + Q_OBJECT + +public: + QtTextEditWidget(QWidget *parent); + + bool eventFilter(QObject *obj, QEvent *ev); + +public Q_SLOTS: + void setValue(const QString &value); + void setStateResetButton(bool enabled); + +private Q_SLOTS: + void buttonClicked(); + +Q_SIGNALS: + void valueChanged(const QString &value); + void resetProperty(); + +private: + QLineEdit *m_lineEdit; + QToolButton *m_defaultButton; + QToolButton *m_button; +}; + +#if QT_VERSION >= 0x040400 +QT_END_NAMESPACE +#endif + +#endif // LIBQTPROPERTYMANAGER_TEXT_EDIT_WIDGET_H diff --git a/studio/src/libqtpropertybrowser-text/libqtpropertybrowser-text/QtTextEditorFactory.cpp b/studio/src/libqtpropertybrowser-text/libqtpropertybrowser-text/QtTextEditorFactory.cpp new file mode 100644 index 0000000000..30245399f3 --- /dev/null +++ b/studio/src/libqtpropertybrowser-text/libqtpropertybrowser-text/QtTextEditorFactory.cpp @@ -0,0 +1,105 @@ +#include + +#if defined(Q_CC_MSVC) +#pragma warning(disable : 4786) /* MS VS 6: truncating debug info after 255 characters */ +#endif + +#if QT_VERSION >= 0x040400 +QT_BEGIN_NAMESPACE +#endif + +QtTextEditorFactory::QtTextEditorFactory(QObject *parent) + : QtAbstractEditorFactory(parent) +{ +} + +QtTextEditorFactory::~QtTextEditorFactory() +{ + qDeleteAll(editorToProperty.keys()); +} + +QWidget *QtTextEditorFactory::createEditor(QtTextPropertyManager *manager, QtProperty *property, QWidget *parent) +{ + auto *editor = new Editor(parent); + auto it = createdEditors.find(property); + if (it == createdEditors.end()) + { + it = createdEditors.insert(property, EditorList()); + } + it.value().append(editor); + editorToProperty.insert(editor, property); + + editor->setValue(manager->value(property)); + editor->setStateResetButton(property->isModified()); + + connect(editor, SIGNAL(resetProperty()), this, SLOT(slotResetProperty())); + connect(editor, SIGNAL(valueChanged(QString)), this, SLOT(slotSetValue(QString))); + connect(editor, SIGNAL(destroyed(QObject *)), this, SLOT(slotEditorDestroyed(QObject *))); + return editor; +} + +void QtTextEditorFactory::connectPropertyManager(QtTextPropertyManager *manager) +{ + connect(manager, SIGNAL(valueChanged(QtProperty *, const QString &)), + this, SLOT(slotPropertyChanged(QtProperty *, const QString &))); +} + +void QtTextEditorFactory::disconnectPropertyManager(QtTextPropertyManager *manager) +{ + disconnect(manager, SIGNAL(valueChanged(QtProperty *, const QString &)), + this, SLOT(slotPropertyChanged(QtProperty *, const QString &))); +} + +void QtTextEditorFactory::slotPropertyChanged(QtProperty *property, const QString &value) +{ + const PropertyToEditorListMap::iterator it = createdEditors.find(property); + if (it == createdEditors.end()) + { + return; + } + QListIterator itEditor(it.value()); + + while (itEditor.hasNext()) + { + QtTextEditWidget *editor = itEditor.next(); + editor->setValue(value); + editor->setStateResetButton(property->isModified()); + } +} + +void QtTextEditorFactory::slotSetValue(const QString &value) +{ + QObject *object = sender(); + const EditorToPropertyMap::ConstIterator ecend = editorToProperty.constEnd(); + for (EditorToPropertyMap::ConstIterator itEditor = editorToProperty.constBegin(); itEditor != ecend; ++itEditor) + if (itEditor.key() == object) + { + QtProperty *property = itEditor.value(); + QtTextPropertyManager *manager = propertyManager(property); + if (!manager) + return; + manager->setValue(property, value); + return; + } +} + +void QtTextEditorFactory::slotResetProperty() +{ + QObject *object = sender(); + const EditorToPropertyMap::ConstIterator ecend = editorToProperty.constEnd(); + for (EditorToPropertyMap::ConstIterator itEditor = editorToProperty.constBegin(); itEditor != ecend; ++itEditor) + if (itEditor.key() == object) + { + QtProperty *property = itEditor.value(); + QtTextPropertyManager *manager = propertyManager(property); + if (!manager) + return; + // not supported anymore + // manager->emitResetProperty(property); + return; + } +} + +#if QT_VERSION >= 0x040400 +QT_END_NAMESPACE +#endif diff --git a/studio/src/libqtpropertybrowser-text/libqtpropertybrowser-text/QtTextEditorFactory.h b/studio/src/libqtpropertybrowser-text/libqtpropertybrowser-text/QtTextEditorFactory.h new file mode 100644 index 0000000000..88f27eb796 --- /dev/null +++ b/studio/src/libqtpropertybrowser-text/libqtpropertybrowser-text/QtTextEditorFactory.h @@ -0,0 +1,43 @@ +#ifndef LIBQTPROPERTYMANAGER_TEXT_EDITOR_FACTORY_H +#define LIBQTPROPERTYMANAGER_TEXT_EDITOR_FACTORY_H + +#include +#include + +#if QT_VERSION >= 0x040400 +QT_BEGIN_NAMESPACE +#endif + +class QtTextEditorFactory : public QtAbstractEditorFactory +{ + Q_OBJECT + +public: + typedef QtTextEditWidget Editor; + typedef QList EditorList; + typedef QMap PropertyToEditorListMap; + typedef QMap EditorToPropertyMap; + + QtTextEditorFactory(QObject *parent = nullptr); + ~QtTextEditorFactory() override; + +protected: + QWidget *createEditor(QtTextPropertyManager *manager, QtProperty *property, QWidget *parent) override; + void connectPropertyManager(QtTextPropertyManager *manager) override; + void disconnectPropertyManager(QtTextPropertyManager *manager) override; + +private Q_SLOTS: + void slotPropertyChanged(QtProperty *property, const QString &value); + void slotSetValue(const QString &value); + void slotResetProperty(); + +private: + PropertyToEditorListMap createdEditors; + EditorToPropertyMap editorToProperty; +}; + +#if QT_VERSION >= 0x040400 +QT_END_NAMESPACE +#endif + +#endif // LIBQTPROPERTYMANAGER_TEXT_EDITOR_FACTORY_H diff --git a/studio/src/libqtpropertybrowser-text/libqtpropertybrowser-text/QtTextPropertyManager.cpp b/studio/src/libqtpropertybrowser-text/libqtpropertybrowser-text/QtTextPropertyManager.cpp new file mode 100644 index 0000000000..a46b7d7b60 --- /dev/null +++ b/studio/src/libqtpropertybrowser-text/libqtpropertybrowser-text/QtTextPropertyManager.cpp @@ -0,0 +1,27 @@ +#include + +#if defined(Q_CC_MSVC) +# pragma warning(disable: 4786) /* MS VS 6: truncating debug info after 255 characters */ +#endif + +#if QT_VERSION >= 0x040400 +QT_BEGIN_NAMESPACE +#endif + +QString QtTextPropertyManager::valueText(const QtProperty *property) const +{ + QString text = QtStringPropertyManager::valueText(property); + for (int i = 0; i < text.size(); i++) + { + if (text.at(i) == '\n') + { + QStringRef ret(&text, 0, i); + return ret.toString() + " ..."; + } + } + return text; +} + +#if QT_VERSION >= 0x040400 +QT_END_NAMESPACE +#endif diff --git a/studio/src/libqtpropertybrowser-text/libqtpropertybrowser-text/QtTextPropertyManager.h b/studio/src/libqtpropertybrowser-text/libqtpropertybrowser-text/QtTextPropertyManager.h new file mode 100644 index 0000000000..4e662fe4bc --- /dev/null +++ b/studio/src/libqtpropertybrowser-text/libqtpropertybrowser-text/QtTextPropertyManager.h @@ -0,0 +1,25 @@ +#ifndef LIBQTPROPERTYMANAGER_TEXT_TEXT_PROPERTY_MANAGER_H +#define LIBQTPROPERTYMANAGER_TEXT_TEXT_PROPERTY_MANAGER_H + +#include + +#if QT_VERSION >= 0x040400 +QT_BEGIN_NAMESPACE +#endif + + +class QT_QTPROPERTYBROWSER_EXPORT QtTextPropertyManager : public QtStringPropertyManager +{ + Q_OBJECT +public: + QtTextPropertyManager(QObject *parent = 0):QtStringPropertyManager(parent) {} + +protected: + virtual QString valueText(const QtProperty *property) const; +}; + +#if QT_VERSION >= 0x040400 +QT_END_NAMESPACE +#endif + +#endif // LIBQTPROPERTYMANAGER_TEXT_TEXT_PROPERTY_MANAGER_H diff --git a/studio/src/main.cpp b/studio/src/main.cpp index 787e579306..22629e039b 100644 --- a/studio/src/main.cpp +++ b/studio/src/main.cpp @@ -39,11 +39,11 @@ #include #include #include -#include -#include +#include +#include //#include -#include -#include +#include +#include #include "startup_settings_dlg.h" #include "splash_screen.h" @@ -142,7 +142,6 @@ int main(int argc, char **argv) nlinfo("Welcome to NeL Object Viewer Qt!"); } - QApplication::setGraphicsSystem("raster"); #ifdef NL_OS_WINDOWS QApplication app(__argc, __argv); #else // NL_OS_WINDOWS diff --git a/studio/src/plugins/bnp_manager/CMakeLists.txt b/studio/src/plugins/bnp_manager/CMakeLists.txt index 883d10fd28..29830e5e16 100644 --- a/studio/src/plugins/bnp_manager/CMakeLists.txt +++ b/studio/src/plugins/bnp_manager/CMakeLists.txt @@ -23,9 +23,9 @@ SET(OVQT_PLUGIN_BNP_MANAGER_RCS bnp_manager.qrc) SET(QT_USE_QTGUI TRUE) -QT4_ADD_RESOURCES(OVQT_PLUGIN_BNP_MANAGER_RC_SRCS ${OVQT_PLUGIN_BNP_MANAGER_RCS}) -QT4_WRAP_CPP(OVQT_PLUG_BNP_MANAGER_MOC_SRC ${OVQT_PLUG_BNP_MANAGER_HDR}) -QT4_WRAP_UI(OVQT_PLUG_BNP_MANAGER_UI_HDRS ${OVQT_PLUG_BNP_MANAGER_UIS}) +QT5_ADD_RESOURCES(OVQT_PLUGIN_BNP_MANAGER_RC_SRCS ${OVQT_PLUGIN_BNP_MANAGER_RCS}) +QT5_WRAP_CPP(OVQT_PLUG_BNP_MANAGER_MOC_SRC ${OVQT_PLUG_BNP_MANAGER_HDR}) +QT5_WRAP_UI(OVQT_PLUG_BNP_MANAGER_UI_HDRS ${OVQT_PLUG_BNP_MANAGER_UIS}) SOURCE_GROUP(QtResources FILES ${OVQT_PLUG_BNP_MANAGER_UIS} ${OVQT_PLUGIN_BNP_MANAGER_RCS}) SOURCE_GROUP(QtGeneratedUiHdr FILES ${OVQT_PLUG_BNP_MANAGER_UI_HDRS}) diff --git a/studio/src/plugins/bnp_manager/bnp_dirtree_dialog.cpp b/studio/src/plugins/bnp_manager/bnp_dirtree_dialog.cpp index 1ddb25df1e..702e2ca1d3 100644 --- a/studio/src/plugins/bnp_manager/bnp_dirtree_dialog.cpp +++ b/studio/src/plugins/bnp_manager/bnp_dirtree_dialog.cpp @@ -20,7 +20,6 @@ #include "bnp_proxy_model.h" // Qt includes -#include // NeL includes #include diff --git a/studio/src/plugins/bnp_manager/bnp_dirtree_dialog.h b/studio/src/plugins/bnp_manager/bnp_dirtree_dialog.h index a4ca1850e1..9abcb65937 100644 --- a/studio/src/plugins/bnp_manager/bnp_dirtree_dialog.h +++ b/studio/src/plugins/bnp_manager/bnp_dirtree_dialog.h @@ -18,7 +18,6 @@ #define BNP_DIRTREE_DIALOG_H // Qt includes -#include // STL includes diff --git a/studio/src/plugins/bnp_manager/bnp_filelist_dialog.cpp b/studio/src/plugins/bnp_manager/bnp_filelist_dialog.cpp index 1efa6aab06..2175b6445e 100644 --- a/studio/src/plugins/bnp_manager/bnp_filelist_dialog.cpp +++ b/studio/src/plugins/bnp_manager/bnp_filelist_dialog.cpp @@ -19,7 +19,6 @@ #include "bnp_file.h" // Qt includes -#include // NeL includes #include @@ -60,8 +59,8 @@ void BnpFileListDialog::setupTable(int nbrows) labels << tr("Filename") << tr("Size"); m_ui.tableWidget->setHorizontalHeaderLabels(labels); - m_ui.tableWidget->horizontalHeader()->setResizeMode(0, QHeaderView::Interactive); - m_ui.tableWidget->horizontalHeader()->setResizeMode(1, QHeaderView::Stretch ); + m_ui.tableWidget->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Interactive); + m_ui.tableWidget->horizontalHeader()->setSectionResizeMode(1, QHeaderView::Stretch ); m_ui.tableWidget->verticalHeader()->hide(); // set vertical size a little bit smaller diff --git a/studio/src/plugins/bnp_manager/bnp_filelist_dialog.h b/studio/src/plugins/bnp_manager/bnp_filelist_dialog.h index fa1dff7c85..b9201f165f 100644 --- a/studio/src/plugins/bnp_manager/bnp_filelist_dialog.h +++ b/studio/src/plugins/bnp_manager/bnp_filelist_dialog.h @@ -18,7 +18,6 @@ #define BNP_FILELIST_DIALOG_H // Qt includes -#include // STL includes #include diff --git a/studio/src/plugins/bnp_manager/bnp_filesystem_model.h b/studio/src/plugins/bnp_manager/bnp_filesystem_model.h index dabd33bd68..abf92e7ebf 100644 --- a/studio/src/plugins/bnp_manager/bnp_filesystem_model.h +++ b/studio/src/plugins/bnp_manager/bnp_filesystem_model.h @@ -17,7 +17,7 @@ #ifndef BNP_FILESYSTEM_MODEL_H #define BNP_FILESYSTEM_MODEL_H -#include +#include namespace BNPManager { diff --git a/studio/src/plugins/bnp_manager/bnp_manager_plugin.cpp b/studio/src/plugins/bnp_manager/bnp_manager_plugin.cpp index 8941410d82..36954670f5 100644 --- a/studio/src/plugins/bnp_manager/bnp_manager_plugin.cpp +++ b/studio/src/plugins/bnp_manager/bnp_manager_plugin.cpp @@ -30,7 +30,7 @@ // Qt includes #include -#include +#include namespace BNPManager { @@ -91,5 +91,3 @@ void BNPManagerPlugin::addAutoReleasedObject(QObject *obj) m_BnpManagerWindow->open(); }*/ } - -Q_EXPORT_PLUGIN(BNPManager::BNPManagerPlugin) diff --git a/studio/src/plugins/bnp_manager/bnp_manager_plugin.h b/studio/src/plugins/bnp_manager/bnp_manager_plugin.h index 4736a4b99f..df9c40203f 100644 --- a/studio/src/plugins/bnp_manager/bnp_manager_plugin.h +++ b/studio/src/plugins/bnp_manager/bnp_manager_plugin.h @@ -47,6 +47,7 @@ class m_BnpManagerWindow; class BNPManagerPlugin : public QObject, public ExtensionSystem::IPlugin { Q_OBJECT + Q_PLUGIN_METADATA(IID IPlugin_iid FILE "plugin-metadata.json") Q_INTERFACES(ExtensionSystem::IPlugin) public: diff --git a/studio/src/plugins/bnp_manager/bnp_manager_window.h b/studio/src/plugins/bnp_manager/bnp_manager_window.h index 887394b00d..4b6d160cb4 100644 --- a/studio/src/plugins/bnp_manager/bnp_manager_window.h +++ b/studio/src/plugins/bnp_manager/bnp_manager_window.h @@ -21,10 +21,10 @@ //#include "ui_bnp_manager_window.h" // Qt includes -#include -#include -#include -#include +#include +#include +#include +#include namespace BNPManager diff --git a/studio/src/plugins/bnp_manager/plugin-metadata.json b/studio/src/plugins/bnp_manager/plugin-metadata.json new file mode 100644 index 0000000000..69f124b567 --- /dev/null +++ b/studio/src/plugins/bnp_manager/plugin-metadata.json @@ -0,0 +1,6 @@ +{ + "Name" : "BNPManager", + "Version" : "0.1", + "Vendor": "Krolock", + "Description": "Edit BNP Files" +} \ No newline at end of file diff --git a/studio/src/plugins/core/CMakeLists.txt b/studio/src/plugins/core/CMakeLists.txt index fefecf5aca..6f8294fb38 100644 --- a/studio/src/plugins/core/CMakeLists.txt +++ b/studio/src/plugins/core/CMakeLists.txt @@ -44,9 +44,9 @@ ENDIF() SET(QT_USE_QTGUI TRUE) SET(QT_USE_QTOPENGL TRUE) -QT4_ADD_RESOURCES(OVQT_CORE_PLUGIN_RC_SRCS ${OVQT_CORE_PLUGIN_RCS}) -QT4_WRAP_CPP(OVQT_CORE_PLUGIN_MOC_SRC ${OVQT_CORE_PLUGIN_HDR}) -QT4_WRAP_UI(OVQT_CORE_PLUGIN_UI_HDRS ${OVQT_CORE_PLUGIN_UIS}) +QT5_ADD_RESOURCES(OVQT_CORE_PLUGIN_RC_SRCS ${OVQT_CORE_PLUGIN_RCS}) +QT5_WRAP_CPP(OVQT_CORE_PLUGIN_MOC_SRC ${OVQT_CORE_PLUGIN_HDR}) +QT5_WRAP_UI(OVQT_CORE_PLUGIN_UI_HDRS ${OVQT_CORE_PLUGIN_UIS}) SOURCE_GROUP(QtResources FILES ${OVQT_CORE_PLUGIN_UIS} ${OVQT_CORE_PLUGIN_RCS}) SOURCE_GROUP(QtGeneratedUiHdr FILES ${OVQT_CORE_PLUGIN_UI_HDRS}) @@ -62,7 +62,7 @@ NL_DEFAULT_PROPS(studio_plugin_core "Tools: Studio Plugin: Core") NL_ADD_RUNTIME_FLAGS(studio_plugin_core) NL_ADD_LIB_SUFFIX(studio_plugin_core) -ADD_DEFINITIONS(-DCORE_LIBRARY -DQT_PLUGIN -DQT_SHARED ${QT_DEFINITIONS}) +ADD_DEFINITIONS(-DCORE_LIBRARY -DQT_PLUGIN -DQT_SHARED -DMESA_GL_NO_X11_HEADERS ${QT_DEFINITIONS}) IF(WIN32) IF(WITH_INSTALL_LIBRARIES) diff --git a/studio/src/plugins/core/Nel3DWidget/nel3d_widget.cpp b/studio/src/plugins/core/Nel3DWidget/nel3d_widget.cpp index 80e5a8db84..1905e3c7ef 100644 --- a/studio/src/plugins/core/Nel3DWidget/nel3d_widget.cpp +++ b/studio/src/plugins/core/Nel3DWidget/nel3d_widget.cpp @@ -17,6 +17,9 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . +// needs to be included before x11 due to some collisions +#include + #include "nel3d_widget.h" #include "nel/3d/u_driver.h" #include "nel/3d/text_context.h" @@ -28,8 +31,6 @@ #include #endif -#include - Nel3DWidget::Nel3DWidget( QWidget *parent ) : NEL3DWIDGET( parent ) { diff --git a/studio/src/plugins/core/Nel3DWidget/nel3d_widget.h b/studio/src/plugins/core/Nel3DWidget/nel3d_widget.h index 27b6dd84cf..3f72942a2e 100644 --- a/studio/src/plugins/core/Nel3DWidget/nel3d_widget.h +++ b/studio/src/plugins/core/Nel3DWidget/nel3d_widget.h @@ -36,9 +36,12 @@ #define NEL3DWIDGET QGLWidget #endif - #include "../core_global.h" +#ifdef NL_OS_UNIX +#include +#endif + namespace NL3D { class UDriver; diff --git a/studio/src/plugins/core/context_manager.cpp b/studio/src/plugins/core/context_manager.cpp index a44cb41e4b..a3124e1cdb 100644 --- a/studio/src/plugins/core/context_manager.cpp +++ b/studio/src/plugins/core/context_manager.cpp @@ -27,8 +27,8 @@ #include // Qt includes -#include -#include +#include +#include namespace Core { diff --git a/studio/src/plugins/core/core_plugin.cpp b/studio/src/plugins/core/core_plugin.cpp index 1d7ebf47c2..7693fc95f7 100644 --- a/studio/src/plugins/core/core_plugin.cpp +++ b/studio/src/plugins/core/core_plugin.cpp @@ -31,11 +31,11 @@ // Qt includes #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include using namespace Core; @@ -103,5 +103,3 @@ void CorePlugin::addAutoReleasedObject(QObject *obj) m_plugMan->addObject(obj); m_autoReleaseObjects.prepend(obj); } - -Q_EXPORT_PLUGIN(CorePlugin) diff --git a/studio/src/plugins/core/core_plugin.h b/studio/src/plugins/core/core_plugin.h index aeddb967bd..04feead5e6 100644 --- a/studio/src/plugins/core/core_plugin.h +++ b/studio/src/plugins/core/core_plugin.h @@ -44,6 +44,7 @@ namespace Core class CorePlugin : public QObject, public ExtensionSystem::IPlugin { Q_OBJECT + Q_PLUGIN_METADATA(IID IPlugin_iid FILE "plugin-metadata.json") Q_INTERFACES(ExtensionSystem::IPlugin) public: diff --git a/studio/src/plugins/core/general_settings_page.cpp b/studio/src/plugins/core/general_settings_page.cpp index af2ede1b79..a46bc49da2 100644 --- a/studio/src/plugins/core/general_settings_page.cpp +++ b/studio/src/plugins/core/general_settings_page.cpp @@ -29,11 +29,11 @@ // Qt includes #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #ifdef HAVE_CONFIG_H #include "config.h" diff --git a/studio/src/plugins/core/main_window.cpp b/studio/src/plugins/core/main_window.cpp index 95b3e2320e..3939a1dadc 100644 --- a/studio/src/plugins/core/main_window.cpp +++ b/studio/src/plugins/core/main_window.cpp @@ -33,8 +33,11 @@ // Qt includes #include -#include -#include +#include +#include +#include +#include +#include namespace Core { diff --git a/studio/src/plugins/core/main_window.h b/studio/src/plugins/core/main_window.h index ba31aece4e..706e67a348 100644 --- a/studio/src/plugins/core/main_window.h +++ b/studio/src/plugins/core/main_window.h @@ -28,9 +28,9 @@ // STL includes // Qt includes -#include -#include -#include +#include +#include +#include namespace Core { diff --git a/studio/src/plugins/core/menu_manager.h b/studio/src/plugins/core/menu_manager.h index afcc88facf..4f2c3a1beb 100644 --- a/studio/src/plugins/core/menu_manager.h +++ b/studio/src/plugins/core/menu_manager.h @@ -28,9 +28,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include namespace Core { diff --git a/studio/src/plugins/core/plugin-metadata.json b/studio/src/plugins/core/plugin-metadata.json new file mode 100644 index 0000000000..d453d851c9 --- /dev/null +++ b/studio/src/plugins/core/plugin-metadata.json @@ -0,0 +1,6 @@ +{ + "Name" : "Core", + "Version" : "0.8", + "Vendor": "Ryzom Core", + "Description": "Core plugin." +} \ No newline at end of file diff --git a/studio/src/plugins/core/plugin_view_dialog.cpp b/studio/src/plugins/core/plugin_view_dialog.cpp index 76cbc828e4..e1d43bd3c8 100644 --- a/studio/src/plugins/core/plugin_view_dialog.cpp +++ b/studio/src/plugins/core/plugin_view_dialog.cpp @@ -26,8 +26,8 @@ // Qt includes #include #include -#include -#include +#include +#include #include #include diff --git a/studio/src/plugins/core/search_paths_settings_page.cpp b/studio/src/plugins/core/search_paths_settings_page.cpp index 918b58a7c7..df4f1547ec 100644 --- a/studio/src/plugins/core/search_paths_settings_page.cpp +++ b/studio/src/plugins/core/search_paths_settings_page.cpp @@ -28,8 +28,8 @@ // Qt includes #include -#include -#include +#include +#include #if !defined NL_OS_WINDOWS #include "core_config.h" diff --git a/studio/src/plugins/core/settings_dialog.cpp b/studio/src/plugins/core/settings_dialog.cpp index b0cc329646..39c2432fb1 100644 --- a/studio/src/plugins/core/settings_dialog.cpp +++ b/studio/src/plugins/core/settings_dialog.cpp @@ -23,8 +23,8 @@ #include "ioptions_page.h" // Qt includes -#include -#include +#include +#include struct PageData { diff --git a/studio/src/plugins/disp_sheet_id/CMakeLists.txt b/studio/src/plugins/disp_sheet_id/CMakeLists.txt index ffccb97b35..bdedf5dc79 100644 --- a/studio/src/plugins/disp_sheet_id/CMakeLists.txt +++ b/studio/src/plugins/disp_sheet_id/CMakeLists.txt @@ -17,8 +17,8 @@ SET(OVQT_DISP_SHEET_ID_PLUGIN_UIS SET(QT_USE_QTGUI TRUE) SET(QT_USE_QTOPENGL TRUE) -QT4_WRAP_CPP(OVQT_DISP_SHEET_ID_PLUGIN_MOC_SRC ${OVQT_DISP_SHEET_ID_PLUGIN_HDR}) -QT4_WRAP_UI(OVQT_DISP_SHEET_ID_PLUGIN_UI_HDRS ${OVQT_DISP_SHEET_ID_PLUGIN_UIS}) +QT5_WRAP_CPP(OVQT_DISP_SHEET_ID_PLUGIN_MOC_SRC ${OVQT_DISP_SHEET_ID_PLUGIN_HDR}) +QT5_WRAP_UI(OVQT_DISP_SHEET_ID_PLUGIN_UI_HDRS ${OVQT_DISP_SHEET_ID_PLUGIN_UIS}) SOURCE_GROUP(QtGeneratedUiHdr FILES ${OVQT_DISP_SHEET_ID_PLUGIN_UI_HDRS}) SOURCE_GROUP(QtGeneratedMocSrc FILES ${OVQT_DISP_SHEET_ID_PLUGIN_MOC_SRC}) diff --git a/studio/src/plugins/disp_sheet_id/disp_sheet_id_plugin.cpp b/studio/src/plugins/disp_sheet_id/disp_sheet_id_plugin.cpp index 7a5b110a6f..f5e3b0785a 100644 --- a/studio/src/plugins/disp_sheet_id/disp_sheet_id_plugin.cpp +++ b/studio/src/plugins/disp_sheet_id/disp_sheet_id_plugin.cpp @@ -26,11 +26,11 @@ // Qt includes #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include // NeL includes #include "nel/misc/debug.h" @@ -87,5 +87,3 @@ void DispSheetIdPlugin::setNelContext(NLMISC::INelContext *nelContext) #endif // NL_OS_WINDOWS m_LibContext = new NLMISC::CLibraryContext(*nelContext); } - -Q_EXPORT_PLUGIN(DispSheetIdPlugin) diff --git a/studio/src/plugins/disp_sheet_id/disp_sheet_id_plugin.h b/studio/src/plugins/disp_sheet_id/disp_sheet_id_plugin.h index a340637777..1c6105662a 100644 --- a/studio/src/plugins/disp_sheet_id/disp_sheet_id_plugin.h +++ b/studio/src/plugins/disp_sheet_id/disp_sheet_id_plugin.h @@ -38,6 +38,7 @@ namespace SheetIdViewPlugin class DispSheetIdPlugin : public QObject, public ExtensionSystem::IPlugin { Q_OBJECT + Q_PLUGIN_METADATA(IID IPlugin_iid FILE "plugin-metadata.json") Q_INTERFACES(ExtensionSystem::IPlugin) public: diff --git a/studio/src/plugins/disp_sheet_id/plugin-metadata.json b/studio/src/plugins/disp_sheet_id/plugin-metadata.json new file mode 100644 index 0000000000..5a3b538d85 --- /dev/null +++ b/studio/src/plugins/disp_sheet_id/plugin-metadata.json @@ -0,0 +1,6 @@ +{ + "Name" : "DisplaySheetId", + "Version" : "1.0", + "Vendor": "pemeon", + "Description": "Display sheet id." +} \ No newline at end of file diff --git a/studio/src/plugins/disp_sheet_id/sheet_id_view.cpp b/studio/src/plugins/disp_sheet_id/sheet_id_view.cpp index e27ef94059..6cd9f61afb 100644 --- a/studio/src/plugins/disp_sheet_id/sheet_id_view.cpp +++ b/studio/src/plugins/disp_sheet_id/sheet_id_view.cpp @@ -21,8 +21,8 @@ #include "nel/misc/path.h" -#include -#include +#include +#include class CPred { diff --git a/studio/src/plugins/disp_sheet_id/sheet_id_view.h b/studio/src/plugins/disp_sheet_id/sheet_id_view.h index ac5022328e..d28f4b06a1 100644 --- a/studio/src/plugins/disp_sheet_id/sheet_id_view.h +++ b/studio/src/plugins/disp_sheet_id/sheet_id_view.h @@ -25,7 +25,7 @@ #include "nel/misc/types_nl.h" #include "nel/misc/sheet_id.h" -#include +#include class SheetIdView : public QDialog { diff --git a/studio/src/plugins/example/CMakeLists.txt b/studio/src/plugins/example/CMakeLists.txt index 6b7e86962b..5c35f32bcd 100644 --- a/studio/src/plugins/example/CMakeLists.txt +++ b/studio/src/plugins/example/CMakeLists.txt @@ -18,8 +18,8 @@ SET(OVQT_PLUG_EXAMPLE_UIS example_settings_page.ui) SET(QT_USE_QTGUI TRUE) SET(QT_USE_QTOPENGL TRUE) -QT4_WRAP_CPP(OVQT_PLUG_EXAMPLE_MOC_SRC ${OVQT_PLUG_EXAMPLE_HDR}) -QT4_WRAP_UI(OVQT_PLUG_EXAMPLE_UI_HDRS ${OVQT_PLUG_EXAMPLE_UIS}) +QT5_WRAP_CPP(OVQT_PLUG_EXAMPLE_MOC_SRC ${OVQT_PLUG_EXAMPLE_HDR}) +QT5_WRAP_UI(OVQT_PLUG_EXAMPLE_UI_HDRS ${OVQT_PLUG_EXAMPLE_UIS}) SOURCE_GROUP(QtResources FILES ${OVQT_PLUG_EXAMPLE_UIS}) SOURCE_GROUP(QtGeneratedUiHdr FILES ${OVQT_PLUG_EXAMPLE_UI_HDRS}) diff --git a/studio/src/plugins/example/example_plugin.cpp b/studio/src/plugins/example/example_plugin.cpp index cf13867c73..00dfbdbe7f 100644 --- a/studio/src/plugins/example/example_plugin.cpp +++ b/studio/src/plugins/example/example_plugin.cpp @@ -1,3 +1,13 @@ +// Qt includes +#include +#include +#include +#include +#include +#include +#include +#include + // Project includes #include "example_plugin.h" #include "example_settings_page.h" @@ -12,14 +22,6 @@ // NeL includes #include "nel/misc/debug.h" -// Qt includes -#include -#include -#include -#include -#include -#include - namespace Plugin { @@ -79,5 +81,3 @@ void ExamplePlugin::addAutoReleasedObject(QObject *obj) } } - -Q_EXPORT_PLUGIN(Plugin::ExamplePlugin) \ No newline at end of file diff --git a/studio/src/plugins/example/example_plugin.h b/studio/src/plugins/example/example_plugin.h index bfb400651e..c2dbbc021d 100644 --- a/studio/src/plugins/example/example_plugin.h +++ b/studio/src/plugins/example/example_plugin.h @@ -24,6 +24,7 @@ namespace Plugin class ExamplePlugin : public QObject, public ExtensionSystem::IPlugin { Q_OBJECT + Q_PLUGIN_METADATA(IID IPlugin_iid FILE "plugin-metadata.json") Q_INTERFACES(ExtensionSystem::IPlugin) public: ExamplePlugin(); diff --git a/studio/src/plugins/example/example_settings_page.cpp b/studio/src/plugins/example/example_settings_page.cpp index 8b12aea0b7..48820b6fb2 100644 --- a/studio/src/plugins/example/example_settings_page.cpp +++ b/studio/src/plugins/example/example_settings_page.cpp @@ -20,7 +20,7 @@ #include "example_settings_page.h" // Qt includes -#include +#include // NeL includes diff --git a/studio/src/plugins/example/plugin-metadata.json b/studio/src/plugins/example/plugin-metadata.json new file mode 100644 index 0000000000..3ffefbc7b7 --- /dev/null +++ b/studio/src/plugins/example/plugin-metadata.json @@ -0,0 +1,6 @@ +{ + "Name" : "ExamplePlugin", + "Version" : "0.2", + "Vendor": "dnk-88", + "Description": "Example ovqt plugin." +} \ No newline at end of file diff --git a/studio/src/plugins/example/qnel_widget.cpp b/studio/src/plugins/example/qnel_widget.cpp index d0821eb6ba..341d1dba4f 100644 --- a/studio/src/plugins/example/qnel_widget.cpp +++ b/studio/src/plugins/example/qnel_widget.cpp @@ -17,14 +17,14 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -#include "qnel_widget.h" - -// STL includes - // Qt includes #include #include +#include "qnel_widget.h" + +// STL includes + // NeL includes #include #include diff --git a/studio/src/plugins/example/qnel_widget.h b/studio/src/plugins/example/qnel_widget.h index 795a0b7a75..48c6513b77 100644 --- a/studio/src/plugins/example/qnel_widget.h +++ b/studio/src/plugins/example/qnel_widget.h @@ -27,7 +27,7 @@ // Qt includes #include -#include +#include class QAction; @@ -38,6 +38,7 @@ typedef QWidget QNeLWidget; typedef QWidget QNeLWidget; #elif defined(NL_OS_UNIX) typedef QGLWidget QNeLWidget; +#include #endif // NL_OS_UNIX namespace NL3D diff --git a/studio/src/plugins/example/simple_viewer.cpp b/studio/src/plugins/example/simple_viewer.cpp index 89a5e88c8b..8b39eba83d 100644 --- a/studio/src/plugins/example/simple_viewer.cpp +++ b/studio/src/plugins/example/simple_viewer.cpp @@ -20,9 +20,9 @@ #include "simple_viewer.h" // Qt includes -#include -#include -#include +#include +#include +#include // NeL includes diff --git a/studio/src/plugins/example/simple_viewer.h b/studio/src/plugins/example/simple_viewer.h index d1a2a19e0a..b6bd3e0c3b 100644 --- a/studio/src/plugins/example/simple_viewer.h +++ b/studio/src/plugins/example/simple_viewer.h @@ -27,7 +27,7 @@ // Qt includes #include -#include +#include class QWidget; namespace Plugin diff --git a/studio/src/plugins/georges_editor/CMakeLists.txt b/studio/src/plugins/georges_editor/CMakeLists.txt index abe7eb3edd..7e9ce571ea 100644 --- a/studio/src/plugins/georges_editor/CMakeLists.txt +++ b/studio/src/plugins/georges_editor/CMakeLists.txt @@ -1,8 +1,10 @@ +FIND_PACKAGE(QtPropertyBrowser REQUIRED) + INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${QT_INCLUDES} ${LIBXML2_INCLUDE_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/../../3rdparty/qtpropertybrowser) + ${QtPropertyBrowser_INCLUDE_DIR}) FILE(GLOB SRC *.cpp *.h) SET(OVQT_EXT_SYS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/../../extension_system/iplugin.h @@ -38,9 +40,9 @@ SET(OVQT_PLUGIN_GEORGES_EDITOR_RCS georges_editor.qrc) SET(QT_USE_QTGUI TRUE) SET(QT_USE_QTOPENGL TRUE) -QT4_ADD_RESOURCES(OVQT_PLUGIN_GEORGES_EDITOR_RC_SRCS ${OVQT_PLUGIN_GEORGES_EDITOR_RCS}) -QT4_WRAP_CPP(OVQT_PLUG_GEORGES_EDITOR_MOC_SRC ${OVQT_PLUG_GEORGES_EDITOR_HDR}) -QT4_WRAP_UI( OVQT_PLUG_GEORGES_EDITOR_UI_HDRS ${OVQT_PLUG_GEORGES_EDITOR_UIS} ) +QT5_ADD_RESOURCES(OVQT_PLUGIN_GEORGES_EDITOR_RC_SRCS ${OVQT_PLUGIN_GEORGES_EDITOR_RCS}) +QT5_WRAP_CPP(OVQT_PLUG_GEORGES_EDITOR_MOC_SRC ${OVQT_PLUG_GEORGES_EDITOR_HDR}) +QT5_WRAP_UI( OVQT_PLUG_GEORGES_EDITOR_UI_HDRS ${OVQT_PLUG_GEORGES_EDITOR_UIS} ) SOURCE_GROUP(QtResources FILES ${OVQT_PLUG_GEORGES_EDITOR_UIS} ${OVQT_PLUGIN_GEORGES_EDITOR_RCS}) SOURCE_GROUP(QtGeneratedUiHdr FILES ${OVQT_PLUG_GEORGES_EDITOR_UI_HDRS}) @@ -50,7 +52,7 @@ SOURCE_GROUP("OVQT Extension System" FILES ${OVQT_EXT_SYS_SRC}) ADD_LIBRARY(studio_plugin_georges_editor MODULE ${SRC} ${OVQT_PLUG_GEORGES_EDITOR_MOC_SRC} ${OVQT_EXT_SYS_SRC} ${OVQT_PLUG_GEORGES_EDITOR_UI_HDRS} ${OVQT_PLUGIN_GEORGES_EDITOR_RC_SRCS}) -TARGET_LINK_LIBRARIES(studio_plugin_georges_editor studio_plugin_core nelmisc nelgeorges qt_property_browser ${QT_LIBRARIES} ${LIBXML2_LIBRARIES}) +TARGET_LINK_LIBRARIES(studio_plugin_georges_editor studio_plugin_core nelmisc nelgeorges qtpropertybrowser ${QtPropertyBrowser_LIBRARY} ${QT_LIBRARIES} ${LIBXML2_LIBRARIES}) NL_DEFAULT_PROPS(studio_plugin_georges_editor "Tools: Studio Plugin: Georges Editor") NL_ADD_RUNTIME_FLAGS(studio_plugin_georges_editor) diff --git a/studio/src/plugins/georges_editor/actions.cpp b/studio/src/plugins/georges_editor/actions.cpp index 54819dc18d..82e6d345b9 100644 --- a/studio/src/plugins/georges_editor/actions.cpp +++ b/studio/src/plugins/georges_editor/actions.cpp @@ -98,8 +98,8 @@ namespace GeorgesQt value = m_oldValue; - array->Elements[m_item->structId()].Name = value.toAscii().data(); - m_item->setName(value.toAscii().data()); + array->Elements[m_item->structId()].Name = value.toLatin1().data(); + m_item->setName(value.toLatin1().data()); m_model->emitDataChanged(m_model->index(m_item->row(), 0, m_item)); } diff --git a/studio/src/plugins/georges_editor/actions.h b/studio/src/plugins/georges_editor/actions.h index 019316e583..3231c3beee 100644 --- a/studio/src/plugins/georges_editor/actions.h +++ b/studio/src/plugins/georges_editor/actions.h @@ -20,7 +20,7 @@ #ifndef ACTIONS_H #define ACTIONS_H -#include +#include #include namespace GeorgesQt diff --git a/studio/src/plugins/georges_editor/browser_ctrl.cpp b/studio/src/plugins/georges_editor/browser_ctrl.cpp index 4d93556f42..f632814e43 100644 --- a/studio/src/plugins/georges_editor/browser_ctrl.cpp +++ b/studio/src/plugins/georges_editor/browser_ctrl.cpp @@ -20,8 +20,8 @@ #include "browser_ctrl.h" -#include "3rdparty/qtpropertybrowser/qttreepropertybrowser.h" -#include "3rdparty/qtpropertybrowser/qtvariantproperty.h" +#include +#include #include "filepath_property_manager.h" #include diff --git a/studio/src/plugins/georges_editor/browser_ctrl_pvt.cpp b/studio/src/plugins/georges_editor/browser_ctrl_pvt.cpp index 3abf3f9881..62f9084fd6 100644 --- a/studio/src/plugins/georges_editor/browser_ctrl_pvt.cpp +++ b/studio/src/plugins/georges_editor/browser_ctrl_pvt.cpp @@ -19,9 +19,10 @@ // along with this program. If not, see . #include "browser_ctrl_pvt.h" -#include "3rdparty/qtpropertybrowser/qttreepropertybrowser.h" -#include "3rdparty/qtpropertybrowser/qtvariantproperty.h" +#include +#include #include +#include #include "formitem.h" #include "nel/georges/form.h" @@ -517,7 +518,7 @@ void BrowserCtrlPvt::onArrayValueChanged( QtProperty *p, const QVariant &value ) void BrowserCtrlPvt::onAtomValueChanged( QtProperty *p, const QVariant &value ) { NLGEORGES::CFormElmAtom *atom = static_cast< NLGEORGES::CFormElmAtom* >( getCurrentNode() ); - atom->setValue( value.toString().toUtf8() ); + atom->setValue( value.toString().toUtf8().constData() ); Q_EMIT modified(); Q_EMIT valueChanged( m_currentNode.name, value.toString() ); diff --git a/studio/src/plugins/georges_editor/browser_ctrl_pvt.h b/studio/src/plugins/georges_editor/browser_ctrl_pvt.h index 704e63b0c2..d0ec984ab8 100644 --- a/studio/src/plugins/georges_editor/browser_ctrl_pvt.h +++ b/studio/src/plugins/georges_editor/browser_ctrl_pvt.h @@ -19,6 +19,7 @@ #define BROWSER_CTRL_PVT_H #include +#include namespace NLGEORGES { diff --git a/studio/src/plugins/georges_editor/dfn_browser_ctrl.cpp b/studio/src/plugins/georges_editor/dfn_browser_ctrl.cpp index ed992f7d36..d71909ce0e 100644 --- a/studio/src/plugins/georges_editor/dfn_browser_ctrl.cpp +++ b/studio/src/plugins/georges_editor/dfn_browser_ctrl.cpp @@ -16,10 +16,10 @@ // along with this program. If not, see . #include "dfn_browser_ctrl.h" -#include "3rdparty/qtpropertybrowser/qttreepropertybrowser.h" -#include "3rdparty/qtpropertybrowser/qtvariantproperty.h" -#include "3rdparty/qtpropertybrowser/qteditorfactory.h" -#include "3rdparty/qtpropertybrowser/qtpropertymanager.h" +#include +#include +#include +#include #include "filepath_property_manager.h" diff --git a/studio/src/plugins/georges_editor/filepath_property_manager.h b/studio/src/plugins/georges_editor/filepath_property_manager.h index 88cc9c31c0..c3700fe3ba 100644 --- a/studio/src/plugins/georges_editor/filepath_property_manager.h +++ b/studio/src/plugins/georges_editor/filepath_property_manager.h @@ -21,7 +21,7 @@ #define QT_QTPROPERTYBROWSER_IMPORT #include -#include <3rdparty/qtpropertybrowser/qtpropertymanager.h> +#include /////////////////////////////////////////////////////////////////////// Manager ///////////////////////////////////////////////////////////////// diff --git a/studio/src/plugins/georges_editor/georges_dfn_dialog.cpp b/studio/src/plugins/georges_editor/georges_dfn_dialog.cpp index 7b0b180567..b86176beaf 100644 --- a/studio/src/plugins/georges_editor/georges_dfn_dialog.cpp +++ b/studio/src/plugins/georges_editor/georges_dfn_dialog.cpp @@ -18,6 +18,7 @@ #include "georges_dfn_dialog.h" #include #include +#include #include "georges.h" #include "dfn_browser_ctrl.h" @@ -25,6 +26,7 @@ #include "nel/misc/file.h" #include "nel/misc/o_xml.h" #include "nel/misc/path.h" +#include "nel/georges/form_dfn.h" class GeorgesDFNDialogPvt { diff --git a/studio/src/plugins/georges_editor/georges_dirtree_dialog.cpp b/studio/src/plugins/georges_editor/georges_dirtree_dialog.cpp index 9599aa3737..6a0c9b348a 100644 --- a/studio/src/plugins/georges_editor/georges_dirtree_dialog.cpp +++ b/studio/src/plugins/georges_editor/georges_dirtree_dialog.cpp @@ -23,7 +23,7 @@ #include "georges_dirtree_dialog.h" // Qt includes -#include +#include #include // NeL includes diff --git a/studio/src/plugins/georges_editor/georges_dirtree_dialog.h b/studio/src/plugins/georges_editor/georges_dirtree_dialog.h index 106f69a012..974a555cde 100644 --- a/studio/src/plugins/georges_editor/georges_dirtree_dialog.h +++ b/studio/src/plugins/georges_editor/georges_dirtree_dialog.h @@ -21,7 +21,7 @@ #define GEORGES_DIRTREE_DIALOG_H // Qt includes -#include +#include // STL includes diff --git a/studio/src/plugins/georges_editor/georges_dock_widget.cpp b/studio/src/plugins/georges_editor/georges_dock_widget.cpp index f301db0f88..30697af0f0 100644 --- a/studio/src/plugins/georges_editor/georges_dock_widget.cpp +++ b/studio/src/plugins/georges_editor/georges_dock_widget.cpp @@ -17,6 +17,8 @@ #include "georges_dock_widget.h" #include +#include +#include GeorgesDockWidget::GeorgesDockWidget( QWidget *parent ) : QDockWidget( parent ) diff --git a/studio/src/plugins/georges_editor/georges_editor_form.cpp b/studio/src/plugins/georges_editor/georges_editor_form.cpp index 89d8dfd197..56cf439088 100644 --- a/studio/src/plugins/georges_editor/georges_editor_form.cpp +++ b/studio/src/plugins/georges_editor/georges_editor_form.cpp @@ -41,6 +41,7 @@ #include #include #include +#include namespace GeorgesQt { diff --git a/studio/src/plugins/georges_editor/georges_editor_form.h b/studio/src/plugins/georges_editor/georges_editor_form.h index a1d33e65eb..c90bd86200 100644 --- a/studio/src/plugins/georges_editor/georges_editor_form.h +++ b/studio/src/plugins/georges_editor/georges_editor_form.h @@ -25,7 +25,7 @@ #include "ui_georges_editor_form.h" // Qt includes -#include +#include class GeorgesDockWidget; diff --git a/studio/src/plugins/georges_editor/georges_editor_plugin.cpp b/studio/src/plugins/georges_editor/georges_editor_plugin.cpp index 8fa764a5ad..6de11d7a1f 100644 --- a/studio/src/plugins/georges_editor/georges_editor_plugin.cpp +++ b/studio/src/plugins/georges_editor/georges_editor_plugin.cpp @@ -109,5 +109,3 @@ QWidget *GeorgesEditorContext::widget() } } - -Q_EXPORT_PLUGIN(GeorgesQt::GeorgesEditorPlugin) \ No newline at end of file diff --git a/studio/src/plugins/georges_editor/georges_editor_plugin.h b/studio/src/plugins/georges_editor/georges_editor_plugin.h index 960cb943bb..2b39267e91 100644 --- a/studio/src/plugins/georges_editor/georges_editor_plugin.h +++ b/studio/src/plugins/georges_editor/georges_editor_plugin.h @@ -48,6 +48,7 @@ class GeorgesEditorForm; class GeorgesEditorPlugin : public QObject, public ExtensionSystem::IPlugin { Q_OBJECT + Q_PLUGIN_METADATA(IID IPlugin_iid FILE "plugin-metadata.json") Q_INTERFACES(ExtensionSystem::IPlugin) public: diff --git a/studio/src/plugins/georges_editor/georges_filesystem_model.h b/studio/src/plugins/georges_editor/georges_filesystem_model.h index 7d1e16cb14..43bb23e4d9 100644 --- a/studio/src/plugins/georges_editor/georges_filesystem_model.h +++ b/studio/src/plugins/georges_editor/georges_filesystem_model.h @@ -17,7 +17,7 @@ #ifndef GEORGES_FILESYSTEM_MODEL_H #define GEORGES_FILESYSTEM_MODEL_H -#include +#include #include namespace GeorgesQt diff --git a/studio/src/plugins/georges_editor/georges_treeview_dialog.cpp b/studio/src/plugins/georges_editor/georges_treeview_dialog.cpp index b6b6a8f92b..48ac5b3ef1 100644 --- a/studio/src/plugins/georges_editor/georges_treeview_dialog.cpp +++ b/studio/src/plugins/georges_editor/georges_treeview_dialog.cpp @@ -22,11 +22,12 @@ #include "georges_treeview_dialog.h" // Qt includes -#include +#include #include #include #include #include +#include // NeL includes #include @@ -73,7 +74,7 @@ namespace GeorgesQt m_ui.setupUi(this); m_header = new ExpandableHeaderView(Qt::Horizontal, m_ui.treeView); m_ui.treeView->setHeader(m_header); - m_ui.treeView->header()->setResizeMode(QHeaderView::ResizeToContents); + m_ui.treeView->header()->setSectionResizeMode(QHeaderView::ResizeToContents); m_ui.treeView->header()->setStretchLastSection(true); m_form = 0; @@ -126,7 +127,7 @@ namespace GeorgesQt NLGEORGES::CForm* CGeorgesTreeViewDialog::getFormByName(const QString formName) { - return (NLGEORGES::CForm *)m_georges->loadForm(formName.toAscii().data()); + return (NLGEORGES::CForm *)m_georges->loadForm(formName.toLatin1().data()); //else //{ // CForm *form = 0; @@ -171,7 +172,7 @@ namespace GeorgesQt m_form = form; // Retrieve a copy of the root definition. - NLGEORGES::CFormDfn *formDfn = dynamic_cast(m_georges->loadFormDfn(dfnName.toAscii().data())); + NLGEORGES::CFormDfn *formDfn = dynamic_cast(m_georges->loadFormDfn(dfnName.toLatin1().data())); // Next we'll use the root node to build a new form. NLGEORGES::CFormElmStruct *fes = dynamic_cast(getRootNode(0)); @@ -274,7 +275,7 @@ namespace GeorgesQt void CGeorgesTreeViewDialog::addParentForm(QString parentFormNm) { // Try to load the form - NLGEORGES::UForm *uParentForm = m_georges->loadForm(parentFormNm.toAscii().data()); + NLGEORGES::UForm *uParentForm = m_georges->loadForm(parentFormNm.toLatin1().data()); NLGEORGES::CForm *parentForm = dynamic_cast(uParentForm); NLGEORGES::CForm *mainForm = static_cast(m_form); @@ -288,11 +289,11 @@ namespace GeorgesQt if (parentForm->Elements.FormDfn == mainForm->Elements.FormDfn) { // This is the parent form selector - if(!mainForm->insertParent(mainForm->getParentCount(),parentFormNm.toAscii().data(), parentForm)) - nlwarning("Failed to add parent form: %s", parentFormNm.toAscii().data()); + if(!mainForm->insertParent(mainForm->getParentCount(),parentFormNm.toLatin1().data(), parentForm)) + nlwarning("Failed to add parent form: %s", parentFormNm.toLatin1().data()); else { - nlinfo("Successfullyadded parent form: %s", parentFormNm.toAscii().data()); + nlinfo("Successfullyadded parent form: %s", parentFormNm.toLatin1().data()); model->addParentForm(parentFormNm); } } diff --git a/studio/src/plugins/georges_editor/georges_treeview_dialog.h b/studio/src/plugins/georges_editor/georges_treeview_dialog.h index eea41c3872..122f56d6e0 100644 --- a/studio/src/plugins/georges_editor/georges_treeview_dialog.h +++ b/studio/src/plugins/georges_editor/georges_treeview_dialog.h @@ -26,9 +26,9 @@ #include "expandable_headerview.h" // Qt includes -#include -#include -#include +#include +#include +#include // STL includes diff --git a/studio/src/plugins/georges_editor/georges_typ_dialog.cpp b/studio/src/plugins/georges_editor/georges_typ_dialog.cpp index 666793c257..b0b2e11fbb 100644 --- a/studio/src/plugins/georges_editor/georges_typ_dialog.cpp +++ b/studio/src/plugins/georges_editor/georges_typ_dialog.cpp @@ -21,10 +21,13 @@ #include #include +#include #include "nel/misc/file.h" #include "nel/misc/o_xml.h" #include "nel/misc/path.h" +#include "nel/georges/u_type.h" +#include "nel/georges/type.h" class GeorgesTypDialogPvt { diff --git a/studio/src/plugins/georges_editor/georgesform_model.h b/studio/src/plugins/georges_editor/georgesform_model.h index 42bf9fad8f..291ab1e768 100644 --- a/studio/src/plugins/georges_editor/georgesform_model.h +++ b/studio/src/plugins/georges_editor/georgesform_model.h @@ -35,6 +35,7 @@ namespace NLGEORGES { class UForm; class CFormElmStruct; class CFormDfn; + class CFormElm; class CFormElmArray; } diff --git a/studio/src/plugins/georges_editor/plugin-metadata.json b/studio/src/plugins/georges_editor/plugin-metadata.json new file mode 100644 index 0000000000..defc0b3b8e --- /dev/null +++ b/studio/src/plugins/georges_editor/plugin-metadata.json @@ -0,0 +1,6 @@ +{ + "Name" : "GeorgesEditor", + "Version" : "0.4", + "Vendor": "aquiles", + "Description": "Tool to create and edit sheets or forms." +} \ No newline at end of file diff --git a/studio/src/plugins/georges_editor/typ_browser_ctrl.cpp b/studio/src/plugins/georges_editor/typ_browser_ctrl.cpp index 906135daea..14affe1b94 100644 --- a/studio/src/plugins/georges_editor/typ_browser_ctrl.cpp +++ b/studio/src/plugins/georges_editor/typ_browser_ctrl.cpp @@ -17,10 +17,10 @@ #include "typ_browser_ctrl.h" -#include "3rdparty/qtpropertybrowser/qttreepropertybrowser.h" -#include "3rdparty/qtpropertybrowser/qtvariantproperty.h" -#include "3rdparty/qtpropertybrowser/qtpropertymanager.h" -#include "3rdparty/qtpropertybrowser/qteditorfactory.h" +#include +#include +#include +#include #include "nel/georges/type.h" diff --git a/studio/src/plugins/gui_editor/CMakeLists.txt b/studio/src/plugins/gui_editor/CMakeLists.txt index cdcd196127..cdeb310963 100644 --- a/studio/src/plugins/gui_editor/CMakeLists.txt +++ b/studio/src/plugins/gui_editor/CMakeLists.txt @@ -64,9 +64,9 @@ SET(OVQT_PLUGIN_GUI_EDITOR_UIS SET(QT_USE_QTGUI TRUE) SET(QT_USE_QTOPENGL TRUE) -QT4_ADD_RESOURCES(OVQT_PLUGIN_GUI_EDITOR_RC_SRCS ${OVQT_PLUGIN_GUI_EDITOR_RCS}) -QT4_WRAP_CPP(OVQT_PLUGIN_GUI_EDITOR_MOC_SRC ${OVQT_PLUGIN_GUI_EDITOR_HDR}) -QT4_WRAP_UI(OVQT_PLUGIN_GUI_EDITOR_UI_HDRS ${OVQT_PLUGIN_GUI_EDITOR_UIS}) +QT5_ADD_RESOURCES(OVQT_PLUGIN_GUI_EDITOR_RC_SRCS ${OVQT_PLUGIN_GUI_EDITOR_RCS}) +QT5_WRAP_CPP(OVQT_PLUGIN_GUI_EDITOR_MOC_SRC ${OVQT_PLUGIN_GUI_EDITOR_HDR}) +QT5_WRAP_UI(OVQT_PLUGIN_GUI_EDITOR_UI_HDRS ${OVQT_PLUGIN_GUI_EDITOR_UIS}) SOURCE_GROUP(QtResources FILES ${OVQT_PLUGIN_GUI_EDITOR_UIS}) SOURCE_GROUP(QtGeneratedUiHdr FILES ${OVQT_PLUGIN_GUI_EDITOR_UI_HDRS}) @@ -89,7 +89,7 @@ TARGET_LINK_LIBRARIES( nelgui ${QT_LIBRARIES} ${QT_QTOPENGL_LIBRARY} - qt_property_browser + ${QtPropertyBrowser_LIBRARY} ) NL_DEFAULT_PROPS(studio_plugin_gui_editor "Tools: Studio Plugin: GUI Editor") diff --git a/studio/src/plugins/gui_editor/action_property_manager.h b/studio/src/plugins/gui_editor/action_property_manager.h index 9bc187dd92..2b77995d86 100644 --- a/studio/src/plugins/gui_editor/action_property_manager.h +++ b/studio/src/plugins/gui_editor/action_property_manager.h @@ -23,7 +23,7 @@ #define QT_QTPROPERTYBROWSER_IMPORT -#include "3rdparty/qtpropertybrowser/qtpropertybrowser.h" +#include #include /////////////////////////////////////////////////////// Manager /////////////////////////////////////////////////////////////////////////// diff --git a/studio/src/plugins/gui_editor/gui_editor_plugin.cpp b/studio/src/plugins/gui_editor/gui_editor_plugin.cpp index a75190fa39..488570fe4f 100644 --- a/studio/src/plugins/gui_editor/gui_editor_plugin.cpp +++ b/studio/src/plugins/gui_editor/gui_editor_plugin.cpp @@ -84,5 +84,3 @@ namespace GUIEditor } } - -Q_EXPORT_PLUGIN(GUIEditor::GUIEditorPlugin) \ No newline at end of file diff --git a/studio/src/plugins/gui_editor/gui_editor_plugin.h b/studio/src/plugins/gui_editor/gui_editor_plugin.h index 30d4f3f452..800d108c2a 100644 --- a/studio/src/plugins/gui_editor/gui_editor_plugin.h +++ b/studio/src/plugins/gui_editor/gui_editor_plugin.h @@ -46,6 +46,7 @@ namespace GUIEditor class GUIEditorPlugin : public QObject, public ExtensionSystem::IPlugin { Q_OBJECT + Q_PLUGIN_METADATA(IID IPlugin_iid FILE "plugin-metadata.json") Q_INTERFACES(ExtensionSystem::IPlugin) public: virtual ~GUIEditorPlugin(); diff --git a/studio/src/plugins/gui_editor/gui_editor_window.cpp b/studio/src/plugins/gui_editor/gui_editor_window.cpp index 74ff0791ae..b722a7336d 100644 --- a/studio/src/plugins/gui_editor/gui_editor_window.cpp +++ b/studio/src/plugins/gui_editor/gui_editor_window.cpp @@ -27,11 +27,11 @@ #include -#include -#include +#include +#include #include #include -#include "../../3rdparty/qtpropertybrowser/QtTreePropertyBrowser" +#include #include "widget_properties.h" #include "widget_info_tree.h" diff --git a/studio/src/plugins/gui_editor/gui_editor_window.h b/studio/src/plugins/gui_editor/gui_editor_window.h index 57ac32020e..1eab073c71 100644 --- a/studio/src/plugins/gui_editor/gui_editor_window.h +++ b/studio/src/plugins/gui_editor/gui_editor_window.h @@ -21,7 +21,7 @@ #define GUI_EDITOR_WINDOW_H #include "ui_gui_editor_window.h" -#include +#include #include #include #include "widget_info.h" diff --git a/studio/src/plugins/gui_editor/plugin-metadata.json b/studio/src/plugins/gui_editor/plugin-metadata.json new file mode 100644 index 0000000000..abbd16327e --- /dev/null +++ b/studio/src/plugins/gui_editor/plugin-metadata.json @@ -0,0 +1,6 @@ +{ + "Name" : "GUI Editor", + "Version" : "0.0.1", + "Vendor": "Ryzom Core", + "Description": "GUI Editor plugin." +} \ No newline at end of file diff --git a/studio/src/plugins/gui_editor/property_browser_ctrl.cpp b/studio/src/plugins/gui_editor/property_browser_ctrl.cpp index b8a38ad930..8461ddc8c8 100644 --- a/studio/src/plugins/gui_editor/property_browser_ctrl.cpp +++ b/studio/src/plugins/gui_editor/property_browser_ctrl.cpp @@ -19,10 +19,10 @@ #include "property_browser_ctrl.h" -#include "../../3rdparty/qtpropertybrowser/QtVariantPropertyManager" -#include "../../3rdparty/qtpropertybrowser/QtEnumPropertyManager" -#include "../../3rdparty/qtpropertybrowser/QtTreePropertyBrowser" -#include "../../3rdparty/qtpropertybrowser/QtEnumEditorFactory" +#include +#include +#include +#include #include "nel/gui/interface_group.h" #include "nel/gui/widget_manager.h" #include diff --git a/studio/src/plugins/gui_editor/texture_property_manager.h b/studio/src/plugins/gui_editor/texture_property_manager.h index 9af7de8c4e..2355f7e47b 100644 --- a/studio/src/plugins/gui_editor/texture_property_manager.h +++ b/studio/src/plugins/gui_editor/texture_property_manager.h @@ -23,7 +23,7 @@ #define QT_QTPROPERTYBROWSER_IMPORT -#include "3rdparty/qtpropertybrowser/qtpropertybrowser.h" +#include #include /////////////////////////////////////////////////////// Manager /////////////////////////////////////////////////////////////////////////// diff --git a/studio/src/plugins/landscape_editor/CMakeLists.txt b/studio/src/plugins/landscape_editor/CMakeLists.txt index fe5a558307..c917f23ef6 100644 --- a/studio/src/plugins/landscape_editor/CMakeLists.txt +++ b/studio/src/plugins/landscape_editor/CMakeLists.txt @@ -30,9 +30,9 @@ SET(OVQT_PLUGIN_LANDSCAPE_EDITOR_RCS landscape_editor.qrc) SET(QT_USE_QTGUI TRUE) SET(QT_USE_QTOPENGL TRUE) -QT4_ADD_RESOURCES(OVQT_PLUGIN_LANDSCAPE_EDITOR_RC_SRCS ${OVQT_PLUGIN_LANDSCAPE_EDITOR_RCS}) -QT4_WRAP_CPP(OVQT_PLUGIN_LANDSCAPE_EDITOR_MOC_SRC ${OVQT_PLUGIN_LANDSCAPE_EDITOR_HDR}) -QT4_WRAP_UI(OVQT_PLUGIN_LANDSCAPE_EDITOR_UI_HDRS ${OVQT_PLUGIN_LANDSCAPE_EDITOR_UIS}) +QT5_ADD_RESOURCES(OVQT_PLUGIN_LANDSCAPE_EDITOR_RC_SRCS ${OVQT_PLUGIN_LANDSCAPE_EDITOR_RCS}) +QT5_WRAP_CPP(OVQT_PLUGIN_LANDSCAPE_EDITOR_MOC_SRC ${OVQT_PLUGIN_LANDSCAPE_EDITOR_HDR}) +QT5_WRAP_UI(OVQT_PLUGIN_LANDSCAPE_EDITOR_UI_HDRS ${OVQT_PLUGIN_LANDSCAPE_EDITOR_UIS}) SOURCE_GROUP(QtResources FILES ${OVQT_PLUGIN_LANDSCAPE_EDITOR_UIS}) SOURCE_GROUP(QtGeneratedUiHdr FILES ${OVQT_PLUGIN_LANDSCAPE_EDITOR_UI_HDRS}) diff --git a/studio/src/plugins/landscape_editor/builder_zone.cpp b/studio/src/plugins/landscape_editor/builder_zone.cpp index 8ed5121a49..b569f1485d 100644 --- a/studio/src/plugins/landscape_editor/builder_zone.cpp +++ b/studio/src/plugins/landscape_editor/builder_zone.cpp @@ -27,8 +27,8 @@ // Qt includes #include -#include -#include +#include +#include namespace LandscapeEditor { diff --git a/studio/src/plugins/landscape_editor/builder_zone.h b/studio/src/plugins/landscape_editor/builder_zone.h index 7fde90e28f..fbf309a2bc 100644 --- a/studio/src/plugins/landscape_editor/builder_zone.h +++ b/studio/src/plugins/landscape_editor/builder_zone.h @@ -39,9 +39,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include namespace LandscapeEditor { diff --git a/studio/src/plugins/landscape_editor/builder_zone_base.cpp b/studio/src/plugins/landscape_editor/builder_zone_base.cpp index 0c0fd49cb2..416db4b122 100644 --- a/studio/src/plugins/landscape_editor/builder_zone_base.cpp +++ b/studio/src/plugins/landscape_editor/builder_zone_base.cpp @@ -28,8 +28,8 @@ // Qt includes #include -#include -#include +#include +#include namespace LandscapeEditor { diff --git a/studio/src/plugins/landscape_editor/builder_zone_base.h b/studio/src/plugins/landscape_editor/builder_zone_base.h index 9e53551b5d..e2f7ebaba7 100644 --- a/studio/src/plugins/landscape_editor/builder_zone_base.h +++ b/studio/src/plugins/landscape_editor/builder_zone_base.h @@ -36,8 +36,8 @@ #include #include #include -#include -#include +#include +#include namespace LandscapeEditor { diff --git a/studio/src/plugins/landscape_editor/landscape_actions.h b/studio/src/plugins/landscape_editor/landscape_actions.h index 9579417d08..523277c9ff 100644 --- a/studio/src/plugins/landscape_editor/landscape_actions.h +++ b/studio/src/plugins/landscape_editor/landscape_actions.h @@ -27,9 +27,9 @@ // NeL includes // Qt includes -#include -#include -#include +#include +#include +#include namespace LandscapeEditor { diff --git a/studio/src/plugins/landscape_editor/landscape_editor_plugin.cpp b/studio/src/plugins/landscape_editor/landscape_editor_plugin.cpp index b9078d0592..d28c303b5e 100644 --- a/studio/src/plugins/landscape_editor/landscape_editor_plugin.cpp +++ b/studio/src/plugins/landscape_editor/landscape_editor_plugin.cpp @@ -103,4 +103,3 @@ QWidget *LandscapeEditorContext::widget() } } -Q_EXPORT_PLUGIN(LandscapeEditor::LandscapeEditorPlugin) diff --git a/studio/src/plugins/landscape_editor/landscape_editor_plugin.h b/studio/src/plugins/landscape_editor/landscape_editor_plugin.h index 5af2e64366..a4a4e695c2 100644 --- a/studio/src/plugins/landscape_editor/landscape_editor_plugin.h +++ b/studio/src/plugins/landscape_editor/landscape_editor_plugin.h @@ -27,7 +27,7 @@ // Qt includes #include -#include +#include namespace NLMISC { @@ -41,6 +41,7 @@ class LandscapeEditorWindow; class LandscapeEditorPlugin : public QObject, public ExtensionSystem::IPlugin { Q_OBJECT + Q_PLUGIN_METADATA(IID IPlugin_iid FILE "plugin-metadata.json") Q_INTERFACES(ExtensionSystem::IPlugin) public: diff --git a/studio/src/plugins/landscape_editor/landscape_editor_window.cpp b/studio/src/plugins/landscape_editor/landscape_editor_window.cpp index a7be907012..3a1b86ed1b 100644 --- a/studio/src/plugins/landscape_editor/landscape_editor_window.cpp +++ b/studio/src/plugins/landscape_editor/landscape_editor_window.cpp @@ -35,10 +35,10 @@ // Qt includes #include -#include -#include -#include -#include +#include +#include +#include +#include namespace LandscapeEditor { diff --git a/studio/src/plugins/landscape_editor/landscape_editor_window.h b/studio/src/plugins/landscape_editor/landscape_editor_window.h index b1ddd81ae7..a4d2c691ca 100644 --- a/studio/src/plugins/landscape_editor/landscape_editor_window.h +++ b/studio/src/plugins/landscape_editor/landscape_editor_window.h @@ -21,10 +21,10 @@ #include "ui_landscape_editor_window.h" // Qt includes -#include -#include -#include -#include +#include +#include +#include +#include namespace LandscapeEditor { diff --git a/studio/src/plugins/landscape_editor/landscape_scene.cpp b/studio/src/plugins/landscape_editor/landscape_scene.cpp index f877935b54..8aa3e5c851 100644 --- a/studio/src/plugins/landscape_editor/landscape_scene.cpp +++ b/studio/src/plugins/landscape_editor/landscape_scene.cpp @@ -22,9 +22,9 @@ #include // Qt includes -#include -#include -#include +#include +#include +#include #include namespace LandscapeEditor @@ -218,7 +218,9 @@ QGraphicsRectItem *LandscapeScene::createLayerBlackout(const NLLIGO::CZoneRegion void LandscapeScene::deleteItemZone(const ZonePosition &zonePos) { - QGraphicsItem *item = itemAt(zonePos.x * m_cellSize, abs(zonePos.y) * m_cellSize); + // ignore transform + QTransform viewportTransform; + QGraphicsItem *item = itemAt(zonePos.x * m_cellSize, abs(zonePos.y) * m_cellSize, viewportTransform); if ((item != 0) && (item->data(ZONE_NAME).toString() != QString(LAYER_BLACKOUT_NAME))) { removeItem(item); @@ -370,7 +372,9 @@ void LandscapeScene::mouseReleaseEvent(QGraphicsSceneMouseEvent *mouseEvent) bool LandscapeScene::checkUnderZone(const int posX, const int posY) { - QGraphicsItem *item = itemAt((posX * m_cellSize), abs(posY) * m_cellSize); + // ignore transform + QTransform viewportTransform; + QGraphicsItem *item = itemAt((posX * m_cellSize), abs(posY) * m_cellSize, viewportTransform); if (item != 0) { //if (item->data(ZONE_NAME) == QString(LAYER_BLACKOUT_NAME)) diff --git a/studio/src/plugins/landscape_editor/landscape_scene.h b/studio/src/plugins/landscape_editor/landscape_scene.h index 9d77fe7c47..0ad17ba10b 100644 --- a/studio/src/plugins/landscape_editor/landscape_scene.h +++ b/studio/src/plugins/landscape_editor/landscape_scene.h @@ -29,8 +29,8 @@ #include // Qt includes -#include -#include +#include +#include namespace LandscapeEditor { diff --git a/studio/src/plugins/landscape_editor/landscape_scene_base.cpp b/studio/src/plugins/landscape_editor/landscape_scene_base.cpp index d6d9b1d7ac..28c4334373 100644 --- a/studio/src/plugins/landscape_editor/landscape_scene_base.cpp +++ b/studio/src/plugins/landscape_editor/landscape_scene_base.cpp @@ -22,9 +22,9 @@ #include // Qt includes -#include -#include -#include +#include +#include +#include #include namespace LandscapeEditor diff --git a/studio/src/plugins/landscape_editor/landscape_scene_base.h b/studio/src/plugins/landscape_editor/landscape_scene_base.h index 2f13583ce8..82a23751e6 100644 --- a/studio/src/plugins/landscape_editor/landscape_scene_base.h +++ b/studio/src/plugins/landscape_editor/landscape_scene_base.h @@ -26,8 +26,8 @@ #include // Qt includes -#include -#include +#include +#include namespace LandscapeEditor { diff --git a/studio/src/plugins/landscape_editor/landscape_view.h b/studio/src/plugins/landscape_editor/landscape_view.h index 2b20bf7490..9acf486e60 100644 --- a/studio/src/plugins/landscape_editor/landscape_view.h +++ b/studio/src/plugins/landscape_editor/landscape_view.h @@ -21,8 +21,8 @@ #include "landscape_editor_global.h" // Qt includes -#include -#include +#include +#include namespace LandscapeEditor { diff --git a/studio/src/plugins/landscape_editor/list_zones_model.cpp b/studio/src/plugins/landscape_editor/list_zones_model.cpp index c0bfdba68b..ded79006f9 100644 --- a/studio/src/plugins/landscape_editor/list_zones_model.cpp +++ b/studio/src/plugins/landscape_editor/list_zones_model.cpp @@ -30,7 +30,7 @@ // Qt includes #include -#include +#include namespace LandscapeEditor { diff --git a/studio/src/plugins/landscape_editor/list_zones_model.h b/studio/src/plugins/landscape_editor/list_zones_model.h index f8a85c03c4..4222799731 100644 --- a/studio/src/plugins/landscape_editor/list_zones_model.h +++ b/studio/src/plugins/landscape_editor/list_zones_model.h @@ -28,7 +28,7 @@ // Qt includes #include #include -#include +#include #include namespace LandscapeEditor diff --git a/studio/src/plugins/landscape_editor/list_zones_widget.cpp b/studio/src/plugins/landscape_editor/list_zones_widget.cpp index 389aa98d9c..fd67e0474c 100644 --- a/studio/src/plugins/landscape_editor/list_zones_widget.cpp +++ b/studio/src/plugins/landscape_editor/list_zones_widget.cpp @@ -32,7 +32,7 @@ #include // Qt includes -#include +#include #include namespace LandscapeEditor diff --git a/studio/src/plugins/landscape_editor/pixmap_database.cpp b/studio/src/plugins/landscape_editor/pixmap_database.cpp index 0f5426209b..72a1cb4fb3 100644 --- a/studio/src/plugins/landscape_editor/pixmap_database.cpp +++ b/studio/src/plugins/landscape_editor/pixmap_database.cpp @@ -27,10 +27,10 @@ // Qt includes #include -#include -#include -#include -#include +#include +#include +#include +#include namespace LandscapeEditor { diff --git a/studio/src/plugins/landscape_editor/pixmap_database.h b/studio/src/plugins/landscape_editor/pixmap_database.h index c4c67aacff..08c315b880 100644 --- a/studio/src/plugins/landscape_editor/pixmap_database.h +++ b/studio/src/plugins/landscape_editor/pixmap_database.h @@ -26,7 +26,7 @@ // Qt includes #include #include -#include +#include namespace LandscapeEditor { diff --git a/studio/src/plugins/landscape_editor/plugin-metadata.json b/studio/src/plugins/landscape_editor/plugin-metadata.json new file mode 100644 index 0000000000..b95ac5484e --- /dev/null +++ b/studio/src/plugins/landscape_editor/plugin-metadata.json @@ -0,0 +1,6 @@ +{ + "Name" : "LandscapeEditor", + "Version" : "0.8", + "Vendor": "GSoC2011_dnk-88", + "Description": "Landscape editor ovqt plugin." +} \ No newline at end of file diff --git a/studio/src/plugins/landscape_editor/project_settings_dialog.cpp b/studio/src/plugins/landscape_editor/project_settings_dialog.cpp index 5bc8eeda9f..6d2f188750 100644 --- a/studio/src/plugins/landscape_editor/project_settings_dialog.cpp +++ b/studio/src/plugins/landscape_editor/project_settings_dialog.cpp @@ -26,8 +26,8 @@ // Qt includes #include -#include -#include +#include +#include namespace LandscapeEditor { diff --git a/studio/src/plugins/landscape_editor/snapshot_dialog.cpp b/studio/src/plugins/landscape_editor/snapshot_dialog.cpp index b13ba791dc..386b9ae496 100644 --- a/studio/src/plugins/landscape_editor/snapshot_dialog.cpp +++ b/studio/src/plugins/landscape_editor/snapshot_dialog.cpp @@ -26,7 +26,7 @@ // Qt includes #include -#include +#include namespace LandscapeEditor { diff --git a/studio/src/plugins/landscape_editor/zone_region_editor.cpp b/studio/src/plugins/landscape_editor/zone_region_editor.cpp index d295fdf317..ff0807585b 100644 --- a/studio/src/plugins/landscape_editor/zone_region_editor.cpp +++ b/studio/src/plugins/landscape_editor/zone_region_editor.cpp @@ -27,7 +27,7 @@ #include // Qt includes -#include +#include namespace LandscapeEditor { diff --git a/studio/src/plugins/log/CMakeLists.txt b/studio/src/plugins/log/CMakeLists.txt index 9b042a3f3d..bb2b81d5ea 100644 --- a/studio/src/plugins/log/CMakeLists.txt +++ b/studio/src/plugins/log/CMakeLists.txt @@ -14,8 +14,8 @@ SET(OVQT_PLUG_LOG_UIS log_form.ui SET(QT_USE_QTGUI TRUE) SET(QT_USE_QTOPENGL TRUE) -QT4_WRAP_CPP(OVQT_PLUG_LOG_MOC_SRC ${OVQT_PLUG_LOG_HDR}) -QT4_WRAP_UI( OVQT_PLUG_LOG_UI_HDRS ${OVQT_PLUG_LOG_UIS} ) +QT5_WRAP_CPP(OVQT_PLUG_LOG_MOC_SRC ${OVQT_PLUG_LOG_HDR}) +QT5_WRAP_UI( OVQT_PLUG_LOG_UI_HDRS ${OVQT_PLUG_LOG_UIS} ) SOURCE_GROUP(QtResources FILES ${OVQT_PLUG_LOG_UIS}) SOURCE_GROUP(QtGeneratedUiHdr FILES ${OVQT_PLUG_LOG_UI_HDRS}) diff --git a/studio/src/plugins/log/log_plugin.cpp b/studio/src/plugins/log/log_plugin.cpp index b5cdec4be3..34c4b1290d 100644 --- a/studio/src/plugins/log/log_plugin.cpp +++ b/studio/src/plugins/log/log_plugin.cpp @@ -30,13 +30,13 @@ #include "../../extension_system/iplugin_spec.h" // Qt includes -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include #include #include #include @@ -202,4 +202,3 @@ namespace Plugin } } } -Q_EXPORT_PLUGIN(Plugin::CLogPlugin) diff --git a/studio/src/plugins/log/log_plugin.h b/studio/src/plugins/log/log_plugin.h index 9e4f644194..247300df69 100644 --- a/studio/src/plugins/log/log_plugin.h +++ b/studio/src/plugins/log/log_plugin.h @@ -52,7 +52,8 @@ namespace Plugin class CLogPlugin : public QDockWidget, public ExtensionSystem::IPlugin { Q_OBJECT - Q_INTERFACES(ExtensionSystem::IPlugin) + Q_PLUGIN_METADATA(IID IPlugin_iid FILE "plugin-metadata.json") + Q_INTERFACES(ExtensionSystem::IPlugin) public: CLogPlugin(QWidget *parent = 0); ~CLogPlugin(); diff --git a/studio/src/plugins/log/log_settings_page.cpp b/studio/src/plugins/log/log_settings_page.cpp index 3fd336097a..2414cc6868 100644 --- a/studio/src/plugins/log/log_settings_page.cpp +++ b/studio/src/plugins/log/log_settings_page.cpp @@ -29,8 +29,8 @@ // NeL includes // Qt includes -#include -#include +#include +#include namespace ExtensionSystem { diff --git a/studio/src/plugins/log/plugin-metadata.json b/studio/src/plugins/log/plugin-metadata.json new file mode 100644 index 0000000000..c65a6101c9 --- /dev/null +++ b/studio/src/plugins/log/plugin-metadata.json @@ -0,0 +1,6 @@ +{ + "Name" : "LogPlugin", + "Version" : "1.1", + "Vendor": "aquiles", + "Description": "DockWidget to display all log messages from NeL." +} \ No newline at end of file diff --git a/studio/src/plugins/mission_compiler/CMakeLists.txt b/studio/src/plugins/mission_compiler/CMakeLists.txt index a3748d559d..7a5a3da4d0 100644 --- a/studio/src/plugins/mission_compiler/CMakeLists.txt +++ b/studio/src/plugins/mission_compiler/CMakeLists.txt @@ -19,9 +19,9 @@ SET(OVQT_PLUG_MISSION_COMPILER_RCS mission_compiler.qrc) SET(QT_USE_QTGUI TRUE) -QT4_WRAP_CPP(OVQT_PLUG_MISSION_COMPILER_MOC_SRC ${OVQT_PLUG_MISSION_COMPILER_HDR}) -QT4_ADD_RESOURCES( OVQT_PLUG_MISSION_COMPILER_RC_SRCS ${OVQT_PLUG_MISSION_COMPILER_RCS}) -QT4_WRAP_UI(OVQT_PLUG_MISSION_COMPILER_UI_HDRS ${OVQT_PLUG_MISSION_COMPILER_UIS}) +QT5_WRAP_CPP(OVQT_PLUG_MISSION_COMPILER_MOC_SRC ${OVQT_PLUG_MISSION_COMPILER_HDR}) +QT5_ADD_RESOURCES( OVQT_PLUG_MISSION_COMPILER_RC_SRCS ${OVQT_PLUG_MISSION_COMPILER_RCS}) +QT5_WRAP_UI(OVQT_PLUG_MISSION_COMPILER_UI_HDRS ${OVQT_PLUG_MISSION_COMPILER_UIS}) SOURCE_GROUP(QtResources FILES ${OVQT_PLUG_MISSION_COMPILER_UIS} ${OVQT_PLUG_MISSION_COMPILER_RCS}) SOURCE_GROUP(QtGeneratedUiHdr FILES ${OVQT_PLUG_MISSION_COMPILER_UI_HDRS}) diff --git a/studio/src/plugins/mission_compiler/mission_compiler_main_window.cpp b/studio/src/plugins/mission_compiler/mission_compiler_main_window.cpp index a8088adedb..3b647b2c54 100644 --- a/studio/src/plugins/mission_compiler/mission_compiler_main_window.cpp +++ b/studio/src/plugins/mission_compiler/mission_compiler_main_window.cpp @@ -242,7 +242,7 @@ void MissionCompilerMainWindow::compileMission(bool publish) NLLIGO::CPrimitives primDoc; NLLIGO::CPrimitiveContext::instance().CurrentPrimitive = &primDoc; - NLLIGO::loadXmlPrimitiveFile(primDoc, NLMISC::CPath::lookup(filename.toAscii().data(), false), m_ligoConfig); + NLLIGO::loadXmlPrimitiveFile(primDoc, NLMISC::CPath::lookup(filename.toLatin1().data(), false), m_ligoConfig); NLLIGO::CPrimitiveContext::instance().CurrentPrimitive = NULL; try @@ -354,7 +354,7 @@ void MissionCompilerMainWindow::handleValidation() TMissionContainer missions; NLLIGO::CPrimitives primDoc; NLLIGO::CPrimitiveContext::instance().CurrentPrimitive = &primDoc; - NLLIGO::loadXmlPrimitiveFile(primDoc, NLMISC::CPath::lookup(filename.toAscii().data(), false), m_ligoConfig); + NLLIGO::loadXmlPrimitiveFile(primDoc, NLMISC::CPath::lookup(filename.toLatin1().data(), false), m_ligoConfig); parsePrimForMissions(primDoc.RootNode, missions); // Parse missions to check modification diff --git a/studio/src/plugins/mission_compiler/mission_compiler_main_window.h b/studio/src/plugins/mission_compiler/mission_compiler_main_window.h index 3d59e206a9..8142185ee0 100644 --- a/studio/src/plugins/mission_compiler/mission_compiler_main_window.h +++ b/studio/src/plugins/mission_compiler/mission_compiler_main_window.h @@ -5,7 +5,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/studio/src/plugins/mission_compiler/mission_compiler_plugin.cpp b/studio/src/plugins/mission_compiler/mission_compiler_plugin.cpp index 46e51f36d1..5ed32d3c7c 100644 --- a/studio/src/plugins/mission_compiler/mission_compiler_plugin.cpp +++ b/studio/src/plugins/mission_compiler/mission_compiler_plugin.cpp @@ -10,12 +10,12 @@ #include // Qt includes -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include "mission_compiler_settings_page.h" @@ -75,5 +75,3 @@ void MissionCompilerPlugin::addAutoReleasedObject(QObject *obj) } } - -Q_EXPORT_PLUGIN(MissionCompiler::MissionCompilerPlugin) \ No newline at end of file diff --git a/studio/src/plugins/mission_compiler/mission_compiler_plugin.h b/studio/src/plugins/mission_compiler/mission_compiler_plugin.h index cc2cac47c0..c0bcfff32c 100644 --- a/studio/src/plugins/mission_compiler/mission_compiler_plugin.h +++ b/studio/src/plugins/mission_compiler/mission_compiler_plugin.h @@ -30,6 +30,7 @@ namespace MissionCompiler class MissionCompilerPlugin : public QObject, public ExtensionSystem::IPlugin { Q_OBJECT + Q_PLUGIN_METADATA(IID IPlugin_iid FILE "plugin-metadata.json") Q_INTERFACES(ExtensionSystem::IPlugin) public: diff --git a/studio/src/plugins/mission_compiler/mission_compiler_settings_page.cpp b/studio/src/plugins/mission_compiler/mission_compiler_settings_page.cpp index 1701c04716..71f512cc68 100644 --- a/studio/src/plugins/mission_compiler/mission_compiler_settings_page.cpp +++ b/studio/src/plugins/mission_compiler/mission_compiler_settings_page.cpp @@ -31,10 +31,10 @@ #include // Qt includes -#include -#include -#include -#include +#include +#include +#include +#include namespace MissionCompiler { diff --git a/studio/src/plugins/mission_compiler/plugin-metadata.json b/studio/src/plugins/mission_compiler/plugin-metadata.json new file mode 100644 index 0000000000..9ca3a586f0 --- /dev/null +++ b/studio/src/plugins/mission_compiler/plugin-metadata.json @@ -0,0 +1,6 @@ +{ + "Name" : "MissionCompiler", + "Version" : "0.1", + "Vendor": "Ryzom Core", + "Description": "Mission Compiler Plugin" +} \ No newline at end of file diff --git a/studio/src/plugins/mission_compiler/validation_file.cpp b/studio/src/plugins/mission_compiler/validation_file.cpp index c284f50cd7..a08a25d2fa 100644 --- a/studio/src/plugins/mission_compiler/validation_file.cpp +++ b/studio/src/plugins/mission_compiler/validation_file.cpp @@ -54,7 +54,7 @@ void CValidationFile::saveMissionValidationFile(std::string filename) nlwarning("Can't find index file '%s' in search path, no mission will be valid", filename.c_str()); return; } - FILE* file = nlfopen(pathName, "w"); + FILE* file = NLMISC::nlfopen(pathName, "w"); nlassert(file!=NULL); // AuthorizedStates diff --git a/studio/src/plugins/object_viewer/CMakeLists.txt b/studio/src/plugins/object_viewer/CMakeLists.txt index 4cc41d1574..ed2be87f8c 100644 --- a/studio/src/plugins/object_viewer/CMakeLists.txt +++ b/studio/src/plugins/object_viewer/CMakeLists.txt @@ -149,9 +149,9 @@ SET(OBJECT_VIEWER_PLUGIN_RCS object_viewer.qrc) SET(QT_USE_QTGUI TRUE) SET(QT_USE_QTOPENGL TRUE) -QT4_ADD_RESOURCES(OBJECT_VIEWER_PLUGIN_RC_SRCS ${OBJECT_VIEWER_PLUGIN_RCS}) -QT4_WRAP_CPP(OBJECT_VIEWER_PLUGIN_MOC_SRC ${OBJECT_VIEWER_PLUGIN_QT_HDR}) -QT4_WRAP_UI(OBJECT_VIEWER_PLUGIN_UI_HDRS ${OBJECT_VIEWER_PLUGIN_UIS}) +QT5_ADD_RESOURCES(OBJECT_VIEWER_PLUGIN_RC_SRCS ${OBJECT_VIEWER_PLUGIN_RCS}) +QT5_WRAP_CPP(OBJECT_VIEWER_PLUGIN_MOC_SRC ${OBJECT_VIEWER_PLUGIN_QT_HDR}) +QT5_WRAP_UI(OBJECT_VIEWER_PLUGIN_UI_HDRS ${OBJECT_VIEWER_PLUGIN_UIS}) SOURCE_GROUP(QtResources FILES ${OBJECT_VIEWER_PLUGIN_UIS}) SOURCE_GROUP(QtGeneratedUiHdr FILES ${OBJECT_VIEWER_PLUGIN_UI_HDRS}) diff --git a/studio/src/plugins/object_viewer/graphics_settings_page.cpp b/studio/src/plugins/object_viewer/graphics_settings_page.cpp index 870af9bf22..4053b452c1 100644 --- a/studio/src/plugins/object_viewer/graphics_settings_page.cpp +++ b/studio/src/plugins/object_viewer/graphics_settings_page.cpp @@ -25,8 +25,8 @@ #include "modules.h" // Qt includes -#include -#include +#include +#include // NeL includes #include diff --git a/studio/src/plugins/object_viewer/graphics_viewport.cpp b/studio/src/plugins/object_viewer/graphics_viewport.cpp index 0cec0be104..cb7240f651 100644 --- a/studio/src/plugins/object_viewer/graphics_viewport.cpp +++ b/studio/src/plugins/object_viewer/graphics_viewport.cpp @@ -17,18 +17,18 @@ */ +// Qt includes +#include +#include +#include +#include + #include "stdpch.h" #include "graphics_viewport.h" #include "../core/Nel3DWidget/nel3d_widget.h" // STL includes -// Qt includes -#include -#include -#include -#include - // NeL includes #include diff --git a/studio/src/plugins/object_viewer/main_window.cpp b/studio/src/plugins/object_viewer/main_window.cpp index dc0c221ccf..7e121bafeb 100644 --- a/studio/src/plugins/object_viewer/main_window.cpp +++ b/studio/src/plugins/object_viewer/main_window.cpp @@ -23,7 +23,9 @@ // STL includes // Qt includes -#include +#include +#include +#include // NeL includes #include diff --git a/studio/src/plugins/object_viewer/main_window.h b/studio/src/plugins/object_viewer/main_window.h index dff4d9b4b8..f7b0ead8d7 100644 --- a/studio/src/plugins/object_viewer/main_window.h +++ b/studio/src/plugins/object_viewer/main_window.h @@ -23,9 +23,9 @@ // STL includes // Qt includes -#include -#include -#include +#include +#include +#include // NeL includes #include diff --git a/studio/src/plugins/object_viewer/object_viewer_plugin.cpp b/studio/src/plugins/object_viewer/object_viewer_plugin.cpp index a4c9481402..14a7d1a844 100644 --- a/studio/src/plugins/object_viewer/object_viewer_plugin.cpp +++ b/studio/src/plugins/object_viewer/object_viewer_plugin.cpp @@ -84,5 +84,3 @@ QWidget *CObjectViewerContext::widget() } } - -Q_EXPORT_PLUGIN(NLQT::ObjectViewerPlugin) \ No newline at end of file diff --git a/studio/src/plugins/object_viewer/object_viewer_plugin.h b/studio/src/plugins/object_viewer/object_viewer_plugin.h index 5018501bf2..311a2af8f7 100644 --- a/studio/src/plugins/object_viewer/object_viewer_plugin.h +++ b/studio/src/plugins/object_viewer/object_viewer_plugin.h @@ -28,6 +28,7 @@ namespace NLQT class ObjectViewerPlugin : public QObject, public ExtensionSystem::IPlugin { Q_OBJECT + Q_PLUGIN_METADATA(IID IPlugin_iid FILE "plugin-metadata.json") Q_INTERFACES(ExtensionSystem::IPlugin) public: diff --git a/studio/src/plugins/object_viewer/particle_system/attrib_widget.cpp b/studio/src/plugins/object_viewer/particle_system/attrib_widget.cpp index e00d07cecf..32096cc920 100644 --- a/studio/src/plugins/object_viewer/particle_system/attrib_widget.cpp +++ b/studio/src/plugins/object_viewer/particle_system/attrib_widget.cpp @@ -21,7 +21,7 @@ #include "attrib_widget.h" // Qt includes -#include +#include // NeL includes #include diff --git a/studio/src/plugins/object_viewer/particle_system/attrib_widget.h b/studio/src/plugins/object_viewer/particle_system/attrib_widget.h index da308aba79..cc2a62d01c 100644 --- a/studio/src/plugins/object_viewer/particle_system/attrib_widget.h +++ b/studio/src/plugins/object_viewer/particle_system/attrib_widget.h @@ -24,7 +24,7 @@ #include "ui_attrib_form.h" // Qt includes -#include +#include // STL includes diff --git a/studio/src/plugins/object_viewer/particle_system/bin_op_dialog.h b/studio/src/plugins/object_viewer/particle_system/bin_op_dialog.h index 3180e5d849..4c44fa9166 100644 --- a/studio/src/plugins/object_viewer/particle_system/bin_op_dialog.h +++ b/studio/src/plugins/object_viewer/particle_system/bin_op_dialog.h @@ -24,12 +24,12 @@ #include // Qt includes -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include // NeL includes #include "nel/3d/ps_attrib_maker_bin_op.h" diff --git a/studio/src/plugins/object_viewer/particle_system/curve_dialog.h b/studio/src/plugins/object_viewer/particle_system/curve_dialog.h index 29a1baec5d..2f5fc3ba05 100644 --- a/studio/src/plugins/object_viewer/particle_system/curve_dialog.h +++ b/studio/src/plugins/object_viewer/particle_system/curve_dialog.h @@ -27,10 +27,10 @@ #include // Qt includes -#include -#include -#include -#include +#include +#include +#include +#include // Project includes #include "hoverpoints.h" diff --git a/studio/src/plugins/object_viewer/particle_system/direction_widget.cpp b/studio/src/plugins/object_viewer/particle_system/direction_widget.cpp index 2bef5e9b5e..d122c0513c 100644 --- a/studio/src/plugins/object_viewer/particle_system/direction_widget.cpp +++ b/studio/src/plugins/object_viewer/particle_system/direction_widget.cpp @@ -21,9 +21,9 @@ #include "direction_widget.h" // Qt includes -#include -#include -#include +#include +#include +#include // NeL includes #include diff --git a/studio/src/plugins/object_viewer/particle_system/emitter_page.cpp b/studio/src/plugins/object_viewer/particle_system/emitter_page.cpp index fe81a245af..67f68e437e 100644 --- a/studio/src/plugins/object_viewer/particle_system/emitter_page.cpp +++ b/studio/src/plugins/object_viewer/particle_system/emitter_page.cpp @@ -21,7 +21,7 @@ #include "emitter_page.h" // Qt includes -#include +#include // NeL includes diff --git a/studio/src/plugins/object_viewer/particle_system/follow_path_dialog.h b/studio/src/plugins/object_viewer/particle_system/follow_path_dialog.h index cf7040d4d8..92c528fb95 100644 --- a/studio/src/plugins/object_viewer/particle_system/follow_path_dialog.h +++ b/studio/src/plugins/object_viewer/particle_system/follow_path_dialog.h @@ -20,12 +20,12 @@ #ifndef FOLLOW_PATH_DIALOG_H #define FOLLOW_PATH_DIALOG_H -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include namespace NL3D { diff --git a/studio/src/plugins/object_viewer/particle_system/located_page.cpp b/studio/src/plugins/object_viewer/particle_system/located_page.cpp index adc38dbee8..0d950edf25 100644 --- a/studio/src/plugins/object_viewer/particle_system/located_page.cpp +++ b/studio/src/plugins/object_viewer/particle_system/located_page.cpp @@ -21,8 +21,8 @@ #include "located_page.h" // Qt includes -#include -#include +#include +#include // NeL includes #include diff --git a/studio/src/plugins/object_viewer/particle_system/mesh_widget.cpp b/studio/src/plugins/object_viewer/particle_system/mesh_widget.cpp index e92ca7e203..aa66d7f1f2 100644 --- a/studio/src/plugins/object_viewer/particle_system/mesh_widget.cpp +++ b/studio/src/plugins/object_viewer/particle_system/mesh_widget.cpp @@ -20,9 +20,9 @@ #include "stdpch.h" // Qt include -#include -#include -#include +#include +#include +#include // NeL include #include diff --git a/studio/src/plugins/object_viewer/particle_system/morph_mesh_dialog.cpp b/studio/src/plugins/object_viewer/particle_system/morph_mesh_dialog.cpp index 20e19b5397..7825edb5d0 100644 --- a/studio/src/plugins/object_viewer/particle_system/morph_mesh_dialog.cpp +++ b/studio/src/plugins/object_viewer/particle_system/morph_mesh_dialog.cpp @@ -21,7 +21,7 @@ #include "morph_mesh_dialog.h" // Qt include -#include +#include // NeL includes #include "nel/3d/ps_mesh.h" diff --git a/studio/src/plugins/object_viewer/particle_system/particle_force_page.cpp b/studio/src/plugins/object_viewer/particle_system/particle_force_page.cpp index 2f9135e3da..bc67409e8b 100644 --- a/studio/src/plugins/object_viewer/particle_system/particle_force_page.cpp +++ b/studio/src/plugins/object_viewer/particle_system/particle_force_page.cpp @@ -21,7 +21,7 @@ #include "particle_force_page.h" // Qt includes -#include +#include // NeL includes #include diff --git a/studio/src/plugins/object_viewer/particle_system/particle_link_skeleton_dialog.cpp b/studio/src/plugins/object_viewer/particle_system/particle_link_skeleton_dialog.cpp index ba5a8efaab..6f500b4136 100644 --- a/studio/src/plugins/object_viewer/particle_system/particle_link_skeleton_dialog.cpp +++ b/studio/src/plugins/object_viewer/particle_system/particle_link_skeleton_dialog.cpp @@ -21,7 +21,7 @@ #include "particle_link_skeleton_dialog.h" // Qt includes -#include +#include // Project includes #include "modules.h" diff --git a/studio/src/plugins/object_viewer/particle_system/particle_property_dialog.h b/studio/src/plugins/object_viewer/particle_system/particle_property_dialog.h index dc7e5dfe88..ad6a8c4db4 100644 --- a/studio/src/plugins/object_viewer/particle_system/particle_property_dialog.h +++ b/studio/src/plugins/object_viewer/particle_system/particle_property_dialog.h @@ -21,11 +21,11 @@ #define PARTICLE_PROPERTY_DIALOG_H // Qt includes -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include // NeL includes #include "nel/misc/smart_ptr.h" diff --git a/studio/src/plugins/object_viewer/particle_system/particle_sound_page.cpp b/studio/src/plugins/object_viewer/particle_system/particle_sound_page.cpp index ee9e77466a..dcbdc589ac 100644 --- a/studio/src/plugins/object_viewer/particle_system/particle_sound_page.cpp +++ b/studio/src/plugins/object_viewer/particle_system/particle_sound_page.cpp @@ -21,7 +21,7 @@ #include "particle_sound_page.h" // Qt includes -#include +#include // NeL includes #include "nel/3d/ps_located.h" @@ -86,7 +86,7 @@ void CSoundPage::setEditedItem(CWorkspaceNode *ownerNode, NL3D::CPSLocatedBindab _ui.pitchWidget->setWorkspaceNode(_Node); _ui.pitchWidget->updateUi(); - _ui.soundNameLineEdit->setText(QString(_Sound->getSoundName().toString().c_str())); + _ui.soundNameLineEdit->setText(QString(_Sound->getSoundName()->c_str())); _ui.spawnCheckBox->setChecked(_Sound->getSpawn()); _ui.muteCheckBox->setChecked(_Sound->getMute()); @@ -95,7 +95,7 @@ void CSoundPage::setEditedItem(CWorkspaceNode *ownerNode, NL3D::CPSLocatedBindab void CSoundPage::browse() { - std::vector names; + std::vector names; NLSOUND::UAudioMixer *audioMixer = Modules::sound().getAudioMixer(); @@ -108,7 +108,7 @@ void CSoundPage::browse() QStringList items; items << tr(""); for(size_t i = 0; i < names.size(); ++i) - items << QString(names[i].toString().c_str()); + items << QString(names[i]->c_str()); bool ok; QString item = QInputDialog::getItem(this, tr("Select your sound"), @@ -162,7 +162,7 @@ void CSoundPage::setKeepPitch(bool state) void CSoundPage::setSoundName(const QString &text) { - _Sound->setSoundName(NLMISC::CSheetId(text.toUtf8().constData())); + _Sound->setSoundName(NLMISC::CStringMapper::map(text.toUtf8().constData())); } void CSoundPage::setEmissionPercent(float value) diff --git a/studio/src/plugins/object_viewer/particle_system/particle_system_page.cpp b/studio/src/plugins/object_viewer/particle_system/particle_system_page.cpp index 7cdf0895b5..9fcc4824fc 100644 --- a/studio/src/plugins/object_viewer/particle_system/particle_system_page.cpp +++ b/studio/src/plugins/object_viewer/particle_system/particle_system_page.cpp @@ -21,10 +21,10 @@ #include "particle_system_page.h" // Qt includes -#include -#include -#include -#include +#include +#include +#include +#include // NeL includes #include diff --git a/studio/src/plugins/object_viewer/particle_system/particle_texture_widget.cpp b/studio/src/plugins/object_viewer/particle_system/particle_texture_widget.cpp index 82e171f19d..e0c77d551c 100644 --- a/studio/src/plugins/object_viewer/particle_system/particle_texture_widget.cpp +++ b/studio/src/plugins/object_viewer/particle_system/particle_texture_widget.cpp @@ -21,8 +21,8 @@ #include "particle_texture_widget.h" // Qt include -#include -#include +#include +#include // NeL includes #include "nel/3d/texture_file.h" diff --git a/studio/src/plugins/object_viewer/particle_system/particle_workspace_dialog.cpp b/studio/src/plugins/object_viewer/particle_system/particle_workspace_dialog.cpp index 4c92a5fc45..029f33e833 100644 --- a/studio/src/plugins/object_viewer/particle_system/particle_workspace_dialog.cpp +++ b/studio/src/plugins/object_viewer/particle_system/particle_workspace_dialog.cpp @@ -33,10 +33,10 @@ #include // Qt includes -#include -#include -#include -#include +#include +#include +#include +#include // Project includes #include "dup_ps.h" diff --git a/studio/src/plugins/object_viewer/particle_system/particle_workspace_page.cpp b/studio/src/plugins/object_viewer/particle_system/particle_workspace_page.cpp index 62ffb6d3b3..af886b9842 100644 --- a/studio/src/plugins/object_viewer/particle_system/particle_workspace_page.cpp +++ b/studio/src/plugins/object_viewer/particle_system/particle_workspace_page.cpp @@ -21,9 +21,9 @@ #include "particle_workspace_page.h" // Qt includes -#include -#include -#include +#include +#include +#include // NeL includes diff --git a/studio/src/plugins/object_viewer/particle_system/spinner_dialog.h b/studio/src/plugins/object_viewer/particle_system/spinner_dialog.h index 4d5839a5a1..298e5fe7ac 100644 --- a/studio/src/plugins/object_viewer/particle_system/spinner_dialog.h +++ b/studio/src/plugins/object_viewer/particle_system/spinner_dialog.h @@ -21,9 +21,9 @@ #define SPINNER_DIALOG_H // Qt includes -#include -#include -#include +#include +#include +#include // Nel include #include "nel/3d/ps_plane_basis_maker.h" diff --git a/studio/src/plugins/object_viewer/particle_system/value_blender_dialog.h b/studio/src/plugins/object_viewer/particle_system/value_blender_dialog.h index 764160916a..f586290394 100644 --- a/studio/src/plugins/object_viewer/particle_system/value_blender_dialog.h +++ b/studio/src/plugins/object_viewer/particle_system/value_blender_dialog.h @@ -23,11 +23,11 @@ #include // Qt includes -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include // STL includes diff --git a/studio/src/plugins/object_viewer/particle_system/value_from_emitter_dialog.h b/studio/src/plugins/object_viewer/particle_system/value_from_emitter_dialog.h index 2600e0bb8f..df2ef6a8c5 100644 --- a/studio/src/plugins/object_viewer/particle_system/value_from_emitter_dialog.h +++ b/studio/src/plugins/object_viewer/particle_system/value_from_emitter_dialog.h @@ -23,10 +23,10 @@ #include // Qt includes -#include -#include -#include -#include +#include +#include +#include +#include // NeL include #include "nel/3d/ps_attrib_maker.h" diff --git a/studio/src/plugins/object_viewer/particle_system/value_gradient_dialog.cpp b/studio/src/plugins/object_viewer/particle_system/value_gradient_dialog.cpp index 5754b181e6..a6cc6329eb 100644 --- a/studio/src/plugins/object_viewer/particle_system/value_gradient_dialog.cpp +++ b/studio/src/plugins/object_viewer/particle_system/value_gradient_dialog.cpp @@ -23,7 +23,7 @@ #include "value_gradient_dialog.h" // Qt include -#include +#include // NeL includes #include diff --git a/studio/src/plugins/object_viewer/particle_system/value_gradient_dialog.h b/studio/src/plugins/object_viewer/particle_system/value_gradient_dialog.h index afa67e8431..f17edf4826 100644 --- a/studio/src/plugins/object_viewer/particle_system/value_gradient_dialog.h +++ b/studio/src/plugins/object_viewer/particle_system/value_gradient_dialog.h @@ -29,16 +29,16 @@ #include "particle_node.h" // Qt includes -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // NeL includes #include diff --git a/studio/src/plugins/object_viewer/plugin-metadata.json b/studio/src/plugins/object_viewer/plugin-metadata.json new file mode 100644 index 0000000000..ef4345b8c3 --- /dev/null +++ b/studio/src/plugins/object_viewer/plugin-metadata.json @@ -0,0 +1,6 @@ +{ + "Name" : "ObjectViewer", + "Version" : "0.8", + "Vendor": "Ryzom Core", + "Description": "Object Viewer plugin." +} \ No newline at end of file diff --git a/studio/src/plugins/object_viewer/scene/animation_set_dialog.cpp b/studio/src/plugins/object_viewer/scene/animation_set_dialog.cpp index f2d5e65671..0a73a5ccca 100644 --- a/studio/src/plugins/object_viewer/scene/animation_set_dialog.cpp +++ b/studio/src/plugins/object_viewer/scene/animation_set_dialog.cpp @@ -21,7 +21,7 @@ #include "animation_set_dialog.h" // Qt includes -#include +#include // NeL includes diff --git a/studio/src/plugins/object_viewer/scene/camera_control.h b/studio/src/plugins/object_viewer/scene/camera_control.h index 50d10a2303..97281b9048 100644 --- a/studio/src/plugins/object_viewer/scene/camera_control.h +++ b/studio/src/plugins/object_viewer/scene/camera_control.h @@ -23,13 +23,13 @@ // STL includes // Qt includes -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include // NeL includes #include diff --git a/studio/src/plugins/object_viewer/scene/setup_fog_dialog.cpp b/studio/src/plugins/object_viewer/scene/setup_fog_dialog.cpp index 2e3184367d..30d4d8bcbf 100644 --- a/studio/src/plugins/object_viewer/scene/setup_fog_dialog.cpp +++ b/studio/src/plugins/object_viewer/scene/setup_fog_dialog.cpp @@ -25,9 +25,9 @@ #include "modules.h" // Qt includes -#include -#include -#include +#include +#include +#include // NeL includes #include diff --git a/studio/src/plugins/object_viewer/scene/skeleton_scale_dialog.cpp b/studio/src/plugins/object_viewer/scene/skeleton_scale_dialog.cpp index 8145c0bcc4..c8daa71ef3 100644 --- a/studio/src/plugins/object_viewer/scene/skeleton_scale_dialog.cpp +++ b/studio/src/plugins/object_viewer/scene/skeleton_scale_dialog.cpp @@ -21,8 +21,8 @@ #include "skeleton_scale_dialog.h" // Qt include -#include -#include +#include +#include // NeL includes #include diff --git a/studio/src/plugins/object_viewer/scene/slot_manager_dialog.cpp b/studio/src/plugins/object_viewer/scene/slot_manager_dialog.cpp index f846bdf4a6..0230f32901 100644 --- a/studio/src/plugins/object_viewer/scene/slot_manager_dialog.cpp +++ b/studio/src/plugins/object_viewer/scene/slot_manager_dialog.cpp @@ -21,7 +21,7 @@ #include "slot_manager_dialog.h" // Qt includes -#include +#include // NeL includes diff --git a/studio/src/plugins/object_viewer/scene/slot_manager_dialog.h b/studio/src/plugins/object_viewer/scene/slot_manager_dialog.h index a25d4121a9..0f71838ae1 100644 --- a/studio/src/plugins/object_viewer/scene/slot_manager_dialog.h +++ b/studio/src/plugins/object_viewer/scene/slot_manager_dialog.h @@ -23,8 +23,9 @@ #include #include "ui_slot_form.h" -#include -#include +#include +#include +#include #include "nel/3d/channel_mixer.h" diff --git a/studio/src/plugins/object_viewer/sound_settings_page.cpp b/studio/src/plugins/object_viewer/sound_settings_page.cpp index 02815919b7..90dfc902af 100644 --- a/studio/src/plugins/object_viewer/sound_settings_page.cpp +++ b/studio/src/plugins/object_viewer/sound_settings_page.cpp @@ -25,9 +25,9 @@ #include "modules.h" // Qt includes -#include -#include -#include +#include +#include +#include namespace NLQT { diff --git a/studio/src/plugins/object_viewer/sound_system.cpp b/studio/src/plugins/object_viewer/sound_system.cpp index 702e963f09..fcc39c15df 100644 --- a/studio/src/plugins/object_viewer/sound_system.cpp +++ b/studio/src/plugins/object_viewer/sound_system.cpp @@ -99,7 +99,7 @@ void CSoundSystem::init() _AudioMixer->getDevices(devices); NLSOUND::UAudioMixer::CInitInfo audioInfo; audioInfo.AutoLoadSample = settings->value(Constants::SOUND_AUTO_LOAD_SAMPLE, true).toBool(); - audioInfo.EnableOccludeObstruct = settings->value(Constants::SOUND_ENABLE_OCCLUDE_OBSTRUCT, true).toBool(); + audioInfo.EnableOcclusionObstruction = settings->value(Constants::SOUND_ENABLE_OCCLUDE_OBSTRUCT, true).toBool(); audioInfo.EnableReverb = settings->value(Constants::SOUND_ENABLE_REVERB, true).toBool(); audioInfo.ManualRolloff = settings->value(Constants::SOUND_MANUAL_ROLL_OFF, true).toBool(); audioInfo.ForceSoftware = settings->value(Constants::SOUND_FORCE_SOFTWARE, false).toBool(); @@ -162,7 +162,7 @@ void CSoundSystem::play(const std::string &soundName) { if (_AudioMixer) { - NLSOUND::USource *src = _AudioMixer->createSource(NLMISC::CSheetId(soundName, "sound"), true); + NLSOUND::USource *src = _AudioMixer->createSource(NLMISC::CStringMapper::map(soundName), true); if (src) { // FIXME: Use relative positioning, and set pos to 0,0,0 @@ -182,7 +182,7 @@ NLSOUND::USource *CSoundSystem::create(const std::string &soundName) { if (_AudioMixer) { - NLSOUND::USource *src = _AudioMixer->createSource(NLMISC::CSheetId(soundName, "sound"), false); + NLSOUND::USource *src = _AudioMixer->createSource(NLMISC::CStringMapper::map(soundName), false); if (src) { // FIXME: Use relative positioning, and set pos to 0,0,0 diff --git a/studio/src/plugins/object_viewer/vegetable/vegetable_appearance_page.cpp b/studio/src/plugins/object_viewer/vegetable/vegetable_appearance_page.cpp index 0366bc11f9..e453c664e0 100644 --- a/studio/src/plugins/object_viewer/vegetable/vegetable_appearance_page.cpp +++ b/studio/src/plugins/object_viewer/vegetable/vegetable_appearance_page.cpp @@ -21,9 +21,9 @@ #include "vegetable_appearance_page.h" // Qt includes -#include -#include -#include +#include +#include +#include // NeL includes #include diff --git a/studio/src/plugins/object_viewer/vegetable/vegetable_density_page.cpp b/studio/src/plugins/object_viewer/vegetable/vegetable_density_page.cpp index ba70b4c9fd..5d516b115e 100644 --- a/studio/src/plugins/object_viewer/vegetable/vegetable_density_page.cpp +++ b/studio/src/plugins/object_viewer/vegetable/vegetable_density_page.cpp @@ -21,8 +21,8 @@ #include "vegetable_density_page.h" // Qt includes -#include -#include +#include +#include // NeL includes #include diff --git a/studio/src/plugins/object_viewer/vegetable/vegetable_dialog.cpp b/studio/src/plugins/object_viewer/vegetable/vegetable_dialog.cpp index 2fc621411c..e726bbe78f 100644 --- a/studio/src/plugins/object_viewer/vegetable/vegetable_dialog.cpp +++ b/studio/src/plugins/object_viewer/vegetable/vegetable_dialog.cpp @@ -21,8 +21,8 @@ #include "vegetable_dialog.h" // Qt includes -#include -#include +#include +#include // NeL includes #include diff --git a/studio/src/plugins/object_viewer/vegetable/vegetable_editor.cpp b/studio/src/plugins/object_viewer/vegetable/vegetable_editor.cpp index 73b6396477..3dfce2209d 100644 --- a/studio/src/plugins/object_viewer/vegetable/vegetable_editor.cpp +++ b/studio/src/plugins/object_viewer/vegetable/vegetable_editor.cpp @@ -25,11 +25,11 @@ #include "../core/icore.h" // Qt includes -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include // NeL includes #include diff --git a/studio/src/plugins/object_viewer/vegetable_settings_page.cpp b/studio/src/plugins/object_viewer/vegetable_settings_page.cpp index cdf0ce4be8..6ace4ad6a8 100644 --- a/studio/src/plugins/object_viewer/vegetable_settings_page.cpp +++ b/studio/src/plugins/object_viewer/vegetable_settings_page.cpp @@ -25,10 +25,10 @@ #include "modules.h" // Qt includes -#include -#include -#include -#include +#include +#include +#include +#include namespace NLQT { diff --git a/studio/src/plugins/object_viewer/widgets/color_edit_widget.cpp b/studio/src/plugins/object_viewer/widgets/color_edit_widget.cpp index 65d9db58d5..9b9ff993c8 100644 --- a/studio/src/plugins/object_viewer/widgets/color_edit_widget.cpp +++ b/studio/src/plugins/object_viewer/widgets/color_edit_widget.cpp @@ -21,9 +21,9 @@ #include "color_edit_widget.h" // Qt includes -#include -#include -#include +#include +#include +#include // Nel includes #include diff --git a/studio/src/plugins/object_viewer/widgets/hoverpoints.cpp b/studio/src/plugins/object_viewer/widgets/hoverpoints.cpp index 184053ab9d..c3f3ec7ade 100644 --- a/studio/src/plugins/object_viewer/widgets/hoverpoints.cpp +++ b/studio/src/plugins/object_viewer/widgets/hoverpoints.cpp @@ -20,6 +20,8 @@ #include "stdpch.h" #include "hoverpoints.h" +#include + #define printf HoverPoints::HoverPoints(QWidget *widget, PointShape shape) diff --git a/studio/src/plugins/object_viewer/widgets/hoverpoints.h b/studio/src/plugins/object_viewer/widgets/hoverpoints.h index f6a6e8b764..b4e2fbf222 100644 --- a/studio/src/plugins/object_viewer/widgets/hoverpoints.h +++ b/studio/src/plugins/object_viewer/widgets/hoverpoints.h @@ -20,7 +20,8 @@ #ifndef HOVERPOINTS_H #define HOVERPOINTS_H -#include +#include +#include QT_FORWARD_DECLARE_CLASS(QBypassWidget) diff --git a/studio/src/plugins/ovqt_sheet_builder/CMakeLists.txt b/studio/src/plugins/ovqt_sheet_builder/CMakeLists.txt index 07e16b4fcf..607d1c5295 100644 --- a/studio/src/plugins/ovqt_sheet_builder/CMakeLists.txt +++ b/studio/src/plugins/ovqt_sheet_builder/CMakeLists.txt @@ -12,7 +12,7 @@ SET(OVQT_PLUG_SHEET_BUILDER_HDR sheetbuilderconfgdialog.h sheetbuilderdialog.h o SET(QT_USE_QTGUI TRUE) SET(QT_USE_QTOPENGL TRUE) -QT4_WRAP_CPP(OVQT_PLUG_SHEET_BUILDER_MOC_SRC ${OVQT_PLUG_SHEET_BUILDER_HDR}) +QT5_WRAP_CPP(OVQT_PLUG_SHEET_BUILDER_MOC_SRC ${OVQT_PLUG_SHEET_BUILDER_HDR}) SOURCE_GROUP(QtGeneratedMocSrc FILES ${OVQT_PLUG_SHEET_BUILDER_MOC_SRC}) SOURCE_GROUP("Sheet builder Plugin" FILES ${SRC}) diff --git a/studio/src/plugins/ovqt_sheet_builder/ovqt_sheet_builder.cpp b/studio/src/plugins/ovqt_sheet_builder/ovqt_sheet_builder.cpp index ecb7c8d316..3c1c72af6c 100644 --- a/studio/src/plugins/ovqt_sheet_builder/ovqt_sheet_builder.cpp +++ b/studio/src/plugins/ovqt_sheet_builder/ovqt_sheet_builder.cpp @@ -30,12 +30,12 @@ #include // Qt includes -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include using namespace Plugin; @@ -90,5 +90,3 @@ void SheetBuilderPlugin::setNelContext(NLMISC::INelContext *nelContext) #endif // NL_OS_WINDOWS m_LibContext = new NLMISC::CLibraryContext(*nelContext); } - -Q_EXPORT_PLUGIN(SheetBuilderPlugin) diff --git a/studio/src/plugins/ovqt_sheet_builder/ovqt_sheet_builder.h b/studio/src/plugins/ovqt_sheet_builder/ovqt_sheet_builder.h index 2a1328caf5..f9841acbef 100644 --- a/studio/src/plugins/ovqt_sheet_builder/ovqt_sheet_builder.h +++ b/studio/src/plugins/ovqt_sheet_builder/ovqt_sheet_builder.h @@ -25,7 +25,7 @@ #include "nel/misc/app_context.h" -#include +#include namespace NLMISC { @@ -38,6 +38,7 @@ namespace Plugin class SheetBuilderPlugin : public QObject, public ExtensionSystem::IPlugin { Q_OBJECT + Q_PLUGIN_METADATA(IID IPlugin_iid FILE "plugin-metadata.json") Q_INTERFACES(ExtensionSystem::IPlugin) public: SheetBuilderPlugin(); diff --git a/studio/src/plugins/ovqt_sheet_builder/plugin-metadata.json b/studio/src/plugins/ovqt_sheet_builder/plugin-metadata.json new file mode 100644 index 0000000000..4756ee852a --- /dev/null +++ b/studio/src/plugins/ovqt_sheet_builder/plugin-metadata.json @@ -0,0 +1,6 @@ +{ + "Name" : "SheetBuilder", + "Version" : "1.0", + "Vendor": "kharvd", + "Description": "make_sheet_id equivalent" +} \ No newline at end of file diff --git a/studio/src/plugins/ovqt_sheet_builder/sheetbuilder.h b/studio/src/plugins/ovqt_sheet_builder/sheetbuilder.h index f976513f7d..e8eabc995b 100644 --- a/studio/src/plugins/ovqt_sheet_builder/sheetbuilder.h +++ b/studio/src/plugins/ovqt_sheet_builder/sheetbuilder.h @@ -145,7 +145,8 @@ void readFormId( string &outputFileName ) map::iterator itFT = FileTypeToId.find(fileType); if( itFT == FileTypeToId.end() ) { - FileTypeToId.insert( make_pair(fileType,fid.FormIDInfos.Type) ); + uint8 type ( fid.FormIDInfos.Type); + FileTypeToId.insert( make_pair(fileType,type) ); } } else diff --git a/studio/src/plugins/tile_editor/CMakeLists.txt b/studio/src/plugins/tile_editor/CMakeLists.txt index 85d6ea737d..f8e5645c0b 100644 --- a/studio/src/plugins/tile_editor/CMakeLists.txt +++ b/studio/src/plugins/tile_editor/CMakeLists.txt @@ -22,9 +22,9 @@ SET(OVQT_PLUG_TILE_EDITOR_RCS tile_editor.qrc) SET(QT_USE_QTGUI TRUE) SET(QT_USE_QTOPENGL TRUE) -QT4_WRAP_CPP(OVQT_TILE_EDITOR_PLUGIN_MOC_SRC ${OVQT_TILE_EDITOR_PLUGIN_HDR}) -QT4_ADD_RESOURCES( OVQT_PLUG_TILE_EDITOR_RC_SRCS ${OVQT_PLUG_TILE_EDITOR_RCS}) -QT4_WRAP_UI(OVQT_TILE_EDITOR_PLUGIN_UI_HDRS ${OVQT_TILE_EDITOR_PLUGIN_UIS}) +QT5_WRAP_CPP(OVQT_TILE_EDITOR_PLUGIN_MOC_SRC ${OVQT_TILE_EDITOR_PLUGIN_HDR}) +QT5_ADD_RESOURCES( OVQT_PLUG_TILE_EDITOR_RC_SRCS ${OVQT_PLUG_TILE_EDITOR_RCS}) +QT5_WRAP_UI(OVQT_TILE_EDITOR_PLUGIN_UI_HDRS ${OVQT_TILE_EDITOR_PLUGIN_UIS}) SOURCE_GROUP(QtGeneratedUiHdr FILES ${OVQT_TILE_EDITOR_PLUGIN_UI_HDRS}) SOURCE_GROUP(QtGeneratedMocSrc FILES ${OVQT_TILE_EDITOR_PLUGIN_MOC_SRC} ${OVQT_PLUG_TILE_EDITOR_RC_SRCS}) diff --git a/studio/src/plugins/tile_editor/plugin-metadata.json b/studio/src/plugins/tile_editor/plugin-metadata.json new file mode 100644 index 0000000000..2712d52404 --- /dev/null +++ b/studio/src/plugins/tile_editor/plugin-metadata.json @@ -0,0 +1,6 @@ +{ + "Name" : "TileEditor", + "Version" : "1.0", + "Vendor": "Ryzom Core", + "Description": "Tile bank editing plugin." +} \ No newline at end of file diff --git a/studio/src/plugins/tile_editor/tile_editor_main_window.cpp b/studio/src/plugins/tile_editor/tile_editor_main_window.cpp index d0dd5faa47..e698952c0f 100644 --- a/studio/src/plugins/tile_editor/tile_editor_main_window.cpp +++ b/studio/src/plugins/tile_editor/tile_editor_main_window.cpp @@ -22,9 +22,9 @@ #include "nel/misc/path.h" -#include -#include -#include +#include +#include +#include #include #include diff --git a/studio/src/plugins/tile_editor/tile_editor_main_window.h b/studio/src/plugins/tile_editor/tile_editor_main_window.h index 628bf3d495..f2e0ce6138 100644 --- a/studio/src/plugins/tile_editor/tile_editor_main_window.h +++ b/studio/src/plugins/tile_editor/tile_editor_main_window.h @@ -26,7 +26,7 @@ #include "nel/misc/types_nl.h" #include "nel/misc/sheet_id.h" -#include +#include #include namespace Ui { diff --git a/studio/src/plugins/tile_editor/tile_editor_plugin.cpp b/studio/src/plugins/tile_editor/tile_editor_plugin.cpp index ac1bc225e3..0c5cce9867 100644 --- a/studio/src/plugins/tile_editor/tile_editor_plugin.cpp +++ b/studio/src/plugins/tile_editor/tile_editor_plugin.cpp @@ -26,12 +26,12 @@ #include "../core/core_constants.h" // Qt includes -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include // NeL includes #include "nel/misc/debug.h" @@ -78,5 +78,3 @@ void TileEditorPlugin::addAutoReleasedObject(QObject *obj) m_plugMan->addObject(obj); m_autoReleaseObjects.prepend(obj); } - -Q_EXPORT_PLUGIN(TileEditorPlugin) diff --git a/studio/src/plugins/tile_editor/tile_editor_plugin.h b/studio/src/plugins/tile_editor/tile_editor_plugin.h index 20a20111e3..c5fe65ed5b 100644 --- a/studio/src/plugins/tile_editor/tile_editor_plugin.h +++ b/studio/src/plugins/tile_editor/tile_editor_plugin.h @@ -41,6 +41,7 @@ namespace TileEditorPluginQt class TileEditorPlugin : public QObject, public ExtensionSystem::IPlugin { Q_OBJECT + Q_PLUGIN_METADATA(IID IPlugin_iid FILE "plugin-metadata.json") Q_INTERFACES(ExtensionSystem::IPlugin) public: diff --git a/studio/src/plugins/tile_editor/tile_item_delegate.cpp b/studio/src/plugins/tile_editor/tile_item_delegate.cpp index a3f50e691a..26654e9838 100644 --- a/studio/src/plugins/tile_editor/tile_item_delegate.cpp +++ b/studio/src/plugins/tile_editor/tile_item_delegate.cpp @@ -18,6 +18,7 @@ // along with this program. If not, see . #include +#include #include diff --git a/studio/src/plugins/tile_editor/tile_item_delegate.h b/studio/src/plugins/tile_editor/tile_item_delegate.h index 00bd521c0f..ac9d7632be 100644 --- a/studio/src/plugins/tile_editor/tile_item_delegate.h +++ b/studio/src/plugins/tile_editor/tile_item_delegate.h @@ -20,7 +20,7 @@ #ifndef TILE_ITEM_DELEGATE_H #define TILE_ITEM_DELEGATE_H -#include +#include #include #include diff --git a/studio/src/plugins/translation_manager/CMakeLists.txt b/studio/src/plugins/translation_manager/CMakeLists.txt index 62b60f9304..059f4d5556 100644 --- a/studio/src/plugins/translation_manager/CMakeLists.txt +++ b/studio/src/plugins/translation_manager/CMakeLists.txt @@ -29,8 +29,8 @@ SET(OVQT_PLUG_TRANSLATION_MANAGER_RCS ftp_selection.qrc) SET(QT_USE_QTGUI TRUE) SET(QT_USE_QTNETWORK TRUE) -QT4_WRAP_CPP(OVQT_PLUG_TRANSLATION_MANAGER_MOC_SRC ${OVQT_PLUG_TRANSLATION_MANAGER_HDR}) -QT4_WRAP_UI(OVQT_PLUG_TRANSLATION_MANAGER_UI_HDRS ${OVQT_PLUG_TRANSLATION_MANAGER_UIS}) +QT5_WRAP_CPP(OVQT_PLUG_TRANSLATION_MANAGER_MOC_SRC ${OVQT_PLUG_TRANSLATION_MANAGER_HDR}) +QT5_WRAP_UI(OVQT_PLUG_TRANSLATION_MANAGER_UI_HDRS ${OVQT_PLUG_TRANSLATION_MANAGER_UIS}) SOURCE_GROUP(QtResources FILES ${OVQT_PLUG_TRANSLATION_MANAGER_UIS}) SOURCE_GROUP(QtGeneratedUiHdr FILES ${OVQT_PLUG_TRANSLATION_MANAGER_UI_HDRS}) diff --git a/studio/src/plugins/translation_manager/editor_phrase.cpp b/studio/src/plugins/translation_manager/editor_phrase.cpp index 510255828d..8ea09f0229 100644 --- a/studio/src/plugins/translation_manager/editor_phrase.cpp +++ b/studio/src/plugins/translation_manager/editor_phrase.cpp @@ -23,14 +23,14 @@ #include "nel/misc/diff_tool.h" // Qt includes -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include using namespace std; diff --git a/studio/src/plugins/translation_manager/editor_phrase.h b/studio/src/plugins/translation_manager/editor_phrase.h index 404a17d515..63eee91257 100644 --- a/studio/src/plugins/translation_manager/editor_phrase.h +++ b/studio/src/plugins/translation_manager/editor_phrase.h @@ -24,17 +24,17 @@ #include "translation_manager_editor.h" // Qt includes -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include namespace TranslationManager diff --git a/studio/src/plugins/translation_manager/editor_worksheet.cpp b/studio/src/plugins/translation_manager/editor_worksheet.cpp index 4ea127527a..4c3164a5c6 100644 --- a/studio/src/plugins/translation_manager/editor_worksheet.cpp +++ b/studio/src/plugins/translation_manager/editor_worksheet.cpp @@ -23,13 +23,13 @@ #include "translation_manager_constants.h" // Qt includes -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include using namespace std; diff --git a/studio/src/plugins/translation_manager/editor_worksheet.h b/studio/src/plugins/translation_manager/editor_worksheet.h index 498f51564f..ed3b6c2a87 100644 --- a/studio/src/plugins/translation_manager/editor_worksheet.h +++ b/studio/src/plugins/translation_manager/editor_worksheet.h @@ -32,13 +32,13 @@ #include "nel/ligo/ligo_config.h" // Qt includes -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include namespace TranslationManager diff --git a/studio/src/plugins/translation_manager/ftp_selection.cpp b/studio/src/plugins/translation_manager/ftp_selection.cpp index ddaad8745a..de016b9d31 100644 --- a/studio/src/plugins/translation_manager/ftp_selection.cpp +++ b/studio/src/plugins/translation_manager/ftp_selection.cpp @@ -19,8 +19,8 @@ #include "ftp_selection.h" -#include -#include +#include +#include namespace TranslationManager { @@ -49,7 +49,7 @@ CFtpSelection::CFtpSelection(QWidget *parent): QDialog(parent) // Connection with the FTP Server. We retrieve the file list. void CFtpSelection::ConnectButtonClicked() { - conn = new QFtp(this); + conn = new QNetworkAccessManager(this); connect(conn, SIGNAL(commandFinished(int,bool)), this, SLOT(FtpCommandFinished(int,bool))); connect(conn, SIGNAL(listInfo(QUrlInfo)), this, SLOT(AddToList(QUrlInfo))); diff --git a/studio/src/plugins/translation_manager/ftp_selection.h b/studio/src/plugins/translation_manager/ftp_selection.h index 9f8af85ddd..f5825c941f 100644 --- a/studio/src/plugins/translation_manager/ftp_selection.h +++ b/studio/src/plugins/translation_manager/ftp_selection.h @@ -10,12 +10,12 @@ #include "ui_ftp_selection.h" -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include namespace TranslationManager @@ -41,7 +41,7 @@ private Q_SLOTS: private: Ui::FtpSelectionDialog _ui; - QFtp *conn; + QNetworkAccessManager *conn; QHash isDirectory; QString currentPath; }; diff --git a/studio/src/plugins/translation_manager/plugin-metadata.json b/studio/src/plugins/translation_manager/plugin-metadata.json new file mode 100644 index 0000000000..dbd62bb14f --- /dev/null +++ b/studio/src/plugins/translation_manager/plugin-metadata.json @@ -0,0 +1,6 @@ +{ + "Name" : "TranslationManager", + "Version" : "0.8", + "Vendor": "Ryzom Core", + "Description": "Translation Manager plugin." +} \ No newline at end of file diff --git a/studio/src/plugins/translation_manager/source_selection.cpp b/studio/src/plugins/translation_manager/source_selection.cpp index 043d82b3d8..bf06745135 100644 --- a/studio/src/plugins/translation_manager/source_selection.cpp +++ b/studio/src/plugins/translation_manager/source_selection.cpp @@ -21,7 +21,7 @@ #include "source_selection.h" -#include +#include namespace TranslationManager { diff --git a/studio/src/plugins/translation_manager/source_selection.h b/studio/src/plugins/translation_manager/source_selection.h index 5d7c7b4601..29de4f1d8f 100644 --- a/studio/src/plugins/translation_manager/source_selection.h +++ b/studio/src/plugins/translation_manager/source_selection.h @@ -22,10 +22,10 @@ #include "ui_source_selection.h" -#include -#include -#include -#include +#include +#include +#include +#include #include diff --git a/studio/src/plugins/translation_manager/translation_manager_editor.h b/studio/src/plugins/translation_manager/translation_manager_editor.h index 1141f43fdb..c94c95c49f 100644 --- a/studio/src/plugins/translation_manager/translation_manager_editor.h +++ b/studio/src/plugins/translation_manager/translation_manager_editor.h @@ -21,12 +21,12 @@ #ifndef TRANSLATION_MANAGER_EDITOR_H #define TRANSLATION_MANAGER_EDITOR_H -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include namespace TranslationManager { diff --git a/studio/src/plugins/translation_manager/translation_manager_main_window.h b/studio/src/plugins/translation_manager/translation_manager_main_window.h index d278a02b97..506dc4a1f1 100644 --- a/studio/src/plugins/translation_manager/translation_manager_main_window.h +++ b/studio/src/plugins/translation_manager/translation_manager_main_window.h @@ -32,14 +32,14 @@ #include "../core/icore_listener.h" // Qt includes -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include // STL includes #include diff --git a/studio/src/plugins/translation_manager/translation_manager_plugin.cpp b/studio/src/plugins/translation_manager/translation_manager_plugin.cpp index 1e4db0c18b..945d212c85 100644 --- a/studio/src/plugins/translation_manager/translation_manager_plugin.cpp +++ b/studio/src/plugins/translation_manager/translation_manager_plugin.cpp @@ -34,13 +34,13 @@ #include "nel/misc/debug.h" // Qt includes -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include namespace TranslationManager { @@ -92,5 +92,3 @@ void TranslationManagerPlugin::addAutoReleasedObject(QObject *obj) } } - -Q_EXPORT_PLUGIN(TranslationManager::TranslationManagerPlugin) \ No newline at end of file diff --git a/studio/src/plugins/translation_manager/translation_manager_plugin.h b/studio/src/plugins/translation_manager/translation_manager_plugin.h index 0b3fb1f1e4..4c81e20abb 100644 --- a/studio/src/plugins/translation_manager/translation_manager_plugin.h +++ b/studio/src/plugins/translation_manager/translation_manager_plugin.h @@ -30,8 +30,8 @@ #include "nel/misc/app_context.h" // Qt includes -#include -#include +#include +#include using namespace std; @@ -53,6 +53,7 @@ class CTranslationManagerContext; class TranslationManagerPlugin : public QObject, public ExtensionSystem::IPlugin { Q_OBJECT + Q_PLUGIN_METADATA(IID IPlugin_iid FILE "plugin-metadata.json") Q_INTERFACES(ExtensionSystem::IPlugin) public: virtual ~TranslationManagerPlugin(); diff --git a/studio/src/plugins/translation_manager/translation_manager_settings_page.cpp b/studio/src/plugins/translation_manager/translation_manager_settings_page.cpp index 54fcd473c3..2c0cae2920 100644 --- a/studio/src/plugins/translation_manager/translation_manager_settings_page.cpp +++ b/studio/src/plugins/translation_manager/translation_manager_settings_page.cpp @@ -23,10 +23,10 @@ #include "../core/icore.h" // Qt includes -#include -#include -#include -#include +#include +#include +#include +#include namespace TranslationManager { diff --git a/studio/src/plugins/world_editor/CMakeLists.txt b/studio/src/plugins/world_editor/CMakeLists.txt index 8b4586a1f8..ad0c8914f0 100644 --- a/studio/src/plugins/world_editor/CMakeLists.txt +++ b/studio/src/plugins/world_editor/CMakeLists.txt @@ -2,7 +2,7 @@ INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${QT_INCLUDES} ${LIBXML2_INCLUDE_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/../../3rdparty/qtpropertybrowser + ${QtPropertyBrowser_INCLUDE_DIR} ) FILE(GLOB SRC *.cpp *.h) @@ -36,9 +36,9 @@ SET(OVQT_PLUGIN_WORLD_EDITOR_RCS world_editor.qrc) SET(QT_USE_QTGUI TRUE) SET(QT_USE_QTOPENGL TRUE) -QT4_ADD_RESOURCES(OVQT_PLUGIN_WORLD_EDITOR_RC_SRCS ${OVQT_PLUGIN_WORLD_EDITOR_RCS}) -QT4_WRAP_CPP(OVQT_PLUGIN_WORLD_EDITOR_MOC_SRC ${OVQT_PLUGIN_WORLD_EDITOR_HDR}) -QT4_WRAP_UI(OVQT_PLUGIN_WORLD_EDITOR_UI_HDRS ${OVQT_PLUGIN_WORLD_EDITOR_UIS}) +QT5_ADD_RESOURCES(OVQT_PLUGIN_WORLD_EDITOR_RC_SRCS ${OVQT_PLUGIN_WORLD_EDITOR_RCS}) +QT5_WRAP_CPP(OVQT_PLUGIN_WORLD_EDITOR_MOC_SRC ${OVQT_PLUGIN_WORLD_EDITOR_HDR}) +QT5_WRAP_UI(OVQT_PLUGIN_WORLD_EDITOR_UI_HDRS ${OVQT_PLUGIN_WORLD_EDITOR_UIS}) SOURCE_GROUP(QtResources FILES ${OVQT_PLUGIN_WORLD_EDITOR_UIS}) SOURCE_GROUP(QtGeneratedUiHdr FILES ${OVQT_PLUGIN_WORLD_EDITOR_UI_HDRS}) @@ -57,8 +57,9 @@ TARGET_LINK_LIBRARIES( studio_plugin_world_editor studio_plugin_landscape_editor nelmisc nel3d - qt_property_browser - ${QT_LIBRARIES} + ${QtPropertyBrowser_LIBRARY} + QtPropertyBrowser::Text + ${QT_LIBRARIES} ${QT_QTOPENGL_LIBRARY} ${LIBXML2_LIBRARIES} ) diff --git a/studio/src/plugins/world_editor/const_string_array_property.h b/studio/src/plugins/world_editor/const_string_array_property.h index 78070ef576..e14642f218 100644 --- a/studio/src/plugins/world_editor/const_string_array_property.h +++ b/studio/src/plugins/world_editor/const_string_array_property.h @@ -23,7 +23,7 @@ #define QT_QTPROPERTYBROWSER_IMPORT -#include "3rdparty/qtpropertybrowser/qtpropertybrowser.h" +#include #include #include diff --git a/studio/src/plugins/world_editor/plugin-metadata.json b/studio/src/plugins/world_editor/plugin-metadata.json new file mode 100644 index 0000000000..a5089798c6 --- /dev/null +++ b/studio/src/plugins/world_editor/plugin-metadata.json @@ -0,0 +1,6 @@ +{ + "Name" : "WorldEditor", + "Version" : "0.6", + "Vendor": "GSoC2011_dnk-88", + "Description": "Landscape editor ovqt plugin." +} \ No newline at end of file diff --git a/studio/src/plugins/world_editor/primitives_view.cpp b/studio/src/plugins/world_editor/primitives_view.cpp index 0f54af5f42..82d581f5dd 100644 --- a/studio/src/plugins/world_editor/primitives_view.cpp +++ b/studio/src/plugins/world_editor/primitives_view.cpp @@ -34,8 +34,8 @@ #include #include #include -#include -#include +#include +#include namespace WorldEditor { diff --git a/studio/src/plugins/world_editor/primitives_view.h b/studio/src/plugins/world_editor/primitives_view.h index 0a1745360e..6c6b2f8ec2 100644 --- a/studio/src/plugins/world_editor/primitives_view.h +++ b/studio/src/plugins/world_editor/primitives_view.h @@ -25,13 +25,13 @@ #include // Qt includes -#include -#include +#include +#include #include #include #include -#include -#include +#include +#include namespace LandscapeEditor { diff --git a/studio/src/plugins/world_editor/project_settings_dialog.cpp b/studio/src/plugins/world_editor/project_settings_dialog.cpp index 80bede1582..40ba276e68 100644 --- a/studio/src/plugins/world_editor/project_settings_dialog.cpp +++ b/studio/src/plugins/world_editor/project_settings_dialog.cpp @@ -27,8 +27,8 @@ // Qt includes #include -#include -#include +#include +#include namespace WorldEditor { diff --git a/studio/src/plugins/world_editor/property_editor_widget.cpp b/studio/src/plugins/world_editor/property_editor_widget.cpp index 1356413fb4..93ae8faf4e 100644 --- a/studio/src/plugins/world_editor/property_editor_widget.cpp +++ b/studio/src/plugins/world_editor/property_editor_widget.cpp @@ -31,7 +31,10 @@ // Qt includes #include +#include #include +#include +#include #include "const_string_array_property.h" diff --git a/studio/src/plugins/world_editor/property_editor_widget.h b/studio/src/plugins/world_editor/property_editor_widget.h index 8a695efa3b..795fe9126f 100644 --- a/studio/src/plugins/world_editor/property_editor_widget.h +++ b/studio/src/plugins/world_editor/property_editor_widget.h @@ -28,9 +28,9 @@ // 3rdparty -#include "qtvariantproperty.h" -#include "qtpropertymanager.h" -#include "qteditorfactory.h" +#include +#include +#include // NeL includes diff --git a/studio/src/plugins/world_editor/world_editor_actions.h b/studio/src/plugins/world_editor/world_editor_actions.h index 4ac39ed90c..4a602207d8 100644 --- a/studio/src/plugins/world_editor/world_editor_actions.h +++ b/studio/src/plugins/world_editor/world_editor_actions.h @@ -26,10 +26,10 @@ // NeL includes // Qt includes -#include -#include -#include -#include +#include +#include +#include +#include #include namespace LandscapeEditor diff --git a/studio/src/plugins/world_editor/world_editor_plugin.cpp b/studio/src/plugins/world_editor/world_editor_plugin.cpp index 45548fc004..072dbcd321 100644 --- a/studio/src/plugins/world_editor/world_editor_plugin.cpp +++ b/studio/src/plugins/world_editor/world_editor_plugin.cpp @@ -140,5 +140,3 @@ QWidget *WorldEditorContext::widget() } } - -Q_EXPORT_PLUGIN(WorldEditor::WorldEditorPlugin) diff --git a/studio/src/plugins/world_editor/world_editor_plugin.h b/studio/src/plugins/world_editor/world_editor_plugin.h index 8788c3d3f4..7c46aab749 100644 --- a/studio/src/plugins/world_editor/world_editor_plugin.h +++ b/studio/src/plugins/world_editor/world_editor_plugin.h @@ -32,7 +32,7 @@ // Qt includes #include -#include +#include namespace NLMISC { @@ -46,6 +46,7 @@ class WorldEditorWindow; class WorldEditorPlugin : public QObject, public ExtensionSystem::IPlugin { Q_OBJECT + Q_PLUGIN_METADATA(IID IPlugin_iid FILE "plugin-metadata.json") Q_INTERFACES(ExtensionSystem::IPlugin) public: diff --git a/studio/src/plugins/world_editor/world_editor_scene.cpp b/studio/src/plugins/world_editor/world_editor_scene.cpp index d86a2d57c4..56cf39a8ae 100644 --- a/studio/src/plugins/world_editor/world_editor_scene.cpp +++ b/studio/src/plugins/world_editor/world_editor_scene.cpp @@ -23,9 +23,9 @@ #include // Qt includes -#include -#include -#include +#include +#include +#include #include namespace WorldEditor diff --git a/studio/src/plugins/world_editor/world_editor_scene.h b/studio/src/plugins/world_editor/world_editor_scene.h index f88b82c096..74403f1501 100644 --- a/studio/src/plugins/world_editor/world_editor_scene.h +++ b/studio/src/plugins/world_editor/world_editor_scene.h @@ -25,7 +25,7 @@ // NeL includes // Qt includes -#include +#include namespace WorldEditor { diff --git a/studio/src/plugins/world_editor/world_editor_scene_item.cpp b/studio/src/plugins/world_editor/world_editor_scene_item.cpp index b94e48a0fa..73e6fcec1b 100644 --- a/studio/src/plugins/world_editor/world_editor_scene_item.cpp +++ b/studio/src/plugins/world_editor/world_editor_scene_item.cpp @@ -21,7 +21,7 @@ #include // Qt includes -#include +#include #include #include #include diff --git a/studio/src/plugins/world_editor/world_editor_scene_item.h b/studio/src/plugins/world_editor/world_editor_scene_item.h index 0579ef32a2..80cde1e9fb 100644 --- a/studio/src/plugins/world_editor/world_editor_scene_item.h +++ b/studio/src/plugins/world_editor/world_editor_scene_item.h @@ -24,11 +24,11 @@ // Qt includes #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include namespace WorldEditor { diff --git a/studio/src/plugins/world_editor/world_editor_settings_page.cpp b/studio/src/plugins/world_editor/world_editor_settings_page.cpp index dc15dc83a5..e56cfcea92 100644 --- a/studio/src/plugins/world_editor/world_editor_settings_page.cpp +++ b/studio/src/plugins/world_editor/world_editor_settings_page.cpp @@ -23,7 +23,7 @@ #include "../core/icore.h" // Qt includes -#include +#include #include // NeL includes diff --git a/studio/src/plugins/world_editor/world_editor_window.cpp b/studio/src/plugins/world_editor/world_editor_window.cpp index 0dcd8c9320..f851c51a20 100644 --- a/studio/src/plugins/world_editor/world_editor_window.cpp +++ b/studio/src/plugins/world_editor/world_editor_window.cpp @@ -39,9 +39,9 @@ // Qt includes #include -#include -#include -#include +#include +#include +#include #include namespace WorldEditor diff --git a/studio/src/plugins/world_editor/world_editor_window.h b/studio/src/plugins/world_editor/world_editor_window.h index 3abd8bd43f..135ae851c0 100644 --- a/studio/src/plugins/world_editor/world_editor_window.h +++ b/studio/src/plugins/world_editor/world_editor_window.h @@ -24,8 +24,8 @@ #include "ui_world_editor_window.h" // Qt includes -#include -#include +#include +#include #include #include #include diff --git a/studio/src/plugins/zone_painter/CMakeLists.txt b/studio/src/plugins/zone_painter/CMakeLists.txt index fef437ec09..783f8a6202 100644 --- a/studio/src/plugins/zone_painter/CMakeLists.txt +++ b/studio/src/plugins/zone_painter/CMakeLists.txt @@ -21,9 +21,9 @@ SET(OVQT_PLUG_ZONE_PAINTER_RCS zone_painter.qrc) SET(QT_USE_QTGUI TRUE) SET(QT_USE_QTOPENGL TRUE) -QT4_WRAP_CPP(OVQT_PLUG_ZONE_PAINTER_MOC_SRC ${OVQT_PLUG_ZONE_PAINTER_HDR}) -QT4_ADD_RESOURCES( OVQT_PLUG_ZONE_PAINTER_RC_SRCS ${OVQT_PLUG_ZONE_PAINTER_RCS}) -QT4_WRAP_UI(OVQT_PLUG_ZONE_PAINTER_UI_HDRS ${OVQT_PLUG_ZONE_PAINTER_UIS}) +QT5_WRAP_CPP(OVQT_PLUG_ZONE_PAINTER_MOC_SRC ${OVQT_PLUG_ZONE_PAINTER_HDR}) +QT5_ADD_RESOURCES( OVQT_PLUG_ZONE_PAINTER_RC_SRCS ${OVQT_PLUG_ZONE_PAINTER_RCS}) +QT5_WRAP_UI(OVQT_PLUG_ZONE_PAINTER_UI_HDRS ${OVQT_PLUG_ZONE_PAINTER_UIS}) SOURCE_GROUP(QtResources FILES ${OVQT_PLUG_ZONE_PAINTER_UIS} ${OVQT_PLUG_ZONE_PAINTER_RCS}) SOURCE_GROUP(QtGeneratedUiHdr FILES ${OVQT_PLUG_ZONE_PAINTER_UI_HDRS}) diff --git a/studio/src/plugins/zone_painter/plugin-metadata.json b/studio/src/plugins/zone_painter/plugin-metadata.json new file mode 100644 index 0000000000..5eccd229c8 --- /dev/null +++ b/studio/src/plugins/zone_painter/plugin-metadata.json @@ -0,0 +1,6 @@ +{ + "Name" : "ZonePainter", + "Version" : "0.0", + "Vendor": "Ryzom Core", + "Description": "Zone Painter Plugin" +} \ No newline at end of file diff --git a/studio/src/plugins/zone_painter/qnel_widget.h b/studio/src/plugins/zone_painter/qnel_widget.h index 77ecf6da36..79a2f0171f 100644 --- a/studio/src/plugins/zone_painter/qnel_widget.h +++ b/studio/src/plugins/zone_painter/qnel_widget.h @@ -27,8 +27,8 @@ #include // Qt includes -#include -#include +#include +#include class QAction; diff --git a/studio/src/plugins/zone_painter/zone_painter_main_window.h b/studio/src/plugins/zone_painter/zone_painter_main_window.h index caa4433e42..56ac90d58e 100644 --- a/studio/src/plugins/zone_painter/zone_painter_main_window.h +++ b/studio/src/plugins/zone_painter/zone_painter_main_window.h @@ -5,7 +5,7 @@ #include #include #include -#include +#include namespace NLQT { class QNLWidget; diff --git a/studio/src/plugins/zone_painter/zone_painter_plugin.cpp b/studio/src/plugins/zone_painter/zone_painter_plugin.cpp index 085a18634d..c8faa28fd9 100644 --- a/studio/src/plugins/zone_painter/zone_painter_plugin.cpp +++ b/studio/src/plugins/zone_painter/zone_painter_plugin.cpp @@ -85,5 +85,3 @@ void ZonePainterPlugin::addAutoReleasedObject(QObject *obj) } } - -Q_EXPORT_PLUGIN(Plugin::ZonePainterPlugin) \ No newline at end of file diff --git a/studio/src/plugins/zone_painter/zone_painter_plugin.h b/studio/src/plugins/zone_painter/zone_painter_plugin.h index a3def41bac..47140b4089 100644 --- a/studio/src/plugins/zone_painter/zone_painter_plugin.h +++ b/studio/src/plugins/zone_painter/zone_painter_plugin.h @@ -45,6 +45,7 @@ namespace Plugin class ZonePainterPlugin : public QObject, public ExtensionSystem::IPlugin { Q_OBJECT + Q_PLUGIN_METADATA(IID IPlugin_iid FILE "plugin-metadata.json") Q_INTERFACES(ExtensionSystem::IPlugin) public: diff --git a/studio/src/splash_screen.cpp b/studio/src/splash_screen.cpp index 6d8360b9f0..67c9dbc1ad 100644 --- a/studio/src/splash_screen.cpp +++ b/studio/src/splash_screen.cpp @@ -85,7 +85,7 @@ void SplashScreen::drawContents( QPainter *painter ) if( progressBarEnabled ) { - QStyleOptionProgressBarV2 pbStyle; + QStyleOptionProgressBar pbStyle; pbStyle.initFrom( this ); pbStyle.state = QStyle::State_Enabled; pbStyle.textVisible = false; From ecf01c42fb6576adf4e8c34010699daa6f25f2a8 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Tue, 13 Feb 2024 14:22:58 +0100 Subject: [PATCH 015/126] update github checkout action --- .github/workflows/build-client.yml | 2 +- .github/workflows/build-studio.yml | 2 +- .github/workflows/cmake-multi-platform.yml | 2 +- .github/workflows/cross-compile-client.yml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-client.yml b/.github/workflows/build-client.yml index 24a600f486..69cd0e3b56 100644 --- a/.github/workflows/build-client.yml +++ b/.github/workflows/build-client.yml @@ -30,7 +30,7 @@ jobs: cmake_options: -DWITH_LIBXML2_ICONV=OFF -GXcode steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set reusable strings # Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file. id: strings diff --git a/.github/workflows/build-studio.yml b/.github/workflows/build-studio.yml index fff2ed94e6..e04a2e79bf 100644 --- a/.github/workflows/build-studio.yml +++ b/.github/workflows/build-studio.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set reusable strings id: strings shell: bash diff --git a/.github/workflows/cmake-multi-platform.yml b/.github/workflows/cmake-multi-platform.yml index ff306692b9..59843c53c2 100644 --- a/.github/workflows/cmake-multi-platform.yml +++ b/.github/workflows/cmake-multi-platform.yml @@ -29,7 +29,7 @@ jobs: ubuntu_version: 20.04 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set reusable strings # Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file. id: strings diff --git a/.github/workflows/cross-compile-client.yml b/.github/workflows/cross-compile-client.yml index fa335158a5..01c672bab1 100644 --- a/.github/workflows/cross-compile-client.yml +++ b/.github/workflows/cross-compile-client.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set reusable strings # Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file. id: strings From 7476e6615c9e1e21a16a7223d1ec9cb91b39326c Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Thu, 9 May 2024 08:57:50 +0200 Subject: [PATCH 016/126] split cmake download from install command to cache downloaded file --- .devcontainer/Dockerfile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index cf9ba3f2be..35c21571ba 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -63,10 +63,11 @@ ARG USERNAME=ryzom ARG USER_UID=1000 ARG USER_GID=$USER_UID -RUN wget --output-document=/tmp/cmake.sh https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-linux-x86_64.sh \ - && mkdir --parents "$CMAKE_INSTALL_DIR" \ +RUN wget --output-document=/tmp/cmake.sh https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-linux-x86_64.sh +RUN mkdir --parents "$CMAKE_INSTALL_DIR" \ && sh /tmp/cmake.sh --skip-license --prefix="$CMAKE_INSTALL_DIR" \ - && ln --symbolic --force "$CMAKE_INSTALL_DIR/bin/cmake" /usr/local/bin/cmake + && ln --symbolic --force "$CMAKE_INSTALL_DIR/bin/cmake" /usr/local/bin/cmake \ + && ln --symbolic --force "$CMAKE_INSTALL_DIR/bin/ctest" /usr/local/bin/ctest RUN groupadd --gid $USER_GID $USERNAME \ && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \ From 301055c86c29c45d60c9426b8884a42f6d0d20ba Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Wed, 15 May 2024 16:42:09 +0200 Subject: [PATCH 017/126] update github cache action --- .github/workflows/build-client.yml | 4 ++-- .github/workflows/cross-compile-client.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-client.yml b/.github/workflows/build-client.yml index 69cd0e3b56..64c1ef480f 100644 --- a/.github/workflows/build-client.yml +++ b/.github/workflows/build-client.yml @@ -68,14 +68,14 @@ jobs: sudo ln --symbolic --force ${{ steps.strings.outputs.cmake-install-dir }}/bin/cmake /usr/local/bin/cmake - name: Cache Hunter Dependencies - uses: actions/cache@v3.3.2 + uses: actions/cache@v4.0.2 with: path: ${{ steps.strings.outputs.hunter-dir }} key: ${{ matrix.os }}-hunter-cache - name: Cache Chocolatey Dependencies if: runner.os == 'Windows' - uses: actions/cache@v3.3.2 + uses: actions/cache@v4.0.2 with: path: C:\Users\runneradmin\AppData\Local\Temp\chocolatey key: ${{ runner.os }}-chocolatey-cache diff --git a/.github/workflows/cross-compile-client.yml b/.github/workflows/cross-compile-client.yml index 01c672bab1..92969ff835 100644 --- a/.github/workflows/cross-compile-client.yml +++ b/.github/workflows/cross-compile-client.yml @@ -49,7 +49,7 @@ jobs: sudo make install - name: Cache Hunter Dependencies - uses: actions/cache@v3.3.2 + uses: actions/cache@v4.0.2 with: path: ${{ steps.strings.outputs.hunter-dir }} key: ubuntu-latest-hunter-cache From 02e10aeee7bb5e751072aad6c20b52b2f9443bf8 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Wed, 15 May 2024 20:02:51 +0200 Subject: [PATCH 018/126] prepare workflow to package and create docker image --- .github/workflows/docker-image.yml | 90 ++++++++++++++++++++++++++++++ docker-compose.yaml | 2 + docker/Dockerfile | 67 ++++++++++++++++++++++ 3 files changed, 159 insertions(+) create mode 100644 .github/workflows/docker-image.yml create mode 100644 docker/Dockerfile diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml new file mode 100644 index 0000000000..32808f60a8 --- /dev/null +++ b/.github/workflows/docker-image.yml @@ -0,0 +1,90 @@ +name: Docker Image + +on: + push: + branches: [ "core4", "feature/*" ] + +env: + ubuntu_version: 22.04 + build_type: Release + cpp_compiler: g++ + c_compiler: gcc + +jobs: + build: + runs-on: ubuntu-22.04 + + steps: + - uses: actions/checkout@v4 + - name: Set reusable strings + id: strings + shell: bash + run: | + echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" + VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') + [[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') + [ "$VERSION" == "core4" ] && VERSION=latest + echo VERSION=$VERSION + echo "build-version=${VERSION}" >> "$GITHUB_OUTPUT" + + - name: Dependencies + run: | + sudo apt update + sudo apt install --yes software-properties-common + wget --quiet https://packages.microsoft.com/config/ubuntu/${{ ubuntu_version }}/packages-microsoft-prod.deb + sudo dpkg --install packages-microsoft-prod.deb + sudo apt update + sudo apt install --yes \ + cmake build-essential ninja-build ccache \ + bison autoconf automake \ + libpng-dev \ + libjpeg-dev \ + libgif-dev libfreetype6-dev \ + freeglut3-dev \ + liblua5.2-dev libluabind-dev libcpptest-dev \ + libogg-dev libvorbis-dev libopenal-dev \ + libavcodec-dev libavformat-dev libavdevice-dev libswscale-dev libpostproc-dev \ + libmysqlclient-dev \ + libxml2-dev \ + libcurl4-openssl-dev libssl-dev \ + libsquish-dev \ + liblzma-dev \ + libgsf-1-dev \ + qtbase5-dev qttools5-dev qttools5-dev-tools \ + libmsquic + wget https://raw.githubusercontent.com/microsoft/msquic/main/src/inc/msquic.h + wget https://raw.githubusercontent.com/microsoft/msquic/main/src/inc/msquic_posix.h + wget https://raw.githubusercontent.com/microsoft/msquic/main/src/inc/quic_sal_stub.h + sudo mv msquic.h msquic_posix.h quic_sal_stub.h /usr/include/ + + - name: Configure CMake + run: > + cmake -B ${{ steps.strings.outputs.build-output-dir }} + -G "Ninja" + -DCMAKE_SUPPRESS_REGENERATION=ON + -DCMAKE_CXX_COMPILER=${{ cpp_compiler }} + -DCMAKE_C_COMPILER=${{ c_compiler }} + -DCMAKE_BUILD_TYPE=${{ build_type }} + -DWITH_STATIC=ON + -DWITH_NEL_TESTS=ON + -DWITH_NEL_SAMPLES=ON + -DWITH_LUA51=OFF + -DWITH_LUA52=ON + -DWITH_RYZOM=ON + -DWITH_RYZOM_SERVER=ON + -DWITH_RYZOM_CLIENT=ON + -DWITH_RYZOM_TOOLS=ON + -DWITH_NEL_TOOLS=ON + -DWITH_NELNS=ON + -DWITH_NELNS_LOGIN_SYSTEM=ON + -DWITH_NELNS_SERVER=ON + -DWITH_QT5=ON + -DWITH_LIBGSF=ON + -DCPACK_PACKAGE_VERSION="${{ steps.strings.outputs.build-version }}" + -S ${{ github.workspace }} + + - name: Package + run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ build_type }} --target package + + - name: Build the Docker image + run: docker build . --file docker/Dockerfile --tag ryzomcore:${{ steps.strings.outputs.build-version }} diff --git a/docker-compose.yaml b/docker-compose.yaml index 023fe9df5e..0948a0a1c8 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -2,3 +2,5 @@ services: devcontainer: image: "ryzomcore/devcontainer" build: ./.devcontainer + volumes: + - ./:/tmp/ryzomcore diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000000..27458a1f6d --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,67 @@ +FROM ubuntu:22.04 + +RUN apt update; \ + DEBIAN_FRONTEND=noninteractive \ + apt install --yes \ + autoconf \ + automake \ + bison \ + build-essential \ + ccache \ + clang-15 \ + freeglut3-dev \ + libavcodec-dev \ + libavdevice-dev \ + libavformat-dev \ + libcpptest-dev \ + libcurl4-openssl-dev \ + libfreetype6-dev \ + libgif-dev \ + libgsf-1-dev \ + libjpeg-dev \ + liblua5.2-dev \ + libluabind-dev \ + liblzma-dev \ + libmysqlclient-dev \ + libogg-dev \ + libopenal-dev \ + libpng-dev \ + libpostproc-dev \ + libsquish-dev \ + libssl-dev \ + libswscale-dev \ + libvorbis-dev \ + libxml2-dev \ + mingw-w64 \ + mingw-w64-tools \ + ninja-build \ + qtbase5-dev \ + qttools5-dev \ + qttools5-dev-tools \ + libqtpropertybrowser-dev \ + qt6-base-dev \ + qt6-l10n-tools \ + qt6-tools-dev \ + qt6-tools-dev-tools + + +RUN apt install --yes \ + doxygen \ + gdb \ + git \ + graphviz \ + libxrandr-dev \ + wget + +ARG USERNAME=ryzom +ARG USER_UID=1000 +ARG USER_GID=$USER_UID +ARG APP_HOME=/app + +RUN groupadd --gid $USER_GID $USERNAME \ + && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME + +COPY build/bin + +USER $USERNAME +WORKDIR $APP_HOME From 8d63444d6e5f9864a6f9cc074a5d01d86d7e3439 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Wed, 15 May 2024 21:05:07 +0200 Subject: [PATCH 019/126] add missing prefix to workflow variables --- .github/workflows/docker-image.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 32808f60a8..342fabce7c 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -31,7 +31,7 @@ jobs: run: | sudo apt update sudo apt install --yes software-properties-common - wget --quiet https://packages.microsoft.com/config/ubuntu/${{ ubuntu_version }}/packages-microsoft-prod.deb + wget --quiet https://packages.microsoft.com/config/ubuntu/${{ env.ubuntu_version }}/packages-microsoft-prod.deb sudo dpkg --install packages-microsoft-prod.deb sudo apt update sudo apt install --yes \ @@ -62,9 +62,9 @@ jobs: cmake -B ${{ steps.strings.outputs.build-output-dir }} -G "Ninja" -DCMAKE_SUPPRESS_REGENERATION=ON - -DCMAKE_CXX_COMPILER=${{ cpp_compiler }} - -DCMAKE_C_COMPILER=${{ c_compiler }} - -DCMAKE_BUILD_TYPE=${{ build_type }} + -DCMAKE_CXX_COMPILER=${{ env.cpp_compiler }} + -DCMAKE_C_COMPILER=${{ env.c_compiler }} + -DCMAKE_BUILD_TYPE=${{ env.build_type }} -DWITH_STATIC=ON -DWITH_NEL_TESTS=ON -DWITH_NEL_SAMPLES=ON @@ -84,7 +84,7 @@ jobs: -S ${{ github.workspace }} - name: Package - run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ build_type }} --target package + run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ env.build_type }} --target package - name: Build the Docker image run: docker build . --file docker/Dockerfile --tag ryzomcore:${{ steps.strings.outputs.build-version }} From bcd289313162ccc4a08a1cd4b563d68d51e041a4 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Wed, 15 May 2024 21:53:08 +0200 Subject: [PATCH 020/126] fix copy command in Dockerfile --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 27458a1f6d..64965b41b5 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -61,7 +61,7 @@ ARG APP_HOME=/app RUN groupadd --gid $USER_GID $USERNAME \ && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME -COPY build/bin +COPY build/ryzomcore-* /app USER $USERNAME WORKDIR $APP_HOME From 4e407671fcff3f1028049fbf3ae31bd6db9b174e Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Thu, 16 May 2024 19:47:45 +0200 Subject: [PATCH 021/126] prepare docker image and push to registry --- .github/workflows/docker-image.yml | 23 +++++++++++++++++++++++ CMakeLists.txt | 2 +- docker-compose.yaml | 6 ++++++ docker/Dockerfile | 6 ++++-- 4 files changed, 34 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 342fabce7c..ca40e487f0 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -9,10 +9,14 @@ env: build_type: Release cpp_compiler: g++ c_compiler: gcc + IMAGE_NAME: ryzomcore-tools jobs: build: runs-on: ubuntu-22.04 + permissions: + packages: write + contents: read steps: - uses: actions/checkout@v4 @@ -81,10 +85,29 @@ jobs: -DWITH_QT5=ON -DWITH_LIBGSF=ON -DCPACK_PACKAGE_VERSION="${{ steps.strings.outputs.build-version }}" + -DCPACK_GENERATOR=STGZ -S ${{ github.workspace }} - name: Package run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ env.build_type }} --target package + - uses: actions/upload-artifact@v4 + with: + name: package + path: ${{ steps.strings.outputs.build-output-dir }}/ryzomcore-* + + - name: Build the Docker image run: docker build . --file docker/Dockerfile --tag ryzomcore:${{ steps.strings.outputs.build-version }} + + - name: Log in to registry + run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin + + - name: Push image + run: | + IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME + IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') + VERSION="${{ steps.strings.outputs.build-version }}" + echo IMAGE_ID=$IMAGE_ID + docker tag $IMAGE_NAME $IMAGE_ID:$VERSION + docker push $IMAGE_ID:$VERSION diff --git a/CMakeLists.txt b/CMakeLists.txt index 23cf7ef867..a4fc01bd3c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -493,7 +493,7 @@ IF(WIN32) SET(CPACK_GENERATOR "NSIS;ZIP") SET(CPACK_SOURCE_GENERATOR "ZIP") ELSE() - SET(CPACK_GENERATOR "TGZ") + SET(CPACK_GENERATOR "TGZ;STGZ") SET(CPACK_SOURCE_GENERATOR "TGZ") ENDIF() set(CPACK_SOURCE_IGNORE_FILES diff --git a/docker-compose.yaml b/docker-compose.yaml index 0948a0a1c8..abf1fb3ffc 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -4,3 +4,9 @@ services: build: ./.devcontainer volumes: - ./:/tmp/ryzomcore + + tools: + image: "ryzomcore/tools" + build: + context: . + dockerfile: docker/Dockerfile diff --git a/docker/Dockerfile b/docker/Dockerfile index 64965b41b5..2c60770ca2 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -61,7 +61,9 @@ ARG APP_HOME=/app RUN groupadd --gid $USER_GID $USERNAME \ && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME -COPY build/ryzomcore-* /app +COPY build/ryzomcore-*.sh /tmp/ryzomcore.sh + +RUN mkdir --parent "$APP_HOME" \ + && /tmp/ryzomcore.sh --skip-license USER $USERNAME -WORKDIR $APP_HOME From cc69b680a72c95545d7f2b57e828610ab4005a30 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Thu, 16 May 2024 21:03:43 +0200 Subject: [PATCH 022/126] remove unused tagging of docker image --- .github/workflows/docker-image.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index ca40e487f0..dd9c8f3351 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -109,5 +109,4 @@ jobs: IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') VERSION="${{ steps.strings.outputs.build-version }}" echo IMAGE_ID=$IMAGE_ID - docker tag $IMAGE_NAME $IMAGE_ID:$VERSION docker push $IMAGE_ID:$VERSION From d312482620949d8f8f5b42e7917da17ba1a19c37 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Thu, 16 May 2024 22:02:35 +0200 Subject: [PATCH 023/126] move image tag to reusable strings --- .github/workflows/docker-image.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index dd9c8f3351..0244ccc116 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -28,8 +28,12 @@ jobs: VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') [[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') [ "$VERSION" == "core4" ] && VERSION=latest + IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME + IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') echo VERSION=$VERSION + echo IMAGE_ID=$IMAGE_ID echo "build-version=${VERSION}" >> "$GITHUB_OUTPUT" + echo "docker-image-tag=${IMAGE_ID}:${VERSION}" >> "$GITHUB_OUTPUT" - name: Dependencies run: | @@ -98,15 +102,11 @@ jobs: - name: Build the Docker image - run: docker build . --file docker/Dockerfile --tag ryzomcore:${{ steps.strings.outputs.build-version }} + run: docker build . --file docker/Dockerfile --tag "${{ steps.strings.outputs.docker-image-tag }}" - name: Log in to registry run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin - name: Push image run: | - IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME - IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') - VERSION="${{ steps.strings.outputs.build-version }}" - echo IMAGE_ID=$IMAGE_ID - docker push $IMAGE_ID:$VERSION + docker push "${{ steps.strings.outputs.docker-image-tag }}" From 74c12a1551bffb404afa5c7426f2415b796b19e1 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Fri, 17 May 2024 15:19:55 +0200 Subject: [PATCH 024/126] only publish docker image in main branches and version tags upload package artifact in cmake build --- .github/workflows/cmake-multi-platform.yml | 8 ++++++++ .../{docker-image.yml => publish-docker-image.yml} | 8 ++++---- 2 files changed, 12 insertions(+), 4 deletions(-) rename .github/workflows/{docker-image.yml => publish-docker-image.yml} (97%) diff --git a/.github/workflows/cmake-multi-platform.yml b/.github/workflows/cmake-multi-platform.yml index 59843c53c2..cee502506c 100644 --- a/.github/workflows/cmake-multi-platform.yml +++ b/.github/workflows/cmake-multi-platform.yml @@ -103,3 +103,11 @@ jobs: # Execute tests defined by the CMake configuration. Note that --build-config is needed because the default Windows generator is a multi-config generator (Visual Studio generator). # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail run: ctest --build-config ${{ matrix.build_type }} + + - name: Package + run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} --target package + + - uses: actions/upload-artifact@v4 + with: + name: package-${{ matrix.os }} + path: ${{ steps.strings.outputs.build-output-dir }}/ryzomcore-* diff --git a/.github/workflows/docker-image.yml b/.github/workflows/publish-docker-image.yml similarity index 97% rename from .github/workflows/docker-image.yml rename to .github/workflows/publish-docker-image.yml index 0244ccc116..8fc9f1323d 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/publish-docker-image.yml @@ -1,8 +1,10 @@ -name: Docker Image +name: Publish Docker Image on: push: - branches: [ "core4", "feature/*" ] + branches: [ "core4" ] + tags: + - v* env: ubuntu_version: 22.04 @@ -74,7 +76,6 @@ jobs: -DCMAKE_C_COMPILER=${{ env.c_compiler }} -DCMAKE_BUILD_TYPE=${{ env.build_type }} -DWITH_STATIC=ON - -DWITH_NEL_TESTS=ON -DWITH_NEL_SAMPLES=ON -DWITH_LUA51=OFF -DWITH_LUA52=ON @@ -100,7 +101,6 @@ jobs: name: package path: ${{ steps.strings.outputs.build-output-dir }}/ryzomcore-* - - name: Build the Docker image run: docker build . --file docker/Dockerfile --tag "${{ steps.strings.outputs.docker-image-tag }}" From bddb94cb924c9d901d8b85120ca1e3018f2341cf Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Wed, 22 May 2024 22:11:18 +0200 Subject: [PATCH 025/126] add library path for docker image to find installed libraries --- docker/Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docker/Dockerfile b/docker/Dockerfile index 2c60770ca2..f237f84579 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -66,4 +66,6 @@ COPY build/ryzomcore-*.sh /tmp/ryzomcore.sh RUN mkdir --parent "$APP_HOME" \ && /tmp/ryzomcore.sh --skip-license +ENV LD_LIBRARY_PATH=/usr/local/lib + USER $USERNAME From 91d5b7bac7097f885f3e96efd4f96085945918d7 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Wed, 22 May 2024 22:45:10 +0200 Subject: [PATCH 026/126] remove dev dependencies from docker image and install some required dependencies --- docker/Dockerfile | 67 ++++++++++------------------------------------- 1 file changed, 14 insertions(+), 53 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index f237f84579..7a7fe36822 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,58 +1,5 @@ FROM ubuntu:22.04 -RUN apt update; \ - DEBIAN_FRONTEND=noninteractive \ - apt install --yes \ - autoconf \ - automake \ - bison \ - build-essential \ - ccache \ - clang-15 \ - freeglut3-dev \ - libavcodec-dev \ - libavdevice-dev \ - libavformat-dev \ - libcpptest-dev \ - libcurl4-openssl-dev \ - libfreetype6-dev \ - libgif-dev \ - libgsf-1-dev \ - libjpeg-dev \ - liblua5.2-dev \ - libluabind-dev \ - liblzma-dev \ - libmysqlclient-dev \ - libogg-dev \ - libopenal-dev \ - libpng-dev \ - libpostproc-dev \ - libsquish-dev \ - libssl-dev \ - libswscale-dev \ - libvorbis-dev \ - libxml2-dev \ - mingw-w64 \ - mingw-w64-tools \ - ninja-build \ - qtbase5-dev \ - qttools5-dev \ - qttools5-dev-tools \ - libqtpropertybrowser-dev \ - qt6-base-dev \ - qt6-l10n-tools \ - qt6-tools-dev \ - qt6-tools-dev-tools - - -RUN apt install --yes \ - doxygen \ - gdb \ - git \ - graphviz \ - libxrandr-dev \ - wget - ARG USERNAME=ryzom ARG USER_UID=1000 ARG USER_GID=$USER_UID @@ -68,4 +15,18 @@ RUN mkdir --parent "$APP_HOME" \ ENV LD_LIBRARY_PATH=/usr/local/lib +# install dependencies +RUN apt update; \ + apt install --yes \ + libgif7 \ + libjpeg8 \ + libpng16-16 \ + libxml2 \ + libfreetype6 \ + liblua5.2-0 \ + libluabind0.9.1d1 \ + libcurl4 \ + libvorbis0a \ + libvorbisfile3 + USER $USERNAME From a5021e60e3ccc609e424eec391f9928e4126bb60 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Wed, 5 Jun 2024 21:49:27 +0200 Subject: [PATCH 027/126] add missing dependencies --- docker/Dockerfile | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 7a7fe36822..c0525acb03 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -18,15 +18,19 @@ ENV LD_LIBRARY_PATH=/usr/local/lib # install dependencies RUN apt update; \ apt install --yes \ + libcurl4 \ + libfreetype6 \ libgif7 \ + libgsf-1-114 \ libjpeg8 \ - libpng16-16 \ - libxml2 \ - libfreetype6 \ liblua5.2-0 \ - libluabind0.9.1d1 \ - libcurl4 \ + libluabind0.9.1d1 \ + libmysqlclient21 \ + libpng16-16 \ + libqt5widgets5 \ + libsquish0 \ libvorbis0a \ - libvorbisfile3 + libvorbisfile3 \ + libxml2 USER $USERNAME From ddee2793963e139fb02bb9bff5305b56c77bd4bb Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Sat, 8 Jun 2024 14:37:49 +0000 Subject: [PATCH 028/126] prepare gtest for naming service test --- .gitignore | 2 +- CMakeLists.txt | 11 ++ nelns/CMakeLists.txt | 3 + nelns/naming_service/CMakeLists.txt | 6 +- nelns/tests/CMakeLists.txt | 14 ++ nelns/tests/naming_service.test.cpp | 6 + .../ryzom_naming_service.cpp | 161 +----------------- 7 files changed, 39 insertions(+), 164 deletions(-) create mode 100644 nelns/tests/CMakeLists.txt create mode 100644 nelns/tests/naming_service.test.cpp diff --git a/.gitignore b/.gitignore index dfc254b44a..dacdb0c16c 100644 --- a/.gitignore +++ b/.gitignore @@ -160,11 +160,11 @@ snowballs/build/* ryzom/build/* build/* build-2010/* -build/* install/* build_* install_* nel/tools/build_gamedata/configuration/buildsite.py +cmake-build-* # Linux nel compile nel/build/nel-config diff --git a/CMakeLists.txt b/CMakeLists.txt index a4fc01bd3c..05097e4108 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -323,6 +323,17 @@ ENDIF() IF(WITH_NEL) IF(WITH_NEL_TESTS) FIND_PACKAGE(CppTest) + + ENABLE_TESTING() + INCLUDE(FetchContent) + FetchContent_Declare( + googletest + URL https://github.com/google/googletest/archive/a7f443b80b105f940225332ed3c31f2790092f47.zip + EXCLUDE_FROM_ALL + ) + SET(gtest_force_shared_crt ON CACHE BOOL "" FORCE) + FetchContent_MakeAvailable(googletest) + INCLUDE(GoogleTest) ENDIF() IF(HUNTER_ENABLED) diff --git a/nelns/CMakeLists.txt b/nelns/CMakeLists.txt index d451111185..36f8f27599 100644 --- a/nelns/CMakeLists.txt +++ b/nelns/CMakeLists.txt @@ -4,6 +4,9 @@ IF(WITH_NELNS_SERVER) ADD_SUBDIRECTORY(admin_executor_service) ADD_SUBDIRECTORY(admin_service) ADD_SUBDIRECTORY(naming_service) + IF (WITH_NEL_TESTS) + ADD_SUBDIRECTORY(tests) + ENDIF () ADD_SUBDIRECTORY(login_service) ADD_SUBDIRECTORY(welcome_service) ENDIF() diff --git a/nelns/naming_service/CMakeLists.txt b/nelns/naming_service/CMakeLists.txt index 596bb5b48f..f0f728663d 100644 --- a/nelns/naming_service/CMakeLists.txt +++ b/nelns/naming_service/CMakeLists.txt @@ -1,6 +1,6 @@ -FILE(GLOB SRC *.cpp *.h) - -ADD_EXECUTABLE(naming_service WIN32 ${SRC}) +ADD_EXECUTABLE(naming_service WIN32 + naming_service.cpp +) TARGET_LINK_LIBRARIES(naming_service nelmisc diff --git a/nelns/tests/CMakeLists.txt b/nelns/tests/CMakeLists.txt new file mode 100644 index 0000000000..ad0f8a5eb2 --- /dev/null +++ b/nelns/tests/CMakeLists.txt @@ -0,0 +1,14 @@ +set(TEST_NAME "naming_service_test") + +add_executable("${TEST_NAME}" + naming_service.test.cpp +) +target_link_libraries("${TEST_NAME}" + GTest::gtest_main + nelmisc + nelnet +) +gtest_discover_tests("${TEST_NAME}" + EXTRA_ARGS "--gtest_output=xml:${CMAKE_CURRENT_BINARY_DIR}/reports/junit-${TEST_NAME}.xml" +) + diff --git a/nelns/tests/naming_service.test.cpp b/nelns/tests/naming_service.test.cpp new file mode 100644 index 0000000000..32d91842af --- /dev/null +++ b/nelns/tests/naming_service.test.cpp @@ -0,0 +1,6 @@ +#include + +TEST(CNamingService, BasicAssertions) { + EXPECT_STRNE("hello", "world"); + EXPECT_EQ(7 * 6, 42); +} diff --git a/ryzom/server/src/ryzom_naming_service/ryzom_naming_service.cpp b/ryzom/server/src/ryzom_naming_service/ryzom_naming_service.cpp index be8a34e9d1..5feb7e19c0 100644 --- a/ryzom/server/src/ryzom_naming_service/ryzom_naming_service.cpp +++ b/ryzom/server/src/ryzom_naming_service/ryzom_naming_service.cpp @@ -97,167 +97,8 @@ void foo() admin_modules_forceLink(); } -/** - * Manager for services instances - * (Moved from the TICKS to the NS) - * Implementable with layer 5, here implemented in NS (layer 3) - * \author Olivier Cado - * \author Nevrax France - * \date 2003 - */ -class CServiceInstanceManager -{ -public: - - /// Constructor - CServiceInstanceManager(); - - /** Add the name of a service which must not be duplicated - * If uniqueOnShard is true, only one service is allowed. - * If uniqueOnShard is false, one service is allowed by physical machine. - */ - void addUniqueService( const std::string& serviceName, bool uniqueOnShard ) - { - _UniqueServices.insert( std::make_pair( serviceName, uniqueOnShard ) ); - } - - /// Check if a service is allowed to start (if so, add it) - bool queryStartService( const std::string& serviceName, TServiceId serviceId, const std::vector &addr, string& reason ); - - /// Release a service instance - void releaseService( NLNET::TServiceId serviceId ); - - /// Display information - void displayInfo( NLMISC::CLog *log = NLMISC::InfoLog ) const; - - /// Make all controlled services quit - void killAllServices(); - -private: - - /// List of restricted services - std::map< std::string, bool > _UniqueServices; - - /// List of granted (online) services - std::set< TServiceId > _OnlineServices; -}; - - CServiceInstanceManager *SIMInstance = NULL; - -/* - * Constructor - */ -CServiceInstanceManager::CServiceInstanceManager() -{ - nlassert( ! SIMInstance ); - SIMInstance = this; - - // Note: addCallbackArray() done in CRangeMirrorManager::init() -} - - -/* - * Check if a service is allowed to start. Answer with a GSTS (Grant Start Service) message - */ -bool CServiceInstanceManager::queryStartService( const std::string& serviceName, TServiceId serviceId, const vector &addr, string& reason ) -{ - bool grantStarting = true; - std::map< std::string, bool >::iterator ius = _UniqueServices.find( serviceName ); - if ( ius != _UniqueServices.end() ) - { - // Service is restricted - set< TServiceId >::iterator ios; - bool uniqueOnShard = (*ius).second; - for ( ios=_OnlineServices.begin(); ios!=_OnlineServices.end(); ++ios ) - { - string name = getServiceName( *ios ); - if ( name == serviceName ) - { - if ( uniqueOnShard ) - { - // Only one service by shard is allowed => deny - grantStarting = false; - reason = toString( "Service %s already found as %hu, must be unique on shard", serviceName.c_str(), ios->get() ); - nlinfo( reason.c_str() ); - break; - } - else - { - // Only one service by physical machine is allowed - - // Implementation for layer5 - //TSockId hostid1, hostid2; - /*CCallbackNetBase *cnb1 = CUnifiedNetwork::getInstance()->getNetBase( serviceId, hostid1 ); - CCallbackNetBase *cnb2 = CUnifiedNetwork::getInstance()->getNetBase( *ios, hostid2 ); - if ( cnb1->hostAddress( hostid1 ).internalIPAddress() == cnb2->hostAddress( hostid2 ).internalIPAddress() )*/ - - // Implementation for NS - if ( addr[0].getAddress() == getHostAddress( *ios ).getAddress() ) - { - grantStarting = false; - reason = toString( "Service %s already found as %hu on same machine", serviceName.c_str(), ios->get() ); - nlinfo( reason.c_str() ); - break; - } - } - } - } - } - - if ( grantStarting ) - { - _OnlineServices.insert( serviceId ); - } - return grantStarting; -} - - -/* - * Release a service instance - */ -void CServiceInstanceManager::releaseService( NLNET::TServiceId serviceId ) -{ - _OnlineServices.erase( serviceId ); // not a problem if not found -} - - -/* - * Display information - */ -void CServiceInstanceManager::displayInfo( NLMISC::CLog *log ) const -{ - log->displayNL( "Restricted services:" ); - std::map< std::string, bool >::const_iterator ius; - for ( ius=_UniqueServices.begin(); ius!=_UniqueServices.end(); ++ius ) - { - log->displayNL( "%s -> only one per %s", (*ius).first.c_str(), (*ius).second?"shard":"machine" ); - } - log->displayNL( "Online registered services:" ); - std::set< TServiceId >::const_iterator ios; - for ( ios=_OnlineServices.begin(); ios!=_OnlineServices.end(); ++ios ) - { - log->displayNL( "%s", CUnifiedNetwork::getInstance()->getServiceUnifiedName( *ios ).c_str() ); - } -} - - -/* - * Make all controlled services quit - */ -void CServiceInstanceManager::killAllServices() -{ - // Send to all known online services - std::set< TServiceId >::const_iterator ios; - for ( ios=_OnlineServices.begin(); ios!=_OnlineServices.end(); ++ios ) - { - doUnregisterService( (TServiceId)(*ios) ); - } -} - - - // // Variables // @@ -267,7 +108,7 @@ list RegisteredServices; /// List of all registred services uint16 MinBasePort = 30000; /// Ports begin at 51000 uint16 MaxBasePort = 30100; /// (note: in this implementation there can be no more than 100 services) -const TServiceId BaseSId(128); /// Allocated SIds begin at 128 (except for Agent Service) +/// Allocated SIds begin at 128 (except for Agent Service) const TTime UnregisterTimeout = 10000; /// After 10s we remove an unregister service if every server didn't ACK the message From 1a452285dc8663a14a0e930920763a04a2b9aede Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Sat, 8 Jun 2024 15:31:02 +0000 Subject: [PATCH 029/126] extract CServiceEntry into separate file --- nelns/naming_service/naming_service.cpp | 23 ++-------------- nelns/naming_service/service_entry.h | 35 +++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 21 deletions(-) create mode 100644 nelns/naming_service/service_entry.h diff --git a/nelns/naming_service/naming_service.cpp b/nelns/naming_service/naming_service.cpp index b10856088d..6dc4a6afda 100644 --- a/nelns/naming_service/naming_service.cpp +++ b/nelns/naming_service/naming_service.cpp @@ -48,6 +48,8 @@ #include "nel/net/service.h" #include "nel/net/module_manager.h" +#include "service_entry.h" + // // Namespaces // @@ -70,27 +72,6 @@ NLMISC_COMMAND(test, "none", "none") } -// -// Structures -// - -struct CServiceEntry -{ - CServiceEntry (TSockId sock, const vector &a, const string &n, TServiceId s) : SockId(sock), Addr(a), Name(n), SId (s), WaitingUnregistration(false) { } - - TSockId SockId; // the connection between the service and the naming service - vector Addr; // address to send to the service who wants to lookup this service - // it s possible to have more than one addr, anyway, the naming service - // will send good address depending of the sub net address of the service - string Name; // name of the service - TServiceId SId; // id of the service - - bool WaitingUnregistration; // true if this service is in unregistration process (wait other service ACK) - TTime WaitingUnregistrationTime; // time of the beginning of the inregistration process - list WaitingUnregistrationServices; // list of service that we wait the answer -}; - - // Helper that emulates layer5's send() //void sendToService( uint16 sid, CMessage& msgout ); diff --git a/nelns/naming_service/service_entry.h b/nelns/naming_service/service_entry.h new file mode 100644 index 0000000000..3a440d4b67 --- /dev/null +++ b/nelns/naming_service/service_entry.h @@ -0,0 +1,35 @@ +#ifndef NL_SERVICE_ENTRY_H +#define NL_SERVICE_ENTRY_H + +#include +#include + +#include +#include +#include +#include + +struct CServiceEntry +{ + CServiceEntry(NLNET::TSockId sock, const std::vector &a, const std::string &n, NLNET::TServiceId s) + : SockId(sock) + , Addr(a) + , Name(n) + , SId(s) + , WaitingUnregistration(false) + { + } + + NLNET::TSockId SockId; // the connection between the service and the naming service + std::vector Addr; // address to send to the service who wants to lookup this service + // it s possible to have more than one addr, anyway, the naming service + // will send good address depending of the sub net address of the service + std::string Name; // name of the service + NLNET::TServiceId SId; // id of the service + + bool WaitingUnregistration; // true if this service is in unregistration process (wait other service ACK) + NLMISC::TTime WaitingUnregistrationTime; // time of the beginning of the inregistration process + std::list WaitingUnregistrationServices; // list of service that we wait the answer +}; + +#endif // NL_SERVICE_ENTRY_H From b0fe35e11f6fec69317563a7b62973608ffff19c Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Sat, 8 Jun 2024 16:01:27 +0000 Subject: [PATCH 030/126] revert changes to unrelated files --- .../ryzom_naming_service.cpp | 161 +++++++++++++++++- 1 file changed, 160 insertions(+), 1 deletion(-) diff --git a/ryzom/server/src/ryzom_naming_service/ryzom_naming_service.cpp b/ryzom/server/src/ryzom_naming_service/ryzom_naming_service.cpp index 5feb7e19c0..be8a34e9d1 100644 --- a/ryzom/server/src/ryzom_naming_service/ryzom_naming_service.cpp +++ b/ryzom/server/src/ryzom_naming_service/ryzom_naming_service.cpp @@ -97,8 +97,167 @@ void foo() admin_modules_forceLink(); } +/** + * Manager for services instances + * (Moved from the TICKS to the NS) + * Implementable with layer 5, here implemented in NS (layer 3) + * \author Olivier Cado + * \author Nevrax France + * \date 2003 + */ +class CServiceInstanceManager +{ +public: + + /// Constructor + CServiceInstanceManager(); + + /** Add the name of a service which must not be duplicated + * If uniqueOnShard is true, only one service is allowed. + * If uniqueOnShard is false, one service is allowed by physical machine. + */ + void addUniqueService( const std::string& serviceName, bool uniqueOnShard ) + { + _UniqueServices.insert( std::make_pair( serviceName, uniqueOnShard ) ); + } + + /// Check if a service is allowed to start (if so, add it) + bool queryStartService( const std::string& serviceName, TServiceId serviceId, const std::vector &addr, string& reason ); + + /// Release a service instance + void releaseService( NLNET::TServiceId serviceId ); + + /// Display information + void displayInfo( NLMISC::CLog *log = NLMISC::InfoLog ) const; + + /// Make all controlled services quit + void killAllServices(); + +private: + + /// List of restricted services + std::map< std::string, bool > _UniqueServices; + + /// List of granted (online) services + std::set< TServiceId > _OnlineServices; +}; + + CServiceInstanceManager *SIMInstance = NULL; + +/* + * Constructor + */ +CServiceInstanceManager::CServiceInstanceManager() +{ + nlassert( ! SIMInstance ); + SIMInstance = this; + + // Note: addCallbackArray() done in CRangeMirrorManager::init() +} + + +/* + * Check if a service is allowed to start. Answer with a GSTS (Grant Start Service) message + */ +bool CServiceInstanceManager::queryStartService( const std::string& serviceName, TServiceId serviceId, const vector &addr, string& reason ) +{ + bool grantStarting = true; + std::map< std::string, bool >::iterator ius = _UniqueServices.find( serviceName ); + if ( ius != _UniqueServices.end() ) + { + // Service is restricted + set< TServiceId >::iterator ios; + bool uniqueOnShard = (*ius).second; + for ( ios=_OnlineServices.begin(); ios!=_OnlineServices.end(); ++ios ) + { + string name = getServiceName( *ios ); + if ( name == serviceName ) + { + if ( uniqueOnShard ) + { + // Only one service by shard is allowed => deny + grantStarting = false; + reason = toString( "Service %s already found as %hu, must be unique on shard", serviceName.c_str(), ios->get() ); + nlinfo( reason.c_str() ); + break; + } + else + { + // Only one service by physical machine is allowed + + // Implementation for layer5 + //TSockId hostid1, hostid2; + /*CCallbackNetBase *cnb1 = CUnifiedNetwork::getInstance()->getNetBase( serviceId, hostid1 ); + CCallbackNetBase *cnb2 = CUnifiedNetwork::getInstance()->getNetBase( *ios, hostid2 ); + if ( cnb1->hostAddress( hostid1 ).internalIPAddress() == cnb2->hostAddress( hostid2 ).internalIPAddress() )*/ + + // Implementation for NS + if ( addr[0].getAddress() == getHostAddress( *ios ).getAddress() ) + { + grantStarting = false; + reason = toString( "Service %s already found as %hu on same machine", serviceName.c_str(), ios->get() ); + nlinfo( reason.c_str() ); + break; + } + } + } + } + } + + if ( grantStarting ) + { + _OnlineServices.insert( serviceId ); + } + return grantStarting; +} + + +/* + * Release a service instance + */ +void CServiceInstanceManager::releaseService( NLNET::TServiceId serviceId ) +{ + _OnlineServices.erase( serviceId ); // not a problem if not found +} + + +/* + * Display information + */ +void CServiceInstanceManager::displayInfo( NLMISC::CLog *log ) const +{ + log->displayNL( "Restricted services:" ); + std::map< std::string, bool >::const_iterator ius; + for ( ius=_UniqueServices.begin(); ius!=_UniqueServices.end(); ++ius ) + { + log->displayNL( "%s -> only one per %s", (*ius).first.c_str(), (*ius).second?"shard":"machine" ); + } + log->displayNL( "Online registered services:" ); + std::set< TServiceId >::const_iterator ios; + for ( ios=_OnlineServices.begin(); ios!=_OnlineServices.end(); ++ios ) + { + log->displayNL( "%s", CUnifiedNetwork::getInstance()->getServiceUnifiedName( *ios ).c_str() ); + } +} + + +/* + * Make all controlled services quit + */ +void CServiceInstanceManager::killAllServices() +{ + // Send to all known online services + std::set< TServiceId >::const_iterator ios; + for ( ios=_OnlineServices.begin(); ios!=_OnlineServices.end(); ++ios ) + { + doUnregisterService( (TServiceId)(*ios) ); + } +} + + + // // Variables // @@ -108,7 +267,7 @@ list RegisteredServices; /// List of all registred services uint16 MinBasePort = 30000; /// Ports begin at 51000 uint16 MaxBasePort = 30100; /// (note: in this implementation there can be no more than 100 services) -/// Allocated SIds begin at 128 (except for Agent Service) +const TServiceId BaseSId(128); /// Allocated SIds begin at 128 (except for Agent Service) const TTime UnregisterTimeout = 10000; /// After 10s we remove an unregister service if every server didn't ACK the message From 4050df987784cd628d167889f4a939f7c2c3da0e Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Sat, 8 Jun 2024 16:32:40 +0000 Subject: [PATCH 031/126] apply clang tidy recommendation --- nelns/naming_service/service_entry.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nelns/naming_service/service_entry.h b/nelns/naming_service/service_entry.h index 3a440d4b67..72b4c3964d 100644 --- a/nelns/naming_service/service_entry.h +++ b/nelns/naming_service/service_entry.h @@ -11,7 +11,7 @@ struct CServiceEntry { - CServiceEntry(NLNET::TSockId sock, const std::vector &a, const std::string &n, NLNET::TServiceId s) + CServiceEntry(NLNET::TSockId sock, const std::vector &a, const std::string &n, const NLNET::TServiceId& s) : SockId(sock) , Addr(a) , Name(n) From d4e7e6696e4b9240056ec55833771671922e567c Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Sat, 8 Jun 2024 17:02:50 +0000 Subject: [PATCH 032/126] extract some helper and variables into separate files --- nelns/naming_service/CMakeLists.txt | 19 ++++++- nelns/naming_service/naming_service.cpp | 55 ++++--------------- .../nelns/naming_service/helper.cpp | 27 +++++++++ .../nelns/naming_service/helper.h | 11 ++++ .../naming_service}/service_entry.h | 2 +- .../nelns/naming_service/variables.cpp | 18 ++++++ .../nelns/naming_service/variables.h | 26 +++++++++ 7 files changed, 110 insertions(+), 48 deletions(-) create mode 100644 nelns/naming_service/nelns/naming_service/helper.cpp create mode 100644 nelns/naming_service/nelns/naming_service/helper.h rename nelns/naming_service/{ => nelns/naming_service}/service_entry.h (95%) create mode 100644 nelns/naming_service/nelns/naming_service/variables.cpp create mode 100644 nelns/naming_service/nelns/naming_service/variables.h diff --git a/nelns/naming_service/CMakeLists.txt b/nelns/naming_service/CMakeLists.txt index f0f728663d..af86f56b62 100644 --- a/nelns/naming_service/CMakeLists.txt +++ b/nelns/naming_service/CMakeLists.txt @@ -1,10 +1,23 @@ +include_directories(${CMAKE_CURRENT_SOURCE_DIR}) + +add_library(nelns_naming_service + nelns/naming_service/helper.cpp + nelns/naming_service/variables.cpp +) +add_library(nelns::ns ALIAS nelns_naming_service) + + ADD_EXECUTABLE(naming_service WIN32 - naming_service.cpp + naming_service.cpp + nelns/naming_service/helper.cpp + nelns/naming_service/helper.h ) TARGET_LINK_LIBRARIES(naming_service - nelmisc - nelnet) + nelmisc + nelnet + nelns::ns +) NL_DEFAULT_PROPS(naming_service "NeLNS, Services: Naming Service") NL_ADD_RUNTIME_FLAGS(naming_service) diff --git a/nelns/naming_service/naming_service.cpp b/nelns/naming_service/naming_service.cpp index 6dc4a6afda..ae6cfbd809 100644 --- a/nelns/naming_service/naming_service.cpp +++ b/nelns/naming_service/naming_service.cpp @@ -34,21 +34,23 @@ // Includes // -#include "nel/misc/types_nl.h" +#include #include #include -#include "nel/misc/debug.h" -#include "nel/misc/command.h" -#include "nel/misc/variable.h" -#include "nel/misc/displayer.h" +#include +#include +#include +#include -#include "nel/net/callback_server.h" -#include "nel/net/service.h" -#include "nel/net/module_manager.h" +#include +#include +#include -#include "service_entry.h" +#include +#include +#include // // Namespaces @@ -76,9 +78,6 @@ NLMISC_COMMAND(test, "none", "none") // Helper that emulates layer5's send() //void sendToService( uint16 sid, CMessage& msgout ); -// Helper that emulate layer5's getServiceName() -string getServiceName( TServiceId sid ); - // Helper that returns the first address of a service CInetAddress getHostAddress( TServiceId sid ); @@ -247,21 +246,6 @@ void CServiceInstanceManager::killAllServices() -// -// Variables -// - -list RegisteredServices; /// List of all registred services - -uint16 MinBasePort = 51000; /// Ports begin at 51000 -uint16 MaxBasePort = 52000; /// (note: in this implementation there can be no more than 1000 services) - -const TServiceId BaseSId(128); /// Allocated SIds begin at 128 (except for Agent Service) - -const TTime UnregisterTimeout = 10000; /// After 10s we remove an unregister service if every server didn't ACK the message - -CCallbackServer *CallbackServer = NULL; - // // Functions // @@ -885,23 +869,6 @@ static void cbRegisteredServices(CMessage& msgin, TSockId from, CCallbackNetBase }*/ -/* - * Helper that emulate layer5's getServiceName() - */ -string getServiceName( TServiceId sid ) -{ - list::iterator it; - for (it = RegisteredServices.begin(); it != RegisteredServices.end (); it++) - { - if ((*it).SId == sid) - { - return (*it).Name; - } - } - return ""; // not found -} - - /* * Helper that returns the first address of a service */ diff --git a/nelns/naming_service/nelns/naming_service/helper.cpp b/nelns/naming_service/nelns/naming_service/helper.cpp new file mode 100644 index 0000000000..5d1f73ef87 --- /dev/null +++ b/nelns/naming_service/nelns/naming_service/helper.cpp @@ -0,0 +1,27 @@ +#include + +#include +#include +#include + +using std::list; +using std::string; + +using NLNET::TServiceId; + +/* + * Helper that emulate layer5's getServiceName() + */ +string getServiceName( TServiceId sid ) +{ + list::iterator it; + for (it = RegisteredServices.begin(); it != RegisteredServices.end (); it++) + { + if ((*it).SId == sid) + { + return (*it).Name; + } + } + return ""; // not found +} + diff --git a/nelns/naming_service/nelns/naming_service/helper.h b/nelns/naming_service/nelns/naming_service/helper.h new file mode 100644 index 0000000000..471be8a9d1 --- /dev/null +++ b/nelns/naming_service/nelns/naming_service/helper.h @@ -0,0 +1,11 @@ +#ifndef NELNS_NAMING_SERVICE_HELPER_H +#define NELNS_NAMING_SERVICE_HELPER_H + +#include + +#include + +// Helper that emulate layer5's getServiceName() +std::string getServiceName(NLNET::TServiceId sid); + +#endif // NELNS_NAMING_SERVICE_HELPER_H diff --git a/nelns/naming_service/service_entry.h b/nelns/naming_service/nelns/naming_service/service_entry.h similarity index 95% rename from nelns/naming_service/service_entry.h rename to nelns/naming_service/nelns/naming_service/service_entry.h index 72b4c3964d..8bb59b4068 100644 --- a/nelns/naming_service/service_entry.h +++ b/nelns/naming_service/nelns/naming_service/service_entry.h @@ -11,7 +11,7 @@ struct CServiceEntry { - CServiceEntry(NLNET::TSockId sock, const std::vector &a, const std::string &n, const NLNET::TServiceId& s) + CServiceEntry(NLNET::TSockId sock, const std::vector &a, const std::string &n, const NLNET::TServiceId &s) : SockId(sock) , Addr(a) , Name(n) diff --git a/nelns/naming_service/nelns/naming_service/variables.cpp b/nelns/naming_service/nelns/naming_service/variables.cpp new file mode 100644 index 0000000000..a525acef21 --- /dev/null +++ b/nelns/naming_service/nelns/naming_service/variables.cpp @@ -0,0 +1,18 @@ +#include + +using std::list; + +using NLMISC::TTime; +using NLNET::CCallbackServer; +using NLNET::TServiceId; + +list RegisteredServices; /// List of all registred services + +uint16 MinBasePort = 51000; /// Ports begin at 51000 +uint16 MaxBasePort = 52000; /// (note: in this implementation there can be no more than 1000 services) + +const TServiceId BaseSId(128); /// Allocated SIds begin at 128 (except for Agent Service) + +const TTime UnregisterTimeout = 10000; /// After 10s we remove an unregister service if every server didn't ACK the message + +CCallbackServer *CallbackServer = nullptr; diff --git a/nelns/naming_service/nelns/naming_service/variables.h b/nelns/naming_service/nelns/naming_service/variables.h new file mode 100644 index 0000000000..7fe547e92e --- /dev/null +++ b/nelns/naming_service/nelns/naming_service/variables.h @@ -0,0 +1,26 @@ +#ifndef NELNS_NAMING_SERVICE_VARIABLES_H +#define NELNS_NAMING_SERVICE_VARIABLES_H + +#include + +#include +#include +#include +#include + +// +// Variables +// + +extern std::list RegisteredServices; /// List of all registred services + +extern uint16 MinBasePort; /// Ports begin at 51000 +extern uint16 MaxBasePort; /// (note: in this implementation there can be no more than 1000 services) + +extern const NLNET::TServiceId BaseSId; /// Allocated SIds begin at 128 (except for Agent Service) + +extern const NLMISC::TTime UnregisterTimeout; /// After 10s we remove an unregister service if every server didn't ACK the message + +extern NLNET::CCallbackServer *CallbackServer; + +#endif // NELNS_NAMING_SERVICE_VARIABLES_H From 04cdfc240f67dc8324ac744f0dcda6b65b226781 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Sat, 8 Jun 2024 18:56:07 +0000 Subject: [PATCH 033/126] extract some functions into separate files --- nelns/naming_service/CMakeLists.txt | 6 +- nelns/naming_service/naming_service.cpp | 258 +----------------- .../nelns/naming_service/can_access.cpp | 38 +++ .../nelns/naming_service/can_access.h | 12 + .../nelns/naming_service/do_remove.cpp | 93 +++++++ .../nelns/naming_service/do_remove.h | 14 + .../naming_service/do_unregister_service.cpp | 45 +++ .../naming_service/do_unregister_service.h | 12 + .../naming_service/effectively_remove.cpp | 12 + .../nelns/naming_service/effectively_remove.h | 10 + .../nelns/naming_service/helper.cpp | 20 +- .../nelns/naming_service/helper.h | 6 +- .../naming_service/service_instance_manager.h | 64 +++++ .../ryzom_naming_service.cpp | 2 +- 14 files changed, 344 insertions(+), 248 deletions(-) create mode 100644 nelns/naming_service/nelns/naming_service/can_access.cpp create mode 100644 nelns/naming_service/nelns/naming_service/can_access.h create mode 100644 nelns/naming_service/nelns/naming_service/do_remove.cpp create mode 100644 nelns/naming_service/nelns/naming_service/do_remove.h create mode 100644 nelns/naming_service/nelns/naming_service/do_unregister_service.cpp create mode 100644 nelns/naming_service/nelns/naming_service/do_unregister_service.h create mode 100644 nelns/naming_service/nelns/naming_service/effectively_remove.cpp create mode 100644 nelns/naming_service/nelns/naming_service/effectively_remove.h create mode 100644 nelns/naming_service/nelns/naming_service/service_instance_manager.h diff --git a/nelns/naming_service/CMakeLists.txt b/nelns/naming_service/CMakeLists.txt index af86f56b62..afca1b379e 100644 --- a/nelns/naming_service/CMakeLists.txt +++ b/nelns/naming_service/CMakeLists.txt @@ -1,6 +1,10 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}) add_library(nelns_naming_service + nelns/naming_service/can_access.cpp + nelns/naming_service/do_remove.cpp + nelns/naming_service/do_unregister_service.cpp + nelns/naming_service/effectively_remove.cpp nelns/naming_service/helper.cpp nelns/naming_service/variables.cpp ) @@ -9,8 +13,6 @@ add_library(nelns::ns ALIAS nelns_naming_service) ADD_EXECUTABLE(naming_service WIN32 naming_service.cpp - nelns/naming_service/helper.cpp - nelns/naming_service/helper.h ) TARGET_LINK_LIBRARIES(naming_service diff --git a/nelns/naming_service/naming_service.cpp b/nelns/naming_service/naming_service.cpp index ae6cfbd809..5d6c3f6d01 100644 --- a/nelns/naming_service/naming_service.cpp +++ b/nelns/naming_service/naming_service.cpp @@ -48,8 +48,12 @@ #include #include +#include +#include +#include #include #include +#include #include // @@ -74,73 +78,13 @@ NLMISC_COMMAND(test, "none", "none") } - -// Helper that emulates layer5's send() -//void sendToService( uint16 sid, CMessage& msgout ); - -// Helper that returns the first address of a service -CInetAddress getHostAddress( TServiceId sid ); - -// Asks a service to stop and tell every one -void doUnregisterService (TServiceId sid); - - -/** - * Manager for services instances - * (Moved from the TICKS to the NS) - * Implementable with layer 5, here implemented in NS (layer 3) - * \author Olivier Cado - * \author Nevrax France - * \date 2003 - */ -class CServiceInstanceManager -{ -public: - - /// Constructor - CServiceInstanceManager(); - - /** Add the name of a service which must not be duplicated - * If uniqueOnShard is true, only one service is allowed. - * If uniqueOnShard is false, one service is allowed by physical machine. - */ - void addUniqueService( const std::string& serviceName, bool uniqueOnShard ) - { - _UniqueServices.insert( std::make_pair( serviceName, uniqueOnShard ) ); - } - - /// Check if a service is allowed to start (if so, add it) - bool queryStartService( const std::string& serviceName, TServiceId serviceId, const std::vector &addr, string& reason ); - - /// Release a service instance - void releaseService( NLNET::TServiceId serviceId ); - - /// Display information - void displayInfo( NLMISC::CLog *log = NLMISC::InfoLog ) const; - - /// Make all controlled services quit - void killAllServices(); - -private: - - /// List of restricted services - std::map< std::string, bool > _UniqueServices; - - /// List of granted (online) services - std::set< TServiceId > _OnlineServices; -}; - - -CServiceInstanceManager *SIMInstance = NULL; - - /* * Constructor */ CServiceInstanceManager::CServiceInstanceManager() { - nlassert( ! SIMInstance ); - SIMInstance = this; + nlassert( ! _Instance ); + _Instance = this; // Note: addCallbackArray() done in CRangeMirrorManager::init() } @@ -244,42 +188,18 @@ void CServiceInstanceManager::killAllServices() } } +CServiceInstanceManager * CServiceInstanceManager::_Instance = nullptr; +CServiceInstanceManager *CServiceInstanceManager::getInstance() +{ + nlassert( _Instance ); + return _Instance; +} // // Functions // -bool canAccess (const vector &addr, const CServiceEntry &entry, vector &accessibleAddr) -{ - accessibleAddr.clear (); - - if (entry.WaitingUnregistration) - return false; - - for (uint i = 0; i < addr.size(); i++) - { - uint32 net = addr[i].internalNetAddress(); - for (uint j = 0; j < entry.Addr.size(); j++) - { - if (net == entry.Addr[j].internalNetAddress()) - { - accessibleAddr.push_back (entry.Addr[j]); - } - } - } - - if (accessibleAddr.empty()) - { - nldebug ("service %s-%hu is not accessible by '%s'", entry.Name.c_str(), entry.SId.get(), vectorCInetAddressToString (addr).c_str ()); - } - else - { - nldebug ("service %s-%hu is accessible by '%s'", entry.Name.c_str(), entry.SId.get(), vectorCInetAddressToString (accessibleAddr).c_str ()); - } - - return !accessibleAddr.empty (); -} void displayRegisteredServices (CLog *log = InfoLog) { @@ -304,137 +224,6 @@ void displayRegisteredServices (CLog *log = InfoLog) } -list::iterator effectivelyRemove (list::iterator &it) -{ - // remove the service from the registered service list - nlinfo ("Effectively remove the service %s-%hu", (*it).Name.c_str(), it->SId.get()); - return RegisteredServices.erase (it); -} - -/* - * Helper procedure for cbLookupAlternate and cbUnregister. - * Note: name is used for a LOGS. - */ -list::iterator doRemove (list::iterator it) -{ - nldebug ("Unregister the service %s-%hu '%s'", (*it).Name.c_str(), it->SId.get(), (*it).Addr[0].asString().c_str()); - - // tell to everybody that this service is unregistered - - CMessage msgout ("UNB"); - msgout.serial ((*it).Name); - msgout.serial ((*it).SId); - - vector accessibleAddress; - nlinfo ("Broadcast the Unregistration of %s-%hu to all registered services", (*it).Name.c_str(), it->SId.get()); - for (list::iterator it3 = RegisteredServices.begin(); it3 != RegisteredServices.end (); it3++) - { - if (canAccess((*it).Addr, (*it3), accessibleAddress)) - { - CallbackServer->send (msgout, (*it3).SockId); - //CNetManager::send ("NS", msgout, (*it3).SockId); - nldebug ("Broadcast to %s-%hu", (*it3).Name.c_str(), it3->SId.get()); - } - } - - // new system, after the unregistation broadcast, we wait ACK from all services before really remove - // the service, before, we tag the service as 'wait before unregister' - // if everybody didn't answer before the time out, we remove it - - (*it).SockId = NULL; - - (*it).WaitingUnregistration = true; - (*it).WaitingUnregistrationTime = CTime::getLocalTime(); - - // we remove all services awaiting his ACK because this service is down so it'll never ACK - for (list::iterator itr = RegisteredServices.begin(); itr != RegisteredServices.end (); itr++) - { - for (list::iterator itw = (*itr).WaitingUnregistrationServices.begin(); itw != (*itr).WaitingUnregistrationServices.end ();) - { - if ((*itw) == (*it).SId) - { - itw = (*itr).WaitingUnregistrationServices.erase (itw); - } - else - { - itw++; - } - } - } - - string res; - for (list::iterator it2 = RegisteredServices.begin(); it2 != RegisteredServices.end (); it2++) - { - if (!(*it2).WaitingUnregistration) - { - (*it).WaitingUnregistrationServices.push_back ((*it2).SId); - res += toString((*it2).SId.get()) + " "; - } - } - - nlinfo ("Before removing the service %s-%hu, we wait the ACK of '%s'", (*it).Name.c_str(), (*it).SId.get(), res.c_str()); - - if ((*it).WaitingUnregistrationServices.empty()) - { - return effectivelyRemove (it); - } - else - { - return ++it; - } - - // Release from the service instance manager - SIMInstance->releaseService( (*it).SId ); -} - -void doUnregisterService (TServiceId sid) -{ - list::iterator it; - for (it = RegisteredServices.begin(); it != RegisteredServices.end (); it++) - { - if ((*it).SId == sid) - { - // found it, remove it - doRemove (it); - return; - } - } - nlwarning ("Service %hu not found", sid.get()); -} - -void doUnregisterService (TSockId from) -{ - list::iterator it; - for (it = RegisteredServices.begin(); it != RegisteredServices.end ();) - { - if ((*it).SockId == from) - { - // it's possible that one "from" have more than one registred service, so we have to find in all the list - // found it, remove it - it = doRemove (it); - } - else - { - it++; - } - } -} - -/*void doUnregisterService (const CInetAddress &addr) -{ - list::iterator it; - for (it = RegisteredServices.begin(); it != RegisteredServices.end (); it++) - { - if ((*it).Addr == addr) - { - // found it, remove it - doRemove (it); - return; - } - } - nlwarning ("Service %s not found", addr.asString().c_str()); -}*/ - /* * Helper function for cbRegister. * If alloc_sid is true, sid is ignored @@ -527,7 +316,7 @@ bool doRegister (const string &name, const vector &addr, TServiceI if (ok) { // Check if the instance is allowed to start, according to the restriction in the config file - if ( SIMInstance->queryStartService( name, sid, addr, reason ) ) + if ( CServiceInstanceManager::getInstance()->queryStartService( name, sid, addr, reason ) ) { // add him in the registered list RegisteredServices.push_back (CServiceEntry(from, addr, name, sid)); @@ -869,23 +658,6 @@ static void cbRegisteredServices(CMessage& msgin, TSockId from, CCallbackNetBase }*/ -/* - * Helper that returns the first address of a service - */ -CInetAddress getHostAddress( TServiceId sid ) -{ - list::iterator it; - for (it = RegisteredServices.begin(); it != RegisteredServices.end (); it++) - { - if ((*it).SId == sid) - { - return (*it).Addr[0]; - } - } - return CInetAddress(); -} - - // // Callback array // @@ -1095,12 +867,12 @@ NLMISC_DYNVARIABLE(uint32, NbRegisteredServices, "display the number of service NLMISC_COMMAND( displayServiceInstances, "SIM: Display info on service instances", "" ) { - SIMInstance->displayInfo( &log ); + CServiceInstanceManager::getInstance()->displayInfo( &log ); return true; } NLMISC_COMMAND( killAllServices, "SIM: Make all the controlled services quit", "" ) { - SIMInstance->killAllServices(); + CServiceInstanceManager::getInstance()->killAllServices(); return true; } diff --git a/nelns/naming_service/nelns/naming_service/can_access.cpp b/nelns/naming_service/nelns/naming_service/can_access.cpp new file mode 100644 index 0000000000..0dc610dc49 --- /dev/null +++ b/nelns/naming_service/nelns/naming_service/can_access.cpp @@ -0,0 +1,38 @@ +#include + +#include + +using std::vector; + +using NLNET::CInetAddress; + +bool canAccess (const vector &addr, const CServiceEntry &entry, vector &accessibleAddr) +{ + accessibleAddr.clear (); + + if (entry.WaitingUnregistration) + return false; + + for (uint i = 0; i < addr.size(); i++) + { + uint32 net = addr[i].internalNetAddress(); + for (uint j = 0; j < entry.Addr.size(); j++) + { + if (net == entry.Addr[j].internalNetAddress()) + { + accessibleAddr.push_back (entry.Addr[j]); + } + } + } + + if (accessibleAddr.empty()) + { + nldebug ("service %s-%hu is not accessible by '%s'", entry.Name.c_str(), entry.SId.get(), vectorCInetAddressToString (addr).c_str ()); + } + else + { + nldebug ("service %s-%hu is accessible by '%s'", entry.Name.c_str(), entry.SId.get(), vectorCInetAddressToString (accessibleAddr).c_str ()); + } + + return !accessibleAddr.empty (); +} diff --git a/nelns/naming_service/nelns/naming_service/can_access.h b/nelns/naming_service/nelns/naming_service/can_access.h new file mode 100644 index 0000000000..31bcd68804 --- /dev/null +++ b/nelns/naming_service/nelns/naming_service/can_access.h @@ -0,0 +1,12 @@ +#ifndef NELNS_NAMING_SERVICE_CAN_ACCESS_H +#define NELNS_NAMING_SERVICE_CAN_ACCESS_H + +#include + +#include +#include +#include + +bool canAccess(const std::vector &addr, const CServiceEntry &entry, std::vector &accessibleAddr); + +#endif // NELNS_NAMING_SERVICE_CAN_ACCESS_H diff --git a/nelns/naming_service/nelns/naming_service/do_remove.cpp b/nelns/naming_service/nelns/naming_service/do_remove.cpp new file mode 100644 index 0000000000..caffc4ea3a --- /dev/null +++ b/nelns/naming_service/nelns/naming_service/do_remove.cpp @@ -0,0 +1,93 @@ +#include + +#include +#include +#include +#include +#include + +using std::list; +using std::string; +using std::vector; + +using NLMISC::CTime; +using NLMISC::toString; +using NLNET::CInetAddress; +using NLNET::CMessage; +using NLNET::TServiceId; + +/* + * Helper procedure for cbLookupAlternate and cbUnregister. + * Note: name is used for a LOGS. + */ +list::iterator doRemove(list::iterator it) +{ + nldebug("Unregister the service %s-%hu '%s'", (*it).Name.c_str(), it->SId.get(), (*it).Addr[0].asString().c_str()); + + // tell to everybody that this service is unregistered + + CMessage msgout("UNB"); + msgout.serial((*it).Name); + msgout.serial((*it).SId); + + vector accessibleAddress; + nlinfo("Broadcast the Unregistration of %s-%hu to all registered services", (*it).Name.c_str(), it->SId.get()); + for (list::iterator it3 = RegisteredServices.begin(); it3 != RegisteredServices.end(); it3++) + { + if (canAccess((*it).Addr, (*it3), accessibleAddress)) + { + CallbackServer->send(msgout, (*it3).SockId); + // CNetManager::send ("NS", msgout, (*it3).SockId); + nldebug("Broadcast to %s-%hu", (*it3).Name.c_str(), it3->SId.get()); + } + } + + // new system, after the unregistation broadcast, we wait ACK from all services before really remove + // the service, before, we tag the service as 'wait before unregister' + // if everybody didn't answer before the time out, we remove it + + (*it).SockId = NULL; + + (*it).WaitingUnregistration = true; + (*it).WaitingUnregistrationTime = CTime::getLocalTime(); + + // we remove all services awaiting his ACK because this service is down so it'll never ACK + for (list::iterator itr = RegisteredServices.begin(); itr != RegisteredServices.end(); itr++) + { + for (list::iterator itw = (*itr).WaitingUnregistrationServices.begin(); itw != (*itr).WaitingUnregistrationServices.end();) + { + if ((*itw) == (*it).SId) + { + itw = (*itr).WaitingUnregistrationServices.erase(itw); + } + else + { + itw++; + } + } + } + + string res; + for (list::iterator it2 = RegisteredServices.begin(); it2 != RegisteredServices.end(); it2++) + { + if (!(*it2).WaitingUnregistration) + { + (*it).WaitingUnregistrationServices.push_back((*it2).SId); + res += toString((*it2).SId.get()) + " "; + } + } + + nlinfo("Before removing the service %s-%hu, we wait the ACK of '%s'", (*it).Name.c_str(), (*it).SId.get(), res.c_str()); + + if ((*it).WaitingUnregistrationServices.empty()) + { + return effectivelyRemove(it); + } + else + { + return ++it; + } + + // Release from the service instance manager + CServiceInstanceManager::getInstance()->releaseService((*it).SId); +} diff --git a/nelns/naming_service/nelns/naming_service/do_remove.h b/nelns/naming_service/nelns/naming_service/do_remove.h new file mode 100644 index 0000000000..6f0a79bff2 --- /dev/null +++ b/nelns/naming_service/nelns/naming_service/do_remove.h @@ -0,0 +1,14 @@ +#ifndef NELNS_NAMING_SERVICE_DO_REMOVE_H +#define NELNS_NAMING_SERVICE_DO_REMOVE_H + +#include + +#include + +/* + * Helper procedure for cbLookupAlternate and cbUnregister. + * Note: name is used for a LOGS. + */ +std::list::iterator doRemove(std::list::iterator it); + +#endif // NELNS_NAMING_SERVICE_DO_REMOVE_H diff --git a/nelns/naming_service/nelns/naming_service/do_unregister_service.cpp b/nelns/naming_service/nelns/naming_service/do_unregister_service.cpp new file mode 100644 index 0000000000..9ed14d1601 --- /dev/null +++ b/nelns/naming_service/nelns/naming_service/do_unregister_service.cpp @@ -0,0 +1,45 @@ +#include + +#include +#include +#include +#include + +using std::list; + +using NLNET::CInetAddress; +using NLNET::TServiceId; +using NLNET::TSockId; + +void doUnregisterService(const TServiceId &sid) +{ + list::iterator it; + for (it = RegisteredServices.begin(); it != RegisteredServices.end(); it++) + { + if ((*it).SId == sid) + { + // found it, remove it + doRemove(it); + return; + } + } + nlwarning("Service %hu not found", sid.get()); +} + +void doUnregisterService(const NLNET::TSockId &from) +{ + list::iterator it; + for (it = RegisteredServices.begin(); it != RegisteredServices.end();) + { + if ((*it).SockId == from) + { + // it's possible that one "from" have more than one registred service, so we have to find in all the list + // found it, remove it + it = doRemove(it); + } + else + { + it++; + } + } +} diff --git a/nelns/naming_service/nelns/naming_service/do_unregister_service.h b/nelns/naming_service/nelns/naming_service/do_unregister_service.h new file mode 100644 index 0000000000..a0112a4b93 --- /dev/null +++ b/nelns/naming_service/nelns/naming_service/do_unregister_service.h @@ -0,0 +1,12 @@ +#ifndef NELNS_NAMING_SERVICE_DO_UNREGISTER_SERVICE_H +#define NELNS_NAMING_SERVICE_DO_UNREGISTER_SERVICE_H + +#include +#include + +// Asks a service to stop and tell every one +void doUnregisterService(const NLNET::TServiceId &sid); + +void doUnregisterService(const NLNET::TSockId &from); + +#endif // NELNS_NAMING_SERVICE_DO_UNREGISTER_SERVICE_H diff --git a/nelns/naming_service/nelns/naming_service/effectively_remove.cpp b/nelns/naming_service/nelns/naming_service/effectively_remove.cpp new file mode 100644 index 0000000000..4b7f754565 --- /dev/null +++ b/nelns/naming_service/nelns/naming_service/effectively_remove.cpp @@ -0,0 +1,12 @@ +#include + +#include + +using std::list; + +list::iterator effectivelyRemove(list::iterator &it) +{ + // remove the service from the registered service list + nlinfo ("Effectively remove the service %s-%hu", (*it).Name.c_str(), it->SId.get()); + return RegisteredServices.erase (it); +} diff --git a/nelns/naming_service/nelns/naming_service/effectively_remove.h b/nelns/naming_service/nelns/naming_service/effectively_remove.h new file mode 100644 index 0000000000..af67fd348a --- /dev/null +++ b/nelns/naming_service/nelns/naming_service/effectively_remove.h @@ -0,0 +1,10 @@ +#ifndef NELNS_NAMING_SERVICE_EFFECTIVELY_REMOVE_H +#define NELNS_NAMING_SERVICE_EFFECTIVELY_REMOVE_H + +#include + +#include + +std::list::iterator effectivelyRemove (std::list::iterator &it); + +#endif // NELNS_NAMING_SERVICE_EFFECTIVELY_REMOVE_H diff --git a/nelns/naming_service/nelns/naming_service/helper.cpp b/nelns/naming_service/nelns/naming_service/helper.cpp index 5d1f73ef87..984f10941d 100644 --- a/nelns/naming_service/nelns/naming_service/helper.cpp +++ b/nelns/naming_service/nelns/naming_service/helper.cpp @@ -1,18 +1,20 @@ #include #include + #include #include using std::list; using std::string; +using NLNET::CInetAddress; using NLNET::TServiceId; /* * Helper that emulate layer5's getServiceName() */ -string getServiceName( TServiceId sid ) +string getServiceName( const TServiceId& sid ) { list::iterator it; for (it = RegisteredServices.begin(); it != RegisteredServices.end (); it++) @@ -25,3 +27,19 @@ string getServiceName( TServiceId sid ) return ""; // not found } + +/* + * Helper that returns the first address of a service + */ +CInetAddress getHostAddress( const TServiceId& sid ) +{ + list::iterator it; + for (it = RegisteredServices.begin(); it != RegisteredServices.end (); it++) + { + if ((*it).SId == sid) + { + return (*it).Addr[0]; + } + } + return {}; +} diff --git a/nelns/naming_service/nelns/naming_service/helper.h b/nelns/naming_service/nelns/naming_service/helper.h index 471be8a9d1..09b4981279 100644 --- a/nelns/naming_service/nelns/naming_service/helper.h +++ b/nelns/naming_service/nelns/naming_service/helper.h @@ -3,9 +3,13 @@ #include +#include #include // Helper that emulate layer5's getServiceName() -std::string getServiceName(NLNET::TServiceId sid); +std::string getServiceName(const NLNET::TServiceId& sid); + +// Helper that returns the first address of a service +NLNET::CInetAddress getHostAddress( const NLNET::TServiceId& sid ); #endif // NELNS_NAMING_SERVICE_HELPER_H diff --git a/nelns/naming_service/nelns/naming_service/service_instance_manager.h b/nelns/naming_service/nelns/naming_service/service_instance_manager.h new file mode 100644 index 0000000000..1800ddf18b --- /dev/null +++ b/nelns/naming_service/nelns/naming_service/service_instance_manager.h @@ -0,0 +1,64 @@ +#ifndef NELNS_NAMING_SERVICE_SERVICE_INSTANCE_MANAGER_H +#define NELNS_NAMING_SERVICE_SERVICE_INSTANCE_MANAGER_H + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +/** + * Manager for services instances + * (Moved from the TICKS to the NS) + * Implementable with layer 5, here implemented in NS (layer 3) + * \author Olivier Cado + * \author Nevrax France + * \date 2003 + */ +class CServiceInstanceManager +{ +private: + static CServiceInstanceManager *_Instance; + +public: + static CServiceInstanceManager *getInstance(); + + /// Constructor + CServiceInstanceManager(); + + /** Add the name of a service which must not be duplicated + * If uniqueOnShard is true, only one service is allowed. + * If uniqueOnShard is false, one service is allowed by physical machine. + */ + void addUniqueService(const std::string &serviceName, bool uniqueOnShard) + { + _UniqueServices.insert(std::make_pair(serviceName, uniqueOnShard)); + } + + /// Check if a service is allowed to start (if so, add it) + bool queryStartService(const std::string &serviceName, NLNET::TServiceId serviceId, const std::vector &addr, std::string &reason); + + /// Release a service instance + void releaseService(NLNET::TServiceId serviceId); + + /// Display information + void displayInfo(NLMISC::CLog *log = NLMISC::InfoLog) const; + + /// Make all controlled services quit + void killAllServices(); + +private: + /// List of restricted services + std::map _UniqueServices; + + /// List of granted (online) services + std::set _OnlineServices; +}; + +#endif // NELNS_NAMING_SERVICE_SERVICE_INSTANCE_MANAGER_H diff --git a/ryzom/server/src/ryzom_naming_service/ryzom_naming_service.cpp b/ryzom/server/src/ryzom_naming_service/ryzom_naming_service.cpp index be8a34e9d1..3905f63524 100644 --- a/ryzom/server/src/ryzom_naming_service/ryzom_naming_service.cpp +++ b/ryzom/server/src/ryzom_naming_service/ryzom_naming_service.cpp @@ -471,7 +471,7 @@ void doUnregisterService (TServiceId sid) nlwarning ("Service %hu not found", sid.get()); } -void doUnregisterService (TSockId from) +void doUnregisterService (const NLNET::TSockId &from) { list::iterator it; for (it = RegisteredServices.begin(); it != RegisteredServices.end ();) From 01d6b98efb98277475894b493d9413d0fc11b9a3 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Sat, 8 Jun 2024 18:59:54 +0000 Subject: [PATCH 034/126] removed clutter --- nelns/naming_service/naming_service.cpp | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/nelns/naming_service/naming_service.cpp b/nelns/naming_service/naming_service.cpp index 5d6c3f6d01..052e25c708 100644 --- a/nelns/naming_service/naming_service.cpp +++ b/nelns/naming_service/naming_service.cpp @@ -236,27 +236,6 @@ bool doRegister (const string &name, const vector &addr, TServiceI string reason; uint8 ok = true; bool needRegister = true; - /*for (list::iterator it = RegisteredServices.begin(); it != RegisteredServices.end (); it++) - { - if ((*it).Addr.asIPString() == addr.asIPString() ) - { - // we already have a service on this address, remplace it if it's the same name - if ((*it).Name == name) - { - // it's the same service, replace it - (*it).SockId = from; - sid = (*it).SId; - nlinfo ("Replace the service %s", name.c_str()); - } - else - { - nlwarning ("Try to register %s to %s but the service %s already on this address. ignore it!", name.c_str(), addr.asIPString().c_str(), (*it).Name.c_str()); - ok = false; - } - needRegister = false; - break; - } - }*/ if (needRegister) { From b8066665fa2a7b08e966f88eb72d058b16db6f41 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Sat, 8 Jun 2024 19:23:32 +0000 Subject: [PATCH 035/126] simplify code --- nelns/naming_service/naming_service.cpp | 210 ++++++++++++------------ 1 file changed, 103 insertions(+), 107 deletions(-) diff --git a/nelns/naming_service/naming_service.cpp b/nelns/naming_service/naming_service.cpp index 052e25c708..fe7a6caaa0 100644 --- a/nelns/naming_service/naming_service.cpp +++ b/nelns/naming_service/naming_service.cpp @@ -235,149 +235,145 @@ bool doRegister (const string &name, const vector &addr, TServiceI // Find if the service is not already registered string reason; uint8 ok = true; - bool needRegister = true; - if (needRegister) + if (sid.get() == 0) { - if (sid.get() == 0) + // we have to find a sid + sid = BaseSId; + bool found = false; + while (!found) { - // we have to find a sid - sid = BaseSId; - bool found = false; - while (!found) + list::iterator it; + for (it = RegisteredServices.begin(); it != RegisteredServices.end (); it++) { - list::iterator it; - for (it = RegisteredServices.begin(); it != RegisteredServices.end (); it++) - { - if ((*it).SId == sid) - { - break; - } - } - if (it == RegisteredServices.end ()) - { - // ok, we have an empty sid - found = true; - } - else + if ((*it).SId == sid) { - sid.set(sid.get()+1); - if (sid.get() == 0) // round the clock - { - nlwarning ("Service identifier allocation overflow"); - ok = false; - break; - } + break; } } - - } - else - { - // we have to check that the user provided sid is available - list::iterator it; - for (it = RegisteredServices.begin(); it != RegisteredServices.end (); it++) + if (it == RegisteredServices.end ()) { - if ((*it).SId == sid) + // ok, we have an empty sid + found = true; + } + else + { + sid.set(sid.get()+1); + if (sid.get() == 0) // round the clock { - nlwarning ("Sid %d already used by another service", sid.get()); + nlwarning ("Service identifier allocation overflow"); ok = false; break; } } - if (it != RegisteredServices.end ()) + } + + } + else + { + // we have to check that the user provided sid is available + list::iterator it; + for (it = RegisteredServices.begin(); it != RegisteredServices.end (); it++) + { + if ((*it).SId == sid) { - ok = true; + nlwarning ("Sid %d already used by another service", sid.get()); + ok = false; + break; } } + if (it != RegisteredServices.end ()) + { + ok = true; + } + } - // if ok, register the service and send a broadcast to other people - if (ok) + // if ok, register the service and send a broadcast to other people + if (ok) + { + // Check if the instance is allowed to start, according to the restriction in the config file + if ( CServiceInstanceManager::getInstance()->queryStartService( name, sid, addr, reason ) ) { - // Check if the instance is allowed to start, according to the restriction in the config file - if ( CServiceInstanceManager::getInstance()->queryStartService( name, sid, addr, reason ) ) + // add him in the registered list + RegisteredServices.push_back (CServiceEntry(from, addr, name, sid)); + + // tell to everybody but not him that this service is registered + if (!reconnection) { - // add him in the registered list - RegisteredServices.push_back (CServiceEntry(from, addr, name, sid)); + CMessage msgout ("RGB"); + TServiceId::size_type s = 1; + msgout.serial (s); + msgout.serial (const_cast(name)); + msgout.serial (sid); + // we need to send all addr to all services even if the service can't access because we use the address index + // to know which connection comes. + msgout.serialCont (const_cast &>(addr)); + nlinfo ("The service is %s-%d, broadcast the Registration to everybody", name.c_str(), sid.get()); - // tell to everybody but not him that this service is registered - if (!reconnection) + vector accessibleAddress; + for (list::iterator it3 = RegisteredServices.begin(); it3 != RegisteredServices.end (); it3++) { - CMessage msgout ("RGB"); - TServiceId::size_type s = 1; - msgout.serial (s); - msgout.serial (const_cast(name)); - msgout.serial (sid); - // we need to send all addr to all services even if the service can't access because we use the address index - // to know which connection comes. - msgout.serialCont (const_cast &>(addr)); - nlinfo ("The service is %s-%d, broadcast the Registration to everybody", name.c_str(), sid.get()); - - vector accessibleAddress; - for (list::iterator it3 = RegisteredServices.begin(); it3 != RegisteredServices.end (); it3++) + // send only services that can be accessed and not itself + if ((*it3).SId != sid && canAccess(addr, (*it3), accessibleAddress)) { - // send only services that can be accessed and not itself - if ((*it3).SId != sid && canAccess(addr, (*it3), accessibleAddress)) - { - CallbackServer->send (msgout, (*it3).SockId); - //CNetManager::send ("NS", msgout, (*it3).SockId); - nldebug ("Broadcast to %s-%hu", (*it3).Name.c_str(), it3->SId.get()); - } + CallbackServer->send (msgout, (*it3).SockId); + //CNetManager::send ("NS", msgout, (*it3).SockId); + nldebug ("Broadcast to %s-%hu", (*it3).Name.c_str(), it3->SId.get()); } } - - // set the sid only if it s ok - from->setAppId (sid.get()); - } - else - { - // Reply "startup denied", and do not send registration to other services - ok = false; } + + // set the sid only if it s ok + from->setAppId (sid.get()); } + else + { + // Reply "startup denied", and do not send registration to other services + ok = false; + } + } - // send the message to the service to say if it s ok or not - if (!reconnection) + // send the message to the service to say if it s ok or not + if (!reconnection) + { + // send the answer to the client + CMessage msgout ("RG"); + msgout.serial (ok); + if (ok) { - // send the answer to the client - CMessage msgout ("RG"); - msgout.serial (ok); - if (ok) - { - msgout.serial (sid); + msgout.serial (sid); - // send him all services available (also itself) - TServiceId::size_type nb = 0; + // send him all services available (also itself) + TServiceId::size_type nb = 0; - vector accessibleAddress; + vector accessibleAddress; - for (list::iterator it2 = RegisteredServices.begin(); it2 != RegisteredServices.end (); it2++) - { - // send only services that are available - if (canAccess(addr, (*it2), accessibleAddress)) - nb++; - } - msgout.serial (nb); + for (list::iterator it2 = RegisteredServices.begin(); it2 != RegisteredServices.end (); it2++) + { + // send only services that are available + if (canAccess(addr, (*it2), accessibleAddress)) + nb++; + } + msgout.serial (nb); - for (list::iterator it = RegisteredServices.begin(); it != RegisteredServices.end (); it++) + for (list::iterator it = RegisteredServices.begin(); it != RegisteredServices.end (); it++) + { + // send only services that are available + if (canAccess(addr, (*it), accessibleAddress)) { - // send only services that are available - if (canAccess(addr, (*it), accessibleAddress)) - { - msgout.serial ((*it).Name); - msgout.serial ((*it).SId); - msgout.serialCont ((*it).Addr); - } + msgout.serial ((*it).Name); + msgout.serial ((*it).SId); + msgout.serialCont ((*it).Addr); } } - else - { - msgout.serial( reason ); - } - - netbase.send (msgout, from); - netbase.flush (from); } + else + { + msgout.serial( reason ); + } + + netbase.send (msgout, from); + netbase.flush (from); } //displayRegisteredServices (); From 10933b9a8145e132900eaf80586854e2ec342a75 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Sat, 8 Jun 2024 19:38:53 +0000 Subject: [PATCH 036/126] move naming service tests into corresponding subfolder --- nelns/CMakeLists.txt | 3 -- nelns/naming_service/CMakeLists.txt | 4 +++ nelns/naming_service/naming_service.cpp | 6 ++-- nelns/naming_service/tests/CMakeLists.txt | 30 +++++++++++++++++++ .../tests/naming_service.test.cpp | 0 .../tests/service_instance_manager.test.cpp | 9 ++++++ nelns/tests/CMakeLists.txt | 14 --------- 7 files changed, 46 insertions(+), 20 deletions(-) create mode 100644 nelns/naming_service/tests/CMakeLists.txt rename nelns/{ => naming_service}/tests/naming_service.test.cpp (100%) create mode 100644 nelns/naming_service/tests/service_instance_manager.test.cpp delete mode 100644 nelns/tests/CMakeLists.txt diff --git a/nelns/CMakeLists.txt b/nelns/CMakeLists.txt index 36f8f27599..d451111185 100644 --- a/nelns/CMakeLists.txt +++ b/nelns/CMakeLists.txt @@ -4,9 +4,6 @@ IF(WITH_NELNS_SERVER) ADD_SUBDIRECTORY(admin_executor_service) ADD_SUBDIRECTORY(admin_service) ADD_SUBDIRECTORY(naming_service) - IF (WITH_NEL_TESTS) - ADD_SUBDIRECTORY(tests) - ENDIF () ADD_SUBDIRECTORY(login_service) ADD_SUBDIRECTORY(welcome_service) ENDIF() diff --git a/nelns/naming_service/CMakeLists.txt b/nelns/naming_service/CMakeLists.txt index afca1b379e..6ce0fc4864 100644 --- a/nelns/naming_service/CMakeLists.txt +++ b/nelns/naming_service/CMakeLists.txt @@ -26,3 +26,7 @@ NL_ADD_RUNTIME_FLAGS(naming_service) INSTALL(TARGETS naming_service RUNTIME DESTINATION sbin COMPONENT ns) INSTALL(FILES naming_service.cfg common.cfg DESTINATION ${NL_ETC_PREFIX}/nelns COMPONENT ns) + +IF (WITH_NEL_TESTS) + ADD_SUBDIRECTORY(tests) +ENDIF () diff --git a/nelns/naming_service/naming_service.cpp b/nelns/naming_service/naming_service.cpp index fe7a6caaa0..a84e87b111 100644 --- a/nelns/naming_service/naming_service.cpp +++ b/nelns/naming_service/naming_service.cpp @@ -83,8 +83,8 @@ NLMISC_COMMAND(test, "none", "none") */ CServiceInstanceManager::CServiceInstanceManager() { - nlassert( ! _Instance ); - _Instance = this; + nlassert( !_SIMInstance); + _SIMInstance = this; // Note: addCallbackArray() done in CRangeMirrorManager::init() } @@ -192,7 +192,7 @@ CServiceInstanceManager * CServiceInstanceManager::_Instance = nullptr; CServiceInstanceManager *CServiceInstanceManager::getInstance() { - nlassert( _Instance ); + nlassert(_Instance); return _Instance; } diff --git a/nelns/naming_service/tests/CMakeLists.txt b/nelns/naming_service/tests/CMakeLists.txt new file mode 100644 index 0000000000..d95c8dbb76 --- /dev/null +++ b/nelns/naming_service/tests/CMakeLists.txt @@ -0,0 +1,30 @@ +set(TEST_NAME "naming_service_test") + +add_executable("${TEST_NAME}" + naming_service.test.cpp +) +target_link_libraries("${TEST_NAME}" + GTest::gtest_main + nelmisc + nelnet + nelns::ns +) +gtest_discover_tests("${TEST_NAME}" + EXTRA_ARGS "--gtest_output=xml:${CMAKE_CURRENT_BINARY_DIR}/reports/junit-${TEST_NAME}.xml" +) + +set(TEST_NAME "service_instance_manager_test") + +add_executable("${TEST_NAME}" + service_instance_manager.test.cpp +) +target_link_libraries("${TEST_NAME}" + GTest::gtest_main + nelmisc + nelnet + nelns::ns +) +gtest_discover_tests("${TEST_NAME}" + EXTRA_ARGS "--gtest_output=xml:${CMAKE_CURRENT_BINARY_DIR}/reports/junit-${TEST_NAME}.xml" +) + diff --git a/nelns/tests/naming_service.test.cpp b/nelns/naming_service/tests/naming_service.test.cpp similarity index 100% rename from nelns/tests/naming_service.test.cpp rename to nelns/naming_service/tests/naming_service.test.cpp diff --git a/nelns/naming_service/tests/service_instance_manager.test.cpp b/nelns/naming_service/tests/service_instance_manager.test.cpp new file mode 100644 index 0000000000..4630caf4ae --- /dev/null +++ b/nelns/naming_service/tests/service_instance_manager.test.cpp @@ -0,0 +1,9 @@ +#include + +#include + +TEST(CServiceInstanceManager, ShouldWork) { + EXPECT_STRNE("hello", "world"); + EXPECT_EQ(7 * 6, 42); + CServiceInstanceManager instance; +} diff --git a/nelns/tests/CMakeLists.txt b/nelns/tests/CMakeLists.txt deleted file mode 100644 index ad0f8a5eb2..0000000000 --- a/nelns/tests/CMakeLists.txt +++ /dev/null @@ -1,14 +0,0 @@ -set(TEST_NAME "naming_service_test") - -add_executable("${TEST_NAME}" - naming_service.test.cpp -) -target_link_libraries("${TEST_NAME}" - GTest::gtest_main - nelmisc - nelnet -) -gtest_discover_tests("${TEST_NAME}" - EXTRA_ARGS "--gtest_output=xml:${CMAKE_CURRENT_BINARY_DIR}/reports/junit-${TEST_NAME}.xml" -) - From 1b698b22482365ca9a3ab4c9ea771e9855e09dee Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Sat, 8 Jun 2024 20:05:46 +0000 Subject: [PATCH 037/126] move CServiceInstanceManager into separate file and add first test for it --- nelns/naming_service/CMakeLists.txt | 8 +- nelns/naming_service/naming_service.cpp | 118 ---------------- .../service_instance_manager.cpp | 131 ++++++++++++++++++ 3 files changed, 136 insertions(+), 121 deletions(-) create mode 100644 nelns/naming_service/nelns/naming_service/service_instance_manager.cpp diff --git a/nelns/naming_service/CMakeLists.txt b/nelns/naming_service/CMakeLists.txt index 6ce0fc4864..55ea2d3083 100644 --- a/nelns/naming_service/CMakeLists.txt +++ b/nelns/naming_service/CMakeLists.txt @@ -6,18 +6,20 @@ add_library(nelns_naming_service nelns/naming_service/do_unregister_service.cpp nelns/naming_service/effectively_remove.cpp nelns/naming_service/helper.cpp + nelns/naming_service/service_instance_manager.cpp nelns/naming_service/variables.cpp ) add_library(nelns::ns ALIAS nelns_naming_service) - +target_link_libraries(nelns_naming_service + nelmisc + nelnet +) ADD_EXECUTABLE(naming_service WIN32 naming_service.cpp ) TARGET_LINK_LIBRARIES(naming_service - nelmisc - nelnet nelns::ns ) diff --git a/nelns/naming_service/naming_service.cpp b/nelns/naming_service/naming_service.cpp index a84e87b111..bab0053c22 100644 --- a/nelns/naming_service/naming_service.cpp +++ b/nelns/naming_service/naming_service.cpp @@ -78,124 +78,6 @@ NLMISC_COMMAND(test, "none", "none") } -/* - * Constructor - */ -CServiceInstanceManager::CServiceInstanceManager() -{ - nlassert( !_SIMInstance); - _SIMInstance = this; - - // Note: addCallbackArray() done in CRangeMirrorManager::init() -} - - -/* - * Check if a service is allowed to start. Answer with a GSTS (Grant Start Service) message - */ -bool CServiceInstanceManager::queryStartService( const std::string& serviceName, TServiceId serviceId, const vector &addr, string& reason ) -{ - bool grantStarting = true; - std::map< std::string, bool >::iterator ius = _UniqueServices.find( serviceName ); - if ( ius != _UniqueServices.end() ) - { - // Service is restricted - set< TServiceId >::iterator ios; - bool uniqueOnShard = (*ius).second; - for ( ios=_OnlineServices.begin(); ios!=_OnlineServices.end(); ++ios ) - { - string name = getServiceName( *ios ); - if ( name == serviceName ) - { - if ( uniqueOnShard ) - { - // Only one service by shard is allowed => deny - grantStarting = false; - reason = toString( "Service %s already found as %hu, must be unique on shard", serviceName.c_str(), ios->get() ); - nlinfo( reason.c_str() ); - break; - } - else - { - // Only one service by physical machine is allowed - - // Implementation for layer5 - //TSockId hostid1, hostid2; - /*CCallbackNetBase *cnb1 = CUnifiedNetwork::getInstance()->getNetBase( serviceId, hostid1 ); - CCallbackNetBase *cnb2 = CUnifiedNetwork::getInstance()->getNetBase( *ios, hostid2 ); - if ( cnb1->hostAddress( hostid1 ).internalIPAddress() == cnb2->hostAddress( hostid2 ).internalIPAddress() )*/ - - // Implementation for NS - if ( addr[0].getAddress() == getHostAddress( *ios ).getAddress() ) - { - grantStarting = false; - reason = toString( "Service %s already found as %hu on same machine", serviceName.c_str(), ios->get() ); - nlinfo( reason.c_str() ); - break; - } - } - } - } - } - - if ( grantStarting ) - { - _OnlineServices.insert( serviceId ); - } - return grantStarting; -} - - -/* - * Release a service instance - */ -void CServiceInstanceManager::releaseService( NLNET::TServiceId serviceId ) -{ - _OnlineServices.erase( serviceId ); // not a problem if not found -} - - -/* - * Display information - */ -void CServiceInstanceManager::displayInfo( NLMISC::CLog *log ) const -{ - log->displayNL( "Restricted services:" ); - std::map< std::string, bool >::const_iterator ius; - for ( ius=_UniqueServices.begin(); ius!=_UniqueServices.end(); ++ius ) - { - log->displayNL( "%s -> only one per %s", (*ius).first.c_str(), (*ius).second?"shard":"machine" ); - } - log->displayNL( "Online registered services:" ); - std::set< TServiceId >::const_iterator ios; - for ( ios=_OnlineServices.begin(); ios!=_OnlineServices.end(); ++ios ) - { - log->displayNL( "%s", CUnifiedNetwork::getInstance()->getServiceUnifiedName( *ios ).c_str() ); - } -} - - -/* - * Make all controlled services quit - */ -void CServiceInstanceManager::killAllServices() -{ - // Send to all known online services - std::set< TServiceId >::const_iterator ios; - for ( ios=_OnlineServices.begin(); ios!=_OnlineServices.end(); ++ios ) - { - doUnregisterService( (TServiceId)(*ios) ); - } -} - -CServiceInstanceManager * CServiceInstanceManager::_Instance = nullptr; - -CServiceInstanceManager *CServiceInstanceManager::getInstance() -{ - nlassert(_Instance); - return _Instance; -} - // // Functions // diff --git a/nelns/naming_service/nelns/naming_service/service_instance_manager.cpp b/nelns/naming_service/nelns/naming_service/service_instance_manager.cpp new file mode 100644 index 0000000000..bb7a20481f --- /dev/null +++ b/nelns/naming_service/nelns/naming_service/service_instance_manager.cpp @@ -0,0 +1,131 @@ +#include + +#include +#include +#include +#include +#include + +using std::map; +using std::set; +using std::string; +using std::vector; + +using NLMISC::toString; +using NLNET::CInetAddress; +using NLNET::CUnifiedNetwork; +using NLNET::TServiceId; + +CServiceInstanceManager *CServiceInstanceManager::_Instance = nullptr; + +CServiceInstanceManager *CServiceInstanceManager::getInstance() +{ + nlassert(_Instance); + return _Instance; +} + +/* + * Constructor + */ +CServiceInstanceManager::CServiceInstanceManager() +{ + nlassert(!_Instance); + _Instance = this; + + // Note: addCallbackArray() done in CRangeMirrorManager::init() +} + +/* + * Check if a service is allowed to start. Answer with a GSTS (Grant Start Service) message + */ +bool CServiceInstanceManager::queryStartService(const string &serviceName, TServiceId serviceId, const vector &addr, string &reason) +{ + bool grantStarting = true; + map::iterator ius = _UniqueServices.find(serviceName); + if (ius != _UniqueServices.end()) + { + // Service is restricted + set::iterator ios; + bool uniqueOnShard = (*ius).second; + for (ios = _OnlineServices.begin(); ios != _OnlineServices.end(); ++ios) + { + string name = getServiceName(*ios); + if (name == serviceName) + { + if (uniqueOnShard) + { + // Only one service by shard is allowed => deny + grantStarting = false; + reason = toString("Service %s already found as %hu, must be unique on shard", serviceName.c_str(), ios->get()); + nlinfo(reason.c_str()); + break; + } + else + { + // Only one service by physical machine is allowed + + // Implementation for layer5 + // TSockId hostid1, hostid2; + /*CCallbackNetBase *cnb1 = CUnifiedNetwork::getInstance()->getNetBase( serviceId, hostid1 ); + CCallbackNetBase *cnb2 = CUnifiedNetwork::getInstance()->getNetBase( *ios, hostid2 ); + if ( cnb1->hostAddress( hostid1 ).internalIPAddress() == cnb2->hostAddress( hostid2 ).internalIPAddress() )*/ + + // Implementation for NS + if (addr[0].getAddress() == getHostAddress(*ios).getAddress()) + { + grantStarting = false; + reason = toString("Service %s already found as %hu on same machine", serviceName.c_str(), ios->get()); + nlinfo(reason.c_str()); + break; + } + } + } + } + } + + if (grantStarting) + { + _OnlineServices.insert(serviceId); + } + return grantStarting; +} + +/* + * Release a service instance + */ +void CServiceInstanceManager::releaseService(NLNET::TServiceId serviceId) +{ + _OnlineServices.erase(serviceId); // not a problem if not found +} + +/* + * Display information + */ +void CServiceInstanceManager::displayInfo(NLMISC::CLog *log) const +{ + log->displayNL("Restricted services:"); + map::const_iterator ius; + for (ius = _UniqueServices.begin(); ius != _UniqueServices.end(); ++ius) + { + log->displayNL("%s -> only one per %s", (*ius).first.c_str(), (*ius).second ? "shard" : "machine"); + } + log->displayNL("Online registered services:"); + set::const_iterator ios; + for (ios = _OnlineServices.begin(); ios != _OnlineServices.end(); ++ios) + { + log->displayNL("%s", CUnifiedNetwork::getInstance()->getServiceUnifiedName(*ios).c_str()); + } +} + +/* + * Make all controlled services quit + */ +void CServiceInstanceManager::killAllServices() +{ + // Send to all known online services + std::set::const_iterator ios; + for (ios = _OnlineServices.begin(); ios != _OnlineServices.end(); ++ios) + { + doUnregisterService((TServiceId)(*ios)); + } +} From 3e94cc55fbf16401d0e1931638ccd95e7faaa89d Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Sat, 8 Jun 2024 20:26:34 +0000 Subject: [PATCH 038/126] add test case for service instance manager singleton --- nelns/naming_service/tests/CMakeLists.txt | 1 + .../tests/service_instance_manager.test.cpp | 14 ++++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/nelns/naming_service/tests/CMakeLists.txt b/nelns/naming_service/tests/CMakeLists.txt index d95c8dbb76..b9793e319f 100644 --- a/nelns/naming_service/tests/CMakeLists.txt +++ b/nelns/naming_service/tests/CMakeLists.txt @@ -20,6 +20,7 @@ add_executable("${TEST_NAME}" ) target_link_libraries("${TEST_NAME}" GTest::gtest_main + GTest::gmock nelmisc nelnet nelns::ns diff --git a/nelns/naming_service/tests/service_instance_manager.test.cpp b/nelns/naming_service/tests/service_instance_manager.test.cpp index 4630caf4ae..58e61205ac 100644 --- a/nelns/naming_service/tests/service_instance_manager.test.cpp +++ b/nelns/naming_service/tests/service_instance_manager.test.cpp @@ -2,8 +2,14 @@ #include -TEST(CServiceInstanceManager, ShouldWork) { - EXPECT_STRNE("hello", "world"); - EXPECT_EQ(7 * 6, 42); - CServiceInstanceManager instance; +TEST(CServiceInstanceManager, getInstanceShouldThrowIfNotInitialized) { + ASSERT_DEATH({ + CServiceInstanceManager::getInstance(); + }, ""); +} + +TEST(CServiceInstanceManager, ConstructorShouldNotThrow) { + EXPECT_NO_THROW({ + CServiceInstanceManager instance; + }); } From a85a166f055db73a223c263e1097afddfad16959 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Sun, 9 Jun 2024 06:31:42 +0000 Subject: [PATCH 039/126] add test for singleton handling in CServiceInstanceManager --- .../service_instance_manager.cpp | 9 +++++++-- .../naming_service/service_instance_manager.h | 2 ++ .../tests/service_instance_manager.test.cpp | 20 +++++++++++++++++-- 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/nelns/naming_service/nelns/naming_service/service_instance_manager.cpp b/nelns/naming_service/nelns/naming_service/service_instance_manager.cpp index bb7a20481f..582156e47f 100644 --- a/nelns/naming_service/nelns/naming_service/service_instance_manager.cpp +++ b/nelns/naming_service/nelns/naming_service/service_instance_manager.cpp @@ -20,7 +20,7 @@ CServiceInstanceManager *CServiceInstanceManager::_Instance = nullptr; CServiceInstanceManager *CServiceInstanceManager::getInstance() { - nlassert(_Instance); + nlassertex(_Instance, ("No Singleton Instance existing")); return _Instance; } @@ -29,12 +29,17 @@ CServiceInstanceManager *CServiceInstanceManager::getInstance() */ CServiceInstanceManager::CServiceInstanceManager() { - nlassert(!_Instance); + nlassertex(!_Instance, ("Singleton Instance already existing")); _Instance = this; // Note: addCallbackArray() done in CRangeMirrorManager::init() } +CServiceInstanceManager::~CServiceInstanceManager() +{ + _Instance = nullptr; +} + /* * Check if a service is allowed to start. Answer with a GSTS (Grant Start Service) message */ diff --git a/nelns/naming_service/nelns/naming_service/service_instance_manager.h b/nelns/naming_service/nelns/naming_service/service_instance_manager.h index 1800ddf18b..25d2370d9b 100644 --- a/nelns/naming_service/nelns/naming_service/service_instance_manager.h +++ b/nelns/naming_service/nelns/naming_service/service_instance_manager.h @@ -32,6 +32,8 @@ class CServiceInstanceManager /// Constructor CServiceInstanceManager(); + virtual ~CServiceInstanceManager(); + /** Add the name of a service which must not be duplicated * If uniqueOnShard is true, only one service is allowed. * If uniqueOnShard is false, one service is allowed by physical machine. diff --git a/nelns/naming_service/tests/service_instance_manager.test.cpp b/nelns/naming_service/tests/service_instance_manager.test.cpp index 58e61205ac..559ff8dfd8 100644 --- a/nelns/naming_service/tests/service_instance_manager.test.cpp +++ b/nelns/naming_service/tests/service_instance_manager.test.cpp @@ -1,15 +1,31 @@ +#include #include #include -TEST(CServiceInstanceManager, getInstanceShouldThrowIfNotInitialized) { +using ::testing::Eq; +using ::testing::NotNull; + +TEST(CServiceInstanceManager, getInstanceShouldAssertIfNotInitialized) { ASSERT_DEATH({ CServiceInstanceManager::getInstance(); }, ""); } -TEST(CServiceInstanceManager, ConstructorShouldNotThrow) { +TEST(CServiceInstanceManager, getInstanceShouldReturnSingleton) { EXPECT_NO_THROW({ CServiceInstanceManager instance; + + EXPECT_THAT(CServiceInstanceManager::getInstance(), NotNull()); + EXPECT_THAT(CServiceInstanceManager::getInstance(), Eq(&instance)); }); } + +TEST(CServiceInstanceManager, DestructorShouldCleanupSingletonInstance) { + { + CServiceInstanceManager instance; + } + ASSERT_DEATH({ + CServiceInstanceManager::getInstance(); + }, ""); +} From e65ef0ba7de80b0f00f1b9252c3a90f9aaced252 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Sun, 9 Jun 2024 07:01:21 +0000 Subject: [PATCH 040/126] add tests for addind unique services --- .../tests/service_instance_manager.test.cpp | 77 ++++++++++++++++--- 1 file changed, 68 insertions(+), 9 deletions(-) diff --git a/nelns/naming_service/tests/service_instance_manager.test.cpp b/nelns/naming_service/tests/service_instance_manager.test.cpp index 559ff8dfd8..558a3269dc 100644 --- a/nelns/naming_service/tests/service_instance_manager.test.cpp +++ b/nelns/naming_service/tests/service_instance_manager.test.cpp @@ -1,18 +1,26 @@ #include #include +#include +#include #include +using ::testing::ElementsAre; using ::testing::Eq; using ::testing::NotNull; +using ::testing::StartsWith; +using ::testing::StrEq; -TEST(CServiceInstanceManager, getInstanceShouldAssertIfNotInitialized) { - ASSERT_DEATH({ - CServiceInstanceManager::getInstance(); - }, ""); +using ::NLMISC::CLightMemDisplayer; +using ::NLMISC::CLog; + +TEST(CServiceInstanceManager, getInstanceShouldAssertIfNotInitialized) +{ + ASSERT_DEATH({ CServiceInstanceManager::getInstance(); }, ""); } -TEST(CServiceInstanceManager, getInstanceShouldReturnSingleton) { +TEST(CServiceInstanceManager, getInstanceShouldReturnSingleton) +{ EXPECT_NO_THROW({ CServiceInstanceManager instance; @@ -21,11 +29,62 @@ TEST(CServiceInstanceManager, getInstanceShouldReturnSingleton) { }); } -TEST(CServiceInstanceManager, DestructorShouldCleanupSingletonInstance) { +TEST(CServiceInstanceManager, DestructorShouldCleanupSingletonInstance) +{ { CServiceInstanceManager instance; } - ASSERT_DEATH({ - CServiceInstanceManager::getInstance(); - }, ""); + ASSERT_DEATH({ CServiceInstanceManager::getInstance(); }, ""); +} + +TEST(CServiceInstanceManager, displayInfoShouldBeEmptyIfNothingRegistered) +{ + CServiceInstanceManager instance; + CLightMemDisplayer displayer; + CLog log = { NLMISC::CLog::LOG_ASSERT }; + log.addDisplayer(&displayer); + + instance.displayInfo(&log); + + EXPECT_THAT( + displayer.lockStrings(), + ElementsAre( + StrEq("Restricted services:\n"), + StrEq("Online registered services:\n"))); +} + +TEST(CServiceInstanceManager, addUniqueServiceShouldAddShardUniqueService) +{ + CServiceInstanceManager instance; + CLightMemDisplayer displayer; + CLog log = { NLMISC::CLog::LOG_ASSERT }; + log.addDisplayer(&displayer); + + instance.addUniqueService("unique-shard-service-name", true); + + instance.displayInfo(&log); + EXPECT_THAT( + displayer.lockStrings(), + ElementsAre( + StartsWith("Restricted services:"), + StartsWith("unique-shard-service-name -> only one per shard"), + StartsWith("Online registered services:"))); +} + +TEST(CServiceInstanceManager, addUniqueServiceShouldAddMachineUniqueService) +{ + CServiceInstanceManager instance; + CLightMemDisplayer displayer; + CLog log = { NLMISC::CLog::LOG_ASSERT }; + log.addDisplayer(&displayer); + + instance.addUniqueService("unique-machine-service-name", false); + + instance.displayInfo(&log); + EXPECT_THAT( + displayer.lockStrings(), + ElementsAre( + StartsWith("Restricted services:"), + StartsWith("unique-machine-service-name -> only one per machine"), + StartsWith("Online registered services:"))); } From c1c3e1fcc48aee97455be28f9f7b857985eb507b Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Sun, 9 Jun 2024 07:06:08 +0000 Subject: [PATCH 041/126] add test results --- .github/workflows/cmake-multi-platform.yml | 6 ++++++ .github/workflows/test-report.yml | 20 ++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 .github/workflows/test-report.yml diff --git a/.github/workflows/cmake-multi-platform.yml b/.github/workflows/cmake-multi-platform.yml index cee502506c..3cc93c136d 100644 --- a/.github/workflows/cmake-multi-platform.yml +++ b/.github/workflows/cmake-multi-platform.yml @@ -104,6 +104,12 @@ jobs: # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail run: ctest --build-config ${{ matrix.build_type }} + - uses: actions/upload-artifact@v4 + if: (success() || failure()) && matrix.os == 'ubuntu-22.04' + with: + name: test-results + path: "${{ steps.strings.outputs.build-output-dir }}/**/reports/junit-*.xml" + - name: Package run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} --target package diff --git a/.github/workflows/test-report.yml b/.github/workflows/test-report.yml new file mode 100644 index 0000000000..70d2946d09 --- /dev/null +++ b/.github/workflows/test-report.yml @@ -0,0 +1,20 @@ +name: "Test Report" +on: + workflow_run: + workflows: ["CMake on multiple platforms"] + types: + - completed +permissions: + contents: read + actions: read + checks: write +jobs: + report: + runs-on: ubuntu-latest + steps: + - uses: dorny/test-reporter@v1 + with: + artifact: test-results + name: GTests + path: '**/*.xml' + reporter: java-junit \ No newline at end of file From db740b5be1ccb1e3798e099195e00f85c9f5f553 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Sun, 9 Jun 2024 07:59:42 +0000 Subject: [PATCH 042/126] add additional test coverage --- .../tests/service_instance_manager.test.cpp | 151 +++++++++++++++++- 1 file changed, 147 insertions(+), 4 deletions(-) diff --git a/nelns/naming_service/tests/service_instance_manager.test.cpp b/nelns/naming_service/tests/service_instance_manager.test.cpp index 558a3269dc..b9b448142c 100644 --- a/nelns/naming_service/tests/service_instance_manager.test.cpp +++ b/nelns/naming_service/tests/service_instance_manager.test.cpp @@ -3,16 +3,27 @@ #include #include +#include +#include #include +#include +using ::std::string; +using ::std::vector; using ::testing::ElementsAre; using ::testing::Eq; +using ::testing::IsFalse; +using ::testing::IsSupersetOf; +using ::testing::IsTrue; using ::testing::NotNull; using ::testing::StartsWith; using ::testing::StrEq; using ::NLMISC::CLightMemDisplayer; using ::NLMISC::CLog; +using ::NLNET::CInetAddress; +using ::NLNET::InvalidSockId; +using ::NLNET::TServiceId; TEST(CServiceInstanceManager, getInstanceShouldAssertIfNotInitialized) { @@ -65,10 +76,8 @@ TEST(CServiceInstanceManager, addUniqueServiceShouldAddShardUniqueService) instance.displayInfo(&log); EXPECT_THAT( displayer.lockStrings(), - ElementsAre( - StartsWith("Restricted services:"), - StartsWith("unique-shard-service-name -> only one per shard"), - StartsWith("Online registered services:"))); + IsSupersetOf({ StartsWith("Restricted services:"), + StartsWith("unique-shard-service-name -> only one per shard") })); } TEST(CServiceInstanceManager, addUniqueServiceShouldAddMachineUniqueService) @@ -88,3 +97,137 @@ TEST(CServiceInstanceManager, addUniqueServiceShouldAddMachineUniqueService) StartsWith("unique-machine-service-name -> only one per machine"), StartsWith("Online registered services:"))); } + +TEST(CServiceInstanceManager, queryStartServiceShouldAddOnlineSercie) +{ + CServiceInstanceManager instance; + TServiceId serviceId(123); + vector addresses = { "localhost:12345" }; + string reason; + CLightMemDisplayer displayer; + CLog log(NLMISC::CLog::LOG_ASSERT); + log.addDisplayer(&displayer); + + EXPECT_THAT( + instance.queryStartService("online-service", serviceId, addresses, reason), + IsTrue()); + + instance.displayInfo(&log); + EXPECT_THAT( + displayer.lockStrings(), + IsSupersetOf({ StartsWith("Online registered services:"), + StartsWith(serviceId.toString()) })); +} + +TEST(CServiceInstanceManager, queryStartServiceShouldAddSingleShardUnqiueService) +{ + CServiceInstanceManager instance; + TServiceId serviceId(123); + vector addresses = { "localhost:12345" }; + string reason; + CLightMemDisplayer displayer; + CLog log(NLMISC::CLog::LOG_ASSERT); + log.addDisplayer(&displayer); + string serviceName = "unique-shard-service-name"; + instance.addUniqueService(serviceName, true); + + EXPECT_THAT( + instance.queryStartService(serviceName, serviceId, addresses, reason), + IsTrue()); + + instance.displayInfo(&log); + EXPECT_THAT( + displayer.lockStrings(), + IsSupersetOf({ StartsWith("Online registered services:"), + StartsWith(serviceId.toString()) })); +} + +TEST(CServiceInstanceManager, queryStartServiceShouldNotAddAdditionalShardUnqiueService) +{ + RegisteredServices.clear(); + CServiceInstanceManager instance; + TServiceId serviceId(123); + vector addresses = { "localhost:12345" }; + string reason; + CLightMemDisplayer displayer; + CLog log(NLMISC::CLog::LOG_ASSERT); + log.addDisplayer(&displayer); + string serviceName = "unique-shard-service-name"; + RegisteredServices.push_back(CServiceEntry(InvalidSockId, addresses, serviceName, serviceId)); + instance.addUniqueService(serviceName, true); + instance.queryStartService(serviceName, serviceId, addresses, reason); + + EXPECT_THAT( + instance.queryStartService(serviceName, serviceId, addresses, reason), + IsFalse()); + + EXPECT_THAT( + reason, + StrEq("Service unique-shard-service-name already found as 123, must be unique on shard")); +} + +TEST(CServiceInstanceManager, queryStartServiceShouldAddAdditionalMachineUnqiueServiceOnDifferentMachine) +{ + RegisteredServices.clear(); + CServiceInstanceManager instance; + TServiceId serviceId(123); + vector firstAddresses = { "127.0.0.1:12345" }; + vector secondAddresses = { "127.0.0.2:12345" }; + string reason; + CLightMemDisplayer displayer; + CLog log(NLMISC::CLog::LOG_ASSERT); + log.addDisplayer(&displayer); + string serviceName = "unique-machine-service-name"; + RegisteredServices.push_back(CServiceEntry(InvalidSockId, firstAddresses, serviceName, serviceId)); + instance.addUniqueService(serviceName, false); + instance.queryStartService(serviceName, serviceId, firstAddresses, reason); + + EXPECT_THAT( + instance.queryStartService(serviceName, serviceId, secondAddresses, reason), + IsTrue()); +} + +TEST(CServiceInstanceManager, queryStartServiceShouldNotAddAdditionalMachineUnqiueService) +{ + RegisteredServices.clear(); + CServiceInstanceManager instance; + TServiceId serviceId(123); + vector addresses = { "localhost:12345" }; + string reason; + CLightMemDisplayer displayer; + CLog log(NLMISC::CLog::LOG_ASSERT); + log.addDisplayer(&displayer); + string serviceName = "unique-machine-service-name"; + RegisteredServices.push_back(CServiceEntry(InvalidSockId, addresses, serviceName, serviceId)); + instance.addUniqueService(serviceName, false); + instance.queryStartService(serviceName, serviceId, addresses, reason); + + EXPECT_THAT( + instance.queryStartService(serviceName, serviceId, addresses, reason), + IsFalse()); + + EXPECT_THAT( + reason, + StrEq("Service unique-machine-service-name already found as 123 on same machine")); +} + +TEST(CServiceInstanceManager, releaseServiceShouldRemoveOnlineSercie) +{ + CServiceInstanceManager instance; + TServiceId serviceId(123); + vector addresses = { "localhost:12345" }; + string reason; + CLightMemDisplayer displayer; + CLog log(NLMISC::CLog::LOG_ASSERT); + log.addDisplayer(&displayer); + instance.queryStartService("online-service", serviceId, addresses, reason); + + instance.releaseService(serviceId); + + instance.displayInfo(&log); + EXPECT_THAT( + displayer.lockStrings(), + ElementsAre( + StartsWith("Restricted services:"), + StartsWith("Online registered services:"))); +} From 47bac25f5130b95f305cf73d1b4c767a29818f6a Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Sun, 9 Jun 2024 08:00:45 +0000 Subject: [PATCH 043/126] remove unused import --- .../nelns/naming_service/service_instance_manager.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/nelns/naming_service/nelns/naming_service/service_instance_manager.cpp b/nelns/naming_service/nelns/naming_service/service_instance_manager.cpp index 582156e47f..eb0dbaefe3 100644 --- a/nelns/naming_service/nelns/naming_service/service_instance_manager.cpp +++ b/nelns/naming_service/nelns/naming_service/service_instance_manager.cpp @@ -4,7 +4,6 @@ #include #include #include -#include using std::map; using std::set; From 8a06ea7fb940a1eece48bdc13b6b1c4bd2526999 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Sun, 9 Jun 2024 09:54:06 +0000 Subject: [PATCH 044/126] extract service class and dependent functions into separate files --- nelns/naming_service/CMakeLists.txt | 2 + nelns/naming_service/naming_service.cpp | 134 +----------------- .../nelns/naming_service/functions.cpp | 32 +++++ .../nelns/naming_service/functions.h | 21 +++ .../nelns/naming_service/naming_service.cpp | 116 +++++++++++++++ .../nelns/naming_service/naming_service.h | 32 +++++ .../nelns/naming_service/variables.h | 3 + 7 files changed, 208 insertions(+), 132 deletions(-) create mode 100644 nelns/naming_service/nelns/naming_service/functions.cpp create mode 100644 nelns/naming_service/nelns/naming_service/functions.h create mode 100644 nelns/naming_service/nelns/naming_service/naming_service.cpp create mode 100644 nelns/naming_service/nelns/naming_service/naming_service.h diff --git a/nelns/naming_service/CMakeLists.txt b/nelns/naming_service/CMakeLists.txt index 55ea2d3083..a648c72435 100644 --- a/nelns/naming_service/CMakeLists.txt +++ b/nelns/naming_service/CMakeLists.txt @@ -5,7 +5,9 @@ add_library(nelns_naming_service nelns/naming_service/do_remove.cpp nelns/naming_service/do_unregister_service.cpp nelns/naming_service/effectively_remove.cpp + nelns/naming_service/functions.cpp nelns/naming_service/helper.cpp + nelns/naming_service/naming_service.cpp nelns/naming_service/service_instance_manager.cpp nelns/naming_service/variables.cpp ) diff --git a/nelns/naming_service/naming_service.cpp b/nelns/naming_service/naming_service.cpp index bab0053c22..3c325bb859 100644 --- a/nelns/naming_service/naming_service.cpp +++ b/nelns/naming_service/naming_service.cpp @@ -51,7 +51,8 @@ #include #include #include -#include +#include +#include #include #include #include @@ -435,31 +436,6 @@ static void cbQueryPort (CMessage& msgin, TSockId from, CCallbackNetBase &netbas } -/* - * Unregisters a service if it has not been done before. - * Note: this callback is called whenever someone disconnects from the NS. - * May be there are too many calls if many clients perform many transactional lookups. - */ -static void cbDisconnect /*(const string &serviceName, TSockId from, void *arg)*/ ( TSockId from, void *arg ) -{ - doUnregisterService (from); - //displayRegisteredServices (); -} - -/* - * a service is connected, send him all services infos - */ -static void cbConnect /*(const string &serviceName, TSockId from, void *arg)*/ ( TSockId from, void *arg ) -{ - // we have to wait the registred services message to send all services because it this points, we can't know which sub net - // the service can use - - //displayRegisteredServices (); - - // set the appid with a bad id (-1) - from->setAppId (~0); -} - /*// returns the list of accessible services with a list of address static void cbRegisteredServices(CMessage& msgin, TSockId from, CCallbackNetBase &netbase) { @@ -530,112 +506,6 @@ TCallbackItem CallbackArray[] = }; -// -// Service -// - -class CNamingService : public NLNET::IService -{ -public: - - /** - * Init - */ - void init() - { - // if a baseport is available in the config file, get it - CConfigFile::CVar *var; - if ((var = ConfigFile.getVarPtr ("BasePort")) != NULL) - { - uint16 newBasePort = var->asInt (); - nlinfo ("Changing the MinBasePort number from %hu to %hu", MinBasePort, newBasePort); - sint32 delta = MaxBasePort - MinBasePort; - nlassert (delta > 0); - MinBasePort = newBasePort; - MaxBasePort = MinBasePort + uint16 (delta); - } - - // Parameters for the service instance manager - try - { - CConfigFile::CVar& uniqueServices = ConfigFile.getVar("UniqueOnShardServices"); - for ( uint i=0; i!=uniqueServices.size(); ++i ) - { - _ServiceInstances.addUniqueService( uniqueServices.asString(i), true ); - } - } - catch(Exception &) - {} - try - { - CConfigFile::CVar& uniqueServicesM = ConfigFile.getVar("UniqueByMachineServices"); - for ( uint i=0; i!=uniqueServicesM.size(); ++i ) - { - _ServiceInstances.addUniqueService( uniqueServicesM.asString(i), false ); - } - } - catch(Exception &) - {} - -/* - // we don't try to associate message from client - CNetManager::getNetBase ("NS")->ignoreAllUnknownId (true); - - // add the callback in case of disconnection - CNetManager::setConnectionCallback ("NS", cbConnect, NULL); - - // add the callback in case of disconnection - CNetManager::setDisconnectionCallback ("NS", cbDisconnect, NULL); -*/ - // DEBUG - // DebugLog->addDisplayer( new CStdDisplayer() ); - - vector v = CInetAddress::localAddresses(); - nlinfo ("%d detected local addresses:", v.size()); - for (uint i = 0; i < v.size(); i++) - { - nlinfo (" %d - '%s'",i, v[i].asString().c_str()); - } - - uint16 nsport = 50000; - if ((var = ConfigFile.getVarPtr ("NSPort")) != NULL) - { - nsport = var->asInt (); - } - - CallbackServer = new CCallbackServer; - CallbackServer->init(nsport); - CallbackServer->addCallbackArray(CallbackArray, sizeof(CallbackArray)/sizeof(CallbackArray[0])); - CallbackServer->setConnectionCallback(cbConnect, NULL); - CallbackServer->setDisconnectionCallback(cbDisconnect, NULL); - } - - /** - * Update - */ - bool update () - { - checkWaitingUnregistrationServices (); - - CallbackServer->update (); - - return true; - } - - void release() - { - if (CallbackServer != NULL) - delete CallbackServer; - CallbackServer = NULL; - } - -private: - - /// Service instance manager singleton - CServiceInstanceManager _ServiceInstances; -}; - - static const char* getCompleteServiceName(const IService* theService) { static std::string s; diff --git a/nelns/naming_service/nelns/naming_service/functions.cpp b/nelns/naming_service/nelns/naming_service/functions.cpp new file mode 100644 index 0000000000..e5bddbec1d --- /dev/null +++ b/nelns/naming_service/nelns/naming_service/functions.cpp @@ -0,0 +1,32 @@ +#include + +#include + +using NLNET::CInetAddress; +using NLNET::TServiceId; +using NLNET::TSockId; + +/* + * Unregisters a service if it has not been done before. + * Note: this callback is called whenever someone disconnects from the NS. + * May be there are too many calls if many clients perform many transactional lookups. + */ +void cbDisconnect(TSockId from, void *arg) +{ + doUnregisterService(from); + // displayRegisteredServices (); +} + +/* + * a service is connected, send him all services infos + */ +void cbConnect(TSockId from, void *arg) +{ + // we have to wait the registred services message to send all services because it this points, we can't know which sub net + // the service can use + + // displayRegisteredServices (); + + // set the appid with a bad id (-1) + from->setAppId(~0); +} diff --git a/nelns/naming_service/nelns/naming_service/functions.h b/nelns/naming_service/nelns/naming_service/functions.h new file mode 100644 index 0000000000..c1424addd7 --- /dev/null +++ b/nelns/naming_service/nelns/naming_service/functions.h @@ -0,0 +1,21 @@ +#ifndef NELNS_NAMING_SERVICE_FUNCTIONS_H +#define NELNS_NAMING_SERVICE_FUNCTIONS_H + +#include +#include + +/* + * Unregisters a service if it has not been done before. + * Note: this callback is called whenever someone disconnects from the NS. + * May be there are too many calls if many clients perform many transactional lookups. + */ +void cbDisconnect(NLNET::TSockId from, void *arg); + +/* + * a service is connected, send him all services infos + */ +void cbConnect(NLNET::TSockId from, void *arg); + +void checkWaitingUnregistrationServices(); + +#endif // NELNS_NAMING_SERVICE_FUNCTIONS_H diff --git a/nelns/naming_service/nelns/naming_service/naming_service.cpp b/nelns/naming_service/nelns/naming_service/naming_service.cpp new file mode 100644 index 0000000000..e65919b8be --- /dev/null +++ b/nelns/naming_service/nelns/naming_service/naming_service.cpp @@ -0,0 +1,116 @@ +#include + +#include +#include +#include +#include +#include +#include +#include + +using std::map; +using std::set; +using std::string; +using std::vector; + +using NLMISC::CConfigFile; +using NLMISC::Exception; +using NLMISC::toString; +using NLNET::CCallbackServer; +using NLNET::CInetAddress; +using NLNET::CUnifiedNetwork; +using NLNET::TServiceId; +using NLNET::TSockId; + +/** + * Init + */ +void CNamingService::init() +{ + // if a baseport is available in the config file, get it + CConfigFile::CVar *var; + if ((var = ConfigFile.getVarPtr("BasePort")) != NULL) + { + uint16 newBasePort = var->asInt(); + nlinfo("Changing the MinBasePort number from %hu to %hu", MinBasePort, newBasePort); + sint32 delta = MaxBasePort - MinBasePort; + nlassert(delta > 0); + MinBasePort = newBasePort; + MaxBasePort = MinBasePort + uint16(delta); + } + + // Parameters for the service instance manager + try + { + CConfigFile::CVar &uniqueServices = ConfigFile.getVar("UniqueOnShardServices"); + for (uint i = 0; i != uniqueServices.size(); ++i) + { + _ServiceInstances.addUniqueService(uniqueServices.asString(i), true); + } + } + catch (Exception &) + { + } + try + { + CConfigFile::CVar &uniqueServicesM = ConfigFile.getVar("UniqueByMachineServices"); + for (uint i = 0; i != uniqueServicesM.size(); ++i) + { + _ServiceInstances.addUniqueService(uniqueServicesM.asString(i), false); + } + } + catch (Exception &) + { + } + + /* + // we don't try to associate message from client + CNetManager::getNetBase ("NS")->ignoreAllUnknownId (true); + + // add the callback in case of disconnection + CNetManager::setConnectionCallback ("NS", cbConnect, NULL); + + // add the callback in case of disconnection + CNetManager::setDisconnectionCallback ("NS", cbDisconnect, NULL); + */ + // DEBUG + // DebugLog->addDisplayer( new CStdDisplayer() ); + + vector v = CInetAddress::localAddresses(); + nlinfo("%d detected local addresses:", v.size()); + for (uint i = 0; i < v.size(); i++) + { + nlinfo(" %d - '%s'", i, v[i].asString().c_str()); + } + + uint16 nsport = 50000; + if ((var = ConfigFile.getVarPtr("NSPort")) != NULL) + { + nsport = var->asInt(); + } + + CallbackServer = new CCallbackServer; + CallbackServer->init(nsport); + CallbackServer->addCallbackArray(CallbackArray, sizeof(CallbackArray) / sizeof(CallbackArray[0])); + CallbackServer->setConnectionCallback(cbConnect, NULL); + CallbackServer->setDisconnectionCallback(cbDisconnect, NULL); +} + +/** + * Update + */ +bool CNamingService::update() +{ + checkWaitingUnregistrationServices(); + + CallbackServer->update(); + + return true; +} + +void CNamingService::release() +{ + if (CallbackServer != NULL) + delete CallbackServer; + CallbackServer = NULL; +} diff --git a/nelns/naming_service/nelns/naming_service/naming_service.h b/nelns/naming_service/nelns/naming_service/naming_service.h new file mode 100644 index 0000000000..1d4d92b69e --- /dev/null +++ b/nelns/naming_service/nelns/naming_service/naming_service.h @@ -0,0 +1,32 @@ +#ifndef NELNS_NAMING_SERVICE_SERVICE_NAMING_SERVICE_H +#define NELNS_NAMING_SERVICE_SERVICE_NAMING_SERVICE_H + +#include +#include +#include + +// +// Service +// + +class CNamingService : public NLNET::IService +{ +public: + /** + * Init + */ + void init(); + + /** + * Update + */ + bool update(); + + void release(); + +private: + /// Service instance manager singleton + CServiceInstanceManager _ServiceInstances; +}; + +#endif // NELNS_NAMING_SERVICE_SERVICE_NAMING_SERVICE_H diff --git a/nelns/naming_service/nelns/naming_service/variables.h b/nelns/naming_service/nelns/naming_service/variables.h index 7fe547e92e..53c7659c73 100644 --- a/nelns/naming_service/nelns/naming_service/variables.h +++ b/nelns/naming_service/nelns/naming_service/variables.h @@ -5,6 +5,7 @@ #include #include +#include #include #include @@ -23,4 +24,6 @@ extern const NLMISC::TTime UnregisterTimeout; /// After 10s we remove an unregis extern NLNET::CCallbackServer *CallbackServer; +extern NLNET::TCallbackItem CallbackArray[5]; + #endif // NELNS_NAMING_SERVICE_VARIABLES_H From 80afc237ba43e209c079e924ccd3321c7811fcd6 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Sun, 9 Jun 2024 10:33:58 +0000 Subject: [PATCH 045/126] extract functions into separate files and organize imports --- nelns/naming_service/naming_service.cpp | 431 ------------------ .../nelns/naming_service/can_access.h | 1 + .../nelns/naming_service/do_remove.cpp | 1 + .../naming_service/do_unregister_service.cpp | 1 + .../nelns/naming_service/functions.cpp | 368 ++++++++++++++- .../nelns/naming_service/functions.h | 73 ++- .../nelns/naming_service/naming_service.cpp | 21 +- .../nelns/naming_service/naming_service.h | 3 +- .../nelns/naming_service/service_entry.h | 1 + .../service_instance_manager.cpp | 1 + .../naming_service/service_instance_manager.h | 1 + .../nelns/naming_service/variables.h | 4 +- nelns/naming_service/tests/CMakeLists.txt | 1 + .../tests/naming_service.test.cpp | 13 +- 14 files changed, 476 insertions(+), 444 deletions(-) diff --git a/nelns/naming_service/naming_service.cpp b/nelns/naming_service/naming_service.cpp index 3c325bb859..57e550c4fa 100644 --- a/nelns/naming_service/naming_service.cpp +++ b/nelns/naming_service/naming_service.cpp @@ -44,13 +44,9 @@ #include #include -#include #include -#include -#include #include -#include #include #include #include @@ -79,433 +75,6 @@ NLMISC_COMMAND(test, "none", "none") } -// -// Functions -// - - -void displayRegisteredServices (CLog *log = InfoLog) -{ - log->displayNL ("Display the %d registered services :", RegisteredServices.size()); - for (list::iterator it = RegisteredServices.begin(); it != RegisteredServices.end (); it++) - { - TSockId id = (*it).SockId; - if (id == NULL) - { - log->displayNL ("> %s-%hu %s '%s' %s %d addr", (*it).Name.c_str(), it->SId.get(), "", "", (*it).WaitingUnregistration?"WaitUnreg":"", (*it).Addr.size()); - for(uint i = 0; i < (*it).Addr.size(); i++) - log->displayNL (" '%s'", (*it).Addr[i].asString().c_str()); - } - else - { - log->displayNL ("> %s-%hu %s '%s' %s %d addr", (*it).Name.c_str(), it->SId.get(), (*it).SockId->asString().c_str(), CallbackServer->hostAddress((*it).SockId).asString().c_str(), (*it).WaitingUnregistration?"WaitUnreg":"", (*it).Addr.size()); - for(uint i = 0; i < (*it).Addr.size(); i++) - log->displayNL (" '%s'", (*it).Addr[i].asString().c_str()); - } - } - log->displayNL ("End of the list"); -} - - -/* - * Helper function for cbRegister. - * If alloc_sid is true, sid is ignored - * Returns false in case of failure of sid allocation or bad sid provided - * Note: the reply is included in this function, because it must be done before things such as syncUniTime() - */ -bool doRegister (const string &name, const vector &addr, TServiceId sid, TSockId from, CCallbackNetBase &netbase, bool reconnection = false) -{ - // Find if the service is not already registered - string reason; - uint8 ok = true; - - if (sid.get() == 0) - { - // we have to find a sid - sid = BaseSId; - bool found = false; - while (!found) - { - list::iterator it; - for (it = RegisteredServices.begin(); it != RegisteredServices.end (); it++) - { - if ((*it).SId == sid) - { - break; - } - } - if (it == RegisteredServices.end ()) - { - // ok, we have an empty sid - found = true; - } - else - { - sid.set(sid.get()+1); - if (sid.get() == 0) // round the clock - { - nlwarning ("Service identifier allocation overflow"); - ok = false; - break; - } - } - } - - } - else - { - // we have to check that the user provided sid is available - list::iterator it; - for (it = RegisteredServices.begin(); it != RegisteredServices.end (); it++) - { - if ((*it).SId == sid) - { - nlwarning ("Sid %d already used by another service", sid.get()); - ok = false; - break; - } - } - if (it != RegisteredServices.end ()) - { - ok = true; - } - } - - // if ok, register the service and send a broadcast to other people - if (ok) - { - // Check if the instance is allowed to start, according to the restriction in the config file - if ( CServiceInstanceManager::getInstance()->queryStartService( name, sid, addr, reason ) ) - { - // add him in the registered list - RegisteredServices.push_back (CServiceEntry(from, addr, name, sid)); - - // tell to everybody but not him that this service is registered - if (!reconnection) - { - CMessage msgout ("RGB"); - TServiceId::size_type s = 1; - msgout.serial (s); - msgout.serial (const_cast(name)); - msgout.serial (sid); - // we need to send all addr to all services even if the service can't access because we use the address index - // to know which connection comes. - msgout.serialCont (const_cast &>(addr)); - nlinfo ("The service is %s-%d, broadcast the Registration to everybody", name.c_str(), sid.get()); - - vector accessibleAddress; - for (list::iterator it3 = RegisteredServices.begin(); it3 != RegisteredServices.end (); it3++) - { - // send only services that can be accessed and not itself - if ((*it3).SId != sid && canAccess(addr, (*it3), accessibleAddress)) - { - CallbackServer->send (msgout, (*it3).SockId); - //CNetManager::send ("NS", msgout, (*it3).SockId); - nldebug ("Broadcast to %s-%hu", (*it3).Name.c_str(), it3->SId.get()); - } - } - } - - // set the sid only if it s ok - from->setAppId (sid.get()); - } - else - { - // Reply "startup denied", and do not send registration to other services - ok = false; - } - } - - // send the message to the service to say if it s ok or not - if (!reconnection) - { - // send the answer to the client - CMessage msgout ("RG"); - msgout.serial (ok); - if (ok) - { - msgout.serial (sid); - - // send him all services available (also itself) - TServiceId::size_type nb = 0; - - vector accessibleAddress; - - for (list::iterator it2 = RegisteredServices.begin(); it2 != RegisteredServices.end (); it2++) - { - // send only services that are available - if (canAccess(addr, (*it2), accessibleAddress)) - nb++; - } - msgout.serial (nb); - - for (list::iterator it = RegisteredServices.begin(); it != RegisteredServices.end (); it++) - { - // send only services that are available - if (canAccess(addr, (*it), accessibleAddress)) - { - msgout.serial ((*it).Name); - msgout.serial ((*it).SId); - msgout.serialCont ((*it).Addr); - } - } - } - else - { - msgout.serial( reason ); - } - - netbase.send (msgout, from); - netbase.flush (from); - } - - //displayRegisteredServices (); - - return ok!=0; -} - -void checkWaitingUnregistrationServices () -{ - for (list::iterator it = RegisteredServices.begin(); it != RegisteredServices.end ();) - { - if ((*it).WaitingUnregistration && ((*it).WaitingUnregistrationServices.empty() || CTime::getLocalTime() > (*it).WaitingUnregistrationTime + UnregisterTimeout)) - { - if ((*it).WaitingUnregistrationServices.empty()) - { - nlinfo ("Removing the service %s-%hu because all services ACKd the removal", (*it).Name.c_str(), (*it).SId.get()); - } - else - { - string res; - for (list::iterator it2 = (*it).WaitingUnregistrationServices.begin(); it2 != (*it).WaitingUnregistrationServices.end (); it2++) - { - res += toString(it2->get()) + " "; - } - nlwarning ("Removing the service %s-%hu because time out occurs (service numbers %s didn't ACK)", (*it).Name.c_str(), (*it).SId.get(), res.c_str()); - } - it = effectivelyRemove (it); - } - else - { - it++; - } - } -} - - -/** - * Callback for service unregistration ACK. Mean that a service was ACK the unregistration broadcast - */ -static void cbACKUnregistration (CMessage& msgin, TSockId from, CCallbackNetBase &netbase) -{ - TServiceId sid; - msgin.serial (sid); - - for (list::iterator it = RegisteredServices.begin(); it != RegisteredServices.end (); it++) - { - if ((*it).SId == sid && (*it).WaitingUnregistration) - { - for (list::iterator it2 = (*it).WaitingUnregistrationServices.begin(); it2 != (*it).WaitingUnregistrationServices.end (); it2++) - { - if (*it2 == TServiceId(uint16(from->appId()))) - { - // remove the acked service - (*it).WaitingUnregistrationServices.erase (it2); - checkWaitingUnregistrationServices (); - return; - } - } - } - } -} - - -/** - * Callback for service registration when the naming service goes down and up (don't need to broadcast) - */ -static void cbResendRegisteration (CMessage& msgin, TSockId from, CCallbackNetBase &netbase) -{ - string name; - vector addr; - TServiceId sid; - msgin.serial (name); - msgin.serialCont (addr); - msgin.serial (sid); - - doRegister (name, addr, sid, from, netbase, true); -} - - - -/** - * Callback for service registration. - * - * Message expected : RG - * - Name of service to register (string) - * - Address of service (CInetAddress) - * - * Message emitted : RG - * - Allocated service identifier (TServiceId) or 0 if failed - */ -static void cbRegister (CMessage& msgin, TSockId from, CCallbackNetBase &netbase) -{ - string name; - vector addr; - TServiceId sid; - msgin.serial (name); - msgin.serialCont (addr); - msgin.serial (sid); - - doRegister (name, addr, sid, from, netbase); -} - - -/** - * Callback for service unregistration. - * - * Message expected : UNI - * - Service identifier (TServiceId) - */ -static void cbUnregisterSId (CMessage& msgin, TSockId from, CCallbackNetBase &netbase) -{ - TServiceId sid; - msgin.serial( sid ); - - doUnregisterService (sid); - //displayRegisteredServices (); -} - - -/* - * Helper function for cbQueryPort - * - * \warning QueryPort + Registration is not atomic so more than one service could ask a port before register - */ -uint16 doAllocatePort (const CInetAddress &addr) -{ - static uint16 nextAvailablePort = MinBasePort; - - // check if nextavailableport is free - - if (nextAvailablePort >= MaxBasePort) nextAvailablePort = MinBasePort; - - bool ok; - do - { - ok = true; - list::iterator it; - for (it = RegisteredServices.begin(); it != RegisteredServices.end (); it++) - { - if ((*it).Addr[0].port () == nextAvailablePort) - { - nextAvailablePort++; - ok = false; - break; - } - } - } - while (!ok); - - return nextAvailablePort++; -} - - -/** - * Callback for port allocation - * Note: if a service queries a port but does not register itself to the naming service, the - * port will remain allocated and unused. - * - * Message expected : QP - * - Name of service to register (string) - * - Address of service (CInetAddress) (its port can be 0) - * - * Message emitted : QP - * - Allocated port number (uint16) - */ -static void cbQueryPort (CMessage& msgin, TSockId from, CCallbackNetBase &netbase) -{ - // Allocate port - uint16 port = doAllocatePort (netbase.hostAddress (from)); - - // Send port back - CMessage msgout ("QP"); - msgout.serial (port); - netbase.send (msgout, from); - - nlinfo ("The service got port %hu", port); -} - - -/*// returns the list of accessible services with a list of address -static void cbRegisteredServices(CMessage& msgin, TSockId from, CCallbackNetBase &netbase) -{ - vector addr; - msgin.serialCont (addr); - - nlinfo ("New service ask me the available services, sending him all services available"); - // send to the new service the list of all services that this service can access (depending of his sub net) - - CMessage msgout ("RGB"); - - uint8 nb = 0; - - vector accessibleAddress; - - for (list::iterator it2 = RegisteredServices.begin(); it2 != RegisteredServices.end (); it2++) - { - // send only services that are available - if (canAccess(addr, (*it2), accessibleAddress)) - nb++; - } - - msgout.serial (nb); - - for (list::iterator it = RegisteredServices.begin(); it != RegisteredServices.end (); it++) - { - // send only services that are available - if (canAccess(addr, (*it), accessibleAddress)) - { - msgout.serial ((*it).Name); - msgout.serial ((*it).SId); - msgout.serialCont (accessibleAddress); - } - } - - CNetManager::send ("NS", msgout, from); -}*/ - - -/* - * Helper that emulates layer5 send() - */ -/*void sendToService( uint16 sid, CMessage& msgout ) -{ - list::iterator it; - for (it = RegisteredServices.begin(); it != RegisteredServices.end (); it++) - { - if ((*it).SId == sid) - { - CallbackServer->send (msgout, (*it).SockId); - } - } -}*/ - - -// -// Callback array -// - -TCallbackItem CallbackArray[] = -{ - { "RG", cbRegister }, - { "RRG", cbResendRegisteration }, - { "QP", cbQueryPort }, - { "UNI", cbUnregisterSId }, - { "ACK_UNI", cbACKUnregistration }, -// { "RS", cbRegisteredServices }, -}; - - static const char* getCompleteServiceName(const IService* theService) { static std::string s; diff --git a/nelns/naming_service/nelns/naming_service/can_access.h b/nelns/naming_service/nelns/naming_service/can_access.h index 31bcd68804..2cadd81358 100644 --- a/nelns/naming_service/nelns/naming_service/can_access.h +++ b/nelns/naming_service/nelns/naming_service/can_access.h @@ -5,6 +5,7 @@ #include #include + #include bool canAccess(const std::vector &addr, const CServiceEntry &entry, std::vector &accessibleAddr); diff --git a/nelns/naming_service/nelns/naming_service/do_remove.cpp b/nelns/naming_service/nelns/naming_service/do_remove.cpp index caffc4ea3a..bd9e3d82fa 100644 --- a/nelns/naming_service/nelns/naming_service/do_remove.cpp +++ b/nelns/naming_service/nelns/naming_service/do_remove.cpp @@ -1,6 +1,7 @@ #include #include + #include #include #include diff --git a/nelns/naming_service/nelns/naming_service/do_unregister_service.cpp b/nelns/naming_service/nelns/naming_service/do_unregister_service.cpp index 9ed14d1601..ccde9a9ced 100644 --- a/nelns/naming_service/nelns/naming_service/do_unregister_service.cpp +++ b/nelns/naming_service/nelns/naming_service/do_unregister_service.cpp @@ -1,6 +1,7 @@ #include #include + #include #include #include diff --git a/nelns/naming_service/nelns/naming_service/functions.cpp b/nelns/naming_service/nelns/naming_service/functions.cpp index e5bddbec1d..671f7083bb 100644 --- a/nelns/naming_service/nelns/naming_service/functions.cpp +++ b/nelns/naming_service/nelns/naming_service/functions.cpp @@ -1,17 +1,381 @@ #include +#include + +#include +#include + +#include #include +#include +#include +#include + +using std::list; +using std::string; +using std::vector; +using NLMISC::CLog; +using NLMISC::CTime; +using NLMISC::InfoLog; +using NLMISC::toString; +using NLNET::CCallbackNetBase; using NLNET::CInetAddress; +using NLNET::CMessage; using NLNET::TServiceId; using NLNET::TSockId; +// +// Functions +// + +void displayRegisteredServices(CLog *log) +{ + log->displayNL("Display the %d registered services :", RegisteredServices.size()); + for (list::iterator it = RegisteredServices.begin(); it != RegisteredServices.end(); it++) + { + TSockId id = (*it).SockId; + if (id == NULL) + { + log->displayNL("> %s-%hu %s '%s' %s %d addr", (*it).Name.c_str(), it->SId.get(), "", "", (*it).WaitingUnregistration ? "WaitUnreg" : "", (*it).Addr.size()); + for (uint i = 0; i < (*it).Addr.size(); i++) + log->displayNL(" '%s'", (*it).Addr[i].asString().c_str()); + } + else + { + log->displayNL("> %s-%hu %s '%s' %s %d addr", (*it).Name.c_str(), it->SId.get(), (*it).SockId->asString().c_str(), CallbackServer->hostAddress((*it).SockId).asString().c_str(), (*it).WaitingUnregistration ? "WaitUnreg" : "", (*it).Addr.size()); + for (uint i = 0; i < (*it).Addr.size(); i++) + log->displayNL(" '%s'", (*it).Addr[i].asString().c_str()); + } + } + log->displayNL("End of the list"); +} + +/* + * Helper function for cbRegister. + * If alloc_sid is true, sid is ignored + * Returns false in case of failure of sid allocation or bad sid provided + * Note: the reply is included in this function, because it must be done before things such as syncUniTime() + */ +bool doRegister(const string &name, const vector &addr, TServiceId sid, TSockId from, CCallbackNetBase &netbase, bool reconnection) +{ + // Find if the service is not already registered + string reason; + uint8 ok = true; + + if (sid.get() == 0) + { + // we have to find a sid + sid = BaseSId; + bool found = false; + while (!found) + { + list::iterator it; + for (it = RegisteredServices.begin(); it != RegisteredServices.end(); it++) + { + if ((*it).SId == sid) + { + break; + } + } + if (it == RegisteredServices.end()) + { + // ok, we have an empty sid + found = true; + } + else + { + sid.set(sid.get() + 1); + if (sid.get() == 0) // round the clock + { + nlwarning("Service identifier allocation overflow"); + ok = false; + break; + } + } + } + } + else + { + // we have to check that the user provided sid is available + list::iterator it; + for (it = RegisteredServices.begin(); it != RegisteredServices.end(); it++) + { + if ((*it).SId == sid) + { + nlwarning("Sid %d already used by another service", sid.get()); + ok = false; + break; + } + } + if (it != RegisteredServices.end()) + { + ok = true; + } + } + + // if ok, register the service and send a broadcast to other people + if (ok) + { + // Check if the instance is allowed to start, according to the restriction in the config file + if (CServiceInstanceManager::getInstance()->queryStartService(name, sid, addr, reason)) + { + // add him in the registered list + RegisteredServices.push_back(CServiceEntry(from, addr, name, sid)); + + // tell to everybody but not him that this service is registered + if (!reconnection) + { + CMessage msgout("RGB"); + TServiceId::size_type s = 1; + msgout.serial(s); + msgout.serial(const_cast(name)); + msgout.serial(sid); + // we need to send all addr to all services even if the service can't access because we use the address index + // to know which connection comes. + msgout.serialCont(const_cast &>(addr)); + nlinfo("The service is %s-%d, broadcast the Registration to everybody", name.c_str(), sid.get()); + + vector accessibleAddress; + for (list::iterator it3 = RegisteredServices.begin(); it3 != RegisteredServices.end(); it3++) + { + // send only services that can be accessed and not itself + if ((*it3).SId != sid && canAccess(addr, (*it3), accessibleAddress)) + { + CallbackServer->send(msgout, (*it3).SockId); + // CNetManager::send ("NS", msgout, (*it3).SockId); + nldebug("Broadcast to %s-%hu", (*it3).Name.c_str(), it3->SId.get()); + } + } + } + + // set the sid only if it s ok + from->setAppId(sid.get()); + } + else + { + // Reply "startup denied", and do not send registration to other services + ok = false; + } + } + + // send the message to the service to say if it s ok or not + if (!reconnection) + { + // send the answer to the client + CMessage msgout("RG"); + msgout.serial(ok); + if (ok) + { + msgout.serial(sid); + + // send him all services available (also itself) + TServiceId::size_type nb = 0; + + vector accessibleAddress; + + for (list::iterator it2 = RegisteredServices.begin(); it2 != RegisteredServices.end(); it2++) + { + // send only services that are available + if (canAccess(addr, (*it2), accessibleAddress)) + nb++; + } + msgout.serial(nb); + + for (list::iterator it = RegisteredServices.begin(); it != RegisteredServices.end(); it++) + { + // send only services that are available + if (canAccess(addr, (*it), accessibleAddress)) + { + msgout.serial((*it).Name); + msgout.serial((*it).SId); + msgout.serialCont((*it).Addr); + } + } + } + else + { + msgout.serial(reason); + } + + netbase.send(msgout, from); + netbase.flush(from); + } + + // displayRegisteredServices (); + + return ok != 0; +} + +void checkWaitingUnregistrationServices() +{ + for (list::iterator it = RegisteredServices.begin(); it != RegisteredServices.end();) + { + if ((*it).WaitingUnregistration && ((*it).WaitingUnregistrationServices.empty() || CTime::getLocalTime() > (*it).WaitingUnregistrationTime + UnregisterTimeout)) + { + if ((*it).WaitingUnregistrationServices.empty()) + { + nlinfo("Removing the service %s-%hu because all services ACKd the removal", (*it).Name.c_str(), (*it).SId.get()); + } + else + { + string res; + for (list::iterator it2 = (*it).WaitingUnregistrationServices.begin(); it2 != (*it).WaitingUnregistrationServices.end(); it2++) + { + res += toString(it2->get()) + " "; + } + nlwarning("Removing the service %s-%hu because time out occurs (service numbers %s didn't ACK)", (*it).Name.c_str(), (*it).SId.get(), res.c_str()); + } + it = effectivelyRemove(it); + } + else + { + it++; + } + } +} + +/** + * Callback for service unregistration ACK. Mean that a service was ACK the unregistration broadcast + */ +void cbACKUnregistration(CMessage &msgin, TSockId from, CCallbackNetBase &netbase) +{ + TServiceId sid; + msgin.serial(sid); + + for (list::iterator it = RegisteredServices.begin(); it != RegisteredServices.end(); it++) + { + if ((*it).SId == sid && (*it).WaitingUnregistration) + { + for (list::iterator it2 = (*it).WaitingUnregistrationServices.begin(); it2 != (*it).WaitingUnregistrationServices.end(); it2++) + { + if (*it2 == TServiceId(uint16(from->appId()))) + { + // remove the acked service + (*it).WaitingUnregistrationServices.erase(it2); + checkWaitingUnregistrationServices(); + return; + } + } + } + } +} + +/** + * Callback for service registration when the naming service goes down and up (don't need to broadcast) + */ +void cbResendRegisteration(CMessage &msgin, TSockId from, CCallbackNetBase &netbase) +{ + string name; + vector addr; + TServiceId sid; + msgin.serial(name); + msgin.serialCont(addr); + msgin.serial(sid); + + doRegister(name, addr, sid, from, netbase, true); +} + +/** + * Callback for service registration. + * + * Message expected : RG + * - Name of service to register (string) + * - Address of service (CInetAddress) + * + * Message emitted : RG + * - Allocated service identifier (TServiceId) or 0 if failed + */ +void cbRegister(CMessage &msgin, TSockId from, CCallbackNetBase &netbase) +{ + string name; + vector addr; + TServiceId sid; + msgin.serial(name); + msgin.serialCont(addr); + msgin.serial(sid); + + doRegister(name, addr, sid, from, netbase); +} + +/** + * Callback for service unregistration. + * + * Message expected : UNI + * - Service identifier (TServiceId) + */ +void cbUnregisterSId(CMessage &msgin, TSockId from, CCallbackNetBase &netbase) +{ + TServiceId sid; + msgin.serial(sid); + + doUnregisterService(sid); + // displayRegisteredServices (); +} + +/* + * Helper function for cbQueryPort + * + * \warning QueryPort + Registration is not atomic so more than one service could ask a port before register + */ +uint16 doAllocatePort(const CInetAddress &addr) +{ + static uint16 nextAvailablePort = MinBasePort; + + // check if nextavailableport is free + + if (nextAvailablePort >= MaxBasePort) nextAvailablePort = MinBasePort; + + bool ok; + do + { + ok = true; + list::iterator it; + for (it = RegisteredServices.begin(); it != RegisteredServices.end(); it++) + { + if ((*it).Addr[0].port() == nextAvailablePort) + { + nextAvailablePort++; + ok = false; + break; + } + } + } while (!ok); + + return nextAvailablePort++; +} + +/** + * Callback for port allocation + * Note: if a service queries a port but does not register itself to the naming service, the + * port will remain allocated and unused. + * + * Message expected : QP + * - Name of service to register (string) + * - Address of service (CInetAddress) (its port can be 0) + * + * Message emitted : QP + * - Allocated port number (uint16) + */ +void cbQueryPort(CMessage &msgin, TSockId from, CCallbackNetBase &netbase) +{ + // Allocate port + uint16 port = doAllocatePort(netbase.hostAddress(from)); + + // Send port back + CMessage msgout("QP"); + msgout.serial(port); + netbase.send(msgout, from); + + nlinfo("The service got port %hu", port); +} + /* * Unregisters a service if it has not been done before. * Note: this callback is called whenever someone disconnects from the NS. * May be there are too many calls if many clients perform many transactional lookups. */ -void cbDisconnect(TSockId from, void *arg) +void cbDisconnect /*(const string &serviceName, TSockId from, void *arg)*/ (TSockId from, void *arg) { doUnregisterService(from); // displayRegisteredServices (); @@ -20,7 +384,7 @@ void cbDisconnect(TSockId from, void *arg) /* * a service is connected, send him all services infos */ -void cbConnect(TSockId from, void *arg) +void cbConnect /*(const string &serviceName, TSockId from, void *arg)*/ (TSockId from, void *arg) { // we have to wait the registred services message to send all services because it this points, we can't know which sub net // the service can use diff --git a/nelns/naming_service/nelns/naming_service/functions.h b/nelns/naming_service/nelns/naming_service/functions.h index c1424addd7..bdced47771 100644 --- a/nelns/naming_service/nelns/naming_service/functions.h +++ b/nelns/naming_service/nelns/naming_service/functions.h @@ -1,8 +1,77 @@ #ifndef NELNS_NAMING_SERVICE_FUNCTIONS_H #define NELNS_NAMING_SERVICE_FUNCTIONS_H -#include +#include +#include + #include +#include +#include +#include +#include + +void displayRegisteredServices(NLMISC::CLog *log = NLMISC::InfoLog); + +/* + * Helper function for cbRegister. + * If alloc_sid is true, sid is ignored + * Returns false in case of failure of sid allocation or bad sid provided + * Note: the reply is included in this function, because it must be done before things such as syncUniTime() + */ +bool doRegister(const std::string &name, const std::vector &addr, NLNET::TServiceId sid, NLNET::TSockId from, NLNET::CCallbackNetBase &netbase, bool reconnection = false); + +void checkWaitingUnregistrationServices(); + +/** + * Callback for service unregistration ACK. Mean that a service was ACK the unregistration broadcast + */ +void cbACKUnregistration(NLNET::CMessage &msgin, NLNET::TSockId from, NLNET::CCallbackNetBase &netbase); + +/** + * Callback for service registration when the naming service goes down and up (don't need to broadcast) + */ +void cbResendRegisteration(NLNET::CMessage &msgin, NLNET::TSockId from, NLNET::CCallbackNetBase &netbase); + +/** + * Callback for service registration. + * + * Message expected : RG + * - Name of service to register (string) + * - Address of service (CInetAddress) + * + * Message emitted : RG + * - Allocated service identifier (TServiceId) or 0 if failed + */ +void cbRegister(NLNET::CMessage &msgin, NLNET::TSockId from, NLNET::CCallbackNetBase &netbase); + +/** + * Callback for service unregistration. + * + * Message expected : UNI + * - Service identifier (TServiceId) + */ +void cbUnregisterSId(NLNET::CMessage &msgin, NLNET::TSockId from, NLNET::CCallbackNetBase &netbase); + +/* + * Helper function for cbQueryPort + * + * \warning QueryPort + Registration is not atomic so more than one service could ask a port before register + */ +uint16 doAllocatePort(const NLNET::CInetAddress &addr); + +/** + * Callback for port allocation + * Note: if a service queries a port but does not register itself to the naming service, the + * port will remain allocated and unused. + * + * Message expected : QP + * - Name of service to register (string) + * - Address of service (CInetAddress) (its port can be 0) + * + * Message emitted : QP + * - Allocated port number (uint16) + */ +void cbQueryPort(NLNET::CMessage &msgin, NLNET::TSockId from, NLNET::CCallbackNetBase &netbase); /* * Unregisters a service if it has not been done before. @@ -16,6 +85,4 @@ void cbDisconnect(NLNET::TSockId from, void *arg); */ void cbConnect(NLNET::TSockId from, void *arg); -void checkWaitingUnregistrationServices(); - #endif // NELNS_NAMING_SERVICE_FUNCTIONS_H diff --git a/nelns/naming_service/nelns/naming_service/naming_service.cpp b/nelns/naming_service/nelns/naming_service/naming_service.cpp index e65919b8be..bed4afa4ad 100644 --- a/nelns/naming_service/nelns/naming_service/naming_service.cpp +++ b/nelns/naming_service/nelns/naming_service/naming_service.cpp @@ -1,9 +1,12 @@ #include -#include -#include #include +#include +#include + +#include #include + #include #include #include @@ -19,9 +22,23 @@ using NLMISC::toString; using NLNET::CCallbackServer; using NLNET::CInetAddress; using NLNET::CUnifiedNetwork; +using NLNET::TCallbackItem; using NLNET::TServiceId; using NLNET::TSockId; +// +// Callback array +// + +TCallbackItem CallbackArray[] = { + { "RG", cbRegister }, + { "RRG", cbResendRegisteration }, + { "QP", cbQueryPort }, + { "UNI", cbUnregisterSId }, + { "ACK_UNI", cbACKUnregistration }, + // { "RS", cbRegisteredServices }, +}; + /** * Init */ diff --git a/nelns/naming_service/nelns/naming_service/naming_service.h b/nelns/naming_service/nelns/naming_service/naming_service.h index 1d4d92b69e..c4c41babe3 100644 --- a/nelns/naming_service/nelns/naming_service/naming_service.h +++ b/nelns/naming_service/nelns/naming_service/naming_service.h @@ -1,8 +1,9 @@ #ifndef NELNS_NAMING_SERVICE_SERVICE_NAMING_SERVICE_H #define NELNS_NAMING_SERVICE_SERVICE_NAMING_SERVICE_H -#include #include +#include + #include // diff --git a/nelns/naming_service/nelns/naming_service/service_entry.h b/nelns/naming_service/nelns/naming_service/service_entry.h index 8bb59b4068..87ca9ac2e2 100644 --- a/nelns/naming_service/nelns/naming_service/service_entry.h +++ b/nelns/naming_service/nelns/naming_service/service_entry.h @@ -5,6 +5,7 @@ #include #include + #include #include #include diff --git a/nelns/naming_service/nelns/naming_service/service_instance_manager.cpp b/nelns/naming_service/nelns/naming_service/service_instance_manager.cpp index eb0dbaefe3..07e1acd354 100644 --- a/nelns/naming_service/nelns/naming_service/service_instance_manager.cpp +++ b/nelns/naming_service/nelns/naming_service/service_instance_manager.cpp @@ -1,6 +1,7 @@ #include #include + #include #include #include diff --git a/nelns/naming_service/nelns/naming_service/service_instance_manager.h b/nelns/naming_service/nelns/naming_service/service_instance_manager.h index 25d2370d9b..0bfaf32121 100644 --- a/nelns/naming_service/nelns/naming_service/service_instance_manager.h +++ b/nelns/naming_service/nelns/naming_service/service_instance_manager.h @@ -10,6 +10,7 @@ #include #include #include + #include #include diff --git a/nelns/naming_service/nelns/naming_service/variables.h b/nelns/naming_service/nelns/naming_service/variables.h index 53c7659c73..8f3cf72602 100644 --- a/nelns/naming_service/nelns/naming_service/variables.h +++ b/nelns/naming_service/nelns/naming_service/variables.h @@ -5,8 +5,10 @@ #include #include + #include #include + #include // @@ -24,6 +26,4 @@ extern const NLMISC::TTime UnregisterTimeout; /// After 10s we remove an unregis extern NLNET::CCallbackServer *CallbackServer; -extern NLNET::TCallbackItem CallbackArray[5]; - #endif // NELNS_NAMING_SERVICE_VARIABLES_H diff --git a/nelns/naming_service/tests/CMakeLists.txt b/nelns/naming_service/tests/CMakeLists.txt index b9793e319f..f65464ed52 100644 --- a/nelns/naming_service/tests/CMakeLists.txt +++ b/nelns/naming_service/tests/CMakeLists.txt @@ -5,6 +5,7 @@ add_executable("${TEST_NAME}" ) target_link_libraries("${TEST_NAME}" GTest::gtest_main + GTest::gmock nelmisc nelnet nelns::ns diff --git a/nelns/naming_service/tests/naming_service.test.cpp b/nelns/naming_service/tests/naming_service.test.cpp index 32d91842af..d0c6722368 100644 --- a/nelns/naming_service/tests/naming_service.test.cpp +++ b/nelns/naming_service/tests/naming_service.test.cpp @@ -1,6 +1,13 @@ +#include #include -TEST(CNamingService, BasicAssertions) { - EXPECT_STRNE("hello", "world"); - EXPECT_EQ(7 * 6, 42); +#include + +using ::testing::NotNull; + + +TEST(CNamingService, ShouldInstantiateSingleton) { + CNamingService instance; + + EXPECT_THAT(CNamingService::getInstance(), NotNull()); } From 2f18df32a0754cc14ae59744aad3c6416468b79b Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Sun, 9 Jun 2024 14:02:27 +0200 Subject: [PATCH 046/126] Feature/update hunter (#707) * update hunter version --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a4fc01bd3c..b1fd19305b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -44,8 +44,8 @@ IF(HUNTER_ENABLED) cmake_minimum_required(VERSION 3.24) INCLUDE("CMakeModules/HunterGate.cmake") HunterGate( - URL "https://github.com/cpp-pm/hunter/archive/v0.25.3.tar.gz" - SHA1 "0dfbc2cb5c4cf7e83533733bdfd2125ff96680cb" + URL "https://github.com/cpp-pm/hunter/archive/v0.25.5.tar.gz" + SHA1 "a20151e4c0740ee7d0f9994476856d813cdead29" FILEPATH "${CMAKE_CURRENT_LIST_DIR}/CMakeModules/HunterConfig.cmake" ) From 85371e34417063d6ef697efd0de42efca752fe12 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Sun, 9 Jun 2024 14:36:08 +0000 Subject: [PATCH 047/126] cleanup singleton in IService on destruction --- nel/src/net/service.cpp | 3 +++ .../tests/naming_service.test.cpp | 25 +++++++++++++++++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/nel/src/net/service.cpp b/nel/src/net/service.cpp index 925075f08f..4131da3170 100644 --- a/nel/src/net/service.cpp +++ b/nel/src/net/service.cpp @@ -375,6 +375,9 @@ IService::IService() : IService::~IService() { + // Singleton + _Instance = nullptr; + // unregister the singleton INelContext::getInstance().releaseSingletonPointer("IService", this); } diff --git a/nelns/naming_service/tests/naming_service.test.cpp b/nelns/naming_service/tests/naming_service.test.cpp index d0c6722368..fab85c989a 100644 --- a/nelns/naming_service/tests/naming_service.test.cpp +++ b/nelns/naming_service/tests/naming_service.test.cpp @@ -3,11 +3,32 @@ #include +using ::testing::Eq; +using ::testing::IsFalse; +using ::testing::IsNull; +using ::testing::IsTrue; using ::testing::NotNull; - -TEST(CNamingService, ShouldInstantiateSingleton) { +TEST(CNamingService, ShouldInstantiateSingleton) +{ CNamingService instance; + EXPECT_THAT(CNamingService::isServiceInitialized(), IsTrue()); EXPECT_THAT(CNamingService::getInstance(), NotNull()); + EXPECT_THAT(CNamingService::getInstance(), Eq(&instance)); +} + +TEST(CNamingService, shouldNotAllowMultipleSimultaneousInstances) +{ + CNamingService first; + ASSERT_DEATH({ CNamingService second; }, ""); +} + +TEST(CNamingService, shouldCleanupSingleton) +{ + { + CNamingService instance; + }; + EXPECT_THAT(CNamingService::isServiceInitialized(), IsFalse()); + EXPECT_THAT(CNamingService::getInstance(), IsNull()); } From 279ff117d8e3053ae490862e319abe7d425b1846 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Sun, 9 Jun 2024 14:59:16 +0000 Subject: [PATCH 048/126] prepare integration test for naming service --- nelns/naming_service/tests/CMakeLists.txt | 18 +++++++++++++---- .../tests/naming_service.it.cpp | 20 +++++++++++++++++++ .../tests/naming_service.test.cpp | 19 +++++++++++++++++- 3 files changed, 52 insertions(+), 5 deletions(-) create mode 100644 nelns/naming_service/tests/naming_service.it.cpp diff --git a/nelns/naming_service/tests/CMakeLists.txt b/nelns/naming_service/tests/CMakeLists.txt index f65464ed52..58a433cd11 100644 --- a/nelns/naming_service/tests/CMakeLists.txt +++ b/nelns/naming_service/tests/CMakeLists.txt @@ -6,8 +6,20 @@ add_executable("${TEST_NAME}" target_link_libraries("${TEST_NAME}" GTest::gtest_main GTest::gmock - nelmisc - nelnet + nelns::ns +) +gtest_discover_tests("${TEST_NAME}" + EXTRA_ARGS "--gtest_output=xml:${CMAKE_CURRENT_BINARY_DIR}/reports/junit-${TEST_NAME}.xml" +) + +set(TEST_NAME "naming_service_it") + +add_executable("${TEST_NAME}" + naming_service.it.cpp +) +target_link_libraries("${TEST_NAME}" + GTest::gtest_main + GTest::gmock nelns::ns ) gtest_discover_tests("${TEST_NAME}" @@ -22,8 +34,6 @@ add_executable("${TEST_NAME}" target_link_libraries("${TEST_NAME}" GTest::gtest_main GTest::gmock - nelmisc - nelnet nelns::ns ) gtest_discover_tests("${TEST_NAME}" diff --git a/nelns/naming_service/tests/naming_service.it.cpp b/nelns/naming_service/tests/naming_service.it.cpp new file mode 100644 index 0000000000..6803be919d --- /dev/null +++ b/nelns/naming_service/tests/naming_service.it.cpp @@ -0,0 +1,20 @@ +#include +#include + +#include + +using ::testing::Eq; +using ::testing::IsFalse; +using ::testing::IsNull; +using ::testing::IsTrue; +using ::testing::NotNull; + +TEST(CNamingService, shouldStartService) +{ + CNamingService instance; + uint16 port = 0; + + auto exitcode = instance.main("short name", "long name", port, "config-dir", "log-dir", "compilation date"); + + EXPECT_THAT(exitcode, Eq(0)); +} diff --git a/nelns/naming_service/tests/naming_service.test.cpp b/nelns/naming_service/tests/naming_service.test.cpp index fab85c989a..b9e500fd62 100644 --- a/nelns/naming_service/tests/naming_service.test.cpp +++ b/nelns/naming_service/tests/naming_service.test.cpp @@ -9,7 +9,7 @@ using ::testing::IsNull; using ::testing::IsTrue; using ::testing::NotNull; -TEST(CNamingService, ShouldInstantiateSingleton) +TEST(CNamingService, shouldInstantiateSingleton) { CNamingService instance; @@ -21,6 +21,7 @@ TEST(CNamingService, ShouldInstantiateSingleton) TEST(CNamingService, shouldNotAllowMultipleSimultaneousInstances) { CNamingService first; + ASSERT_DEATH({ CNamingService second; }, ""); } @@ -29,6 +30,22 @@ TEST(CNamingService, shouldCleanupSingleton) { CNamingService instance; }; + EXPECT_THAT(CNamingService::isServiceInitialized(), IsFalse()); EXPECT_THAT(CNamingService::getInstance(), IsNull()); } + +TEST(CNamingService, shouldAllowNewInstanceAfterDestruction) +{ + { + CNamingService first; + }; + + { + CNamingService second; + + EXPECT_THAT(CNamingService::isServiceInitialized(), IsTrue()); + EXPECT_THAT(CNamingService::getInstance(), NotNull()); + EXPECT_THAT(CNamingService::getInstance(), Eq(&second)); + }; +} From 73c850f7ee09a4a8f25e54006ff1abb7da4e6f6e Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Sun, 9 Jun 2024 16:44:45 +0000 Subject: [PATCH 049/126] remove integration test --- nelns/naming_service/tests/CMakeLists.txt | 13 ------------ .../tests/naming_service.it.cpp | 20 ------------------- 2 files changed, 33 deletions(-) delete mode 100644 nelns/naming_service/tests/naming_service.it.cpp diff --git a/nelns/naming_service/tests/CMakeLists.txt b/nelns/naming_service/tests/CMakeLists.txt index 58a433cd11..72c4c539d9 100644 --- a/nelns/naming_service/tests/CMakeLists.txt +++ b/nelns/naming_service/tests/CMakeLists.txt @@ -12,19 +12,6 @@ gtest_discover_tests("${TEST_NAME}" EXTRA_ARGS "--gtest_output=xml:${CMAKE_CURRENT_BINARY_DIR}/reports/junit-${TEST_NAME}.xml" ) -set(TEST_NAME "naming_service_it") - -add_executable("${TEST_NAME}" - naming_service.it.cpp -) -target_link_libraries("${TEST_NAME}" - GTest::gtest_main - GTest::gmock - nelns::ns -) -gtest_discover_tests("${TEST_NAME}" - EXTRA_ARGS "--gtest_output=xml:${CMAKE_CURRENT_BINARY_DIR}/reports/junit-${TEST_NAME}.xml" -) set(TEST_NAME "service_instance_manager_test") diff --git a/nelns/naming_service/tests/naming_service.it.cpp b/nelns/naming_service/tests/naming_service.it.cpp deleted file mode 100644 index 6803be919d..0000000000 --- a/nelns/naming_service/tests/naming_service.it.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include -#include - -#include - -using ::testing::Eq; -using ::testing::IsFalse; -using ::testing::IsNull; -using ::testing::IsTrue; -using ::testing::NotNull; - -TEST(CNamingService, shouldStartService) -{ - CNamingService instance; - uint16 port = 0; - - auto exitcode = instance.main("short name", "long name", port, "config-dir", "log-dir", "compilation date"); - - EXPECT_THAT(exitcode, Eq(0)); -} From b6f91f53671cc3de271b46c7e08d41a2e624e4bf Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Sun, 9 Jun 2024 17:23:26 +0000 Subject: [PATCH 050/126] add basic test for running a naming service --- .../tests/naming_service.test.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/nelns/naming_service/tests/naming_service.test.cpp b/nelns/naming_service/tests/naming_service.test.cpp index b9e500fd62..92a999bd13 100644 --- a/nelns/naming_service/tests/naming_service.test.cpp +++ b/nelns/naming_service/tests/naming_service.test.cpp @@ -1,6 +1,8 @@ #include #include +#include + #include using ::testing::Eq; @@ -9,6 +11,8 @@ using ::testing::IsNull; using ::testing::IsTrue; using ::testing::NotNull; +using ::NLMISC::CConfigFile; + TEST(CNamingService, shouldInstantiateSingleton) { CNamingService instance; @@ -49,3 +53,18 @@ TEST(CNamingService, shouldAllowNewInstanceAfterDestruction) EXPECT_THAT(CNamingService::getInstance(), Eq(&second)); }; } + +TEST(CNamingService, shouldInitialize) +{ + CNamingService instance; + CConfigFile::CVar var; + var.Type = CConfigFile::CVar::T_STRING; + + instance.ConfigFile.insertVar("UniqueOnShardServices", var); + instance.ConfigFile.insertVar("UniqueByMachineServices", var); + + instance.init(); + instance.update(); + + instance.release(); +} From f45c85fa188d886d4dc99d255c73bcc6f4188128 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Sun, 9 Jun 2024 17:46:56 +0000 Subject: [PATCH 051/126] reformat code --- nelns/naming_service/tests/service_instance_manager.test.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nelns/naming_service/tests/service_instance_manager.test.cpp b/nelns/naming_service/tests/service_instance_manager.test.cpp index b9b448142c..4d074b3285 100644 --- a/nelns/naming_service/tests/service_instance_manager.test.cpp +++ b/nelns/naming_service/tests/service_instance_manager.test.cpp @@ -3,13 +3,16 @@ #include #include + #include + #include #include #include using ::std::string; using ::std::vector; + using ::testing::ElementsAre; using ::testing::Eq; using ::testing::IsFalse; @@ -21,6 +24,7 @@ using ::testing::StrEq; using ::NLMISC::CLightMemDisplayer; using ::NLMISC::CLog; + using ::NLNET::CInetAddress; using ::NLNET::InvalidSockId; using ::NLNET::TServiceId; From 80853517b50841789ea918ae47d3ebeac1c4815f Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Sun, 9 Jun 2024 19:17:33 +0000 Subject: [PATCH 052/126] remove integration test --- .../tests/naming_service.test.cpp | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/nelns/naming_service/tests/naming_service.test.cpp b/nelns/naming_service/tests/naming_service.test.cpp index 92a999bd13..b9e500fd62 100644 --- a/nelns/naming_service/tests/naming_service.test.cpp +++ b/nelns/naming_service/tests/naming_service.test.cpp @@ -1,8 +1,6 @@ #include #include -#include - #include using ::testing::Eq; @@ -11,8 +9,6 @@ using ::testing::IsNull; using ::testing::IsTrue; using ::testing::NotNull; -using ::NLMISC::CConfigFile; - TEST(CNamingService, shouldInstantiateSingleton) { CNamingService instance; @@ -53,18 +49,3 @@ TEST(CNamingService, shouldAllowNewInstanceAfterDestruction) EXPECT_THAT(CNamingService::getInstance(), Eq(&second)); }; } - -TEST(CNamingService, shouldInitialize) -{ - CNamingService instance; - CConfigFile::CVar var; - var.Type = CConfigFile::CVar::T_STRING; - - instance.ConfigFile.insertVar("UniqueOnShardServices", var); - instance.ConfigFile.insertVar("UniqueByMachineServices", var); - - instance.init(); - instance.update(); - - instance.release(); -} From eeed8e0429611b20bfb926f4aa88999c5016b7be Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Sun, 9 Jun 2024 19:49:37 +0000 Subject: [PATCH 053/126] arrange code into preious sections --- nelns/naming_service/CMakeLists.txt | 5 - nelns/naming_service/naming_service.cpp | 1 - .../nelns/naming_service/can_access.cpp | 38 ---- .../nelns/naming_service/can_access.h | 13 -- .../nelns/naming_service/do_remove.cpp | 94 --------- .../nelns/naming_service/do_remove.h | 14 -- .../naming_service/do_unregister_service.cpp | 46 ----- .../naming_service/do_unregister_service.h | 12 -- .../naming_service/effectively_remove.cpp | 12 -- .../nelns/naming_service/effectively_remove.h | 10 - .../nelns/naming_service/functions.cpp | 182 +++++++++++++++++- .../nelns/naming_service/functions.h | 24 +++ .../nelns/naming_service/helper.cpp | 45 ----- .../nelns/naming_service/helper.h | 15 -- .../nelns/naming_service/naming_service.cpp | 1 - .../service_instance_manager.cpp | 4 +- 16 files changed, 204 insertions(+), 312 deletions(-) delete mode 100644 nelns/naming_service/nelns/naming_service/can_access.cpp delete mode 100644 nelns/naming_service/nelns/naming_service/can_access.h delete mode 100644 nelns/naming_service/nelns/naming_service/do_remove.cpp delete mode 100644 nelns/naming_service/nelns/naming_service/do_remove.h delete mode 100644 nelns/naming_service/nelns/naming_service/do_unregister_service.cpp delete mode 100644 nelns/naming_service/nelns/naming_service/do_unregister_service.h delete mode 100644 nelns/naming_service/nelns/naming_service/effectively_remove.cpp delete mode 100644 nelns/naming_service/nelns/naming_service/effectively_remove.h delete mode 100644 nelns/naming_service/nelns/naming_service/helper.cpp delete mode 100644 nelns/naming_service/nelns/naming_service/helper.h diff --git a/nelns/naming_service/CMakeLists.txt b/nelns/naming_service/CMakeLists.txt index a648c72435..26cfde7110 100644 --- a/nelns/naming_service/CMakeLists.txt +++ b/nelns/naming_service/CMakeLists.txt @@ -1,12 +1,7 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}) add_library(nelns_naming_service - nelns/naming_service/can_access.cpp - nelns/naming_service/do_remove.cpp - nelns/naming_service/do_unregister_service.cpp - nelns/naming_service/effectively_remove.cpp nelns/naming_service/functions.cpp - nelns/naming_service/helper.cpp nelns/naming_service/naming_service.cpp nelns/naming_service/service_instance_manager.cpp nelns/naming_service/variables.cpp diff --git a/nelns/naming_service/naming_service.cpp b/nelns/naming_service/naming_service.cpp index 57e550c4fa..4787c958c5 100644 --- a/nelns/naming_service/naming_service.cpp +++ b/nelns/naming_service/naming_service.cpp @@ -46,7 +46,6 @@ #include -#include #include #include #include diff --git a/nelns/naming_service/nelns/naming_service/can_access.cpp b/nelns/naming_service/nelns/naming_service/can_access.cpp deleted file mode 100644 index 0dc610dc49..0000000000 --- a/nelns/naming_service/nelns/naming_service/can_access.cpp +++ /dev/null @@ -1,38 +0,0 @@ -#include - -#include - -using std::vector; - -using NLNET::CInetAddress; - -bool canAccess (const vector &addr, const CServiceEntry &entry, vector &accessibleAddr) -{ - accessibleAddr.clear (); - - if (entry.WaitingUnregistration) - return false; - - for (uint i = 0; i < addr.size(); i++) - { - uint32 net = addr[i].internalNetAddress(); - for (uint j = 0; j < entry.Addr.size(); j++) - { - if (net == entry.Addr[j].internalNetAddress()) - { - accessibleAddr.push_back (entry.Addr[j]); - } - } - } - - if (accessibleAddr.empty()) - { - nldebug ("service %s-%hu is not accessible by '%s'", entry.Name.c_str(), entry.SId.get(), vectorCInetAddressToString (addr).c_str ()); - } - else - { - nldebug ("service %s-%hu is accessible by '%s'", entry.Name.c_str(), entry.SId.get(), vectorCInetAddressToString (accessibleAddr).c_str ()); - } - - return !accessibleAddr.empty (); -} diff --git a/nelns/naming_service/nelns/naming_service/can_access.h b/nelns/naming_service/nelns/naming_service/can_access.h deleted file mode 100644 index 2cadd81358..0000000000 --- a/nelns/naming_service/nelns/naming_service/can_access.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef NELNS_NAMING_SERVICE_CAN_ACCESS_H -#define NELNS_NAMING_SERVICE_CAN_ACCESS_H - -#include - -#include -#include - -#include - -bool canAccess(const std::vector &addr, const CServiceEntry &entry, std::vector &accessibleAddr); - -#endif // NELNS_NAMING_SERVICE_CAN_ACCESS_H diff --git a/nelns/naming_service/nelns/naming_service/do_remove.cpp b/nelns/naming_service/nelns/naming_service/do_remove.cpp deleted file mode 100644 index bd9e3d82fa..0000000000 --- a/nelns/naming_service/nelns/naming_service/do_remove.cpp +++ /dev/null @@ -1,94 +0,0 @@ -#include - -#include - -#include -#include -#include -#include - -using std::list; -using std::string; -using std::vector; - -using NLMISC::CTime; -using NLMISC::toString; -using NLNET::CInetAddress; -using NLNET::CMessage; -using NLNET::TServiceId; - -/* - * Helper procedure for cbLookupAlternate and cbUnregister. - * Note: name is used for a LOGS. - */ -list::iterator doRemove(list::iterator it) -{ - nldebug("Unregister the service %s-%hu '%s'", (*it).Name.c_str(), it->SId.get(), (*it).Addr[0].asString().c_str()); - - // tell to everybody that this service is unregistered - - CMessage msgout("UNB"); - msgout.serial((*it).Name); - msgout.serial((*it).SId); - - vector accessibleAddress; - nlinfo("Broadcast the Unregistration of %s-%hu to all registered services", (*it).Name.c_str(), it->SId.get()); - for (list::iterator it3 = RegisteredServices.begin(); it3 != RegisteredServices.end(); it3++) - { - if (canAccess((*it).Addr, (*it3), accessibleAddress)) - { - CallbackServer->send(msgout, (*it3).SockId); - // CNetManager::send ("NS", msgout, (*it3).SockId); - nldebug("Broadcast to %s-%hu", (*it3).Name.c_str(), it3->SId.get()); - } - } - - // new system, after the unregistation broadcast, we wait ACK from all services before really remove - // the service, before, we tag the service as 'wait before unregister' - // if everybody didn't answer before the time out, we remove it - - (*it).SockId = NULL; - - (*it).WaitingUnregistration = true; - (*it).WaitingUnregistrationTime = CTime::getLocalTime(); - - // we remove all services awaiting his ACK because this service is down so it'll never ACK - for (list::iterator itr = RegisteredServices.begin(); itr != RegisteredServices.end(); itr++) - { - for (list::iterator itw = (*itr).WaitingUnregistrationServices.begin(); itw != (*itr).WaitingUnregistrationServices.end();) - { - if ((*itw) == (*it).SId) - { - itw = (*itr).WaitingUnregistrationServices.erase(itw); - } - else - { - itw++; - } - } - } - - string res; - for (list::iterator it2 = RegisteredServices.begin(); it2 != RegisteredServices.end(); it2++) - { - if (!(*it2).WaitingUnregistration) - { - (*it).WaitingUnregistrationServices.push_back((*it2).SId); - res += toString((*it2).SId.get()) + " "; - } - } - - nlinfo("Before removing the service %s-%hu, we wait the ACK of '%s'", (*it).Name.c_str(), (*it).SId.get(), res.c_str()); - - if ((*it).WaitingUnregistrationServices.empty()) - { - return effectivelyRemove(it); - } - else - { - return ++it; - } - - // Release from the service instance manager - CServiceInstanceManager::getInstance()->releaseService((*it).SId); -} diff --git a/nelns/naming_service/nelns/naming_service/do_remove.h b/nelns/naming_service/nelns/naming_service/do_remove.h deleted file mode 100644 index 6f0a79bff2..0000000000 --- a/nelns/naming_service/nelns/naming_service/do_remove.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef NELNS_NAMING_SERVICE_DO_REMOVE_H -#define NELNS_NAMING_SERVICE_DO_REMOVE_H - -#include - -#include - -/* - * Helper procedure for cbLookupAlternate and cbUnregister. - * Note: name is used for a LOGS. - */ -std::list::iterator doRemove(std::list::iterator it); - -#endif // NELNS_NAMING_SERVICE_DO_REMOVE_H diff --git a/nelns/naming_service/nelns/naming_service/do_unregister_service.cpp b/nelns/naming_service/nelns/naming_service/do_unregister_service.cpp deleted file mode 100644 index ccde9a9ced..0000000000 --- a/nelns/naming_service/nelns/naming_service/do_unregister_service.cpp +++ /dev/null @@ -1,46 +0,0 @@ -#include - -#include - -#include -#include -#include - -using std::list; - -using NLNET::CInetAddress; -using NLNET::TServiceId; -using NLNET::TSockId; - -void doUnregisterService(const TServiceId &sid) -{ - list::iterator it; - for (it = RegisteredServices.begin(); it != RegisteredServices.end(); it++) - { - if ((*it).SId == sid) - { - // found it, remove it - doRemove(it); - return; - } - } - nlwarning("Service %hu not found", sid.get()); -} - -void doUnregisterService(const NLNET::TSockId &from) -{ - list::iterator it; - for (it = RegisteredServices.begin(); it != RegisteredServices.end();) - { - if ((*it).SockId == from) - { - // it's possible that one "from" have more than one registred service, so we have to find in all the list - // found it, remove it - it = doRemove(it); - } - else - { - it++; - } - } -} diff --git a/nelns/naming_service/nelns/naming_service/do_unregister_service.h b/nelns/naming_service/nelns/naming_service/do_unregister_service.h deleted file mode 100644 index a0112a4b93..0000000000 --- a/nelns/naming_service/nelns/naming_service/do_unregister_service.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef NELNS_NAMING_SERVICE_DO_UNREGISTER_SERVICE_H -#define NELNS_NAMING_SERVICE_DO_UNREGISTER_SERVICE_H - -#include -#include - -// Asks a service to stop and tell every one -void doUnregisterService(const NLNET::TServiceId &sid); - -void doUnregisterService(const NLNET::TSockId &from); - -#endif // NELNS_NAMING_SERVICE_DO_UNREGISTER_SERVICE_H diff --git a/nelns/naming_service/nelns/naming_service/effectively_remove.cpp b/nelns/naming_service/nelns/naming_service/effectively_remove.cpp deleted file mode 100644 index 4b7f754565..0000000000 --- a/nelns/naming_service/nelns/naming_service/effectively_remove.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include - -#include - -using std::list; - -list::iterator effectivelyRemove(list::iterator &it) -{ - // remove the service from the registered service list - nlinfo ("Effectively remove the service %s-%hu", (*it).Name.c_str(), it->SId.get()); - return RegisteredServices.erase (it); -} diff --git a/nelns/naming_service/nelns/naming_service/effectively_remove.h b/nelns/naming_service/nelns/naming_service/effectively_remove.h deleted file mode 100644 index af67fd348a..0000000000 --- a/nelns/naming_service/nelns/naming_service/effectively_remove.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef NELNS_NAMING_SERVICE_EFFECTIVELY_REMOVE_H -#define NELNS_NAMING_SERVICE_EFFECTIVELY_REMOVE_H - -#include - -#include - -std::list::iterator effectivelyRemove (std::list::iterator &it); - -#endif // NELNS_NAMING_SERVICE_EFFECTIVELY_REMOVE_H diff --git a/nelns/naming_service/nelns/naming_service/functions.cpp b/nelns/naming_service/nelns/naming_service/functions.cpp index 671f7083bb..32d533070a 100644 --- a/nelns/naming_service/nelns/naming_service/functions.cpp +++ b/nelns/naming_service/nelns/naming_service/functions.cpp @@ -5,9 +5,6 @@ #include #include -#include -#include -#include #include #include @@ -29,6 +26,37 @@ using NLNET::TSockId; // Functions // +bool canAccess(const vector &addr, const CServiceEntry &entry, vector &accessibleAddr) +{ + accessibleAddr.clear(); + + if (entry.WaitingUnregistration) + return false; + + for (uint i = 0; i < addr.size(); i++) + { + uint32 net = addr[i].internalNetAddress(); + for (uint j = 0; j < entry.Addr.size(); j++) + { + if (net == entry.Addr[j].internalNetAddress()) + { + accessibleAddr.push_back(entry.Addr[j]); + } + } + } + + if (accessibleAddr.empty()) + { + nldebug("service %s-%hu is not accessible by '%s'", entry.Name.c_str(), entry.SId.get(), vectorCInetAddressToString(addr).c_str()); + } + else + { + nldebug("service %s-%hu is accessible by '%s'", entry.Name.c_str(), entry.SId.get(), vectorCInetAddressToString(accessibleAddr).c_str()); + } + + return !accessibleAddr.empty(); +} + void displayRegisteredServices(CLog *log) { log->displayNL("Display the %d registered services :", RegisteredServices.size()); @@ -51,6 +79,122 @@ void displayRegisteredServices(CLog *log) log->displayNL("End of the list"); } +list::iterator effectivelyRemove(list::iterator &it) +{ + // remove the service from the registered service list + nlinfo("Effectively remove the service %s-%hu", (*it).Name.c_str(), it->SId.get()); + return RegisteredServices.erase(it); +} + +/* + * Helper procedure for cbLookupAlternate and cbUnregister. + * Note: name is used for a LOGS. + */ +list::iterator doRemove(list::iterator it) +{ + nldebug("Unregister the service %s-%hu '%s'", (*it).Name.c_str(), it->SId.get(), (*it).Addr[0].asString().c_str()); + + // tell to everybody that this service is unregistered + + CMessage msgout("UNB"); + msgout.serial((*it).Name); + msgout.serial((*it).SId); + + vector accessibleAddress; + nlinfo("Broadcast the Unregistration of %s-%hu to all registered services", (*it).Name.c_str(), it->SId.get()); + for (list::iterator it3 = RegisteredServices.begin(); it3 != RegisteredServices.end(); it3++) + { + if (canAccess((*it).Addr, (*it3), accessibleAddress)) + { + CallbackServer->send(msgout, (*it3).SockId); + // CNetManager::send ("NS", msgout, (*it3).SockId); + nldebug("Broadcast to %s-%hu", (*it3).Name.c_str(), it3->SId.get()); + } + } + + // new system, after the unregistation broadcast, we wait ACK from all services before really remove + // the service, before, we tag the service as 'wait before unregister' + // if everybody didn't answer before the time out, we remove it + + (*it).SockId = NULL; + + (*it).WaitingUnregistration = true; + (*it).WaitingUnregistrationTime = CTime::getLocalTime(); + + // we remove all services awaiting his ACK because this service is down so it'll never ACK + for (list::iterator itr = RegisteredServices.begin(); itr != RegisteredServices.end(); itr++) + { + for (list::iterator itw = (*itr).WaitingUnregistrationServices.begin(); itw != (*itr).WaitingUnregistrationServices.end();) + { + if ((*itw) == (*it).SId) + { + itw = (*itr).WaitingUnregistrationServices.erase(itw); + } + else + { + itw++; + } + } + } + + string res; + for (list::iterator it2 = RegisteredServices.begin(); it2 != RegisteredServices.end(); it2++) + { + if (!(*it2).WaitingUnregistration) + { + (*it).WaitingUnregistrationServices.push_back((*it2).SId); + res += toString((*it2).SId.get()) + " "; + } + } + + nlinfo("Before removing the service %s-%hu, we wait the ACK of '%s'", (*it).Name.c_str(), (*it).SId.get(), res.c_str()); + + if ((*it).WaitingUnregistrationServices.empty()) + { + return effectivelyRemove(it); + } + else + { + return ++it; + } + + // Release from the service instance manager + CServiceInstanceManager::getInstance()->releaseService((*it).SId); +} + +void doUnregisterService(const TServiceId &sid) +{ + list::iterator it; + for (it = RegisteredServices.begin(); it != RegisteredServices.end(); it++) + { + if ((*it).SId == sid) + { + // found it, remove it + doRemove(it); + return; + } + } + nlwarning("Service %hu not found", sid.get()); +} + +void doUnregisterService(const NLNET::TSockId &from) +{ + list::iterator it; + for (it = RegisteredServices.begin(); it != RegisteredServices.end();) + { + if ((*it).SockId == from) + { + // it's possible that one "from" have more than one registred service, so we have to find in all the list + // found it, remove it + it = doRemove(it); + } + else + { + it++; + } + } +} + /* * Helper function for cbRegister. * If alloc_sid is true, sid is ignored @@ -394,3 +538,35 @@ void cbConnect /*(const string &serviceName, TSockId from, void *arg)*/ (TSockId // set the appid with a bad id (-1) from->setAppId(~0); } + +/* + * Helper that emulate layer5's getServiceName() + */ +string getServiceName(const TServiceId &sid) +{ + list::iterator it; + for (it = RegisteredServices.begin(); it != RegisteredServices.end(); it++) + { + if ((*it).SId == sid) + { + return (*it).Name; + } + } + return ""; // not found +} + +/* + * Helper that returns the first address of a service + */ +CInetAddress getHostAddress(const TServiceId &sid) +{ + list::iterator it; + for (it = RegisteredServices.begin(); it != RegisteredServices.end(); it++) + { + if ((*it).SId == sid) + { + return (*it).Addr[0]; + } + } + return {}; +} diff --git a/nelns/naming_service/nelns/naming_service/functions.h b/nelns/naming_service/nelns/naming_service/functions.h index bdced47771..9959349a9e 100644 --- a/nelns/naming_service/nelns/naming_service/functions.h +++ b/nelns/naming_service/nelns/naming_service/functions.h @@ -1,6 +1,7 @@ #ifndef NELNS_NAMING_SERVICE_FUNCTIONS_H #define NELNS_NAMING_SERVICE_FUNCTIONS_H +#include #include #include @@ -10,8 +11,25 @@ #include #include +#include + +bool canAccess(const std::vector &addr, const CServiceEntry &entry, std::vector &accessibleAddr); + void displayRegisteredServices(NLMISC::CLog *log = NLMISC::InfoLog); +std::list::iterator effectivelyRemove (std::list::iterator &it); + +/* + * Helper procedure for cbLookupAlternate and cbUnregister. + * Note: name is used for a LOGS. + */ +std::list::iterator doRemove(std::list::iterator it); + +// Asks a service to stop and tell every one +void doUnregisterService(const NLNET::TServiceId &sid); + +void doUnregisterService(const NLNET::TSockId &from); + /* * Helper function for cbRegister. * If alloc_sid is true, sid is ignored @@ -85,4 +103,10 @@ void cbDisconnect(NLNET::TSockId from, void *arg); */ void cbConnect(NLNET::TSockId from, void *arg); +// Helper that emulate layer5's getServiceName() +std::string getServiceName(const NLNET::TServiceId& sid); + +// Helper that returns the first address of a service +NLNET::CInetAddress getHostAddress( const NLNET::TServiceId& sid ); + #endif // NELNS_NAMING_SERVICE_FUNCTIONS_H diff --git a/nelns/naming_service/nelns/naming_service/helper.cpp b/nelns/naming_service/nelns/naming_service/helper.cpp deleted file mode 100644 index 984f10941d..0000000000 --- a/nelns/naming_service/nelns/naming_service/helper.cpp +++ /dev/null @@ -1,45 +0,0 @@ -#include - -#include - -#include -#include - -using std::list; -using std::string; - -using NLNET::CInetAddress; -using NLNET::TServiceId; - -/* - * Helper that emulate layer5's getServiceName() - */ -string getServiceName( const TServiceId& sid ) -{ - list::iterator it; - for (it = RegisteredServices.begin(); it != RegisteredServices.end (); it++) - { - if ((*it).SId == sid) - { - return (*it).Name; - } - } - return ""; // not found -} - - -/* - * Helper that returns the first address of a service - */ -CInetAddress getHostAddress( const TServiceId& sid ) -{ - list::iterator it; - for (it = RegisteredServices.begin(); it != RegisteredServices.end (); it++) - { - if ((*it).SId == sid) - { - return (*it).Addr[0]; - } - } - return {}; -} diff --git a/nelns/naming_service/nelns/naming_service/helper.h b/nelns/naming_service/nelns/naming_service/helper.h deleted file mode 100644 index 09b4981279..0000000000 --- a/nelns/naming_service/nelns/naming_service/helper.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef NELNS_NAMING_SERVICE_HELPER_H -#define NELNS_NAMING_SERVICE_HELPER_H - -#include - -#include -#include - -// Helper that emulate layer5's getServiceName() -std::string getServiceName(const NLNET::TServiceId& sid); - -// Helper that returns the first address of a service -NLNET::CInetAddress getHostAddress( const NLNET::TServiceId& sid ); - -#endif // NELNS_NAMING_SERVICE_HELPER_H diff --git a/nelns/naming_service/nelns/naming_service/naming_service.cpp b/nelns/naming_service/nelns/naming_service/naming_service.cpp index bed4afa4ad..757d2ad959 100644 --- a/nelns/naming_service/nelns/naming_service/naming_service.cpp +++ b/nelns/naming_service/nelns/naming_service/naming_service.cpp @@ -7,7 +7,6 @@ #include #include -#include #include #include diff --git a/nelns/naming_service/nelns/naming_service/service_instance_manager.cpp b/nelns/naming_service/nelns/naming_service/service_instance_manager.cpp index 07e1acd354..342de2697b 100644 --- a/nelns/naming_service/nelns/naming_service/service_instance_manager.cpp +++ b/nelns/naming_service/nelns/naming_service/service_instance_manager.cpp @@ -2,9 +2,7 @@ #include -#include -#include -#include +#include using std::map; using std::set; From b5500bb85d052ae8dd74e7526369525501d21150 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Mon, 10 Jun 2024 05:38:57 +0000 Subject: [PATCH 054/126] try installing cmake via action --- .github/workflows/cross-compile-client.yml | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/.github/workflows/cross-compile-client.yml b/.github/workflows/cross-compile-client.yml index 92969ff835..79cdf7e9c1 100644 --- a/.github/workflows/cross-compile-client.yml +++ b/.github/workflows/cross-compile-client.yml @@ -19,11 +19,13 @@ jobs: run: | echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" echo "hunter-dir=${{ github.workspace }}/.hunter" >> "$GITHUB_OUTPUT" - echo "cmake-version=3.27.9" >> "$GITHUB_OUTPUT" - echo "cmake-install-dir=/opt/cmake-3.27.9" >> "$GITHUB_OUTPUT" COMMIT_HASH=${{ github.sha }} echo "version=sha.${COMMIT_HASH:0:8}" >> "$GITHUB_OUTPUT" + - uses: lukka/get-cmake@v3.29.5 + with: + cmakeVersion: 3.27.9 + - name: Dependencies run: | sudo apt update @@ -38,10 +40,6 @@ jobs: mingw-w64 \ mingw-w64-tools \ ninja-build - wget --output-document=/tmp/cmake.sh https://github.com/Kitware/CMake/releases/download/v${{ steps.strings.outputs.cmake-version }}/cmake-${{ steps.strings.outputs.cmake-version }}-linux-x86_64.sh - sudo mkdir ${{ steps.strings.outputs.cmake-install-dir }} - sudo sh /tmp/cmake.sh --skip-license --prefix=${{ steps.strings.outputs.cmake-install-dir }} - sudo ln --symbolic --force ${{ steps.strings.outputs.cmake-install-dir }}/bin/cmake /usr/local/bin/cmake git clone --depth 1 --branch openssl-3.0.12 https://github.com/openssl/openssl.git cd openssl ./Configure mingw --cross-compile-prefix=i686-w64-mingw32- --prefix=/usr/i686-w64-mingw32 @@ -55,8 +53,6 @@ jobs: key: ubuntu-latest-hunter-cache - name: Configure CMake - # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. - # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type run: > cmake --version; cmake -B ${{ steps.strings.outputs.build-output-dir }} From dc5bf7b950d8f0ba0ff852e7f88f661848920cbf Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Mon, 10 Jun 2024 15:18:42 +0200 Subject: [PATCH 055/126] install specific cmake version via github action --- .github/workflows/build-client.yml | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build-client.yml b/.github/workflows/build-client.yml index 64c1ef480f..3a79241e74 100644 --- a/.github/workflows/build-client.yml +++ b/.github/workflows/build-client.yml @@ -38,8 +38,11 @@ jobs: run: | echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" echo "hunter-dir=${{ github.workspace }}/.hunter" >> "$GITHUB_OUTPUT" - echo "cmake-version=3.27.9" >> "$GITHUB_OUTPUT" - echo "cmake-install-dir=/opt/cmake-3.27.9" >> "$GITHUB_OUTPUT" + + - uses: lukka/get-cmake@v3.29.5 + if: runner.os == 'Linux' + with: + cmakeVersion: 3.27.9 - name: Dependencies Linux if: runner.os == 'Linux' @@ -62,10 +65,6 @@ jobs: wget https://raw.githubusercontent.com/microsoft/msquic/main/src/inc/msquic_posix.h wget https://raw.githubusercontent.com/microsoft/msquic/main/src/inc/quic_sal_stub.h sudo mv msquic.h msquic_posix.h quic_sal_stub.h /usr/include/ - wget --output-document=/tmp/cmake.sh https://github.com/Kitware/CMake/releases/download/v${{ steps.strings.outputs.cmake-version }}/cmake-${{ steps.strings.outputs.cmake-version }}-linux-x86_64.sh - sudo mkdir ${{ steps.strings.outputs.cmake-install-dir }} - sudo sh /tmp/cmake.sh --skip-license --prefix=${{ steps.strings.outputs.cmake-install-dir }} - sudo ln --symbolic --force ${{ steps.strings.outputs.cmake-install-dir }}/bin/cmake /usr/local/bin/cmake - name: Cache Hunter Dependencies uses: actions/cache@v4.0.2 @@ -86,8 +85,6 @@ jobs: choco install directx-sdk - name: Configure CMake - # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. - # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type run: > cmake --version; cmake -B ${{ steps.strings.outputs.build-output-dir }} From 5b9fe947c4195dd3b08b89a91f11e3be5daf8ac3 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Tue, 11 Jun 2024 16:05:39 +0000 Subject: [PATCH 056/126] make library parts of naming service static --- nelns/naming_service/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nelns/naming_service/CMakeLists.txt b/nelns/naming_service/CMakeLists.txt index 26cfde7110..29e81c7487 100644 --- a/nelns/naming_service/CMakeLists.txt +++ b/nelns/naming_service/CMakeLists.txt @@ -1,6 +1,6 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}) -add_library(nelns_naming_service +add_library(nelns_naming_service STATIC nelns/naming_service/functions.cpp nelns/naming_service/naming_service.cpp nelns/naming_service/service_instance_manager.cpp From 5de513a0f45439012ad9fffb54bba77be95caf32 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Tue, 11 Jun 2024 16:06:55 +0000 Subject: [PATCH 057/126] revert unwanted changes --- ryzom/server/src/ryzom_naming_service/ryzom_naming_service.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ryzom/server/src/ryzom_naming_service/ryzom_naming_service.cpp b/ryzom/server/src/ryzom_naming_service/ryzom_naming_service.cpp index 3905f63524..be8a34e9d1 100644 --- a/ryzom/server/src/ryzom_naming_service/ryzom_naming_service.cpp +++ b/ryzom/server/src/ryzom_naming_service/ryzom_naming_service.cpp @@ -471,7 +471,7 @@ void doUnregisterService (TServiceId sid) nlwarning ("Service %hu not found", sid.get()); } -void doUnregisterService (const NLNET::TSockId &from) +void doUnregisterService (TSockId from) { list::iterator it; for (it = RegisteredServices.begin(); it != RegisteredServices.end ();) From ebd74a1b1f06e984097a383f16542b45920c4784 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Tue, 11 Jun 2024 17:55:52 +0000 Subject: [PATCH 058/126] remove some unused variables in tests --- .../tests/service_instance_manager.test.cpp | 45 ++++--------------- 1 file changed, 9 insertions(+), 36 deletions(-) diff --git a/nelns/naming_service/tests/service_instance_manager.test.cpp b/nelns/naming_service/tests/service_instance_manager.test.cpp index 4d074b3285..7d8cebc2ae 100644 --- a/nelns/naming_service/tests/service_instance_manager.test.cpp +++ b/nelns/naming_service/tests/service_instance_manager.test.cpp @@ -102,62 +102,41 @@ TEST(CServiceInstanceManager, addUniqueServiceShouldAddMachineUniqueService) StartsWith("Online registered services:"))); } -TEST(CServiceInstanceManager, queryStartServiceShouldAddOnlineSercie) +TEST(CServiceInstanceManager, queryStartServiceShouldGrantSingleService) { CServiceInstanceManager instance; TServiceId serviceId(123); vector addresses = { "localhost:12345" }; string reason; - CLightMemDisplayer displayer; - CLog log(NLMISC::CLog::LOG_ASSERT); - log.addDisplayer(&displayer); EXPECT_THAT( - instance.queryStartService("online-service", serviceId, addresses, reason), + instance.queryStartService("single-service", serviceId, addresses, reason), IsTrue()); - - instance.displayInfo(&log); - EXPECT_THAT( - displayer.lockStrings(), - IsSupersetOf({ StartsWith("Online registered services:"), - StartsWith(serviceId.toString()) })); } -TEST(CServiceInstanceManager, queryStartServiceShouldAddSingleShardUnqiueService) +TEST(CServiceInstanceManager, queryStartServiceShouldGrantSingleShardUnqiueService) { CServiceInstanceManager instance; TServiceId serviceId(123); vector addresses = { "localhost:12345" }; string reason; - CLightMemDisplayer displayer; - CLog log(NLMISC::CLog::LOG_ASSERT); - log.addDisplayer(&displayer); string serviceName = "unique-shard-service-name"; instance.addUniqueService(serviceName, true); EXPECT_THAT( instance.queryStartService(serviceName, serviceId, addresses, reason), IsTrue()); - - instance.displayInfo(&log); - EXPECT_THAT( - displayer.lockStrings(), - IsSupersetOf({ StartsWith("Online registered services:"), - StartsWith(serviceId.toString()) })); } -TEST(CServiceInstanceManager, queryStartServiceShouldNotAddAdditionalShardUnqiueService) +TEST(CServiceInstanceManager, queryStartServiceShouldNotGrantAdditionalShardUnqiueService) { RegisteredServices.clear(); CServiceInstanceManager instance; TServiceId serviceId(123); vector addresses = { "localhost:12345" }; string reason; - CLightMemDisplayer displayer; - CLog log(NLMISC::CLog::LOG_ASSERT); - log.addDisplayer(&displayer); string serviceName = "unique-shard-service-name"; - RegisteredServices.push_back(CServiceEntry(InvalidSockId, addresses, serviceName, serviceId)); + RegisteredServices.emplace_back(InvalidSockId, addresses, serviceName, serviceId); instance.addUniqueService(serviceName, true); instance.queryStartService(serviceName, serviceId, addresses, reason); @@ -170,7 +149,7 @@ TEST(CServiceInstanceManager, queryStartServiceShouldNotAddAdditionalShardUnqiue StrEq("Service unique-shard-service-name already found as 123, must be unique on shard")); } -TEST(CServiceInstanceManager, queryStartServiceShouldAddAdditionalMachineUnqiueServiceOnDifferentMachine) +TEST(CServiceInstanceManager, queryStartServiceShouldGrantAdditionalMachineUnqiueServiceOnDifferentMachine) { RegisteredServices.clear(); CServiceInstanceManager instance; @@ -178,11 +157,8 @@ TEST(CServiceInstanceManager, queryStartServiceShouldAddAdditionalMachineUnqiueS vector firstAddresses = { "127.0.0.1:12345" }; vector secondAddresses = { "127.0.0.2:12345" }; string reason; - CLightMemDisplayer displayer; - CLog log(NLMISC::CLog::LOG_ASSERT); - log.addDisplayer(&displayer); string serviceName = "unique-machine-service-name"; - RegisteredServices.push_back(CServiceEntry(InvalidSockId, firstAddresses, serviceName, serviceId)); + RegisteredServices.emplace_back(InvalidSockId, firstAddresses, serviceName, serviceId); instance.addUniqueService(serviceName, false); instance.queryStartService(serviceName, serviceId, firstAddresses, reason); @@ -191,18 +167,15 @@ TEST(CServiceInstanceManager, queryStartServiceShouldAddAdditionalMachineUnqiueS IsTrue()); } -TEST(CServiceInstanceManager, queryStartServiceShouldNotAddAdditionalMachineUnqiueService) +TEST(CServiceInstanceManager, queryStartServiceShouldNotGrantAdditionalMachineUnqiueServiceOnSameMachine) { RegisteredServices.clear(); CServiceInstanceManager instance; TServiceId serviceId(123); vector addresses = { "localhost:12345" }; string reason; - CLightMemDisplayer displayer; - CLog log(NLMISC::CLog::LOG_ASSERT); - log.addDisplayer(&displayer); string serviceName = "unique-machine-service-name"; - RegisteredServices.push_back(CServiceEntry(InvalidSockId, addresses, serviceName, serviceId)); + RegisteredServices.emplace_back(InvalidSockId, addresses, serviceName, serviceId); instance.addUniqueService(serviceName, false); instance.queryStartService(serviceName, serviceId, addresses, reason); From 1a30edd82f41b723d98eca4bc30ac40c31993ca1 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Tue, 11 Jun 2024 19:32:45 +0000 Subject: [PATCH 059/126] add gtest suites as single test in ctest --- CMakeLists.txt | 2 +- nelns/naming_service/tests/CMakeLists.txt | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5adbad19bd..3ecc3ea803 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -464,7 +464,7 @@ ENDIF() IF(WITH_NEL_TESTS) ENABLE_TESTING() - ADD_TEST(nel_unit_test ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nel_unit_test --html) + ADD_TEST(NAME nel_unit_test COMMAND nel_unit_test) IF(BUILD_DASHBOARD) INCLUDE(Dart) SET(SVNCOMMAND svn) diff --git a/nelns/naming_service/tests/CMakeLists.txt b/nelns/naming_service/tests/CMakeLists.txt index 72c4c539d9..f891de42a5 100644 --- a/nelns/naming_service/tests/CMakeLists.txt +++ b/nelns/naming_service/tests/CMakeLists.txt @@ -8,8 +8,9 @@ target_link_libraries("${TEST_NAME}" GTest::gmock nelns::ns ) -gtest_discover_tests("${TEST_NAME}" - EXTRA_ARGS "--gtest_output=xml:${CMAKE_CURRENT_BINARY_DIR}/reports/junit-${TEST_NAME}.xml" +add_test( + NAME "${TEST_NAME}" + COMMAND "${TEST_NAME}" "--gtest_output=xml:${CMAKE_CURRENT_BINARY_DIR}/reports/junit-${TEST_NAME}.xml" ) @@ -23,7 +24,7 @@ target_link_libraries("${TEST_NAME}" GTest::gmock nelns::ns ) -gtest_discover_tests("${TEST_NAME}" - EXTRA_ARGS "--gtest_output=xml:${CMAKE_CURRENT_BINARY_DIR}/reports/junit-${TEST_NAME}.xml" +add_test( + NAME "${TEST_NAME}" + COMMAND "${TEST_NAME}" "--gtest_output=xml:${CMAKE_CURRENT_BINARY_DIR}/reports/junit-${TEST_NAME}.xml" ) - From 7b06e88a935acc2e6939bcabfef3dea3b2bb7722 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Wed, 12 Jun 2024 16:31:15 +0000 Subject: [PATCH 060/126] extract function for redundant cmake code --- CMakeLists.txt | 5 +++-- CMakeModules/add_test_executable.cmake | 8 ++++++++ nelns/naming_service/CMakeLists.txt | 5 +++-- nelns/naming_service/tests/CMakeLists.txt | 24 ++++------------------- 4 files changed, 18 insertions(+), 24 deletions(-) create mode 100644 CMakeModules/add_test_executable.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 3ecc3ea803..48cb8b3e25 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -325,7 +325,7 @@ IF(WITH_NEL) FIND_PACKAGE(CppTest) ENABLE_TESTING() - INCLUDE(FetchContent) + include(FetchContent) FetchContent_Declare( googletest URL https://github.com/google/googletest/archive/a7f443b80b105f940225332ed3c31f2790092f47.zip @@ -333,7 +333,8 @@ IF(WITH_NEL) ) SET(gtest_force_shared_crt ON CACHE BOOL "" FORCE) FetchContent_MakeAvailable(googletest) - INCLUDE(GoogleTest) + include(GoogleTest) + include(CMakeModules/add_test_executable.cmake) ENDIF() IF(HUNTER_ENABLED) diff --git a/CMakeModules/add_test_executable.cmake b/CMakeModules/add_test_executable.cmake new file mode 100644 index 0000000000..75582a5fd5 --- /dev/null +++ b/CMakeModules/add_test_executable.cmake @@ -0,0 +1,8 @@ +function(add_test_executable name) + add_executable(${ARGV}) + target_link_libraries("${name}" + GTest::gtest_main + GTest::gmock + ) + add_test(NAME "${name}" COMMAND "${name}") +endfunction() diff --git a/nelns/naming_service/CMakeLists.txt b/nelns/naming_service/CMakeLists.txt index 29e81c7487..6134b22328 100644 --- a/nelns/naming_service/CMakeLists.txt +++ b/nelns/naming_service/CMakeLists.txt @@ -1,5 +1,3 @@ -include_directories(${CMAKE_CURRENT_SOURCE_DIR}) - add_library(nelns_naming_service STATIC nelns/naming_service/functions.cpp nelns/naming_service/naming_service.cpp @@ -7,6 +5,9 @@ add_library(nelns_naming_service STATIC nelns/naming_service/variables.cpp ) add_library(nelns::ns ALIAS nelns_naming_service) + +target_include_directories(nelns_naming_service PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) + target_link_libraries(nelns_naming_service nelmisc nelnet diff --git a/nelns/naming_service/tests/CMakeLists.txt b/nelns/naming_service/tests/CMakeLists.txt index f891de42a5..8ba3d98ead 100644 --- a/nelns/naming_service/tests/CMakeLists.txt +++ b/nelns/naming_service/tests/CMakeLists.txt @@ -1,30 +1,14 @@ -set(TEST_NAME "naming_service_test") - -add_executable("${TEST_NAME}" +add_test_executable(naming_service_test naming_service.test.cpp ) -target_link_libraries("${TEST_NAME}" - GTest::gtest_main - GTest::gmock +target_link_libraries(naming_service_test nelns::ns ) -add_test( - NAME "${TEST_NAME}" - COMMAND "${TEST_NAME}" "--gtest_output=xml:${CMAKE_CURRENT_BINARY_DIR}/reports/junit-${TEST_NAME}.xml" -) -set(TEST_NAME "service_instance_manager_test") - -add_executable("${TEST_NAME}" +add_test_executable(service_instance_manager_test service_instance_manager.test.cpp ) -target_link_libraries("${TEST_NAME}" - GTest::gtest_main - GTest::gmock +target_link_libraries(service_instance_manager_test nelns::ns ) -add_test( - NAME "${TEST_NAME}" - COMMAND "${TEST_NAME}" "--gtest_output=xml:${CMAKE_CURRENT_BINARY_DIR}/reports/junit-${TEST_NAME}.xml" -) From b49a18bbd3f6b661ef4a93f312749a94684b8500 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Wed, 12 Jun 2024 20:23:52 +0000 Subject: [PATCH 061/126] allow setting CMAKE_C_FLAGS and CMAKE_CXX_FLAGS to be able to enable coverage --- CMakeModules/nel.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeModules/nel.cmake b/CMakeModules/nel.cmake index ffefe398a1..f0af98fac6 100644 --- a/CMakeModules/nel.cmake +++ b/CMakeModules/nel.cmake @@ -1085,8 +1085,8 @@ MACRO(NL_SETUP_BUILD) ENDMACRO() MACRO(NL_SETUP_BUILD_FLAGS) - SET(CMAKE_C_FLAGS ${PLATFORM_CFLAGS} CACHE STRING "" FORCE) - SET(CMAKE_CXX_FLAGS ${PLATFORM_CXXFLAGS} CACHE STRING "" FORCE) + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${PLATFORM_CFLAGS}" CACHE STRING "" FORCE) + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${PLATFORM_CXXFLAGS}" CACHE STRING "" FORCE) SET(CMAKE_EXE_LINKER_FLAGS ${PLATFORM_LINKFLAGS} CACHE STRING "" FORCE) SET(CMAKE_MODULE_LINKER_FLAGS ${PLATFORM_LINKFLAGS} CACHE STRING "" FORCE) SET(CMAKE_SHARED_LINKER_FLAGS ${PLATFORM_LINKFLAGS} CACHE STRING "" FORCE) From 45dbe8d8fa1699cced040815cfc03fb2b546cd2e Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Wed, 12 Jun 2024 20:26:51 +0000 Subject: [PATCH 062/126] add cmake presets --- .gitignore | 3 ++ CMakePresets.json | 75 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 78 insertions(+) create mode 100644 CMakePresets.json diff --git a/.gitignore b/.gitignore index dacdb0c16c..8a6aff0c47 100644 --- a/.gitignore +++ b/.gitignore @@ -271,3 +271,6 @@ web/public_php/db_version_ring web/public_php/config_user.php nel/tools/build_gamedata/processes/pz/build_world_packed_col.cfg nel/tools/build_gamedata/processes/cartographer/island_screenshots.cfg + +# machine specific files +CMakeUserPresets.json \ No newline at end of file diff --git a/CMakePresets.json b/CMakePresets.json new file mode 100644 index 0000000000..6e6208a353 --- /dev/null +++ b/CMakePresets.json @@ -0,0 +1,75 @@ +{ + "version": 6, + "configurePresets": [ + { + "name": "base", + "hidden": true, + "generator": "Ninja Multi-Config", + "binaryDir": "${sourceDir}/build" + }, + { + "inherits": [ + "base" + ], + "name": "default", + "cacheVariables": { + "WITH_STATIC": true, + "WITH_NEL_TESTS": false, + "WITH_NEL_SAMPLES": true, + "WITH_LUA51": false, + "WITH_LUA52": true, + "WITH_RYZOM": true, + "WITH_RYZOM_SERVER": true, + "WITH_RYZOM_CLIENT": true, + "WITH_RYZOM_TOOLS": true, + "WITH_NEL_TOOLS": true, + "WITH_NELNS": true, + "WITH_NELNS_LOGIN_SYSTEM": true, + "WITH_NELNS_SERVER": true, + "WITH_QT5": true, + "WITH_LIBGSF": true, + "WITH_MONGODB": false, + "WITH_PCH": false + } + }, + { + "inherits": [ + "default" + ], + "name": "default-coverage", + "cacheVariables": { + "CMAKE_C_FLAGS": "--coverage", + "CMAKE_CXX_FLAGS": "--coverage" + } + } + ], + "buildPresets": [ + { + "name": "debug", + "configurePreset": "default", + "configuration": "Debug" + }, + { + "name": "release", + "configurePreset": "default", + "configuration": "Release" + } + ], + "testPresets": [ + { + "name": "default", + "configurePreset": "default", + "configuration": "Release", + "output": { + "outputOnFailure": true + }, + "execution": { + "noTestsAction": "error", + "stopOnFailure": false + }, + "environment": { + "GTEST_OUTPUT": "xml:${sourceDir}/build/reports/" + } + } + ] +} \ No newline at end of file From 22937acf5435217021eb13a4148340a3b934ee5a Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Wed, 12 Jun 2024 20:29:38 +0000 Subject: [PATCH 063/126] add test for naming service port allocation --- nelns/naming_service/tests/CMakeLists.txt | 8 ++++++ .../tests/do_allocate_port.test.cpp | 27 +++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 nelns/naming_service/tests/do_allocate_port.test.cpp diff --git a/nelns/naming_service/tests/CMakeLists.txt b/nelns/naming_service/tests/CMakeLists.txt index 8ba3d98ead..b28a912800 100644 --- a/nelns/naming_service/tests/CMakeLists.txt +++ b/nelns/naming_service/tests/CMakeLists.txt @@ -1,3 +1,11 @@ +add_test_executable(do_allocate_port_test + do_allocate_port.test.cpp +) +target_link_libraries(do_allocate_port_test + nelns::ns +) + + add_test_executable(naming_service_test naming_service.test.cpp ) diff --git a/nelns/naming_service/tests/do_allocate_port.test.cpp b/nelns/naming_service/tests/do_allocate_port.test.cpp new file mode 100644 index 0000000000..3dc252c1a9 --- /dev/null +++ b/nelns/naming_service/tests/do_allocate_port.test.cpp @@ -0,0 +1,27 @@ +#include +#include + +#include +#include + +using ::testing::Eq; +using ::testing::IsFalse; +using ::testing::IsNull; +using ::testing::IsTrue; +using ::testing::NotNull; + +using ::NLNET::CInetAddress; + +TEST(doAllocatePort, shouldStartAtMinBaseportAndWrapArroundMaxBasePort) +{ + MinBasePort = 10; + MaxBasePort = 15; + CInetAddress addresses( "localhost:12345" ); + + EXPECT_THAT(doAllocatePort(addresses), Eq(10)); + EXPECT_THAT(doAllocatePort(addresses), Eq(11)); + EXPECT_THAT(doAllocatePort(addresses), Eq(12)); + EXPECT_THAT(doAllocatePort(addresses), Eq(13)); + EXPECT_THAT(doAllocatePort(addresses), Eq(14)); + EXPECT_THAT(doAllocatePort(addresses), Eq(10)); +} From 0217ac0e342793b835cb74f98e6614e389f3c211 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Thu, 13 Jun 2024 06:27:05 +0000 Subject: [PATCH 064/126] add test coverage for doAllocatePort --- .../tests/do_allocate_port.test.cpp | 82 ++++++++++++++++--- 1 file changed, 71 insertions(+), 11 deletions(-) diff --git a/nelns/naming_service/tests/do_allocate_port.test.cpp b/nelns/naming_service/tests/do_allocate_port.test.cpp index 3dc252c1a9..80174d751e 100644 --- a/nelns/naming_service/tests/do_allocate_port.test.cpp +++ b/nelns/naming_service/tests/do_allocate_port.test.cpp @@ -1,9 +1,19 @@ #include #include +#include +#include + +#include +#include +#include + #include #include +using ::std::string; +using ::std::vector; + using ::testing::Eq; using ::testing::IsFalse; using ::testing::IsNull; @@ -11,17 +21,67 @@ using ::testing::IsTrue; using ::testing::NotNull; using ::NLNET::CInetAddress; +using ::NLNET::InvalidSockId; +using ::NLNET::TServiceId; + +class doAllocatePortTest : public testing::Test +{ +protected: + void SetUp() override + { + MinBasePort = 10; + MaxBasePort = 15; + RegisteredServices.clear(); + } + + void TearDown() override + { + RegisteredServices.clear(); + } +}; -TEST(doAllocatePort, shouldStartAtMinBaseportAndWrapArroundMaxBasePort) +TEST_F(doAllocatePortTest, shouldStartAtMinBaseport) { - MinBasePort = 10; - MaxBasePort = 15; - CInetAddress addresses( "localhost:12345" ); - - EXPECT_THAT(doAllocatePort(addresses), Eq(10)); - EXPECT_THAT(doAllocatePort(addresses), Eq(11)); - EXPECT_THAT(doAllocatePort(addresses), Eq(12)); - EXPECT_THAT(doAllocatePort(addresses), Eq(13)); - EXPECT_THAT(doAllocatePort(addresses), Eq(14)); - EXPECT_THAT(doAllocatePort(addresses), Eq(10)); + CInetAddress address("localhost:12345"); + + EXPECT_THAT(doAllocatePort(address), Eq(10)); +} + +TEST_F(doAllocatePortTest, shouldIncreasePorts) +{ + CInetAddress address("localhost:12345"); + + EXPECT_THAT(doAllocatePort(address), Eq(11)); + EXPECT_THAT(doAllocatePort(address), Eq(12)); + EXPECT_THAT(doAllocatePort(address), Eq(13)); +} + +TEST_F(doAllocatePortTest, shouldWrapArroundMaxBasePort) +{ + CInetAddress address("localhost:12345"); + + EXPECT_THAT(doAllocatePort(address), Eq(14)); + EXPECT_THAT(doAllocatePort(address), Eq(10)); +} + +TEST_F(doAllocatePortTest, shouldSkipPortsUsedByRegisteredServices) +{ + CInetAddress address("10.0.0.1:11"); + TServiceId serviceId(123); + vector addresses { address }; + string serviceName = "test-service-name"; + RegisteredServices.emplace_back(InvalidSockId, addresses, serviceName, serviceId); + + EXPECT_THAT(doAllocatePort(address), Eq(12)); +} + +TEST_F(doAllocatePortTest, shouldNotSkipPortIfNotUsedByRegisteredServices) +{ + CInetAddress address("10.0.0.1:10"); + TServiceId serviceId(123); + vector addresses { address }; + string serviceName = "test-service-name"; + RegisteredServices.emplace_back(InvalidSockId, addresses, serviceName, serviceId); + + EXPECT_THAT(doAllocatePort(address), Eq(13)); } From 5c765dd49f74f589c0198bdc239491b64b727615 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Thu, 13 Jun 2024 06:27:12 +0000 Subject: [PATCH 065/126] cleanup some imports --- nelns/naming_service/tests/service_instance_manager.test.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nelns/naming_service/tests/service_instance_manager.test.cpp b/nelns/naming_service/tests/service_instance_manager.test.cpp index 7d8cebc2ae..98629a4947 100644 --- a/nelns/naming_service/tests/service_instance_manager.test.cpp +++ b/nelns/naming_service/tests/service_instance_manager.test.cpp @@ -5,8 +5,9 @@ #include #include +#include +#include -#include #include #include From e8786fff829940cc69621dae3c7d82f865ecea50 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Thu, 13 Jun 2024 08:15:46 +0000 Subject: [PATCH 066/126] add some documentation of the naming_service cli --- nelns/naming_service/README.md | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 nelns/naming_service/README.md diff --git a/nelns/naming_service/README.md b/nelns/naming_service/README.md new file mode 100644 index 0000000000..0078158e49 --- /dev/null +++ b/nelns/naming_service/README.md @@ -0,0 +1,34 @@ +# naming_service + +## options + +``` +--nsname + sets a service full name post fix + Examples: + naming_service --nsname test # will result in the service full name 'naming_service_test' +--fullnsname + sets the service full name, defaults to 'naming_service', takes precedence over --nsname +--shortnsname + sets the service short name, defaults to 'NS' +--nolog + don't log to file, takes precedence over setting in the config file +``` + +## NLNET::IService inherited options + +``` +--writepid +-A + path where to run the service, takes precedence over setting in the config file +-C + config file dir +-L + log dir +-N + text tat will be inserted between the log file name and the extension + Examples: + -N test # will result in a logfile _test.log +-Z + if set to 'u' releases the module manager +``` \ No newline at end of file From 9a03d1f77d6230b620e76af9f8ea9dbede4ed324 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Thu, 13 Jun 2024 09:15:42 +0000 Subject: [PATCH 067/126] adjust test reports path --- .github/workflows/cmake-multi-platform.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cmake-multi-platform.yml b/.github/workflows/cmake-multi-platform.yml index 3cc93c136d..a13a6baa38 100644 --- a/.github/workflows/cmake-multi-platform.yml +++ b/.github/workflows/cmake-multi-platform.yml @@ -108,7 +108,8 @@ jobs: if: (success() || failure()) && matrix.os == 'ubuntu-22.04' with: name: test-results - path: "${{ steps.strings.outputs.build-output-dir }}/**/reports/junit-*.xml" + if-no-files-found: error + path: "${{ steps.strings.outputs.build-output-dir }}/**/reports/*.xml" - name: Package run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} --target package From 00a5475dff824994e7ad4e3d8b9e06f06380ac39 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Thu, 13 Jun 2024 09:41:01 +0000 Subject: [PATCH 068/126] run workflow on specific image version --- .github/workflows/cross-compile-client.yml | 7 +++++-- .github/workflows/publish-docker-image.yml | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cross-compile-client.yml b/.github/workflows/cross-compile-client.yml index 79cdf7e9c1..e1dd10278a 100644 --- a/.github/workflows/cross-compile-client.yml +++ b/.github/workflows/cross-compile-client.yml @@ -6,9 +6,12 @@ on: pull_request: branches: [ "core4" ] +env: + os: ubuntu-22.04 + jobs: build: - runs-on: ubuntu-latest + runs-on: ${{ env.os }} steps: - uses: actions/checkout@v4 @@ -50,7 +53,7 @@ jobs: uses: actions/cache@v4.0.2 with: path: ${{ steps.strings.outputs.hunter-dir }} - key: ubuntu-latest-hunter-cache + key: ${{ env.os }}-hunter-cache - name: Configure CMake run: > diff --git a/.github/workflows/publish-docker-image.yml b/.github/workflows/publish-docker-image.yml index 8fc9f1323d..0a061df2a6 100644 --- a/.github/workflows/publish-docker-image.yml +++ b/.github/workflows/publish-docker-image.yml @@ -15,7 +15,7 @@ env: jobs: build: - runs-on: ubuntu-22.04 + runs-on: ubuntu-${{ env.ubuntu_version }} permissions: packages: write contents: read From 3c47b91bbfe7364df49f804ea8d33f5fa3fa0794 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Thu, 13 Jun 2024 09:43:53 +0000 Subject: [PATCH 069/126] run workflow on specific image version --- .github/workflows/build-client.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-client.yml b/.github/workflows/build-client.yml index 3a79241e74..2c09e6a61b 100644 --- a/.github/workflows/build-client.yml +++ b/.github/workflows/build-client.yml @@ -14,9 +14,15 @@ jobs: fail-fast: false matrix: - os: [ubuntu-22.04, ubuntu-20.04, windows-latest, windows-2019, macos-latest, macos-11] + os: + - ubuntu-22.04 + - ubuntu-20.04 + - windows-2022 + - windows-2019 + - macos-14 + - macos-11 include: - - os: windows-latest + - os: windows-2022 cmake_options: -DWITH_DRIVER_DIRECT3D=ON -DWITH_DRIVER_XAUDIO2=ON - os: windows-2019 cmake_options: -DWITH_DRIVER_DIRECT3D=ON -DWITH_DRIVER_XAUDIO2=ON @@ -24,7 +30,7 @@ jobs: ubuntu_version: 22.04 - os: ubuntu-20.04 ubuntu_version: 20.04 - - os: macos-latest + - os: macos-14 cmake_options: -DWITH_LIBXML2_ICONV=OFF -GXcode - os: macos-11 cmake_options: -DWITH_LIBXML2_ICONV=OFF -GXcode From 3209228d198d870fe4b768484a872e233a46f0c6 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Thu, 13 Jun 2024 09:47:15 +0000 Subject: [PATCH 070/126] revert invalid workflow changes --- .github/workflows/cross-compile-client.yml | 7 ++----- .github/workflows/publish-docker-image.yml | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/cross-compile-client.yml b/.github/workflows/cross-compile-client.yml index e1dd10278a..7f19c07704 100644 --- a/.github/workflows/cross-compile-client.yml +++ b/.github/workflows/cross-compile-client.yml @@ -6,12 +6,9 @@ on: pull_request: branches: [ "core4" ] -env: - os: ubuntu-22.04 - jobs: build: - runs-on: ${{ env.os }} + runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 @@ -53,7 +50,7 @@ jobs: uses: actions/cache@v4.0.2 with: path: ${{ steps.strings.outputs.hunter-dir }} - key: ${{ env.os }}-hunter-cache + key: ubuntu-22.04-hunter-cache - name: Configure CMake run: > diff --git a/.github/workflows/publish-docker-image.yml b/.github/workflows/publish-docker-image.yml index 0a061df2a6..8fc9f1323d 100644 --- a/.github/workflows/publish-docker-image.yml +++ b/.github/workflows/publish-docker-image.yml @@ -15,7 +15,7 @@ env: jobs: build: - runs-on: ubuntu-${{ env.ubuntu_version }} + runs-on: ubuntu-22.04 permissions: packages: write contents: read From 599e7714de30e30ba93afec8f30d1e83a8a4b496 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Thu, 13 Jun 2024 09:57:48 +0000 Subject: [PATCH 071/126] use cmake preset to run tests --- .github/workflows/cmake-multi-platform.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/cmake-multi-platform.yml b/.github/workflows/cmake-multi-platform.yml index a13a6baa38..dde8d9a2d3 100644 --- a/.github/workflows/cmake-multi-platform.yml +++ b/.github/workflows/cmake-multi-platform.yml @@ -99,10 +99,9 @@ jobs: run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} - name: Unit Tests - working-directory: ${{ steps.strings.outputs.build-output-dir }} # Execute tests defined by the CMake configuration. Note that --build-config is needed because the default Windows generator is a multi-config generator (Visual Studio generator). # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail - run: ctest --build-config ${{ matrix.build_type }} + run: ctest --preset default - uses: actions/upload-artifact@v4 if: (success() || failure()) && matrix.os == 'ubuntu-22.04' From 1eb5a35b4995212e4fbbea27ee7e9a8b27124425 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Thu, 13 Jun 2024 10:22:19 +0000 Subject: [PATCH 072/126] don't build on workflow changes to different workflows --- .github/workflows/build-client.yml | 6 ++++++ .github/workflows/build-studio.yml | 6 ++++++ .github/workflows/cmake-multi-platform.yml | 6 ++++++ .github/workflows/cross-compile-client.yml | 6 ++++++ .github/workflows/publish-docker-image.yml | 3 +++ 5 files changed, 27 insertions(+) diff --git a/.github/workflows/build-client.yml b/.github/workflows/build-client.yml index 2c09e6a61b..a0d770c5bb 100644 --- a/.github/workflows/build-client.yml +++ b/.github/workflows/build-client.yml @@ -3,8 +3,14 @@ name: build client on multiple platforms on: push: branches: [ "core4", "feature/*" ] + paths-ignore: + - '.github/workflows/**.yml' + - '!.github/workflows/build-client.yml' pull_request: branches: [ "core4" ] + paths-ignore: + - '.github/workflows/**.yml' + - '!.github/workflows/build-client.yml' jobs: build: diff --git a/.github/workflows/build-studio.yml b/.github/workflows/build-studio.yml index e04a2e79bf..24a0449a52 100644 --- a/.github/workflows/build-studio.yml +++ b/.github/workflows/build-studio.yml @@ -3,8 +3,14 @@ name: build studio on: push: branches: [ "core4", "feature/*" ] + paths-ignore: + - '.github/workflows/**.yml' + - '!.github/workflows/build-studio.yml' pull_request: branches: [ "core4" ] + paths-ignore: + - '.github/workflows/**.yml' + - '!.github/workflows/build-studio.yml' jobs: build: diff --git a/.github/workflows/cmake-multi-platform.yml b/.github/workflows/cmake-multi-platform.yml index dde8d9a2d3..99fc9ff45c 100644 --- a/.github/workflows/cmake-multi-platform.yml +++ b/.github/workflows/cmake-multi-platform.yml @@ -3,8 +3,14 @@ name: CMake on multiple platforms on: push: branches: [ "core4", "feature/*" ] + paths-ignore: + - '.github/workflows/**.yml' + - '!.github/workflows/cmake-multi-platform.yml' pull_request: branches: [ "core4" ] + paths-ignore: + - '.github/workflows/**.yml' + - '!.github/workflows/cmake-multi-platform.yml' jobs: build: diff --git a/.github/workflows/cross-compile-client.yml b/.github/workflows/cross-compile-client.yml index 7f19c07704..8756bc628e 100644 --- a/.github/workflows/cross-compile-client.yml +++ b/.github/workflows/cross-compile-client.yml @@ -3,8 +3,14 @@ name: build 32-Bit windows client on: push: branches: [ "core4", "feature/*" ] + paths-ignore: + - '.github/workflows/**.yml' + - '!.github/workflows/cross-compile-client.yml' pull_request: branches: [ "core4" ] + paths-ignore: + - '.github/workflows/**.yml' + - '!.github/workflows/cross-compile-client.yml' jobs: build: diff --git a/.github/workflows/publish-docker-image.yml b/.github/workflows/publish-docker-image.yml index 8fc9f1323d..98b82a0b37 100644 --- a/.github/workflows/publish-docker-image.yml +++ b/.github/workflows/publish-docker-image.yml @@ -5,6 +5,9 @@ on: branches: [ "core4" ] tags: - v* + paths-ignore: + - '.github/workflows/**.yml' + - '!.github/workflows/publish-docker-image.yml' env: ubuntu_version: 22.04 From ed7aba565ad9b011c05f2dfe3841f4bd2f52c7df Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Thu, 13 Jun 2024 14:57:25 +0000 Subject: [PATCH 073/126] add preset for pipeline client build --- .github/workflows/build-client.yml | 17 ++--------------- CMakePresets.json | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/.github/workflows/build-client.yml b/.github/workflows/build-client.yml index a0d770c5bb..69d94f4a40 100644 --- a/.github/workflows/build-client.yml +++ b/.github/workflows/build-client.yml @@ -98,25 +98,12 @@ jobs: - name: Configure CMake run: > - cmake --version; - cmake -B ${{ steps.strings.outputs.build-output-dir }} + cmake --preset client ${{ matrix.cmake_options }} - -DCMAKE_CONFIGURATION_TYPES=Release - -DFINAL_VERSION=OFF -DHUNTER_CONFIGURATION_TYPES=Release -DHUNTER_ENABLED=ON -DHUNTER_ROOT=${{ steps.strings.outputs.hunter-dir }} - -DWITH_DRIVER_OPENAL=ON - -DWITH_DRIVER_OPENGL=ON - -DWITH_INSTALL_LIBRARIES=OFF - -DWITH_NEL_SAMPLES=OFF - -DWITH_NEL_TESTS=OFF - -DWITH_NEL_TOOLS=OFF - -DWITH_RYZOM_CLIENT=ON - -DWITH_RYZOM_SERVER=OFF - -DWITH_RYZOM_TOOLS=OFF -S ${{ github.workspace }} - name: Build - # Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator). - run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config Release + run: cmake --build --preset client diff --git a/CMakePresets.json b/CMakePresets.json index 6e6208a353..cf99a69f17 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -41,6 +41,22 @@ "CMAKE_C_FLAGS": "--coverage", "CMAKE_CXX_FLAGS": "--coverage" } + }, + { + "inherits": "base", + "name": "client", + "cacheVariables": { + "FINAL_VERSION": false, + "WITH_DRIVER_OPENAL": true, + "WITH_DRIVER_OPENGL": true, + "WITH_INSTALL_LIBRARIES": false, + "WITH_NEL_SAMPLES": false, + "WITH_NEL_TESTS": false, + "WITH_NEL_TOOLS": false, + "WITH_RYZOM_CLIENT": true, + "WITH_RYZOM_SERVER": false, + "WITH_RYZOM_TOOLS": false + } } ], "buildPresets": [ @@ -53,6 +69,11 @@ "name": "release", "configurePreset": "default", "configuration": "Release" + }, + { + "name": "client", + "configurePreset": "client", + "configuration": "Release" } ], "testPresets": [ From d8e2f8883755a2c4099ca397f4ebe5a52757f690 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Thu, 13 Jun 2024 15:29:56 +0000 Subject: [PATCH 074/126] add preset for pipeline client build --- .github/workflows/build-client.yml | 13 ++++--- CMakePresets.json | 62 ++++++++++++++++++++++++++++-- 2 files changed, 65 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build-client.yml b/.github/workflows/build-client.yml index 69d94f4a40..e97de31313 100644 --- a/.github/workflows/build-client.yml +++ b/.github/workflows/build-client.yml @@ -29,17 +29,19 @@ jobs: - macos-11 include: - os: windows-2022 - cmake_options: -DWITH_DRIVER_DIRECT3D=ON -DWITH_DRIVER_XAUDIO2=ON + cmake_preset: windows-client - os: windows-2019 - cmake_options: -DWITH_DRIVER_DIRECT3D=ON -DWITH_DRIVER_XAUDIO2=ON + cmake_preset: windows-client - os: ubuntu-22.04 ubuntu_version: 22.04 + cmake_preset: linux-client - os: ubuntu-20.04 ubuntu_version: 20.04 + cmake_preset: linux-client - os: macos-14 - cmake_options: -DWITH_LIBXML2_ICONV=OFF -GXcode + cmake_preset: macos-client - os: macos-11 - cmake_options: -DWITH_LIBXML2_ICONV=OFF -GXcode + cmake_preset: macos-client steps: - uses: actions/checkout@v4 @@ -98,8 +100,7 @@ jobs: - name: Configure CMake run: > - cmake --preset client - ${{ matrix.cmake_options }} + cmake --preset ${{ matrix.cmake_preset }} -DHUNTER_CONFIGURATION_TYPES=Release -DHUNTER_ENABLED=ON -DHUNTER_ROOT=${{ steps.strings.outputs.hunter-dir }} diff --git a/CMakePresets.json b/CMakePresets.json index cf99a69f17..cc95d7175e 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -4,13 +4,39 @@ { "name": "base", "hidden": true, - "generator": "Ninja Multi-Config", "binaryDir": "${sourceDir}/build" }, { - "inherits": [ - "base" - ], + "name": "linux", + "inherits": "base", + "generator": "Ninja Multi-Config", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Linux" + } + }, + { + "name": "windows", + "inherits": "base", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" + } + }, + { + "name": "macos", + "inherits": "base", + "generator": "Xcode", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Darwin" + } + }, + { + "inherits": "base", "name": "default", "cacheVariables": { "WITH_STATIC": true, @@ -57,6 +83,34 @@ "WITH_RYZOM_SERVER": false, "WITH_RYZOM_TOOLS": false } + }, + { + "inherits": [ + "linux", + "client" + ], + "name": "linux-client" + }, + { + "inherits": [ + "windows", + "client" + ], + "name": "windows-client", + "cacheVariables": { + "WITH_DRIVER_DIRECT3D": true, + "WITH_DRIVER_XAUDIO2": true + } + }, + { + "inherits": [ + "macos", + "client" + ], + "name": "macos-client", + "cacheVariables": { + "WITH_LIBXML2_ICONV": false + } } ], "buildPresets": [ From 27c98c5f814728ad9c056ea5390613a031e4fc89 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Thu, 13 Jun 2024 16:22:30 +0000 Subject: [PATCH 075/126] add macos-12 for building the client --- .github/workflows/build-client.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build-client.yml b/.github/workflows/build-client.yml index e97de31313..1e415474d1 100644 --- a/.github/workflows/build-client.yml +++ b/.github/workflows/build-client.yml @@ -40,6 +40,8 @@ jobs: cmake_preset: linux-client - os: macos-14 cmake_preset: macos-client + - os: macos-12 + cmake_preset: macos-client - os: macos-11 cmake_preset: macos-client From 52655d5aa749f6af5c391e502f392c40baa2e461 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Thu, 13 Jun 2024 17:24:26 +0000 Subject: [PATCH 076/126] add environment variable to target macos10 --- .github/workflows/build-client.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/build-client.yml b/.github/workflows/build-client.yml index 1e415474d1..0abc54866f 100644 --- a/.github/workflows/build-client.yml +++ b/.github/workflows/build-client.yml @@ -101,6 +101,8 @@ jobs: choco install directx-sdk - name: Configure CMake + env: + MACOSX_DEPLOYMENT_TARGET: 10.12 run: > cmake --preset ${{ matrix.cmake_preset }} -DHUNTER_CONFIGURATION_TYPES=Release @@ -109,4 +111,6 @@ jobs: -S ${{ github.workspace }} - name: Build + env: + MACOSX_DEPLOYMENT_TARGET: 10.12 run: cmake --build --preset client From 9bf7801a38e081734d32464726059630f6877a16 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Thu, 13 Jun 2024 18:40:35 +0000 Subject: [PATCH 077/126] always save hunter cache --- .github/workflows/build-client.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/build-client.yml b/.github/workflows/build-client.yml index 0abc54866f..9ff2bcf2e0 100644 --- a/.github/workflows/build-client.yml +++ b/.github/workflows/build-client.yml @@ -110,6 +110,12 @@ jobs: -DHUNTER_ROOT=${{ steps.strings.outputs.hunter-dir }} -S ${{ github.workspace }} + - uses: actions/cache/save@v4 + if: always() + with: + path: ${{ steps.strings.outputs.hunter-dir }} + key: ${{ matrix.os }}-hunter-cache + - name: Build env: MACOSX_DEPLOYMENT_TARGET: 10.12 From 203018b8876558b7431121ece8a7cde70a293385 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Fri, 14 Jun 2024 07:54:21 +0000 Subject: [PATCH 078/126] use list method to append path to CMAKE_MODULE_PATH --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 48cb8b3e25..e62ff953ff 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,7 +22,7 @@ CMAKE_MINIMUM_REQUIRED(VERSION 3.22) #----------------------------------------------------------------------------- # Load some macros. -SET(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules;${CMAKE_MODULE_PATH}") +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/CMakeModules") #----------------------------------------------------------------------------- # Set CMake 2.6 Policies. IF(COMMAND cmake_policy) From 17160f1492fb798d98947ce1e5a3481b66315064 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Fri, 14 Jun 2024 08:29:21 +0000 Subject: [PATCH 079/126] enable hunter debug in pipeline --- .github/workflows/build-client.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-client.yml b/.github/workflows/build-client.yml index 9ff2bcf2e0..d2c86810ce 100644 --- a/.github/workflows/build-client.yml +++ b/.github/workflows/build-client.yml @@ -107,6 +107,7 @@ jobs: cmake --preset ${{ matrix.cmake_preset }} -DHUNTER_CONFIGURATION_TYPES=Release -DHUNTER_ENABLED=ON + -DHUNTER_STATUS_DEBUG=ON -DHUNTER_ROOT=${{ steps.strings.outputs.hunter-dir }} -S ${{ github.workspace }} From 80d280b3b33e9ad36a33f684501defb3d3c3bfb8 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Fri, 14 Jun 2024 08:55:50 +0000 Subject: [PATCH 080/126] clear hunter cache and use save / restore respectively --- .github/workflows/build-client.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-client.yml b/.github/workflows/build-client.yml index d2c86810ce..dda8e09dcd 100644 --- a/.github/workflows/build-client.yml +++ b/.github/workflows/build-client.yml @@ -82,11 +82,10 @@ jobs: wget https://raw.githubusercontent.com/microsoft/msquic/main/src/inc/quic_sal_stub.h sudo mv msquic.h msquic_posix.h quic_sal_stub.h /usr/include/ - - name: Cache Hunter Dependencies - uses: actions/cache@v4.0.2 + - uses: actions/cache/restore@v4.0.2 with: path: ${{ steps.strings.outputs.hunter-dir }} - key: ${{ matrix.os }}-hunter-cache + key: ${{ matrix.os }}-hunter - name: Cache Chocolatey Dependencies if: runner.os == 'Windows' @@ -115,7 +114,7 @@ jobs: if: always() with: path: ${{ steps.strings.outputs.hunter-dir }} - key: ${{ matrix.os }}-hunter-cache + key: ${{ matrix.os }}-hunter - name: Build env: From cd3759b1f3975615ea288a100adea8e1b3fe65c1 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Fri, 14 Jun 2024 09:50:55 +0000 Subject: [PATCH 081/126] disable hunter cache server for macos 12 --- .github/workflows/build-client.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build-client.yml b/.github/workflows/build-client.yml index dda8e09dcd..4feb426b2a 100644 --- a/.github/workflows/build-client.yml +++ b/.github/workflows/build-client.yml @@ -42,6 +42,7 @@ jobs: cmake_preset: macos-client - os: macos-12 cmake_preset: macos-client + cmake_options: -DHUNTER_USE_CACHE_SERVERS=NO - os: macos-11 cmake_preset: macos-client @@ -104,6 +105,7 @@ jobs: MACOSX_DEPLOYMENT_TARGET: 10.12 run: > cmake --preset ${{ matrix.cmake_preset }} + ${{ matrix.cmake_options }} -DHUNTER_CONFIGURATION_TYPES=Release -DHUNTER_ENABLED=ON -DHUNTER_STATUS_DEBUG=ON From fd163edbf7eb1af4ba718b2aca91d169747f9c0f Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Fri, 14 Jun 2024 12:03:17 +0000 Subject: [PATCH 082/126] only store hunter cache if successfully as it wont't get updated --- .github/workflows/build-client.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build-client.yml b/.github/workflows/build-client.yml index 4feb426b2a..bfd6ce8df5 100644 --- a/.github/workflows/build-client.yml +++ b/.github/workflows/build-client.yml @@ -113,7 +113,6 @@ jobs: -S ${{ github.workspace }} - uses: actions/cache/save@v4 - if: always() with: path: ${{ steps.strings.outputs.hunter-dir }} key: ${{ matrix.os }}-hunter From e628ad9d98aab1315b89aa3f04465906732b53f4 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Sat, 15 Jun 2024 20:43:27 +0200 Subject: [PATCH 083/126] Feature/remove deprecated macos build image (#712) * remove deprecated runner image from build --- .devcontainer/Dockerfile | 3 +-- .github/workflows/build-client.yml | 32 ++++++++++++++++++++++-------- CMakeLists.txt | 8 ++++---- CMakePresets.json | 6 ++++++ 4 files changed, 35 insertions(+), 14 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 35c21571ba..8895d2070e 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -66,8 +66,7 @@ ARG USER_GID=$USER_UID RUN wget --output-document=/tmp/cmake.sh https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-linux-x86_64.sh RUN mkdir --parents "$CMAKE_INSTALL_DIR" \ && sh /tmp/cmake.sh --skip-license --prefix="$CMAKE_INSTALL_DIR" \ - && ln --symbolic --force "$CMAKE_INSTALL_DIR/bin/cmake" /usr/local/bin/cmake \ - && ln --symbolic --force "$CMAKE_INSTALL_DIR/bin/ctest" /usr/local/bin/ctest + && ln --symbolic --force "$CMAKE_INSTALL_DIR/bin/"* /usr/local/bin RUN groupadd --gid $USER_GID $USERNAME \ && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \ diff --git a/.github/workflows/build-client.yml b/.github/workflows/build-client.yml index bfd6ce8df5..895f760a23 100644 --- a/.github/workflows/build-client.yml +++ b/.github/workflows/build-client.yml @@ -26,7 +26,7 @@ jobs: - windows-2022 - windows-2019 - macos-14 - - macos-11 + - macos-12 include: - os: windows-2022 cmake_preset: windows-client @@ -43,8 +43,6 @@ jobs: - os: macos-12 cmake_preset: macos-client cmake_options: -DHUNTER_USE_CACHE_SERVERS=NO - - os: macos-11 - cmake_preset: macos-client steps: - uses: actions/checkout@v4 @@ -88,18 +86,22 @@ jobs: path: ${{ steps.strings.outputs.hunter-dir }} key: ${{ matrix.os }}-hunter - - name: Cache Chocolatey Dependencies + - uses: actions/cache/restore@v4.0.2 if: runner.os == 'Windows' - uses: actions/cache@v4.0.2 with: path: C:\Users\runneradmin\AppData\Local\Temp\chocolatey - key: ${{ runner.os }}-chocolatey-cache + key: ${{ matrix.os }}-chocolatey - name: Dependencies Windows if: runner.os == 'Windows' - run: > + run: | choco install directx-sdk + - uses: actions/cache/save@v4 + with: + path: C:\Users\runneradmin\AppData\Local\Temp\chocolatey + key: ${{ matrix.os }}-chocolatey + - name: Configure CMake env: MACOSX_DEPLOYMENT_TARGET: 10.12 @@ -108,7 +110,6 @@ jobs: ${{ matrix.cmake_options }} -DHUNTER_CONFIGURATION_TYPES=Release -DHUNTER_ENABLED=ON - -DHUNTER_STATUS_DEBUG=ON -DHUNTER_ROOT=${{ steps.strings.outputs.hunter-dir }} -S ${{ github.workspace }} @@ -121,3 +122,18 @@ jobs: env: MACOSX_DEPLOYMENT_TARGET: 10.12 run: cmake --build --preset client + + - name: Package + run: cmake --build --preset client --target package + + - uses: actions/upload-artifact@v4 + if: ${{ failure() }} + with: + name: ${{ matrix.os }}-logs + path: build/**/*.log + + - uses: actions/upload-artifact@v4 + with: + name: ${{ matrix.os }}-client-package + path: build/ryzomcore-* + if-no-files-found: error diff --git a/CMakeLists.txt b/CMakeLists.txt index e62ff953ff..eca8265898 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -484,14 +484,13 @@ SET(CPACK_PACKAGE_VERSION_MINOR "${NL_VERSION_MINOR}") SET(CPACK_PACKAGE_VERSION_PATCH "${NL_VERSION_PATCH}") SET(CPACK_INSTALL_CMAKE_PROJECTS "${CMAKE_BINARY_DIR};NeL;ALL;/") SET(CPACK_PACKAGE_EXECUTABLES "ryzomcore${NL_VERSION}" "ryzomcore") -SET(CPACK_SET_DESTDIR TRUE) # NSIS Specific Packing Setup SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "RyzomCore") SET(CPACK_NSIS_MODIFY_PATH "ON") -SET(CPACK_NSIS_MUI_ICON ${CMAKE_SOURCE_DIR}/resources/nevraxpill.ico) -SET(CPACK_NSIS_MUI_UNIICON ${CMAKE_SOURCE_DIR}/resources/nevraxpill.ico) -SET(CPACK_PACKAGE_ICON ${CMAKE_SOURCE_DIR}/resources\\\\nel.bmp) +SET(CPACK_NSIS_MUI_ICON ${CMAKE_SOURCE_DIR}/nel/resources/nevraxpill.ico) +SET(CPACK_NSIS_MUI_UNIICON ${CMAKE_SOURCE_DIR}/nel/resources/nevraxpill.ico) +SET(CPACK_PACKAGE_ICON ${CMAKE_SOURCE_DIR}/nel/resources\\\\nel.bmp) SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} RyzomCore") SET(CPACK_NSIS_HELP_LINK "http:\\\\\\\\dev.ryzom.com") SET(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\dev.ryzom.com\\\\projects\\\\nel\\\\wiki") @@ -505,6 +504,7 @@ IF(WIN32) SET(CPACK_GENERATOR "NSIS;ZIP") SET(CPACK_SOURCE_GENERATOR "ZIP") ELSE() + SET(CPACK_SET_DESTDIR TRUE) SET(CPACK_GENERATOR "TGZ;STGZ") SET(CPACK_SOURCE_GENERATOR "TGZ") ENDIF() diff --git a/CMakePresets.json b/CMakePresets.json index cc95d7175e..a79022ce01 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -146,5 +146,11 @@ "GTEST_OUTPUT": "xml:${sourceDir}/build/reports/" } } + ], + "packagePresets": [ + { + "name": "client", + "configurePreset": "client" + } ] } \ No newline at end of file From 9efc362ef341fb09869eddf10fe345bd64915e3c Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Sun, 16 Jun 2024 06:23:39 +0000 Subject: [PATCH 084/126] use cmake preset in ci pipeline --- .github/workflows/cmake-multi-platform.yml | 38 ++++++---------------- CMakePresets.json | 22 ++++++++++--- 2 files changed, 28 insertions(+), 32 deletions(-) diff --git a/.github/workflows/cmake-multi-platform.yml b/.github/workflows/cmake-multi-platform.yml index 99fc9ff45c..0655d44729 100644 --- a/.github/workflows/cmake-multi-platform.yml +++ b/.github/workflows/cmake-multi-platform.yml @@ -23,6 +23,7 @@ jobs: matrix: os: [ubuntu-22.04, ubuntu-20.04] build_type: [Release] + build_preset: [release] c_compiler: [gcc] include: - os: ubuntu-22.04 @@ -74,39 +75,20 @@ jobs: sudo mv msquic.h msquic_posix.h quic_sal_stub.h /usr/include/ - name: Configure CMake - # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. - # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type run: > - cmake -B ${{ steps.strings.outputs.build-output-dir }} - -G "Ninja" - -DCMAKE_SUPPRESS_REGENERATION=ON + cmake --preset linux-default -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} - -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} - -DWITH_STATIC=ON - -DWITH_NEL_TESTS=ON - -DWITH_NEL_SAMPLES=ON - -DWITH_LUA51=OFF - -DWITH_LUA52=ON - -DWITH_RYZOM=ON - -DWITH_RYZOM_SERVER=ON - -DWITH_RYZOM_CLIENT=ON - -DWITH_RYZOM_TOOLS=ON - -DWITH_NEL_TOOLS=ON - -DWITH_NELNS=ON - -DWITH_NELNS_LOGIN_SYSTEM=ON - -DWITH_NELNS_SERVER=ON - -DWITH_QT5=ON - -DWITH_LIBGSF=ON - -S ${{ github.workspace }} - name: Build - # Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator). - run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} + run: cmake --build --preset ${{ matrix.build_preset }} + + - uses: actions/upload-artifact@v4 + with: + name: ${{ matrix.os }}-build + path: build - name: Unit Tests - # Execute tests defined by the CMake configuration. Note that --build-config is needed because the default Windows generator is a multi-config generator (Visual Studio generator). - # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail run: ctest --preset default - uses: actions/upload-artifact@v4 @@ -114,10 +96,10 @@ jobs: with: name: test-results if-no-files-found: error - path: "${{ steps.strings.outputs.build-output-dir }}/**/reports/*.xml" + path: ${{ steps.strings.outputs.build-output-dir }}/**/reports/*.xml - name: Package - run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} --target package + run: cpack --preset default - uses: actions/upload-artifact@v4 with: diff --git a/CMakePresets.json b/CMakePresets.json index a79022ce01..4ed4183f9d 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -7,8 +7,9 @@ "binaryDir": "${sourceDir}/build" }, { - "name": "linux", "inherits": "base", + "name": "linux", + "hidden": true, "generator": "Ninja Multi-Config", "condition": { "type": "equals", @@ -17,8 +18,9 @@ } }, { - "name": "windows", "inherits": "base", + "name": "windows", + "hidden": true, "condition": { "type": "equals", "lhs": "${hostSystemName}", @@ -26,8 +28,9 @@ } }, { - "name": "macos", "inherits": "base", + "name": "macos", + "hidden": true, "generator": "Xcode", "condition": { "type": "equals", @@ -40,7 +43,7 @@ "name": "default", "cacheVariables": { "WITH_STATIC": true, - "WITH_NEL_TESTS": false, + "WITH_NEL_TESTS": true, "WITH_NEL_SAMPLES": true, "WITH_LUA51": false, "WITH_LUA52": true, @@ -68,6 +71,13 @@ "CMAKE_CXX_FLAGS": "--coverage" } }, + { + "inherits": [ + "linux", + "default" + ], + "name": "linux-default" + }, { "inherits": "base", "name": "client", @@ -148,6 +158,10 @@ } ], "packagePresets": [ + { + "name": "default", + "configurePreset": "default" + }, { "name": "client", "configurePreset": "client" From d3f7be4a3c27d3c50a08b24996f509a4cf3085a6 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Sun, 16 Jun 2024 10:40:53 +0000 Subject: [PATCH 085/126] don't disable precompiled headers in default preset --- CMakePresets.json | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/CMakePresets.json b/CMakePresets.json index 4ed4183f9d..9a8bc8b066 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -56,9 +56,7 @@ "WITH_NELNS_LOGIN_SYSTEM": true, "WITH_NELNS_SERVER": true, "WITH_QT5": true, - "WITH_LIBGSF": true, - "WITH_MONGODB": false, - "WITH_PCH": false + "WITH_LIBGSF": true } }, { From 1c4b661c4528134c4f637dea9541daee77424853 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Sun, 16 Jun 2024 11:19:04 +0000 Subject: [PATCH 086/126] use all resources to build in pipeline --- .github/workflows/cmake-multi-platform.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cmake-multi-platform.yml b/.github/workflows/cmake-multi-platform.yml index 0655d44729..104cd3d0ae 100644 --- a/.github/workflows/cmake-multi-platform.yml +++ b/.github/workflows/cmake-multi-platform.yml @@ -81,7 +81,7 @@ jobs: -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} - name: Build - run: cmake --build --preset ${{ matrix.build_preset }} + run: cmake --build --parallel $(nproc) --preset ${{ matrix.build_preset }} - uses: actions/upload-artifact@v4 with: From c8ac84c7856819bda709e29dc336a66eaa862704 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Sun, 16 Jun 2024 11:56:56 +0000 Subject: [PATCH 087/126] Revert "use all resources to build in pipeline" This reverts commit 1c4b661c4528134c4f637dea9541daee77424853. --- .github/workflows/cmake-multi-platform.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cmake-multi-platform.yml b/.github/workflows/cmake-multi-platform.yml index 104cd3d0ae..0655d44729 100644 --- a/.github/workflows/cmake-multi-platform.yml +++ b/.github/workflows/cmake-multi-platform.yml @@ -81,7 +81,7 @@ jobs: -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} - name: Build - run: cmake --build --parallel $(nproc) --preset ${{ matrix.build_preset }} + run: cmake --build --preset ${{ matrix.build_preset }} - uses: actions/upload-artifact@v4 with: From 627a9c294fd4e8e679c4311f1f174d081ac3878f Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Sun, 16 Jun 2024 13:06:39 +0000 Subject: [PATCH 088/126] include docker image in ci pipeline --- .github/workflows/cmake-multi-platform.yml | 212 ++++++++++++++------- 1 file changed, 139 insertions(+), 73 deletions(-) diff --git a/.github/workflows/cmake-multi-platform.yml b/.github/workflows/cmake-multi-platform.yml index 0655d44729..0b46c702f4 100644 --- a/.github/workflows/cmake-multi-platform.yml +++ b/.github/workflows/cmake-multi-platform.yml @@ -12,8 +12,36 @@ on: - '.github/workflows/**.yml' - '!.github/workflows/cmake-multi-platform.yml' +env: + DEFAULT_BRANCH: core4 + IMAGE_NAME: ryzomcore-tools + jobs: + strings: + runs-on: ubuntu-latest + outputs: + build-output-dir: ${{ steps.strings.outputs.build-output-dir }} + build-version: ${{ steps.strings.outputs.build-version }} + docker-image-tag: ${{ steps.strings.outputs.docker-image-tag }} + steps: + - name: Set reusable strings + id: strings + shell: bash + run: | + echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" + COMMIT_HASH=${{ github.sha }} + VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') + [[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') + [ "$VERSION" == "$DEFAULT_BRANCH}}" ] && VERSION=latest + IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME + IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') + echo VERSION=$VERSION + echo IMAGE_ID=$IMAGE_ID + echo "build-version=${VERSION}+sha.${COMMIT_HASH:0:8}" >> "$GITHUB_OUTPUT" + echo "docker-image-tag=${IMAGE_ID}:${VERSION}" >> "$GITHUB_OUTPUT" + build: + needs: [ strings ] runs-on: ${{ matrix.os }} strategy: @@ -21,10 +49,10 @@ jobs: fail-fast: false matrix: - os: [ubuntu-22.04, ubuntu-20.04] - build_type: [Release] - build_preset: [release] - c_compiler: [gcc] + os: [ ubuntu-22.04, ubuntu-20.04 ] + build_type: [ Release ] + build_preset: [ release ] + c_compiler: [ gcc ] include: - os: ubuntu-22.04 c_compiler: gcc @@ -36,72 +64,110 @@ jobs: ubuntu_version: 20.04 steps: - - uses: actions/checkout@v4 - - name: Set reusable strings - # Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file. - id: strings - shell: bash - run: | - echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" - - - name: Dependencies - run: | - sudo apt update - sudo apt install --yes software-properties-common - wget --quiet https://packages.microsoft.com/config/ubuntu/${{ matrix.ubuntu_version }}/packages-microsoft-prod.deb - sudo dpkg --install packages-microsoft-prod.deb - sudo apt update - sudo apt install --yes \ - cmake build-essential ninja-build ccache \ - bison autoconf automake \ - libpng-dev \ - libjpeg-dev \ - libgif-dev libfreetype6-dev \ - freeglut3-dev \ - liblua5.2-dev libluabind-dev libcpptest-dev \ - libogg-dev libvorbis-dev libopenal-dev \ - libavcodec-dev libavformat-dev libavdevice-dev libswscale-dev libpostproc-dev \ - libmysqlclient-dev \ - libxml2-dev \ - libcurl4-openssl-dev libssl-dev \ - libsquish-dev \ - liblzma-dev \ - libgsf-1-dev \ - qtbase5-dev qttools5-dev qttools5-dev-tools \ - libmsquic - wget https://raw.githubusercontent.com/microsoft/msquic/main/src/inc/msquic.h - wget https://raw.githubusercontent.com/microsoft/msquic/main/src/inc/msquic_posix.h - wget https://raw.githubusercontent.com/microsoft/msquic/main/src/inc/quic_sal_stub.h - sudo mv msquic.h msquic_posix.h quic_sal_stub.h /usr/include/ - - - name: Configure CMake - run: > - cmake --preset linux-default - -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} - -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} - - - name: Build - run: cmake --build --preset ${{ matrix.build_preset }} - - - uses: actions/upload-artifact@v4 - with: - name: ${{ matrix.os }}-build - path: build - - - name: Unit Tests - run: ctest --preset default - - - uses: actions/upload-artifact@v4 - if: (success() || failure()) && matrix.os == 'ubuntu-22.04' - with: - name: test-results - if-no-files-found: error - path: ${{ steps.strings.outputs.build-output-dir }}/**/reports/*.xml - - - name: Package - run: cpack --preset default - - - uses: actions/upload-artifact@v4 - with: - name: package-${{ matrix.os }} - path: ${{ steps.strings.outputs.build-output-dir }}/ryzomcore-* + - uses: lukka/get-cmake@v3.29.5 + + - uses: actions/checkout@v4 + + - name: Dependencies + run: | + sudo apt update + sudo apt install --yes software-properties-common + wget --quiet https://packages.microsoft.com/config/ubuntu/${{ matrix.ubuntu_version }}/packages-microsoft-prod.deb + sudo dpkg --install packages-microsoft-prod.deb + sudo apt update + sudo apt install --yes \ + build-essential ccache \ + bison autoconf automake \ + libpng-dev \ + libjpeg-dev \ + libgif-dev libfreetype6-dev \ + freeglut3-dev \ + liblua5.2-dev libluabind-dev libcpptest-dev \ + libogg-dev libvorbis-dev libopenal-dev \ + libavcodec-dev libavformat-dev libavdevice-dev libswscale-dev libpostproc-dev \ + libmysqlclient-dev \ + libxml2-dev \ + libcurl4-openssl-dev libssl-dev \ + libsquish-dev \ + liblzma-dev \ + libgsf-1-dev \ + qtbase5-dev qttools5-dev qttools5-dev-tools \ + libmsquic + wget https://raw.githubusercontent.com/microsoft/msquic/main/src/inc/msquic.h + wget https://raw.githubusercontent.com/microsoft/msquic/main/src/inc/msquic_posix.h + wget https://raw.githubusercontent.com/microsoft/msquic/main/src/inc/quic_sal_stub.h + sudo mv msquic.h msquic_posix.h quic_sal_stub.h /usr/include/ + + - name: Configure CMake + run: > + cmake --preset linux-default + -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} + -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} + + - name: Build + run: cmake --build --preset ${{ matrix.build_preset }} + + - uses: actions/upload-artifact@v4 + with: + name: ${{ matrix.os }}-build + path: build + + - name: Unit Tests + run: ctest --preset default + + - uses: actions/upload-artifact@v4 + if: (success() || failure()) && matrix.os == 'ubuntu-22.04' + with: + name: test-results + if-no-files-found: error + path: ${{ needs.strings.outputs.build-output-dir }}/**/reports/*.xml + + + package: + runs-on: ubuntu-latest + needs: [ strings, build ] + + steps: + - uses: lukka/get-cmake@v3.29.5 + + - uses: actions/checkout@v4 + + - uses: actions/download-artifact@v4 + with: + name: build-ubuntu-22.04 + path: ${{ needs.strings.outputs.build-output-dir }} + + - name: Package + run: cpack --preset default + + - uses: actions/upload-artifact@v4 + with: + name: package-ubuntu-22.04 + path: ${{ steps.strings.outputs.build-output-dir }}/ryzomcore-* + if-no-files-found: error + + docker: + runs-on: ubuntu-latest + needs: [ strings, package ] + permissions: + packages: write + contents: read + + steps: + - uses: actions/checkout@v4 + + - uses: actions/download-artifact@v4 + with: + name: package-ubuntu-22.04 + path: ${{ needs.strings.outputs.build-output-dir }} + + - name: Build the Docker image + run: | + docker build . --file docker/Dockerfile --tag "${{ needs.strings.outputs.docker-image-tag }}" + docker save --output=${{ needs.strings.outputs.build-output-dir }}/docker-$IMAGE_NAME-${{ needs.strings.outputs.build-version }} "${{ needs.strings.outputs.docker-image-tag }}" + + - uses: actions/upload-artifact@v4 + with: + name: docker + path: ${{ steps.strings.outputs.build-output-dir }}/docker-* + if-no-files-found: error From 115379a3dd4c39ba84fe0d65a8b786aa57cf7bd1 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Sun, 16 Jun 2024 14:19:01 +0000 Subject: [PATCH 089/126] adjust artifact name for further jobs --- .github/workflows/cmake-multi-platform.yml | 26 +++------------------- 1 file changed, 3 insertions(+), 23 deletions(-) diff --git a/.github/workflows/cmake-multi-platform.yml b/.github/workflows/cmake-multi-platform.yml index 0b46c702f4..019abfe4df 100644 --- a/.github/workflows/cmake-multi-platform.yml +++ b/.github/workflows/cmake-multi-platform.yml @@ -107,11 +107,6 @@ jobs: - name: Build run: cmake --build --preset ${{ matrix.build_preset }} - - uses: actions/upload-artifact@v4 - with: - name: ${{ matrix.os }}-build - path: build - - name: Unit Tests run: ctest --preset default @@ -122,33 +117,18 @@ jobs: if-no-files-found: error path: ${{ needs.strings.outputs.build-output-dir }}/**/reports/*.xml - - package: - runs-on: ubuntu-latest - needs: [ strings, build ] - - steps: - - uses: lukka/get-cmake@v3.29.5 - - - uses: actions/checkout@v4 - - - uses: actions/download-artifact@v4 - with: - name: build-ubuntu-22.04 - path: ${{ needs.strings.outputs.build-output-dir }} - - name: Package run: cpack --preset default - uses: actions/upload-artifact@v4 with: - name: package-ubuntu-22.04 + name: ${{ matrix.os }}-package path: ${{ steps.strings.outputs.build-output-dir }}/ryzomcore-* if-no-files-found: error docker: runs-on: ubuntu-latest - needs: [ strings, package ] + needs: [ strings, build ] permissions: packages: write contents: read @@ -158,7 +138,7 @@ jobs: - uses: actions/download-artifact@v4 with: - name: package-ubuntu-22.04 + name: ubuntu-22.04-package path: ${{ needs.strings.outputs.build-output-dir }} - name: Build the Docker image From 31c17928931d5dc0f233327e0451deb96857bbbf Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Mon, 17 Jun 2024 05:18:13 +0000 Subject: [PATCH 090/126] reference string from job dependency --- .github/workflows/cmake-multi-platform.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cmake-multi-platform.yml b/.github/workflows/cmake-multi-platform.yml index 019abfe4df..a47f483e5e 100644 --- a/.github/workflows/cmake-multi-platform.yml +++ b/.github/workflows/cmake-multi-platform.yml @@ -123,7 +123,7 @@ jobs: - uses: actions/upload-artifact@v4 with: name: ${{ matrix.os }}-package - path: ${{ steps.strings.outputs.build-output-dir }}/ryzomcore-* + path: ${{ needs.strings.outputs.build-output-dir }}/ryzomcore-* if-no-files-found: error docker: @@ -149,5 +149,5 @@ jobs: - uses: actions/upload-artifact@v4 with: name: docker - path: ${{ steps.strings.outputs.build-output-dir }}/docker-* + path: ${{ needs.strings.outputs.build-output-dir }}/docker-* if-no-files-found: error From 4fc504279034f36297dbcceeabd29a7f851f49d4 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Mon, 17 Jun 2024 06:43:15 +0000 Subject: [PATCH 091/126] adjust docker file to be able to install even if package installer is not exectuable --- docker/Dockerfile | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index c0525acb03..d14c141cba 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -8,11 +8,6 @@ ARG APP_HOME=/app RUN groupadd --gid $USER_GID $USERNAME \ && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME -COPY build/ryzomcore-*.sh /tmp/ryzomcore.sh - -RUN mkdir --parent "$APP_HOME" \ - && /tmp/ryzomcore.sh --skip-license - ENV LD_LIBRARY_PATH=/usr/local/lib # install dependencies @@ -33,4 +28,12 @@ RUN apt update; \ libvorbisfile3 \ libxml2 + +COPY build/ryzomcore-*.sh /tmp/ryzomcore.sh + +RUN mkdir --parent "$APP_HOME" \ + && sh /tmp/ryzomcore.sh --skip-license + + USER $USERNAME +WORKDIR $APP_HOME From 64eacf5a79eedba10e9ec79687d92cc30293a5ba Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Mon, 17 Jun 2024 07:39:13 +0000 Subject: [PATCH 092/126] push docker image in ci pipeline on default branch --- .github/workflows/cmake-multi-platform.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/cmake-multi-platform.yml b/.github/workflows/cmake-multi-platform.yml index a47f483e5e..0fbff26f67 100644 --- a/.github/workflows/cmake-multi-platform.yml +++ b/.github/workflows/cmake-multi-platform.yml @@ -151,3 +151,9 @@ jobs: name: docker path: ${{ needs.strings.outputs.build-output-dir }}/docker-* if-no-files-found: error + + - name: Push image + if: github.ref == 'refs/heads/${{ env.DEFAULT_BRANCH }}' + run: | + echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin + docker push "${{ steps.strings.outputs.docker-image-tag }}" From 01605c770c7b1ef1cfa7a9e31b7dc391878fc439 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Mon, 17 Jun 2024 10:35:19 +0200 Subject: [PATCH 093/126] fix type in pipeline strings --- .github/workflows/cmake-multi-platform.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cmake-multi-platform.yml b/.github/workflows/cmake-multi-platform.yml index 0fbff26f67..47dd3ea898 100644 --- a/.github/workflows/cmake-multi-platform.yml +++ b/.github/workflows/cmake-multi-platform.yml @@ -32,7 +32,7 @@ jobs: COMMIT_HASH=${{ github.sha }} VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') [[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') - [ "$VERSION" == "$DEFAULT_BRANCH}}" ] && VERSION=latest + [ "$VERSION" == "$DEFAULT_BRANCH" ] && VERSION=latest IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') echo VERSION=$VERSION From a716f433c5e42f9db3673d261cd303c85d6606d8 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Mon, 17 Jun 2024 16:24:53 +0200 Subject: [PATCH 094/126] reference job dependency for strings --- .github/workflows/cmake-multi-platform.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cmake-multi-platform.yml b/.github/workflows/cmake-multi-platform.yml index 47dd3ea898..74cbccad11 100644 --- a/.github/workflows/cmake-multi-platform.yml +++ b/.github/workflows/cmake-multi-platform.yml @@ -156,4 +156,4 @@ jobs: if: github.ref == 'refs/heads/${{ env.DEFAULT_BRANCH }}' run: | echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin - docker push "${{ steps.strings.outputs.docker-image-tag }}" + docker push "${{ needs.strings.outputs.docker-image-tag }}" From dd2fd244262615a960e3005ad95d8f87c83d2fe5 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Mon, 17 Jun 2024 16:49:59 +0200 Subject: [PATCH 095/126] update pipeline to remove deprecated image version --- azure-pipelines.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index f0b407fcc7..944fb55364 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -133,12 +133,13 @@ jobs: -DWITH_DRIVER_DIRECT3D=ON -DWITH_DRIVER_XAUDIO2=ON -DDXSDK_DIR=C:/DXSDK - macOS11: - vmImage: 'macOS-11' + macOS12: + vmImage: 'macOS-12' releaseName: 'macOS' MACOSX_DEPLOYMENT_TARGET: 10.12 cmakeExtra: >- -DWITH_LIBXML2_ICONV=OFF + -DHUNTER_USE_CACHE_SERVERS=NO -GXcode timeoutInMinutes: 120 pool: From 93b72b68257e59b897b9e50450e78f8420f49e9f Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Mon, 17 Jun 2024 17:24:40 +0200 Subject: [PATCH 096/126] use msquic in pipeline --- .github/workflows/cmake-multi-platform.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/cmake-multi-platform.yml b/.github/workflows/cmake-multi-platform.yml index 74cbccad11..e04040d821 100644 --- a/.github/workflows/cmake-multi-platform.yml +++ b/.github/workflows/cmake-multi-platform.yml @@ -101,6 +101,7 @@ jobs: - name: Configure CMake run: > cmake --preset linux-default + -DWITH_MSQUIC=ON -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} From 5bb8941ec9992dd66c3ee35621b41e787bc7a881 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Mon, 17 Jun 2024 17:25:31 +0200 Subject: [PATCH 097/126] use presets in pipeline --- azure-pipelines.yml | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 944fb55364..9fca163f1b 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -33,26 +33,18 @@ jobs: wget https://raw.githubusercontent.com/microsoft/msquic/main/src/inc/quic_sal_stub.h sudo mv msquic.h msquic_posix.h quic_sal_stub.h /usr/include/ displayName: 'Dependencies' - - script: | - mkdir build - cmake --version - cd build - cmake -G "Ninja" -DCMAKE_SUPPRESS_REGENERATION=ON \ - -DWITH_STATIC=ON -DWITH_NEL_TESTS=ON -DWITH_NEL_SAMPLES=ON \ - -DWITH_MSQUIC=ON \ - -DWITH_LUA51=OFF -DWITH_LUA52=ON \ - -DWITH_RYZOM=ON -DWITH_RYZOM_SERVER=ON -DWITH_RYZOM_CLIENT=ON -DWITH_RYZOM_TOOLS=ON \ - -DWITH_NEL_TOOLS=ON -DWITH_NELNS=ON -DWITH_NELNS_LOGIN_SYSTEM=ON -DWITH_NELNS_SERVER=ON \ - -DWITH_QT5=ON -DWITH_LIBGSF=ON .. - cat CMakeCache.txt + - script: > + cmake --preset linux-default + -DCMAKE_SUPPRESS_REGENERATION=ON + -DWITH_MSQUIC=ON displayName: 'CMake' - script: | - cd build - ninja -j`nproc` + cat build/CMakeCache.txt + - script: | + cmake --build --preset release displayName: 'Make' - script: | - cd nel/tools/nel_unit_test - ../../../build/bin/nel_unit_test + ctest --preset default displayName: 'Unit Tests' - job: ubuntu22 timeoutInMinutes: 120 From 994be9b4a56433d291335583a6bdee2f8a723963 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Mon, 17 Jun 2024 19:03:31 +0200 Subject: [PATCH 098/126] use presets in pipeline --- azure-pipelines.yml | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 9fca163f1b..d5162915bb 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -46,6 +46,7 @@ jobs: - script: | ctest --preset default displayName: 'Unit Tests' + - job: ubuntu22 timeoutInMinutes: 120 pool: @@ -80,27 +81,20 @@ jobs: wget https://raw.githubusercontent.com/microsoft/msquic/main/src/inc/quic_sal_stub.h sudo mv msquic.h msquic_posix.h quic_sal_stub.h /usr/include/ displayName: 'Dependencies' - - script: | - mkdir build - cmake --version - cd build - cmake -G "Ninja" -DCMAKE_SUPPRESS_REGENERATION=ON \ - -DWITH_STATIC=ON -DWITH_NEL_TESTS=ON -DWITH_NEL_SAMPLES=ON \ - -DWITH_MSQUIC=ON \ - -DWITH_LUA51=OFF -DWITH_LUA52=ON \ - -DWITH_RYZOM=ON -DWITH_RYZOM_SERVER=ON -DWITH_RYZOM_CLIENT=ON -DWITH_RYZOM_TOOLS=ON \ - -DWITH_NEL_TOOLS=ON -DWITH_NELNS=ON -DWITH_NELNS_LOGIN_SYSTEM=ON -DWITH_NELNS_SERVER=ON \ - -DWITH_QT5=ON -DWITH_LIBGSF=ON .. - cat CMakeCache.txt + - script: > + cmake --preset linux-default + -DCMAKE_SUPPRESS_REGENERATION=ON + -DWITH_MSQUIC=ON displayName: 'CMake' - script: | - cd build - ninja -j`nproc` + cat build/CMakeCache.txt + - script: | + cmake --build --preset release displayName: 'Make' - script: | - cd nel/tools/nel_unit_test - ../../../build/bin/nel_unit_test + ctest --preset default displayName: 'Unit Tests' + - job: client strategy: matrix: From 7915d0e83593dc21342bcfe0205b81c88a659ea9 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Fri, 21 Jun 2024 19:10:42 +0200 Subject: [PATCH 099/126] Feature/naming service tests (#713) * integration test for nameing service --- .github/workflows/cmake-multi-platform.yml | 2 +- nel/include/nel/net/callback_net_base.h | 3 +- nel/src/net/callback_net_base.cpp | 2 +- .../nelns/naming_service/functions.cpp | 22 -- .../nelns/naming_service/functions.h | 12 -- .../nelns/naming_service/naming_service.cpp | 35 ++-- .../nelns/naming_service/naming_service.h | 14 ++ nelns/naming_service/tests/CMakeLists.txt | 19 +- .../tests/naming_service.it.cpp | 198 ++++++++++++++++++ 9 files changed, 251 insertions(+), 56 deletions(-) create mode 100644 nelns/naming_service/tests/naming_service.it.cpp diff --git a/.github/workflows/cmake-multi-platform.yml b/.github/workflows/cmake-multi-platform.yml index e04040d821..83008f194c 100644 --- a/.github/workflows/cmake-multi-platform.yml +++ b/.github/workflows/cmake-multi-platform.yml @@ -154,7 +154,7 @@ jobs: if-no-files-found: error - name: Push image - if: github.ref == 'refs/heads/${{ env.DEFAULT_BRANCH }}' + if: ${{ github.ref == format('refs/heads/{0}', env.DEFAULT_BRANCH) }} run: | echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin docker push "${{ needs.strings.outputs.docker-image-tag }}" diff --git a/nel/include/nel/net/callback_net_base.h b/nel/include/nel/net/callback_net_base.h index 3efb068a4e..ce616454e9 100644 --- a/nel/include/nel/net/callback_net_base.h +++ b/nel/include/nel/net/callback_net_base.h @@ -31,6 +31,7 @@ #include #endif +#include #include @@ -43,7 +44,7 @@ class CCallbackNetBase; * msgin contains parameters of the message * from is the SockId of the connection, for a client, from is always the same value */ -typedef void (*TMsgCallback) (CMessage &msgin, TSockId from, CCallbackNetBase &netbase); +typedef std::function TMsgCallback; /// Callback items. See CMsgSocket::update() for an explanation on how the callbacks are called. diff --git a/nel/src/net/callback_net_base.cpp b/nel/src/net/callback_net_base.cpp index 7a117f6403..70f260e0d8 100644 --- a/nel/src/net/callback_net_base.cpp +++ b/nel/src/net/callback_net_base.cpp @@ -206,7 +206,7 @@ void CCallbackNetBase::processOneMessage () } else { - LNETL3_DEBUG ("LNETL3NB_CB: Calling callback (%s)%s", msgin.getName().c_str(), (cb==_DefaultCallback)?" DEFAULT_CB":""); + LNETL3_DEBUG ("LNETL3NB_CB: Calling callback (%s)", msgin.getName().c_str()); if (_PreDispatchCallback != NULL) { diff --git a/nelns/naming_service/nelns/naming_service/functions.cpp b/nelns/naming_service/nelns/naming_service/functions.cpp index 32d533070a..37f819cc11 100644 --- a/nelns/naming_service/nelns/naming_service/functions.cpp +++ b/nelns/naming_service/nelns/naming_service/functions.cpp @@ -420,28 +420,6 @@ void cbResendRegisteration(CMessage &msgin, TSockId from, CCallbackNetBase &netb doRegister(name, addr, sid, from, netbase, true); } -/** - * Callback for service registration. - * - * Message expected : RG - * - Name of service to register (string) - * - Address of service (CInetAddress) - * - * Message emitted : RG - * - Allocated service identifier (TServiceId) or 0 if failed - */ -void cbRegister(CMessage &msgin, TSockId from, CCallbackNetBase &netbase) -{ - string name; - vector addr; - TServiceId sid; - msgin.serial(name); - msgin.serialCont(addr); - msgin.serial(sid); - - doRegister(name, addr, sid, from, netbase); -} - /** * Callback for service unregistration. * diff --git a/nelns/naming_service/nelns/naming_service/functions.h b/nelns/naming_service/nelns/naming_service/functions.h index 9959349a9e..41b33b5fb4 100644 --- a/nelns/naming_service/nelns/naming_service/functions.h +++ b/nelns/naming_service/nelns/naming_service/functions.h @@ -50,18 +50,6 @@ void cbACKUnregistration(NLNET::CMessage &msgin, NLNET::TSockId from, NLNET::CCa */ void cbResendRegisteration(NLNET::CMessage &msgin, NLNET::TSockId from, NLNET::CCallbackNetBase &netbase); -/** - * Callback for service registration. - * - * Message expected : RG - * - Name of service to register (string) - * - Address of service (CInetAddress) - * - * Message emitted : RG - * - Allocated service identifier (TServiceId) or 0 if failed - */ -void cbRegister(NLNET::CMessage &msgin, NLNET::TSockId from, NLNET::CCallbackNetBase &netbase); - /** * Callback for service unregistration. * diff --git a/nelns/naming_service/nelns/naming_service/naming_service.cpp b/nelns/naming_service/nelns/naming_service/naming_service.cpp index 757d2ad959..efcce08190 100644 --- a/nelns/naming_service/nelns/naming_service/naming_service.cpp +++ b/nelns/naming_service/nelns/naming_service/naming_service.cpp @@ -18,26 +18,15 @@ using std::vector; using NLMISC::CConfigFile; using NLMISC::Exception; using NLMISC::toString; +using NLNET::CCallbackNetBase; using NLNET::CCallbackServer; using NLNET::CInetAddress; +using NLNET::CMessage; using NLNET::CUnifiedNetwork; using NLNET::TCallbackItem; using NLNET::TServiceId; using NLNET::TSockId; -// -// Callback array -// - -TCallbackItem CallbackArray[] = { - { "RG", cbRegister }, - { "RRG", cbResendRegisteration }, - { "QP", cbQueryPort }, - { "UNI", cbUnregisterSId }, - { "ACK_UNI", cbACKUnregistration }, - // { "RS", cbRegisteredServices }, -}; - /** * Init */ @@ -105,6 +94,14 @@ void CNamingService::init() nsport = var->asInt(); } + TCallbackItem CallbackArray[] = { + { "RG", [=](auto &msgin, auto from, auto &netbase) { cbRegister(msgin, from); } }, + { "RRG", cbResendRegisteration }, + { "QP", cbQueryPort }, + { "UNI", cbUnregisterSId }, + { "ACK_UNI", cbACKUnregistration }, + // { "RS", cbRegisteredServices }, + }; CallbackServer = new CCallbackServer; CallbackServer->init(nsport); CallbackServer->addCallbackArray(CallbackArray, sizeof(CallbackArray) / sizeof(CallbackArray[0])); @@ -130,3 +127,15 @@ void CNamingService::release() delete CallbackServer; CallbackServer = NULL; } + +void CNamingService::cbRegister(CMessage &msgin, TSockId from) +{ + string name; + vector addr; + TServiceId sid; + msgin.serial(name); + msgin.serialCont(addr); + msgin.serial(sid); + + doRegister(name, addr, sid, from, *CallbackServer); +} diff --git a/nelns/naming_service/nelns/naming_service/naming_service.h b/nelns/naming_service/nelns/naming_service/naming_service.h index c4c41babe3..6e43836cc3 100644 --- a/nelns/naming_service/nelns/naming_service/naming_service.h +++ b/nelns/naming_service/nelns/naming_service/naming_service.h @@ -2,6 +2,8 @@ #define NELNS_NAMING_SERVICE_SERVICE_NAMING_SERVICE_H #include +#include +#include #include #include @@ -26,6 +28,18 @@ class CNamingService : public NLNET::IService void release(); private: + /** + * Callback for service registration. + * + * Message expected : RG + * - Name of service to register (string) + * - Address of service (CInetAddress) + * + * Message emitted : RG + * - Allocated service identifier (TServiceId) or 0 if failed + */ + void cbRegister(NLNET::CMessage &msgin, NLNET::TSockId from); + /// Service instance manager singleton CServiceInstanceManager _ServiceInstances; }; diff --git a/nelns/naming_service/tests/CMakeLists.txt b/nelns/naming_service/tests/CMakeLists.txt index b28a912800..1e7050e586 100644 --- a/nelns/naming_service/tests/CMakeLists.txt +++ b/nelns/naming_service/tests/CMakeLists.txt @@ -1,22 +1,29 @@ -add_test_executable(do_allocate_port_test +add_test_executable(nelns_do_allocate_port_test do_allocate_port.test.cpp ) -target_link_libraries(do_allocate_port_test +target_link_libraries(nelns_do_allocate_port_test nelns::ns ) -add_test_executable(naming_service_test +add_test_executable(nelns_naming_service_test naming_service.test.cpp ) -target_link_libraries(naming_service_test +target_link_libraries(nelns_naming_service_test nelns::ns ) -add_test_executable(service_instance_manager_test +add_test_executable(nelns_service_instance_manager_test service_instance_manager.test.cpp ) -target_link_libraries(service_instance_manager_test +target_link_libraries(nelns_service_instance_manager_test + nelns::ns +) + +add_test_executable(nelns_naming_service_it + naming_service.it.cpp +) +target_link_libraries(nelns_naming_service_it nelns::ns ) diff --git a/nelns/naming_service/tests/naming_service.it.cpp b/nelns/naming_service/tests/naming_service.it.cpp new file mode 100644 index 0000000000..a93fea964b --- /dev/null +++ b/nelns/naming_service/tests/naming_service.it.cpp @@ -0,0 +1,198 @@ +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +using ::std::nullopt; +using ::std::optional; +using ::std::string; +using ::std::vector; +using ::testing::AllOf; +using ::testing::ElementsAre; +using ::testing::Eq; +using ::testing::Field; +using ::testing::FieldsAre; +using ::testing::IsFalse; +using ::testing::IsNull; +using ::testing::IsTrue; +using ::testing::Not; +using ::testing::NotNull; +using ::testing::Optional; +using ::testing::Property; +using ::testing::SizeIs; +using ::testing::StrEq; + +using CVar = ::NLMISC::CConfigFile::CVar; +using ::NLMISC::IStream; +using ::NLNET::CCallbackClient; +using ::NLNET::CCallbackNetBase; +using ::NLNET::CInetAddress; +using ::NLNET::CInetHost; +using ::NLNET::CMessage; +using ::NLNET::TCallbackItem; +using ::NLNET::TServiceId; +using ::NLNET::TSockId; + +struct RGBResponseEntry +{ + string name; + TServiceId sid; + vector addr; + void serial(IStream &stream) + { + stream.serial(name); + stream.serial(sid); + stream.serialCont(addr); + } +}; + +struct RGBResponse +{ + vector items; + void serial(IStream &stream) + { + TServiceId::size_type size; + stream.serial(size); + for (TServiceId::size_type i = 0; i < size; ++i) + { + RGBResponseEntry entry; + + stream.serial(entry); + items.push_back(entry); + } + } +}; + +struct RGResponse +{ + bool success; + optional sid; + optional content; + optional reason; + void serial(IStream &stream) + { + stream.serial(success); + + if (success) + { + TServiceId sidIn; + stream.serial(sidIn); + sid = sidIn; + RGBResponse contentIn; + stream.serial(contentIn); + content = contentIn; + } + else + { + string reasonIn; + stream.serial(reasonIn); + reason = reasonIn; + } + } +}; + +struct RGRequest +{ + TServiceId serviceId; + string name; + vector addresses; + + void serial(IStream &stream) + { + stream.serial(name); + stream.serialCont(addresses); + stream.serial(serviceId); + } +}; + +class CNamingServiceIT : public testing::Test +{ +protected: + CCallbackClient client; + CNamingService instance; + int port = 50000; + + void SetUp() override + { + CVar basePort; + basePort.Type = NLMISC::CConfigFile::CVar::T_INT; + basePort.setAsInt(51000); + instance.ConfigFile.insertVar("BasePort", basePort); + + CVar uniqueOnShardServices; + uniqueOnShardServices.Type = NLMISC::CConfigFile::CVar::T_STRING; + uniqueOnShardServices.setAsString((vector) {}); + instance.ConfigFile.insertVar("UniqueOnShardServices", uniqueOnShardServices); + + CVar uniqueByMachineServices; + uniqueByMachineServices.Type = NLMISC::CConfigFile::CVar::T_STRING; + uniqueByMachineServices.setAsString((vector) {}); + instance.ConfigFile.insertVar("UniqueByMachineServices", uniqueByMachineServices); + + CVar nsPort; + nsPort.Type = NLMISC::CConfigFile::CVar::T_INT; + nsPort.setAsInt(port); + instance.ConfigFile.insertVar("NSPort", nsPort); + instance.init(); + + CInetHost host("localhost"); + host.setPort(port); + client.connect(host); + ASSERT_THAT(client.connected(), IsTrue()); + } + + void TearDown() override + { + client.disconnect(); + } +}; + +TEST_F(CNamingServiceIT, shouldAnswerToRegistration) +{ + RGRequest request{ + .serviceId = TServiceId(123), + .name = "test-service", + .addresses = {"localhost:12345"} + }; + CMessage msgout("RG"); + msgout.serial(request); + + RGResponse response; + TCallbackItem callbackArray[] = { + { "RG", [&response](CMessage &msgin, TSockId from, CCallbackNetBase &netbase) { + msgin.serial(response); + } } + }; + client.addCallbackArray(callbackArray, sizeof(callbackArray) / sizeof(callbackArray[0])); + + client.send(msgout); + client.flush(); + instance.update(); + client.update2(-1, 100); + + EXPECT_THAT(response.success, IsTrue()); + EXPECT_THAT(response.sid, Optional(Eq(request.serviceId))); + EXPECT_THAT( + response.content, + Optional(Field(&RGBResponse::items, + ElementsAre( + AllOf( + Field(&RGBResponseEntry::name, "test-service"), + Field(&RGBResponseEntry::sid, Eq(request.serviceId)), + Field(&RGBResponseEntry::addr, ElementsAre(Property(&CInetAddress::asString, "[::1]:12345")))))))); +} From 05eff55e34a78f36de6949ccd7ef21c1fa94aaab Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Fri, 21 Jun 2024 19:00:51 +0000 Subject: [PATCH 100/126] remove obsolete workflow --- .github/workflows/publish-docker-image.yml | 115 --------------------- 1 file changed, 115 deletions(-) delete mode 100644 .github/workflows/publish-docker-image.yml diff --git a/.github/workflows/publish-docker-image.yml b/.github/workflows/publish-docker-image.yml deleted file mode 100644 index 98b82a0b37..0000000000 --- a/.github/workflows/publish-docker-image.yml +++ /dev/null @@ -1,115 +0,0 @@ -name: Publish Docker Image - -on: - push: - branches: [ "core4" ] - tags: - - v* - paths-ignore: - - '.github/workflows/**.yml' - - '!.github/workflows/publish-docker-image.yml' - -env: - ubuntu_version: 22.04 - build_type: Release - cpp_compiler: g++ - c_compiler: gcc - IMAGE_NAME: ryzomcore-tools - -jobs: - build: - runs-on: ubuntu-22.04 - permissions: - packages: write - contents: read - - steps: - - uses: actions/checkout@v4 - - name: Set reusable strings - id: strings - shell: bash - run: | - echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" - VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') - [[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') - [ "$VERSION" == "core4" ] && VERSION=latest - IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME - IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') - echo VERSION=$VERSION - echo IMAGE_ID=$IMAGE_ID - echo "build-version=${VERSION}" >> "$GITHUB_OUTPUT" - echo "docker-image-tag=${IMAGE_ID}:${VERSION}" >> "$GITHUB_OUTPUT" - - - name: Dependencies - run: | - sudo apt update - sudo apt install --yes software-properties-common - wget --quiet https://packages.microsoft.com/config/ubuntu/${{ env.ubuntu_version }}/packages-microsoft-prod.deb - sudo dpkg --install packages-microsoft-prod.deb - sudo apt update - sudo apt install --yes \ - cmake build-essential ninja-build ccache \ - bison autoconf automake \ - libpng-dev \ - libjpeg-dev \ - libgif-dev libfreetype6-dev \ - freeglut3-dev \ - liblua5.2-dev libluabind-dev libcpptest-dev \ - libogg-dev libvorbis-dev libopenal-dev \ - libavcodec-dev libavformat-dev libavdevice-dev libswscale-dev libpostproc-dev \ - libmysqlclient-dev \ - libxml2-dev \ - libcurl4-openssl-dev libssl-dev \ - libsquish-dev \ - liblzma-dev \ - libgsf-1-dev \ - qtbase5-dev qttools5-dev qttools5-dev-tools \ - libmsquic - wget https://raw.githubusercontent.com/microsoft/msquic/main/src/inc/msquic.h - wget https://raw.githubusercontent.com/microsoft/msquic/main/src/inc/msquic_posix.h - wget https://raw.githubusercontent.com/microsoft/msquic/main/src/inc/quic_sal_stub.h - sudo mv msquic.h msquic_posix.h quic_sal_stub.h /usr/include/ - - - name: Configure CMake - run: > - cmake -B ${{ steps.strings.outputs.build-output-dir }} - -G "Ninja" - -DCMAKE_SUPPRESS_REGENERATION=ON - -DCMAKE_CXX_COMPILER=${{ env.cpp_compiler }} - -DCMAKE_C_COMPILER=${{ env.c_compiler }} - -DCMAKE_BUILD_TYPE=${{ env.build_type }} - -DWITH_STATIC=ON - -DWITH_NEL_SAMPLES=ON - -DWITH_LUA51=OFF - -DWITH_LUA52=ON - -DWITH_RYZOM=ON - -DWITH_RYZOM_SERVER=ON - -DWITH_RYZOM_CLIENT=ON - -DWITH_RYZOM_TOOLS=ON - -DWITH_NEL_TOOLS=ON - -DWITH_NELNS=ON - -DWITH_NELNS_LOGIN_SYSTEM=ON - -DWITH_NELNS_SERVER=ON - -DWITH_QT5=ON - -DWITH_LIBGSF=ON - -DCPACK_PACKAGE_VERSION="${{ steps.strings.outputs.build-version }}" - -DCPACK_GENERATOR=STGZ - -S ${{ github.workspace }} - - - name: Package - run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ env.build_type }} --target package - - - uses: actions/upload-artifact@v4 - with: - name: package - path: ${{ steps.strings.outputs.build-output-dir }}/ryzomcore-* - - - name: Build the Docker image - run: docker build . --file docker/Dockerfile --tag "${{ steps.strings.outputs.docker-image-tag }}" - - - name: Log in to registry - run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin - - - name: Push image - run: | - docker push "${{ steps.strings.outputs.docker-image-tag }}" From c55cc9e787dbf55265b2b55b2a0ef3f0d49997dc Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Wed, 26 Jun 2024 18:03:16 +0000 Subject: [PATCH 101/126] add test for re-registration --- .../tests/naming_service.it.cpp | 52 ++++++++++++++----- 1 file changed, 40 insertions(+), 12 deletions(-) diff --git a/nelns/naming_service/tests/naming_service.it.cpp b/nelns/naming_service/tests/naming_service.it.cpp index a93fea964b..0fd62584f1 100644 --- a/nelns/naming_service/tests/naming_service.it.cpp +++ b/nelns/naming_service/tests/naming_service.it.cpp @@ -15,6 +15,7 @@ #include #include +#include #include #include @@ -124,7 +125,7 @@ class CNamingServiceIT : public testing::Test { protected: CCallbackClient client; - CNamingService instance; + CNamingService namingService; int port = 50000; void SetUp() override @@ -132,23 +133,23 @@ class CNamingServiceIT : public testing::Test CVar basePort; basePort.Type = NLMISC::CConfigFile::CVar::T_INT; basePort.setAsInt(51000); - instance.ConfigFile.insertVar("BasePort", basePort); + namingService.ConfigFile.insertVar("BasePort", basePort); CVar uniqueOnShardServices; uniqueOnShardServices.Type = NLMISC::CConfigFile::CVar::T_STRING; uniqueOnShardServices.setAsString((vector) {}); - instance.ConfigFile.insertVar("UniqueOnShardServices", uniqueOnShardServices); + namingService.ConfigFile.insertVar("UniqueOnShardServices", uniqueOnShardServices); CVar uniqueByMachineServices; uniqueByMachineServices.Type = NLMISC::CConfigFile::CVar::T_STRING; uniqueByMachineServices.setAsString((vector) {}); - instance.ConfigFile.insertVar("UniqueByMachineServices", uniqueByMachineServices); + namingService.ConfigFile.insertVar("UniqueByMachineServices", uniqueByMachineServices); CVar nsPort; nsPort.Type = NLMISC::CConfigFile::CVar::T_INT; nsPort.setAsInt(port); - instance.ConfigFile.insertVar("NSPort", nsPort); - instance.init(); + namingService.ConfigFile.insertVar("NSPort", nsPort); + namingService.init(); CInetHost host("localhost"); host.setPort(port); @@ -159,15 +160,18 @@ class CNamingServiceIT : public testing::Test void TearDown() override { client.disconnect(); + client.update2(-1, 200); + namingService.release(); + RegisteredServices.clear(); } }; TEST_F(CNamingServiceIT, shouldAnswerToRegistration) { - RGRequest request{ + RGRequest request { .serviceId = TServiceId(123), - .name = "test-service", - .addresses = {"localhost:12345"} + .name = "test register service", + .addresses = { "localhost:12345" } }; CMessage msgout("RG"); msgout.serial(request); @@ -182,8 +186,8 @@ TEST_F(CNamingServiceIT, shouldAnswerToRegistration) client.send(msgout); client.flush(); - instance.update(); - client.update2(-1, 100); + namingService.update(); + client.update2(-1, 200); EXPECT_THAT(response.success, IsTrue()); EXPECT_THAT(response.sid, Optional(Eq(request.serviceId))); @@ -192,7 +196,31 @@ TEST_F(CNamingServiceIT, shouldAnswerToRegistration) Optional(Field(&RGBResponse::items, ElementsAre( AllOf( - Field(&RGBResponseEntry::name, "test-service"), + Field(&RGBResponseEntry::name, Eq(request.name)), Field(&RGBResponseEntry::sid, Eq(request.serviceId)), Field(&RGBResponseEntry::addr, ElementsAre(Property(&CInetAddress::asString, "[::1]:12345")))))))); } + +TEST_F(CNamingServiceIT, shouldUpdateServiceRegistry) +{ + RGRequest request { + .serviceId = TServiceId(123), + .name = "test re-register service", + .addresses = { "localhost:12345" } + }; + CMessage msgout("RRG"); + msgout.serial(request); + + client.send(msgout); + client.flush(); + namingService.update(); + + EXPECT_THAT( + RegisteredServices, + ElementsAre( + AllOf( + Field(&CServiceEntry::Name, Eq(request.name)), + Field(&CServiceEntry::SId, Eq(request.serviceId)), + Field(&CServiceEntry::Addr, ElementsAre(Property(&CInetAddress::asString, "[::1]:12345"))) + ))); +} From 8fe1b01b99c7d305662bc95a68dd7779709155dd Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Wed, 26 Jun 2024 18:51:31 +0000 Subject: [PATCH 102/126] move callback to service method --- .../nelns/naming_service/functions.cpp | 15 --------------- .../nelns/naming_service/naming_service.cpp | 15 ++++++++++++++- .../nelns/naming_service/naming_service.h | 5 +++++ nelns/naming_service/tests/naming_service.it.cpp | 1 + 4 files changed, 20 insertions(+), 16 deletions(-) diff --git a/nelns/naming_service/nelns/naming_service/functions.cpp b/nelns/naming_service/nelns/naming_service/functions.cpp index 37f819cc11..ce7243b07d 100644 --- a/nelns/naming_service/nelns/naming_service/functions.cpp +++ b/nelns/naming_service/nelns/naming_service/functions.cpp @@ -405,21 +405,6 @@ void cbACKUnregistration(CMessage &msgin, TSockId from, CCallbackNetBase &netbas } } -/** - * Callback for service registration when the naming service goes down and up (don't need to broadcast) - */ -void cbResendRegisteration(CMessage &msgin, TSockId from, CCallbackNetBase &netbase) -{ - string name; - vector addr; - TServiceId sid; - msgin.serial(name); - msgin.serialCont(addr); - msgin.serial(sid); - - doRegister(name, addr, sid, from, netbase, true); -} - /** * Callback for service unregistration. * diff --git a/nelns/naming_service/nelns/naming_service/naming_service.cpp b/nelns/naming_service/nelns/naming_service/naming_service.cpp index efcce08190..349c1f6ddd 100644 --- a/nelns/naming_service/nelns/naming_service/naming_service.cpp +++ b/nelns/naming_service/nelns/naming_service/naming_service.cpp @@ -96,7 +96,7 @@ void CNamingService::init() TCallbackItem CallbackArray[] = { { "RG", [=](auto &msgin, auto from, auto &netbase) { cbRegister(msgin, from); } }, - { "RRG", cbResendRegisteration }, + { "RRG", [=](auto &msgin, auto from, auto &netbase) { cbResendRegisteration(msgin, from); } }, { "QP", cbQueryPort }, { "UNI", cbUnregisterSId }, { "ACK_UNI", cbACKUnregistration }, @@ -139,3 +139,16 @@ void CNamingService::cbRegister(CMessage &msgin, TSockId from) doRegister(name, addr, sid, from, *CallbackServer); } + +void CNamingService::cbResendRegisteration(CMessage &msgin, TSockId from) +{ + string name; + vector addr; + TServiceId sid; + msgin.serial(name); + msgin.serialCont(addr); + msgin.serial(sid); + + doRegister(name, addr, sid, from, *CallbackServer, true); +} + diff --git a/nelns/naming_service/nelns/naming_service/naming_service.h b/nelns/naming_service/nelns/naming_service/naming_service.h index 6e43836cc3..e1c78ec6d9 100644 --- a/nelns/naming_service/nelns/naming_service/naming_service.h +++ b/nelns/naming_service/nelns/naming_service/naming_service.h @@ -40,6 +40,11 @@ class CNamingService : public NLNET::IService */ void cbRegister(NLNET::CMessage &msgin, NLNET::TSockId from); + /** + * Callback for service registration when the naming service goes down and up (don't need to broadcast) + */ + void cbResendRegisteration(NLNET::CMessage &msgin, NLNET::TSockId from); + /// Service instance manager singleton CServiceInstanceManager _ServiceInstances; }; diff --git a/nelns/naming_service/tests/naming_service.it.cpp b/nelns/naming_service/tests/naming_service.it.cpp index 0fd62584f1..fc63e26d69 100644 --- a/nelns/naming_service/tests/naming_service.it.cpp +++ b/nelns/naming_service/tests/naming_service.it.cpp @@ -214,6 +214,7 @@ TEST_F(CNamingServiceIT, shouldUpdateServiceRegistry) client.send(msgout); client.flush(); namingService.update(); + client.update2(-1, 200); EXPECT_THAT( RegisteredServices, From cfb08805ee7b93bdb1ae829d2ee7f44f0e3e592b Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Wed, 26 Jun 2024 19:38:23 +0000 Subject: [PATCH 103/126] add test for query port message --- .../tests/naming_service.it.cpp | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/nelns/naming_service/tests/naming_service.it.cpp b/nelns/naming_service/tests/naming_service.it.cpp index fc63e26d69..fd8897da37 100644 --- a/nelns/naming_service/tests/naming_service.it.cpp +++ b/nelns/naming_service/tests/naming_service.it.cpp @@ -127,12 +127,13 @@ class CNamingServiceIT : public testing::Test CCallbackClient client; CNamingService namingService; int port = 50000; + int minPort = 51000; void SetUp() override { CVar basePort; basePort.Type = NLMISC::CConfigFile::CVar::T_INT; - basePort.setAsInt(51000); + basePort.setAsInt(minPort); namingService.ConfigFile.insertVar("BasePort", basePort); CVar uniqueOnShardServices; @@ -213,6 +214,7 @@ TEST_F(CNamingServiceIT, shouldUpdateServiceRegistry) client.send(msgout); client.flush(); + client.update2(-1, 200); namingService.update(); client.update2(-1, 200); @@ -225,3 +227,24 @@ TEST_F(CNamingServiceIT, shouldUpdateServiceRegistry) Field(&CServiceEntry::Addr, ElementsAre(Property(&CInetAddress::asString, "[::1]:12345"))) ))); } + +TEST_F(CNamingServiceIT, shouldAnswerToQueryPort) +{ + CMessage msgout("QP"); + + uint16 response(0); + TCallbackItem callbackArray[] = { + { "QP", [&response](CMessage &msgin, TSockId from, CCallbackNetBase &netbase) { + msgin.serial(response); + } } + }; + client.addCallbackArray(callbackArray, sizeof(callbackArray) / sizeof(callbackArray[0])); + + client.send(msgout); + client.flush(); + client.update2(-1, 200); + namingService.update(); + client.update2(-1, 200); + + EXPECT_THAT(response, Eq(minPort)); +} From 9cb4d4f94ad9239dd20ba37238671042954cf214 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Mon, 1 Jul 2024 07:38:55 +0000 Subject: [PATCH 104/126] use naming client and async to wait for response to make test less flaky --- .../tests/naming_service.it.cpp | 35 ++++++++++--------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/nelns/naming_service/tests/naming_service.it.cpp b/nelns/naming_service/tests/naming_service.it.cpp index fd8897da37..3a5edce09c 100644 --- a/nelns/naming_service/tests/naming_service.it.cpp +++ b/nelns/naming_service/tests/naming_service.it.cpp @@ -1,6 +1,8 @@ #include #include +#include +#include #include #include #include @@ -13,6 +15,7 @@ #include #include #include +#include #include #include @@ -40,11 +43,13 @@ using ::testing::StrEq; using CVar = ::NLMISC::CConfigFile::CVar; using ::NLMISC::IStream; +using ::NLMISC::nlSleep; using ::NLNET::CCallbackClient; using ::NLNET::CCallbackNetBase; using ::NLNET::CInetAddress; using ::NLNET::CInetHost; using ::NLNET::CMessage; +using ::NLNET::CNamingClient; using ::NLNET::TCallbackItem; using ::NLNET::TServiceId; using ::NLNET::TSockId; @@ -126,8 +131,10 @@ class CNamingServiceIT : public testing::Test protected: CCallbackClient client; CNamingService namingService; + CInetHost host = CInetHost("localhost"); int port = 50000; int minPort = 51000; + std::chrono::seconds defaultTimeout = std::chrono::seconds(1); void SetUp() override { @@ -152,7 +159,6 @@ class CNamingServiceIT : public testing::Test namingService.ConfigFile.insertVar("NSPort", nsPort); namingService.init(); - CInetHost host("localhost"); host.setPort(port); client.connect(host); ASSERT_THAT(client.connected(), IsTrue()); @@ -230,21 +236,18 @@ TEST_F(CNamingServiceIT, shouldUpdateServiceRegistry) TEST_F(CNamingServiceIT, shouldAnswerToQueryPort) { - CMessage msgout("QP"); + vector addresses{ "localhost:12345" }; + CNamingClient::connect(host, NLNET::CCallbackNetBase::Off, addresses); - uint16 response(0); - TCallbackItem callbackArray[] = { - { "QP", [&response](CMessage &msgin, TSockId from, CCallbackNetBase &netbase) { - msgin.serial(response); - } } - }; - client.addCallbackArray(callbackArray, sizeof(callbackArray) / sizeof(callbackArray[0])); - - client.send(msgout); - client.flush(); - client.update2(-1, 200); - namingService.update(); - client.update2(-1, 200); + auto response = std::async(std::launch::async, &CNamingClient::queryServicePort); + auto update = std::async(std::launch::async, [=, &response](){ + while (response.valid()) + { + namingService.update(); + nlSleep (1); + } + }); - EXPECT_THAT(response, Eq(minPort)); + response.wait_for(defaultTimeout ); + EXPECT_THAT(response.get(), Eq(minPort)); } From 1f38e63d3d34444501908a7f0793bcf9010cf7b5 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Mon, 1 Jul 2024 08:26:54 +0000 Subject: [PATCH 105/126] check for future state after wait --- nelns/naming_service/tests/naming_service.it.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/nelns/naming_service/tests/naming_service.it.cpp b/nelns/naming_service/tests/naming_service.it.cpp index 3a5edce09c..3d6fa1bd85 100644 --- a/nelns/naming_service/tests/naming_service.it.cpp +++ b/nelns/naming_service/tests/naming_service.it.cpp @@ -230,24 +230,24 @@ TEST_F(CNamingServiceIT, shouldUpdateServiceRegistry) AllOf( Field(&CServiceEntry::Name, Eq(request.name)), Field(&CServiceEntry::SId, Eq(request.serviceId)), - Field(&CServiceEntry::Addr, ElementsAre(Property(&CInetAddress::asString, "[::1]:12345"))) - ))); + Field(&CServiceEntry::Addr, ElementsAre(Property(&CInetAddress::asString, "[::1]:12345")))))); } TEST_F(CNamingServiceIT, shouldAnswerToQueryPort) { - vector addresses{ "localhost:12345" }; + vector addresses { "localhost:12345" }; CNamingClient::connect(host, NLNET::CCallbackNetBase::Off, addresses); auto response = std::async(std::launch::async, &CNamingClient::queryServicePort); - auto update = std::async(std::launch::async, [=, &response](){ + auto update = std::async(std::launch::async, [=, &response]() { while (response.valid()) { namingService.update(); - nlSleep (1); + nlSleep(1); } }); - response.wait_for(defaultTimeout ); + auto state = response.wait_for(defaultTimeout); + ASSERT_THAT(state, Eq(std::future_status::ready)); EXPECT_THAT(response.get(), Eq(minPort)); } From f9d448efd71fd9aa64eba29f7465c1b9f238465a Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Mon, 1 Jul 2024 08:51:48 +0000 Subject: [PATCH 106/126] move callback to member function --- .../nelns/naming_service/functions.cpp | 25 ------------------- .../nelns/naming_service/functions.h | 19 -------------- .../nelns/naming_service/naming_service.cpp | 18 ++++++++++--- .../nelns/naming_service/naming_service.h | 16 +++++++++++- 4 files changed, 30 insertions(+), 48 deletions(-) diff --git a/nelns/naming_service/nelns/naming_service/functions.cpp b/nelns/naming_service/nelns/naming_service/functions.cpp index ce7243b07d..93d0c452d5 100644 --- a/nelns/naming_service/nelns/naming_service/functions.cpp +++ b/nelns/naming_service/nelns/naming_service/functions.cpp @@ -452,31 +452,6 @@ uint16 doAllocatePort(const CInetAddress &addr) return nextAvailablePort++; } -/** - * Callback for port allocation - * Note: if a service queries a port but does not register itself to the naming service, the - * port will remain allocated and unused. - * - * Message expected : QP - * - Name of service to register (string) - * - Address of service (CInetAddress) (its port can be 0) - * - * Message emitted : QP - * - Allocated port number (uint16) - */ -void cbQueryPort(CMessage &msgin, TSockId from, CCallbackNetBase &netbase) -{ - // Allocate port - uint16 port = doAllocatePort(netbase.hostAddress(from)); - - // Send port back - CMessage msgout("QP"); - msgout.serial(port); - netbase.send(msgout, from); - - nlinfo("The service got port %hu", port); -} - /* * Unregisters a service if it has not been done before. * Note: this callback is called whenever someone disconnects from the NS. diff --git a/nelns/naming_service/nelns/naming_service/functions.h b/nelns/naming_service/nelns/naming_service/functions.h index 41b33b5fb4..48421d75f9 100644 --- a/nelns/naming_service/nelns/naming_service/functions.h +++ b/nelns/naming_service/nelns/naming_service/functions.h @@ -45,11 +45,6 @@ void checkWaitingUnregistrationServices(); */ void cbACKUnregistration(NLNET::CMessage &msgin, NLNET::TSockId from, NLNET::CCallbackNetBase &netbase); -/** - * Callback for service registration when the naming service goes down and up (don't need to broadcast) - */ -void cbResendRegisteration(NLNET::CMessage &msgin, NLNET::TSockId from, NLNET::CCallbackNetBase &netbase); - /** * Callback for service unregistration. * @@ -65,20 +60,6 @@ void cbUnregisterSId(NLNET::CMessage &msgin, NLNET::TSockId from, NLNET::CCallba */ uint16 doAllocatePort(const NLNET::CInetAddress &addr); -/** - * Callback for port allocation - * Note: if a service queries a port but does not register itself to the naming service, the - * port will remain allocated and unused. - * - * Message expected : QP - * - Name of service to register (string) - * - Address of service (CInetAddress) (its port can be 0) - * - * Message emitted : QP - * - Allocated port number (uint16) - */ -void cbQueryPort(NLNET::CMessage &msgin, NLNET::TSockId from, NLNET::CCallbackNetBase &netbase); - /* * Unregisters a service if it has not been done before. * Note: this callback is called whenever someone disconnects from the NS. diff --git a/nelns/naming_service/nelns/naming_service/naming_service.cpp b/nelns/naming_service/nelns/naming_service/naming_service.cpp index 349c1f6ddd..76469189f3 100644 --- a/nelns/naming_service/nelns/naming_service/naming_service.cpp +++ b/nelns/naming_service/nelns/naming_service/naming_service.cpp @@ -96,8 +96,8 @@ void CNamingService::init() TCallbackItem CallbackArray[] = { { "RG", [=](auto &msgin, auto from, auto &netbase) { cbRegister(msgin, from); } }, - { "RRG", [=](auto &msgin, auto from, auto &netbase) { cbResendRegisteration(msgin, from); } }, - { "QP", cbQueryPort }, + { "RRG", [=](auto &msgin, auto from, auto &netbase) { cbResendRegistration(msgin, from); } }, + { "QP", [=](auto &msgin, auto from, auto &netbase) { cbQueryPort(msgin, from); } }, { "UNI", cbUnregisterSId }, { "ACK_UNI", cbACKUnregistration }, // { "RS", cbRegisteredServices }, @@ -140,7 +140,7 @@ void CNamingService::cbRegister(CMessage &msgin, TSockId from) doRegister(name, addr, sid, from, *CallbackServer); } -void CNamingService::cbResendRegisteration(CMessage &msgin, TSockId from) +void CNamingService::cbResendRegistration(NLNET::CMessage &msgin, TSockId from) { string name; vector addr; @@ -152,3 +152,15 @@ void CNamingService::cbResendRegisteration(CMessage &msgin, TSockId from) doRegister(name, addr, sid, from, *CallbackServer, true); } +void CNamingService::cbQueryPort(CMessage &msgin, TSockId from) +{ + // Allocate port + uint16 port = doAllocatePort(CallbackServer->hostAddress(from)); + + // Send port back + CMessage msgout("QP"); + msgout.serial(port); + CallbackServer->send(msgout, from); + + nlinfo("The service got port %hu", port); +} diff --git a/nelns/naming_service/nelns/naming_service/naming_service.h b/nelns/naming_service/nelns/naming_service/naming_service.h index e1c78ec6d9..3608f00596 100644 --- a/nelns/naming_service/nelns/naming_service/naming_service.h +++ b/nelns/naming_service/nelns/naming_service/naming_service.h @@ -43,7 +43,21 @@ class CNamingService : public NLNET::IService /** * Callback for service registration when the naming service goes down and up (don't need to broadcast) */ - void cbResendRegisteration(NLNET::CMessage &msgin, NLNET::TSockId from); + void cbResendRegistration(NLNET::CMessage &msgin, NLNET::TSockId from); + + /** + * Callback for port allocation + * Note: if a service queries a port but does not register itself to the naming service, the + * port will remain allocated and unused. + * + * Message expected : QP + * - Name of service to register (string) + * - Address of service (CInetAddress) (its port can be 0) + * + * Message emitted : QP + * - Allocated port number (uint16) + */ + void cbQueryPort(NLNET::CMessage &msgin, NLNET::TSockId from); /// Service instance manager singleton CServiceInstanceManager _ServiceInstances; From 522bfa5e4af483ba5cae31cfc19dda96946a684a Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Mon, 1 Jul 2024 13:34:07 +0000 Subject: [PATCH 107/126] add target to build all test executables --- CMakeLists.txt | 2 +- {CMakeModules => cmake}/add_test_executable.cmake | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) rename {CMakeModules => cmake}/add_test_executable.cmake (74%) diff --git a/CMakeLists.txt b/CMakeLists.txt index eca8265898..c1d92324d4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -334,7 +334,7 @@ IF(WITH_NEL) SET(gtest_force_shared_crt ON CACHE BOOL "" FORCE) FetchContent_MakeAvailable(googletest) include(GoogleTest) - include(CMakeModules/add_test_executable.cmake) + include(cmake/add_test_executable.cmake) ENDIF() IF(HUNTER_ENABLED) diff --git a/CMakeModules/add_test_executable.cmake b/cmake/add_test_executable.cmake similarity index 74% rename from CMakeModules/add_test_executable.cmake rename to cmake/add_test_executable.cmake index 75582a5fd5..9d081a7f39 100644 --- a/CMakeModules/add_test_executable.cmake +++ b/cmake/add_test_executable.cmake @@ -1,8 +1,13 @@ +add_custom_target(unit_test) + function(add_test_executable name) add_executable(${ARGV}) target_link_libraries("${name}" GTest::gtest_main GTest::gmock ) + add_test(NAME "${name}" COMMAND "${name}") + + add_dependencies(unit_test "${name}") endfunction() From 99b67dced374eac601cc6ae1c74d60e2a42705ac Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Mon, 1 Jul 2024 14:09:02 +0000 Subject: [PATCH 108/126] use std::async in test to make test less flaky and remove dependency on fixed wait time --- .../tests/naming_service.it.cpp | 50 +++++++++++++------ 1 file changed, 34 insertions(+), 16 deletions(-) diff --git a/nelns/naming_service/tests/naming_service.it.cpp b/nelns/naming_service/tests/naming_service.it.cpp index 3d6fa1bd85..d5e169879a 100644 --- a/nelns/naming_service/tests/naming_service.it.cpp +++ b/nelns/naming_service/tests/naming_service.it.cpp @@ -134,7 +134,7 @@ class CNamingServiceIT : public testing::Test CInetHost host = CInetHost("localhost"); int port = 50000; int minPort = 51000; - std::chrono::seconds defaultTimeout = std::chrono::seconds(1); + std::chrono::seconds defaultTimeout = std::chrono::seconds(10); void SetUp() override { @@ -183,29 +183,47 @@ TEST_F(CNamingServiceIT, shouldAnswerToRegistration) CMessage msgout("RG"); msgout.serial(request); - RGResponse response; + std::promise response_promise; + std::future response = response_promise.get_future(); TCallbackItem callbackArray[] = { - { "RG", [&response](CMessage &msgin, TSockId from, CCallbackNetBase &netbase) { + { "RG", [&response_promise](CMessage &msgin, TSockId from, CCallbackNetBase &netbase) { + RGResponse response; msgin.serial(response); + response_promise.set_value(response); } } }; client.addCallbackArray(callbackArray, sizeof(callbackArray) / sizeof(callbackArray[0])); client.send(msgout); - client.flush(); - namingService.update(); - client.update2(-1, 200); + auto updateClient = std::async(std::launch::async, [=, &response]() { + while (response.valid()) + { + client.update(); + nlSleep(1); + } + }); + auto updateNamingService = std::async(std::launch::async, [=, &response]() { + while (response.valid()) + { + namingService.update(); + nlSleep(1); + } + }); - EXPECT_THAT(response.success, IsTrue()); - EXPECT_THAT(response.sid, Optional(Eq(request.serviceId))); - EXPECT_THAT( - response.content, - Optional(Field(&RGBResponse::items, - ElementsAre( - AllOf( - Field(&RGBResponseEntry::name, Eq(request.name)), - Field(&RGBResponseEntry::sid, Eq(request.serviceId)), - Field(&RGBResponseEntry::addr, ElementsAre(Property(&CInetAddress::asString, "[::1]:12345")))))))); + auto state = response.wait_for(defaultTimeout); + ASSERT_THAT(state, Eq(std::future_status::ready)); + EXPECT_THAT(response.get(), + AllOf( + Field(&RGResponse::success, IsTrue()), + Field(&RGResponse::sid, Optional(Eq(request.serviceId))), + Field( + &RGResponse::content, + Optional(Field(&RGBResponse::items, + ElementsAre( + AllOf( + Field(&RGBResponseEntry::name, Eq(request.name)), + Field(&RGBResponseEntry::sid, Eq(request.serviceId)), + Field(&RGBResponseEntry::addr, ElementsAre(Property(&CInetAddress::asString, "[::1]:12345")))))))))); } TEST_F(CNamingServiceIT, shouldUpdateServiceRegistry) From 18bf2c4a6a843105895d049a9168c933a403978d Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Mon, 1 Jul 2024 15:23:14 +0000 Subject: [PATCH 109/126] update to latest hunter version to be able to build on Visual Studio 2022 version 17.10 --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c1d92324d4..be0aa89af0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -44,8 +44,8 @@ IF(HUNTER_ENABLED) cmake_minimum_required(VERSION 3.24) INCLUDE("CMakeModules/HunterGate.cmake") HunterGate( - URL "https://github.com/cpp-pm/hunter/archive/v0.25.5.tar.gz" - SHA1 "a20151e4c0740ee7d0f9994476856d813cdead29" + URL "https://github.com/cpp-pm/hunter/archive/v0.25.6.tar.gz" + SHA1 "69e4a05bd514bb05cb2c5aa02ce8ac420516aaf7" FILEPATH "${CMAKE_CURRENT_LIST_DIR}/CMakeModules/HunterConfig.cmake" ) From c9dc9335e94edee7ef752cfdcbbe7f9800bf48bd Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Fri, 5 Jul 2024 11:48:42 +0000 Subject: [PATCH 110/126] set project with version in nel and snowballs subproject --- CMakeLists.txt | 14 +++++++++----- nel/CMakeLists.txt | 8 ++++++++ snowballs2/CMakeLists.txt | 4 ++++ 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index be0aa89af0..e61b56b045 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,6 +34,10 @@ IF(COMMAND cmake_policy) IF(POLICY CMP0020) CMAKE_POLICY(SET CMP0020 NEW) ENDIF() + + IF (POLICY CMP0048) + cmake_policy(SET CMP0048 NEW) + ENDIF () ENDIF() @@ -81,11 +85,11 @@ ELSE() SET(CURRENT_YEAR "2019") ENDIF() -PROJECT(RyzomCore CXX C) -SET(NL_VERSION_MAJOR 4) -SET(NL_VERSION_MINOR 1) -SET(NL_VERSION_PATCH 0 CACHE STRING "Patch version") -SET(NL_VERSION_BUILD 0 CACHE STRING "Build number") +PROJECT(RyzomCore VERSION 4.1.0.0 LANGUAGES CXX C) +SET(NL_VERSION_MAJOR ${RyzomCore_VERSION_MAJOR}) +SET(NL_VERSION_MINOR ${RyzomCore_VERSION_MINOR}) +SET(NL_VERSION_PATCH ${RyzomCore_VERSION_PATCH} CACHE STRING "Patch version") +SET(NL_VERSION_BUILD ${RyzomCore_VERSION_TWEAK} CACHE STRING "Build number") SET(YEAR "2001-${CURRENT_YEAR}") SET(AUTHOR "Winch Gate and The Ryzom Core Community") diff --git a/nel/CMakeLists.txt b/nel/CMakeLists.txt index e080c640c2..1392c6dbd2 100644 --- a/nel/CMakeLists.txt +++ b/nel/CMakeLists.txt @@ -1,3 +1,11 @@ +IF (COMMAND cmake_policy) + IF (POLICY CMP0048) + cmake_policy(SET CMP0048 NEW) + ENDIF () +ENDIF () + +project(NeL VERSION ${RyzomCore_VERSION} LANGUAGES CXX C) + IF(WITH_STATIC_DRIVERS) ADD_DEFINITIONS(-DNL_STATIC) ENDIF() diff --git a/snowballs2/CMakeLists.txt b/snowballs2/CMakeLists.txt index 368754236a..543dc5062c 100644 --- a/snowballs2/CMakeLists.txt +++ b/snowballs2/CMakeLists.txt @@ -1,3 +1,7 @@ +cmake_minimum_required(VERSION 3.27) + +project(Snowballs VERSION 2.0.0 LANGUAGES CXX) + IF(WIN32) SET(SNOWBALLS_CONFIG_FILE "." CACHE FILEPATH "Snowballs config file location") ELSE() From 8abd54de40b6e56bd839d76f0cd15f60b050c210 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Fri, 5 Jul 2024 13:47:19 +0000 Subject: [PATCH 111/126] adjust path according to subproject location --- nel/tools/nel_unit_test/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nel/tools/nel_unit_test/CMakeLists.txt b/nel/tools/nel_unit_test/CMakeLists.txt index 6abc06a490..7e26a24981 100644 --- a/nel/tools/nel_unit_test/CMakeLists.txt +++ b/nel/tools/nel_unit_test/CMakeLists.txt @@ -8,6 +8,6 @@ TARGET_LINK_LIBRARIES(nel_unit_test ${CPPTEST_LIBRARIES} nelmisc nelnet nelligo) NL_DEFAULT_PROPS(nel_unit_test "Unit Tests") NL_ADD_RUNTIME_FLAGS(nel_unit_test) -ADD_DEFINITIONS(-DNEL_UNIT_BASE="${PROJECT_SOURCE_DIR}/nel/tools/nel_unit_test/") +ADD_DEFINITIONS(-DNEL_UNIT_BASE="${PROJECT_SOURCE_DIR}/tools/nel_unit_test/") INSTALL(TARGETS nel_unit_test RUNTIME DESTINATION ${NL_BIN_PREFIX}) From 840e0e12ea5db538c0d9062c692e8d89dac10db6 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Fri, 5 Jul 2024 17:17:01 +0000 Subject: [PATCH 112/126] simplify boolean expression by applying absorption law --- nel/src/3d/driver/direct3d/CMakeLists.txt | 2 +- nel/src/3d/driver/opengl/CMakeLists.txt | 2 +- nel/src/3d/driver/opengles/CMakeLists.txt | 2 +- nel/src/sound/driver/dsound/CMakeLists.txt | 2 +- nel/src/sound/driver/fmod/CMakeLists.txt | 2 +- nel/src/sound/driver/openal/CMakeLists.txt | 2 +- nel/src/sound/driver/xaudio2/CMakeLists.txt | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/nel/src/3d/driver/direct3d/CMakeLists.txt b/nel/src/3d/driver/direct3d/CMakeLists.txt index b2254f7db9..0486f4dc56 100644 --- a/nel/src/3d/driver/direct3d/CMakeLists.txt +++ b/nel/src/3d/driver/direct3d/CMakeLists.txt @@ -16,7 +16,7 @@ IF(WITH_PCH) target_precompile_headers(nel_drv_direct3d_win PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/stddirect3d.h) ENDIF() -IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC_DRIVERS) OR NOT WITH_STATIC_DRIVERS) +IF(WITH_INSTALL_LIBRARIES OR NOT WITH_STATIC_DRIVERS) INSTALL(TARGETS nel_drv_direct3d_win LIBRARY DESTINATION ${NL_DRIVER_PREFIX} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${NL_DRIVER_PREFIX} COMPONENT drivers3d) IF(WITH_MAXPLUGIN) INSTALL(TARGETS nel_drv_direct3d_win RUNTIME DESTINATION maxplugin COMPONENT drivers3d) diff --git a/nel/src/3d/driver/opengl/CMakeLists.txt b/nel/src/3d/driver/opengl/CMakeLists.txt index 8b73799f61..c4433fd3f0 100644 --- a/nel/src/3d/driver/opengl/CMakeLists.txt +++ b/nel/src/3d/driver/opengl/CMakeLists.txt @@ -95,7 +95,7 @@ IF(WITH_PCH) target_precompile_headers(${NLDRV_OGL_LIB} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/stdopengl.h) ENDIF() -IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC_DRIVERS) OR NOT WITH_STATIC_DRIVERS) +IF(WITH_INSTALL_LIBRARIES OR NOT WITH_STATIC_DRIVERS) INSTALL(TARGETS ${NLDRV_OGL_LIB} LIBRARY DESTINATION ${NL_DRIVER_PREFIX} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${NL_DRIVER_PREFIX} COMPONENT drivers3d) IF(WITH_MAXPLUGIN) INSTALL(TARGETS ${NLDRV_OGL_LIB} RUNTIME DESTINATION maxplugin COMPONENT drivers3d) diff --git a/nel/src/3d/driver/opengles/CMakeLists.txt b/nel/src/3d/driver/opengles/CMakeLists.txt index 74ecdf1826..ec852e29e6 100644 --- a/nel/src/3d/driver/opengles/CMakeLists.txt +++ b/nel/src/3d/driver/opengles/CMakeLists.txt @@ -74,7 +74,7 @@ IF(WITH_PCH) target_precompile_headers(${NLDRV_OGLES_LIB} PRIVATE ${SOURCE_DIR}/stdopengl.hp) ENDIF() -IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC_DRIVERS) OR NOT WITH_STATIC_DRIVERS) +IF(WITH_INSTALL_LIBRARIES OR NOT WITH_STATIC_DRIVERS) INSTALL(TARGETS ${NLDRV_OGLES_LIB} LIBRARY DESTINATION ${NL_DRIVER_PREFIX} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${NL_DRIVER_PREFIX} COMPONENT drivers3d) IF(WITH_MAXPLUGIN) INSTALL(TARGETS ${NLDRV_OGLES_LIB} RUNTIME DESTINATION maxplugin COMPONENT drivers3d) diff --git a/nel/src/sound/driver/dsound/CMakeLists.txt b/nel/src/sound/driver/dsound/CMakeLists.txt index 2525ee16ed..a75dba73c9 100644 --- a/nel/src/sound/driver/dsound/CMakeLists.txt +++ b/nel/src/sound/driver/dsound/CMakeLists.txt @@ -13,7 +13,7 @@ IF(WITH_PCH) target_precompile_headers(nel_drv_dsound_win PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/stddsound.h) ENDIF() -IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC_DRIVERS) OR NOT WITH_STATIC_DRIVERS) +IF(WITH_INSTALL_LIBRARIES OR NOT WITH_STATIC_DRIVERS) INSTALL(TARGETS nel_drv_dsound_win RUNTIME DESTINATION ${NL_DRIVER_PREFIX} LIBRARY DESTINATION ${NL_DRIVER_PREFIX} ARCHIVE DESTINATION ${NL_LIB_PREFIX} COMPONENT driverssound) IF(WITH_MAXPLUGIN) INSTALL(TARGETS nel_drv_dsound_win RUNTIME DESTINATION maxplugin COMPONENT driverssound) diff --git a/nel/src/sound/driver/fmod/CMakeLists.txt b/nel/src/sound/driver/fmod/CMakeLists.txt index 19c3480870..83cd914631 100644 --- a/nel/src/sound/driver/fmod/CMakeLists.txt +++ b/nel/src/sound/driver/fmod/CMakeLists.txt @@ -13,7 +13,7 @@ IF(WITH_PCH) target_precompile_headers(nel_drv_fmod_win PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/stdfmod.h) ENDIF() -IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC_DRIVERS) OR NOT WITH_STATIC_DRIVERS) +IF(WITH_INSTALL_LIBRARIES OR NOT WITH_STATIC_DRIVERS) INSTALL(TARGETS nel_drv_fmod_win RUNTIME DESTINATION ${NL_DRIVER_PREFIX} LIBRARY DESTINATION ${NL_DRIVER_PREFIX} ARCHIVE DESTINATION ${NL_LIB_PREFIX} COMPONENT driverssound) IF(WITH_MAXPLUGIN) INSTALL(TARGETS nel_drv_fmod_win RUNTIME DESTINATION maxplugin COMPONENT driverssound) diff --git a/nel/src/sound/driver/openal/CMakeLists.txt b/nel/src/sound/driver/openal/CMakeLists.txt index 7d9810198d..626168ea8c 100644 --- a/nel/src/sound/driver/openal/CMakeLists.txt +++ b/nel/src/sound/driver/openal/CMakeLists.txt @@ -55,7 +55,7 @@ IF(WITH_PCH) target_precompile_headers(${NLDRV_AL_LIB} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/stdopenal.h) ENDIF() -IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC_DRIVERS) OR NOT WITH_STATIC_DRIVERS) +IF(WITH_INSTALL_LIBRARIES OR NOT WITH_STATIC_DRIVERS) INSTALL(TARGETS ${NLDRV_AL_LIB} RUNTIME DESTINATION ${NL_DRIVER_PREFIX} LIBRARY DESTINATION ${NL_DRIVER_PREFIX} ARCHIVE DESTINATION ${NL_LIB_PREFIX} COMPONENT driverssound) IF(WITH_MAXPLUGIN) INSTALL(TARGETS ${NLDRV_AL_LIB} RUNTIME DESTINATION maxplugin COMPONENT driverssound) diff --git a/nel/src/sound/driver/xaudio2/CMakeLists.txt b/nel/src/sound/driver/xaudio2/CMakeLists.txt index 0be4e1be4d..eda2f65449 100644 --- a/nel/src/sound/driver/xaudio2/CMakeLists.txt +++ b/nel/src/sound/driver/xaudio2/CMakeLists.txt @@ -40,7 +40,7 @@ IF(WITH_PCH) target_precompile_headers(nel_drv_xaudio2_win PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/stdxaudio2.h) ENDIF() -IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC_DRIVERS) OR NOT WITH_STATIC_DRIVERS) +IF(WITH_INSTALL_LIBRARIES OR NOT WITH_STATIC_DRIVERS) INSTALL(TARGETS nel_drv_xaudio2_win RUNTIME DESTINATION ${NL_DRIVER_PREFIX} LIBRARY DESTINATION ${NL_DRIVER_PREFIX} ARCHIVE DESTINATION ${NL_LIB_PREFIX} COMPONENT driverssound) IF(WITH_MAXPLUGIN) INSTALL(TARGETS nel_drv_xaudio2_win RUNTIME DESTINATION maxplugin COMPONENT driverssound) From 5c94f270ee8176df98c0766c52f1baa05c5dbc90 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Mon, 8 Jul 2024 09:53:15 +0000 Subject: [PATCH 113/126] migrate config file test to gtest to prevent segfault if file can not be loaded and get some test output so the error can be identified --- CMakeLists.txt | 32 ++-- nel/tools/nel_unit_test/CMakeLists.txt | 21 ++- .../ut_misc_config_file.test.cpp | 140 ++++++++++++++++++ 3 files changed, 175 insertions(+), 18 deletions(-) create mode 100644 nel/tools/nel_unit_test/ut_misc_config_file.test.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index e61b56b045..937faa4b0e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -324,23 +324,23 @@ IF(WITH_MSQUIC) FIND_PACKAGE(msquic REQUIRED) ENDIF() -IF(WITH_NEL) - IF(WITH_NEL_TESTS) - FIND_PACKAGE(CppTest) - - ENABLE_TESTING() - include(FetchContent) - FetchContent_Declare( - googletest - URL https://github.com/google/googletest/archive/a7f443b80b105f940225332ed3c31f2790092f47.zip - EXCLUDE_FROM_ALL - ) - SET(gtest_force_shared_crt ON CACHE BOOL "" FORCE) - FetchContent_MakeAvailable(googletest) - include(GoogleTest) - include(cmake/add_test_executable.cmake) - ENDIF() +IF(WITH_NEL_TESTS) + FIND_PACKAGE(CppTest) + + ENABLE_TESTING() + include(FetchContent) + FetchContent_Declare( + googletest + URL https://github.com/google/googletest/archive/a7f443b80b105f940225332ed3c31f2790092f47.zip + EXCLUDE_FROM_ALL + ) + SET(gtest_force_shared_crt ON CACHE BOOL "" FORCE) + FetchContent_MakeAvailable(googletest) + include(GoogleTest) + include(cmake/add_test_executable.cmake) +ENDIF() +IF(WITH_NEL) IF(HUNTER_ENABLED) IF(WITH_GUI) HUNTER_ADD_PACKAGE(luabind) diff --git a/nel/tools/nel_unit_test/CMakeLists.txt b/nel/tools/nel_unit_test/CMakeLists.txt index 7e26a24981..c2ee3c0229 100644 --- a/nel/tools/nel_unit_test/CMakeLists.txt +++ b/nel/tools/nel_unit_test/CMakeLists.txt @@ -1,6 +1,8 @@ FILE(GLOB SRC *.cpp *.h) -ADD_EXECUTABLE(nel_unit_test ${SRC}) +ADD_EXECUTABLE(nel_unit_test + nel_unit_test.cpp +) INCLUDE_DIRECTORIES(${CPPTEST_INCLUDE_DIR}) @@ -8,6 +10,21 @@ TARGET_LINK_LIBRARIES(nel_unit_test ${CPPTEST_LIBRARIES} nelmisc nelnet nelligo) NL_DEFAULT_PROPS(nel_unit_test "Unit Tests") NL_ADD_RUNTIME_FLAGS(nel_unit_test) -ADD_DEFINITIONS(-DNEL_UNIT_BASE="${PROJECT_SOURCE_DIR}/tools/nel_unit_test/") +target_compile_definitions(nel_unit_test + PUBLIC + NEL_UNIT_BASE="${PROJECT_SOURCE_DIR}/tools/nel_unit_test/" +) INSTALL(TARGETS nel_unit_test RUNTIME DESTINATION ${NL_BIN_PREFIX}) + + +add_test_executable(nel_misc_config_file_test + ut_misc_config_file.test.cpp +) +target_link_libraries(nel_misc_config_file_test + nelmisc +) +target_compile_definitions(nel_misc_config_file_test + PUBLIC + NEL_UNIT_BASE="${CMAKE_CURRENT_SOURCE_DIR}/" +) diff --git a/nel/tools/nel_unit_test/ut_misc_config_file.test.cpp b/nel/tools/nel_unit_test/ut_misc_config_file.test.cpp new file mode 100644 index 0000000000..93a9c30972 --- /dev/null +++ b/nel/tools/nel_unit_test/ut_misc_config_file.test.cpp @@ -0,0 +1,140 @@ +#include +#include + +#include + +#include +#include +#include + +#ifndef NEL_UNIT_BASE +#define NEL_UNIT_BASE "" +#endif // NEL_UNIT_BASE + +using std::string; + +using ::testing::IsFalse; +using ::testing::IsNull; +using ::testing::IsTrue; +using ::testing::NotNull; +using ::testing::StartsWith; +using ::testing::StrEq; + +class CUTMiscConfigFileTest : public testing::Test +{ +protected: + NLMISC::CApplicationContext context; + + void SetUp() override + { + context = NLMISC::CApplicationContext(); + + NLMISC::createDebug(NULL); + } + + void TearDown() override + { + } +}; + +TEST_F(CUTMiscConfigFileTest, configWithInclude) +{ + NLMISC::CConfigFile configFile; + + ASSERT_NO_THROW({ configFile.load(NEL_UNIT_BASE "ut_misc_files/cfg_with_include.cfg"); }); + + ASSERT_THAT(configFile.loaded(), IsTrue()); + EXPECT_THAT(configFile.getVarPtr("CfgWithInclude"), NotNull()); + EXPECT_THAT(configFile.getVar("CfgWithInclude").asString(0), StrEq("ok")); + EXPECT_THAT(configFile.getVarPtr("IncludedCfg"), NotNull()); + EXPECT_THAT(configFile.getVar("IncludedCfg").asString(0), StrEq("ok")); +} + +TEST_F(CUTMiscConfigFileTest, configWithOptional) +{ + NLMISC::CConfigFile configFile; + + ASSERT_NO_THROW({ configFile.load(NEL_UNIT_BASE "ut_misc_files/cfg_with_optional.cfg"); }); + + ASSERT_THAT(configFile.loaded(), IsTrue()); + EXPECT_THAT(configFile.getVarPtr("CfgWithInclude"), NotNull()); + EXPECT_THAT(configFile.getVar("CfgWithInclude").asString(0), StrEq("ok")); + EXPECT_THAT(configFile.getVarPtr("IncludedCfg"), NotNull()); + EXPECT_THAT(configFile.getVar("IncludedCfg").asString(0), StrEq("ok")); +} + +TEST_F(CUTMiscConfigFileTest, configWithDefine) +{ + NLMISC::CConfigFile configFile; + + ASSERT_NO_THROW({ configFile.load(NEL_UNIT_BASE "ut_misc_files/cfg_with_define.cfg"); }); + + ASSERT_THAT(configFile.loaded(), IsTrue()); + EXPECT_THAT(configFile.getVarPtr("CfgReadableVar"), NotNull()); + EXPECT_THAT(configFile.getVarPtr("CfgNotToBeFound"), IsNull()); + EXPECT_THAT(configFile.getVarPtr("CfgInvisible"), IsNull()); + EXPECT_THAT(configFile.getVarPtr("CfgMustExist"), NotNull()); +} + +TEST_F(CUTMiscConfigFileTest, configWithBadTest) +{ + NLMISC::CLightMemDisplayer warnings; + NLMISC::CLog logger; + logger.addDisplayer(&warnings); + NLMISC::CNLWarningOverride override(&logger); + + NLMISC::CConfigFile configFile; + + string fullName = NLMISC::CPath::getFullPath(NEL_UNIT_BASE "ut_misc_files/cfg_with_bad_test.cfg", false); + + ASSERT_NO_THROW({ configFile.load(fullName); }); + + EXPECT_THAT(configFile.getVarPtr("ASimpleVar"), NotNull()); + + auto &warningLogs = warnings.lockStrings(); + EXPECT_THAT(warningLogs, Contains(StrEq(string("Preprocess: In file ") + fullName + "(6) : Error unrecognized preprocessor command\n"))); + EXPECT_THAT(warningLogs, Contains(StrEq(string("Preprocess: In file ") + fullName + "(9) : Error found '#endif' without matching #if\n"))); + EXPECT_THAT(warningLogs, Contains(StrEq(string("Preprocess: In file ") + fullName + "(12) : Error parsing include file command\n"))); + EXPECT_THAT(warningLogs, Contains(StrEq(string("Preprocess: In file ") + fullName + "(13) : Error parsing include file command\n"))); + EXPECT_THAT(warningLogs, Contains(StrEq(string("Preprocess: In file ") + fullName + "(14) : Error parsing optional file command\n"))); + EXPECT_THAT(warningLogs, Contains(StrEq(string("Preprocess: In file ") + fullName + "(15) : Error parsing optional file command\n"))); + EXPECT_THAT(warningLogs, Contains(StrEq(string("Preprocess: In file ") + fullName + "(16) : Error parsing #define command\n"))); + EXPECT_THAT(warningLogs, Contains(StrEq(string("Preprocess: In file ") + fullName + "(17) : Error parsing #ifdef command\n"))); + EXPECT_THAT(warningLogs, Contains(StartsWith("Preprocess: Missing 1 closing #endif after parsing"))); +} + +TEST_F(CUTMiscConfigFileTest, configIncludeAndOptional) +{ + NLMISC::CLightMemDisplayer warnings; + NLMISC::CLog logger; + logger.addDisplayer(&warnings); + NLMISC::CNLWarningOverride override(&logger); + + NLMISC::CConfigFile configFile; + + string fullName = NLMISC::CPath::getFullPath(NEL_UNIT_BASE "ut_misc_files/cfg_with_include_and_optional.cfg", false); + + ASSERT_NO_THROW({ configFile.load(fullName); }); + + auto &warningLogs = warnings.lockStrings(); + EXPECT_THAT(warningLogs, Contains(StrEq(string("Preprocess: In file ") + fullName + "(2) : Cannot include file 'a_missing_file.cfg'\n"))); +} + +TEST_F(CUTMiscConfigFileTest, reportErrorInSubFiles) +{ + NLMISC::CLightMemDisplayer warnings; + NLMISC::CLog logger; + logger.addDisplayer(&warnings); + NLMISC::CNLWarningOverride override(&logger); + + NLMISC::CConfigFile configFile; + + string fullName = NLMISC::CPath::getFullPath(NEL_UNIT_BASE "ut_misc_files/cfg_with_error_main.cfg", false); + string subfullName = NLMISC::CPath::getFullPath(NEL_UNIT_BASE "ut_misc_files/cfg_with_error.cfg", false); + + EXPECT_THROW({ configFile.load(fullName); }, NLMISC::EParseError); + + // check that we have error report with correct filename and line number + auto &warningLogs = warnings.lockStrings(); + EXPECT_THAT(warningLogs, Contains(StrEq(string("CF: Parsing error in file ") + subfullName + " line 18, look in 'debug_cfg_with_error_main.cfg' for a preprocessed version of the config file\n"))); +} From d05dc492c9404b2126ae9a40378ce26f8b777431 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Tue, 9 Jul 2024 19:09:22 +0000 Subject: [PATCH 114/126] remove obsolete find module --- CMakeModules/FindIconv.cmake | 72 ------------------------------------ 1 file changed, 72 deletions(-) delete mode 100644 CMakeModules/FindIconv.cmake diff --git a/CMakeModules/FindIconv.cmake b/CMakeModules/FindIconv.cmake deleted file mode 100644 index 6fad57be4b..0000000000 --- a/CMakeModules/FindIconv.cmake +++ /dev/null @@ -1,72 +0,0 @@ -# - Try to find Iconv -# Once done this will define -# -# ICONV_FOUND - system has Iconv -# ICONV_INCLUDE_DIR - the Iconv include directory -# ICONV_LIBRARIES - Link these to use Iconv -# ICONV_SECOND_ARGUMENT_IS_CONST - the second argument for iconv() is const -# -include(CheckCCompilerFlag) -include(CheckCSourceCompiles) - -IF (ICONV_INCLUDE_DIR AND ICONV_LIBRARIES) - # Already in cache, be silent - SET(ICONV_FIND_QUIETLY TRUE) -ENDIF (ICONV_INCLUDE_DIR AND ICONV_LIBRARIES) - -FIND_PATH(ICONV_INCLUDE_DIR iconv.h HINTS /sw/include/ PATHS /opt/local) - -FIND_LIBRARY(ICONV_LIBRARIES_RELEASE NAMES iconv libiconv c PATHS /opt/local) -FIND_LIBRARY(ICONV_LIBRARIES_DEBUG NAMES iconvd libiconvd c PATHS /opt/local) - -IF (ICONV_LIBRARIES_RELEASE AND ICONV_LIBRARIES_DEBUG) - SET(ICONV_LIBRARIES optimized ${ICONV_LIBRARIES_RELEASE} debug ${ICONV_LIBRARIES_DEBUG}) -ELSE() - SET(ICONV_LIBRARIES ${ICONV_LIBRARIES_RELEASE}) -ENDIF() - -IF(ICONV_INCLUDE_DIR AND ICONV_LIBRARIES) - SET(ICONV_FOUND TRUE) -ENDIF() - -set(CMAKE_REQUIRED_INCLUDES ${ICONV_INCLUDE_DIR}) -set(CMAKE_REQUIRED_LIBRARIES ${ICONV_LIBRARIES}) -IF(ICONV_FOUND) - check_c_compiler_flag("-Werror" ICONV_HAVE_WERROR) - set (CMAKE_C_FLAGS_BACKUP "${CMAKE_C_FLAGS}") - if(ICONV_HAVE_WERROR) - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror") - ENDIF() - check_c_source_compiles(" - #include - int main(){ - iconv_t conv = 0; - const char* in = 0; - size_t ilen = 0; - char* out = 0; - size_t olen = 0; - iconv(conv, &in, &ilen, &out, &olen); - return 0; - } -" ICONV_SECOND_ARGUMENT_IS_CONST ) - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS_BACKUP}") -ENDIF() -set(CMAKE_REQUIRED_INCLUDES) -set(CMAKE_REQUIRED_LIBRARIES) - -IF(ICONV_FOUND) - IF(NOT ICONV_FIND_QUIETLY) - MESSAGE(STATUS "Found Iconv: ${ICONV_LIBRARIES}") - ENDIF() -ELSE() - IF(Iconv_FIND_REQUIRED) - MESSAGE(FATAL_ERROR "Could not find Iconv") - ENDIF() -ENDIF() - -MARK_AS_ADVANCED( - ICONV_INCLUDE_DIR - ICONV_LIBRARIES - ICONV_LIBRARIES_DEBUG - ICONV_SECOND_ARGUMENT_IS_CONST -) From f8bcaff8752db70ca4848fd37b27b35fb8b615e7 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Wed, 10 Jul 2024 16:01:20 +0200 Subject: [PATCH 115/126] build on macos13 as macos14 currently is not supported out of the box --- .github/workflows/build-client.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-client.yml b/.github/workflows/build-client.yml index 895f760a23..0376a2959d 100644 --- a/.github/workflows/build-client.yml +++ b/.github/workflows/build-client.yml @@ -25,7 +25,7 @@ jobs: - ubuntu-20.04 - windows-2022 - windows-2019 - - macos-14 + - macos-13 - macos-12 include: - os: windows-2022 From 36553e3c90e1004be338044150c88d996bce6553 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Wed, 10 Jul 2024 16:25:06 +0200 Subject: [PATCH 116/126] build on macos13 as macos14 currently is not supported out of the box --- .github/workflows/build-client.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-client.yml b/.github/workflows/build-client.yml index 0376a2959d..b1a98288ba 100644 --- a/.github/workflows/build-client.yml +++ b/.github/workflows/build-client.yml @@ -38,7 +38,7 @@ jobs: - os: ubuntu-20.04 ubuntu_version: 20.04 cmake_preset: linux-client - - os: macos-14 + - os: macos-13 cmake_preset: macos-client - os: macos-12 cmake_preset: macos-client From 64914602e4fb2d4249e5929200ad3e3052384de1 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Thu, 11 Jul 2024 21:37:01 +0200 Subject: [PATCH 117/126] add cmake option for macos 13 --- .github/workflows/build-client.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-client.yml b/.github/workflows/build-client.yml index b1a98288ba..735b29214e 100644 --- a/.github/workflows/build-client.yml +++ b/.github/workflows/build-client.yml @@ -40,6 +40,7 @@ jobs: cmake_preset: linux-client - os: macos-13 cmake_preset: macos-client + cmake_options: -DHUNTER_USE_CACHE_SERVERS=NO - os: macos-12 cmake_preset: macos-client cmake_options: -DHUNTER_USE_CACHE_SERVERS=NO From f2d95b61e2b2ca2b7855377252a52630f38d5c91 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Fri, 12 Jul 2024 09:02:54 +0000 Subject: [PATCH 118/126] cleanup line endings --- .../driver_direct3d_pixel_program.cpp | 2 +- .../opengl/driver_opengl_pixel_program.cpp | 2 +- nel/src/gui/lua_loadlib.c | 1104 ++++++++--------- .../processes/anim/sh/export.sh | 114 +- .../processes/anim/sh/install.sh | 44 +- .../processes/clodbank/sh/build.sh | 52 +- .../processes/clodbank/sh/export.sh | 120 +- .../processes/clodbank/sh/install.sh | 44 +- .../processes/displace/sh/export.sh | 58 +- .../processes/displace/sh/install.sh | 44 +- .../processes/farbank/sh/build.sh | 178 +-- .../processes/farbank/sh/install.sh | 44 +- .../processes/font/sh/export.sh | 64 +- .../processes/font/sh/install.sh | 44 +- .../build_gamedata/processes/ig/sh/build.sh | 608 ++++----- .../build_gamedata/processes/ig/sh/export.sh | 180 +-- .../build_gamedata/processes/ig/sh/install.sh | 60 +- .../processes/ig_light/sh/install.sh | 46 +- .../processes/interface/sh/build.sh | 120 +- .../processes/interface/sh/export.sh | 124 +- .../processes/interface/sh/install.sh | 48 +- .../build_gamedata/processes/ligo/sh/build.sh | 404 +++--- .../processes/ligo/sh/export.sh | 144 +-- .../build_gamedata/processes/map/sh/build.sh | 280 ++--- .../build_gamedata/processes/map/sh/export.sh | 114 +- .../processes/map/sh/install.sh | 110 +- .../processes/pacs_prim/sh/export.sh | 118 +- .../processes/pacs_prim/sh/install.sh | 60 +- .../build_gamedata/processes/ps/sh/export.sh | 62 +- .../build_gamedata/processes/ps/sh/install.sh | 44 +- .../processes/rbank/sh/build.sh | 716 +++++------ .../processes/rbank/sh/clean.sh | 62 +- .../processes/rbank/sh/export.sh | 114 +- .../processes/rbank/sh/install.sh | 44 +- .../processes/shape/sh/build.sh | 472 +++---- .../processes/shape/sh/export.sh | 280 ++--- .../processes/shape/sh/install.sh | 72 +- .../processes/skel/sh/export.sh | 160 +-- .../processes/skel/sh/install.sh | 44 +- .../processes/smallbank/sh/export.sh | 144 +-- .../processes/smallbank/sh/install.sh | 44 +- .../build_gamedata/processes/swt/sh/export.sh | 114 +- .../processes/swt/sh/install.sh | 44 +- .../processes/tiles/sh/build.sh | 86 +- .../processes/tiles/sh/export.sh | 66 +- .../processes/tiles/sh/install.sh | 44 +- .../processes/veget/sh/export.sh | 104 +- .../processes/veget/sh/install.sh | 44 +- .../processes/vegetset/sh/export.sh | 58 +- .../processes/vegetset/sh/install.sh | 44 +- .../build_gamedata/processes/zone/sh/build.sh | 298 ++--- .../processes/zone/sh/export.sh | 218 ++-- .../processes/zone_light/sh/build.sh | 238 ++-- .../processes/zone_light/sh/export.sh | 56 +- .../processes/zone_light/sh/install.sh | 88 +- .../zone_light/sh/patch_tile_water.sh | 126 +- nel/tools/3d/build_gamedata/sh/build.sh | 66 +- nel/tools/3d/build_gamedata/sh/clean.sh | 58 +- .../3d/build_gamedata/sh/client_clean.sh | 52 +- .../3d/build_gamedata/sh/client_setup.sh | 46 +- nel/tools/3d/build_gamedata/sh/export.sh | 66 +- nel/tools/3d/build_gamedata/sh/install.sh | 66 +- nel/tools/3d/build_gamedata/sh/setup.sh | 124 +- 63 files changed, 4347 insertions(+), 4347 deletions(-) diff --git a/nel/src/3d/driver/direct3d/driver_direct3d_pixel_program.cpp b/nel/src/3d/driver/direct3d/driver_direct3d_pixel_program.cpp index f1cca7b2b5..744cea58b9 100644 --- a/nel/src/3d/driver/direct3d/driver_direct3d_pixel_program.cpp +++ b/nel/src/3d/driver/direct3d/driver_direct3d_pixel_program.cpp @@ -1,7 +1,7 @@ /** \file driver_direct3d_pixel_program.cpp * Direct 3d driver implementation * - * $Id: driver_direct3d_pixel_program.cpp,v 1.1.2.4 2007/07/09 15:26:35 legallo Exp $ + * $Id$ * * \todo manage better the init/release system (if a throw occurs in the init, we must release correctly the driver) */ diff --git a/nel/src/3d/driver/opengl/driver_opengl_pixel_program.cpp b/nel/src/3d/driver/opengl/driver_opengl_pixel_program.cpp index 29ec4caf8b..cd6c3adf41 100644 --- a/nel/src/3d/driver/opengl/driver_opengl_pixel_program.cpp +++ b/nel/src/3d/driver/opengl/driver_opengl_pixel_program.cpp @@ -1,7 +1,7 @@ /** \file driver_opengl_pixel_program.cpp * OpenGL driver implementation for pixel program manipulation. * - * $Id: driver_opengl_pixel_program.cpp,v 1.1.2.4 2007/07/09 15:29:00 legallo Exp $ + * $Id$ * * \todo manage better the init/release system (if a throw occurs in the init, we must release correctly the driver) */ diff --git a/nel/src/gui/lua_loadlib.c b/nel/src/gui/lua_loadlib.c index 837ec1a2bc..8acab487e5 100644 --- a/nel/src/gui/lua_loadlib.c +++ b/nel/src/gui/lua_loadlib.c @@ -1,552 +1,552 @@ -// Ryzom - MMORPG Framework -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -#include "stdpch.h" -#include -#include -#include "lua_loadlib.h" - -typedef lua_State * (*Tlua_open) (void); -typedef void (*Tlua_close) (lua_State *L); -typedef lua_State *(*Tlua_newthread) (lua_State *L); -typedef lua_CFunction (*Tlua_atpanic) (lua_State *L, lua_CFunction panicf); -typedef int (*Tlua_gettop) (lua_State *L); -typedef void (*Tlua_settop) (lua_State *L, int idx); -typedef void (*Tlua_pushvalue) (lua_State *L, int idx); -typedef void (*Tlua_remove) (lua_State *L, int idx); -typedef void (*Tlua_insert )(lua_State *L, int idx); -typedef void (*Tlua_replace) (lua_State *L, int idx); -typedef int (*Tlua_checkstack) (lua_State *L, int sz); -typedef void (*Tlua_xmove) (lua_State *from, lua_State *to, int n); -typedef int (*Tlua_isnumber) (lua_State *L, int idx); -typedef int (*Tlua_isstring) (lua_State *L, int idx); -typedef int (*Tlua_iscfunction) (lua_State *L, int idx); -typedef int (*Tlua_isuserdata) (lua_State *L, int idx); -typedef int (*Tlua_type) (lua_State *L, int idx); -typedef const char *(*Tlua_typename) (lua_State *L, int tp); -typedef int (*Tlua_equal) (lua_State *L, int idx1, int idx2); -typedef int (*Tlua_rawequal) (lua_State *L, int idx1, int idx2); -typedef int (*Tlua_lessthan) (lua_State *L, int idx1, int idx2); -typedef lua_Number (*Tlua_tonumber) (lua_State *L, int idx); -typedef int (*Tlua_toboolean) (lua_State *L, int idx); -typedef const char *(*Tlua_tostring) (lua_State *L, int idx); -typedef size_t (*Tlua_strlen) (lua_State *L, int idx); -typedef lua_CFunction (*Tlua_tocfunction) (lua_State *L, int idx); -typedef void *(*Tlua_touserdata) (lua_State *L, int idx); -typedef lua_State *(*Tlua_tothread) (lua_State *L, int idx); -typedef const void *(*Tlua_topointer) (lua_State *L, int idx); -typedef void (*Tlua_pushnil) (lua_State *L); -typedef void (*Tlua_pushnumber) (lua_State *L, lua_Number n); -typedef void (*Tlua_pushlstring) (lua_State *L, const char *s, size_t l); -typedef void (*Tlua_pushstring) (lua_State *L, const char *s); -typedef const char *(*Tlua_pushvfstring) (lua_State *L, const char *fmt, va_list argp); -typedef const char *(*Tlua_pushfstring) (lua_State *L, const char *fmt, ...); -typedef void (*Tlua_pushcclosure) (lua_State *L, lua_CFunction fn, int n); -typedef void (*Tlua_pushboolean) (lua_State *L, int b); -typedef void (*Tlua_pushlightuserdata) (lua_State *L, void *p); -typedef void (*Tlua_gettable) (lua_State *L, int idx); -typedef void (*Tlua_rawget) (lua_State *L, int idx); -typedef void (*Tlua_rawgeti) (lua_State *L, int idx, int n); -typedef void (*Tlua_newtable) (lua_State *L); -typedef void *(*Tlua_newuserdata) (lua_State *L, size_t sz); -typedef int (*Tlua_getmetatable) (lua_State *L, int objindex); -typedef void (*Tlua_getfenv) (lua_State *L, int idx); -typedef void (*Tlua_settable) (lua_State *L, int idx); -typedef void (*Tlua_rawset) (lua_State *L, int idx); -typedef void (*Tlua_rawseti) (lua_State *L, int idx, int n); -typedef int (*Tlua_setmetatable) (lua_State *L, int objindex); -typedef int (*Tlua_setfenv) (lua_State *L, int idx); -typedef void (*Tlua_call) (lua_State *L, int nargs, int nresults); -typedef int (*Tlua_pcall) (lua_State *L, int nargs, int nresults, int errfunc); -typedef int (*Tlua_cpcall) (lua_State *L, lua_CFunction func, void *ud); -typedef int (*Tlua_load) (lua_State *L, lua_Chunkreader reader, void *dt, - const char *chunkname); -typedef int (*Tlua_dump) (lua_State *L, lua_Chunkwriter writer, void *data); -typedef int (*Tlua_yield) (lua_State *L, int nresults); -typedef int (*Tlua_resume) (lua_State *L, int narg); -typedef int (*Tlua_getgcthreshold) (lua_State *L); -typedef int (*Tlua_getgccount) (lua_State *L); -typedef void (*Tlua_setgcthreshold) (lua_State *L, int newthreshold); -typedef const char *(*Tlua_version) (void); -typedef int (*Tlua_error) (lua_State *L); -typedef int (*Tlua_next) (lua_State *L, int idx); -typedef void (*Tlua_concat) (lua_State *L, int n); -typedef int (*Tlua_pushupvalues) (lua_State *L); -typedef void (*Tlua_Hook) (lua_State *L, lua_Debug *ar); -typedef int (*Tlua_getstack) (lua_State *L, int level, lua_Debug *ar); -typedef int (*Tlua_getinfo) (lua_State *L, const char *what, lua_Debug *ar); -typedef const char *(*Tlua_getlocal) (lua_State *L, const lua_Debug *ar, int n); -typedef const char *(*Tlua_setlocal) (lua_State *L, const lua_Debug *ar, int n); -typedef const char *(*Tlua_getupvalue) (lua_State *L, int funcindex, int n); -typedef const char *(*Tlua_setupvalue) (lua_State *L, int funcindex, int n); -typedef int (*Tlua_sethook) (lua_State *L, lua_Hook func, int mask, int count); -typedef lua_Hook (*Tlua_gethook) (lua_State *L); -typedef int (*Tlua_gethookmask) (lua_State *L); -typedef int (*Tlua_gethookcount) (lua_State *L); - -// from lauxlib.h -typedef void (*TluaL_openlib) (lua_State *L, const char *libname, - const luaL_reg *l, int nup); -typedef int (*TluaL_getmetafield) (lua_State *L, int obj, const char *e); -typedef int (*TluaL_callmeta) (lua_State *L, int obj, const char *e); -typedef int (*TluaL_typerror) (lua_State *L, int narg, const char *tname); -typedef int (*TluaL_argerror) (lua_State *L, int numarg, const char *extramsg); -typedef const char *(*TluaL_checklstring) (lua_State *L, int numArg, size_t *l); -typedef const char *(*TluaL_optlstring) (lua_State *L, int numArg, - const char *def, size_t *l); -typedef lua_Number (*TluaL_checknumber) (lua_State *L, int numArg); -typedef lua_Number (*TluaL_optnumber) (lua_State *L, int nArg, lua_Number def); - -typedef void (*TluaL_checkstack) (lua_State *L, int sz, const char *msg); -typedef void (*TluaL_checktype) (lua_State *L, int narg, int t); -typedef void (*TluaL_checkany) (lua_State *L, int narg); - -typedef int (*TluaL_newmetatable) (lua_State *L, const char *tname); -typedef void (*TluaL_getmetatable) (lua_State *L, const char *tname); -typedef void *(*TluaL_checkudata) (lua_State *L, int ud, const char *tname); - -typedef void (*TluaL_where) (lua_State *L, int lvl); -typedef int (*TluaL_error) (lua_State *L, const char *fmt, ...); - -typedef int (*TluaL_findstring) (const char *st, const char *const lst[]); - -typedef int (*TluaL_ref) (lua_State *L, int t); -typedef void (*TluaL_unref) (lua_State *L, int t, int ref); - -typedef int (*TluaL_getn) (lua_State *L, int t); -typedef void (*TluaL_setn) (lua_State *L, int t, int n); - -typedef int (*TluaL_loadfile) (lua_State *L, const char *filename); -typedef int (*TluaL_loadbuffer) (lua_State *L, const char *buff, size_t sz, - const char *name); - -typedef void (*TluaL_buffinit) (lua_State *L, luaL_Buffer *B); -typedef char *(*TluaL_prepbuffer) (luaL_Buffer *B); -typedef void (*TluaL_addlstring) (luaL_Buffer *B, const char *s, size_t l); -typedef void (*TluaL_addstring) (luaL_Buffer *B, const char *s); -typedef void (*TluaL_addvalue) (luaL_Buffer *B); -typedef void (*TluaL_pushresult) (luaL_Buffer *B); -typedef int (*Tlua_dofile) (lua_State *L, const char *filename); -typedef int (*Tlua_dostring) (lua_State *L, const char *str); -typedef int (*Tlua_dobuffer) (lua_State *L, const char *buff, size_t sz, - const char *n); - -// from lualib.h -typedef int (*Tluaopen_base) (lua_State *L); -typedef int (*Tluaopen_table) (lua_State *L); -typedef int (*Tluaopen_io) (lua_State *L); -typedef int (*Tluaopen_string) (lua_State *L); -typedef int (*Tluaopen_math) (lua_State *L); -typedef int (*Tluaopen_debug) (lua_State *L); -typedef int (*Tluaopen_loadlib) (lua_State *L); - -// from lua.h -Tlua_open dlllua_open; -Tlua_close dlllua_close; -Tlua_newthread dlllua_newthread; -Tlua_atpanic dlllua_atpanic; -Tlua_gettop dlllua_gettop; -Tlua_settop dlllua_settop; -Tlua_pushvalue dlllua_pushvalue; -Tlua_remove dlllua_remove; -Tlua_insert dlllua_insert ; -Tlua_replace dlllua_replace; -Tlua_checkstack dlllua_checkstack; -Tlua_xmove dlllua_xmove; -Tlua_isnumber dlllua_isnumber; -Tlua_isstring dlllua_isstring; -Tlua_iscfunction dlllua_iscfunction; -Tlua_isuserdata dlllua_isuserdata; -Tlua_type dlllua_type; -Tlua_typename dlllua_typename; -Tlua_equal dlllua_equal; -Tlua_rawequal dlllua_rawequal; -Tlua_lessthan dlllua_lessthan; -Tlua_tonumber dlllua_tonumber; -Tlua_toboolean dlllua_toboolean; -Tlua_tostring dlllua_tostring; -Tlua_strlen dlllua_strlen; -Tlua_tocfunction dlllua_tocfunction; -Tlua_touserdata dlllua_touserdata; -Tlua_tothread dlllua_tothread; -Tlua_topointer dlllua_topointer; -Tlua_pushnil dlllua_pushnil; -Tlua_pushnumber dlllua_pushnumber; -Tlua_pushlstring dlllua_pushlstring; -Tlua_pushstring dlllua_pushstring; -Tlua_pushvfstring dlllua_pushvfstring; -Tlua_pushfstring dlllua_pushfstring; -Tlua_pushcclosure dlllua_pushcclosure; -Tlua_pushboolean dlllua_pushboolean; -Tlua_pushlightuserdata dlllua_pushlightuserdata; -Tlua_gettable dlllua_gettable; -Tlua_rawget dlllua_rawget; -Tlua_rawgeti dlllua_rawgeti; -Tlua_newtable dlllua_newtable; -Tlua_newuserdata dlllua_newuserdata; -Tlua_getmetatable dlllua_getmetatable; -Tlua_getfenv dlllua_getfenv; -Tlua_settable dlllua_settable; -Tlua_rawset dlllua_rawset; -Tlua_rawseti dlllua_rawseti; -Tlua_setmetatable dlllua_setmetatable; -Tlua_setfenv dlllua_setfenv; -Tlua_call dlllua_call; -Tlua_pcall dlllua_pcall; -Tlua_cpcall dlllua_cpcall; -Tlua_load dlllua_load; -Tlua_dump dlllua_dump; -Tlua_yield dlllua_yield; -Tlua_resume dlllua_resume; -Tlua_getgcthreshold dlllua_getgcthreshold; -Tlua_getgccount dlllua_getgccount; -Tlua_setgcthreshold dlllua_setgcthreshold; -Tlua_version dlllua_version; -Tlua_error dlllua_error; -Tlua_next dlllua_next; -Tlua_concat dlllua_concat; -Tlua_pushupvalues dlllua_pushupvalues; -Tlua_getstack dlllua_getstack; -Tlua_getinfo dlllua_getinfo; -Tlua_getlocal dlllua_getlocal; -Tlua_setlocal dlllua_setlocal; -Tlua_getupvalue dlllua_getupvalue; -Tlua_setupvalue dlllua_setupvalue; -Tlua_sethook dlllua_sethook; -Tlua_gethook dlllua_gethook; -Tlua_gethookmask dlllua_gethookmask; -Tlua_gethookcount dlllua_gethookcount; -// from lauxlib.h -TluaL_openlib dllluaL_openlib; -TluaL_getmetafield dllluaL_getmetafield; -TluaL_callmeta dllluaL_callmeta; -TluaL_typerror dllluaL_typerror; -TluaL_argerror dllluaL_argerror; -TluaL_checklstring dllluaL_checklstring; -TluaL_optlstring dllluaL_optlstring; -TluaL_checknumber dllluaL_checknumber; -TluaL_optnumber dllluaL_optnumber; -TluaL_checkstack dllluaL_checkstack; -TluaL_checktype dllluaL_checktype; -TluaL_checkany dllluaL_checkany; -TluaL_newmetatable dllluaL_newmetatable; -TluaL_getmetatable dllluaL_getmetatable; -TluaL_checkudata dllluaL_checkudata; -TluaL_where dllluaL_where; -TluaL_error dllluaL_error; -TluaL_findstring dllluaL_findstring; -TluaL_ref dllluaL_ref; -TluaL_unref dllluaL_unref; -TluaL_getn dllluaL_getn; -TluaL_setn dllluaL_setn; -TluaL_loadfile dllluaL_loadfile; -TluaL_loadbuffer dllluaL_loadbuffer; -TluaL_buffinit dllluaL_buffinit; -TluaL_prepbuffer dllluaL_prepbuffer; -TluaL_addlstring dllluaL_addlstring; -TluaL_addstring dllluaL_addstring; -TluaL_addvalue dllluaL_addvalue; -TluaL_pushresult dllluaL_pushresult; -Tlua_dofile dlllua_dofile; -Tlua_dostring dlllua_dostring; -Tlua_dobuffer dlllua_dobuffer; -// from lua lib.h -Tluaopen_base dllluaopen_base; -Tluaopen_table dllluaopen_table; -Tluaopen_io dllluaopen_io; -Tluaopen_string dllluaopen_string; -Tluaopen_math dllluaopen_math; -Tluaopen_debug dllluaopen_debug; -Tluaopen_loadlib dllluaopen_loadlib; - -// call to actual dll function -lua_State *lua_open (void) { return dlllua_open(); } -void lua_close (lua_State *L) { dlllua_close(L); } -lua_State *lua_newthread (lua_State *L) { return dlllua_newthread(L); } -lua_CFunction lua_atpanic (lua_State *L, lua_CFunction panicf) { return dlllua_atpanic(L, panicf); } -int lua_gettop (lua_State *L) { return dlllua_gettop(L); } -void lua_settop (lua_State *L, int idx) { dlllua_settop(L, idx); } -void lua_pushvalue (lua_State *L, int idx) { dlllua_pushvalue(L, idx); } -void lua_remove (lua_State *L, int idx) { dlllua_remove(L, idx); } -void lua_insert (lua_State *L, int idx) { dlllua_insert (L, idx); } -void lua_replace (lua_State *L, int idx) { dlllua_replace(L, idx); } -int lua_checkstack (lua_State *L, int sz) { return dlllua_checkstack(L, sz); } -void lua_xmove (lua_State *from, lua_State *to, int n) { dlllua_xmove(from, to, n); } -int lua_isnumber (lua_State *L, int idx) { return dlllua_isnumber(L, idx); } -int lua_isstring (lua_State *L, int idx) { return dlllua_isstring(L, idx); } -int lua_iscfunction (lua_State *L, int idx) { return dlllua_iscfunction(L, idx); } -int lua_isuserdata (lua_State *L, int idx) { return dlllua_isuserdata(L, idx); } -int lua_type (lua_State *L, int idx) { return dlllua_type(L, idx); } -const char *lua_typename (lua_State *L, int tp) { return dlllua_typename(L, tp); } -int lua_equal (lua_State *L, int idx1, int idx2) { return dlllua_equal(L, idx1, idx2); } -int lua_rawequal (lua_State *L, int idx1, int idx2) { return dlllua_rawequal(L, idx1, idx2); } -int lua_lessthan (lua_State *L, int idx1, int idx2) { return dlllua_lessthan(L, idx1, idx2); } -lua_Number lua_tonumber (lua_State *L, int idx) { return dlllua_tonumber(L, idx); } -int lua_toboolean (lua_State *L, int idx) { return dlllua_toboolean(L, idx); } -const char *lua_tostring (lua_State *L, int idx) { return dlllua_tostring(L, idx); } -size_t lua_strlen (lua_State *L, int idx) { return dlllua_strlen(L, idx); } -lua_CFunction lua_tocfunction (lua_State *L, int idx) { return dlllua_tocfunction(L, idx); } -void *lua_touserdata (lua_State *L, int idx) { return dlllua_touserdata(L, idx); } -lua_State *lua_tothread (lua_State *L, int idx) { return dlllua_tothread(L, idx); } -const void *lua_topointer (lua_State *L, int idx) { return dlllua_topointer(L, idx); } -void lua_pushnil (lua_State *L) { dlllua_pushnil(L); } -void lua_pushnumber (lua_State *L, lua_Number n) { dlllua_pushnumber(L, n); } -void lua_pushlstring (lua_State *L, const char *s, size_t l) { dlllua_pushlstring(L, s, l); } -void lua_pushstring (lua_State *L, const char *s) { dlllua_pushstring(L, s); } - -const char *lua_pushvfstring (lua_State *L, const char *fmt, va_list argp) -{ - const char *result; - va_list _args; - va_start (_args, fmt); - result = dlllua_pushvfstring(L, fmt, _args); - va_end(_args); - return result; -} - -const char *lua_pushfstring (lua_State *L, const char *fmt, ...) -{ - const char *result; - va_list _args; - va_start (_args, fmt); - result = dlllua_pushfstring(L, fmt, _args); - va_end(_args); - return result; -} - -void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n) { dlllua_pushcclosure(L, fn, n); } -void lua_pushboolean (lua_State *L, int b) { dlllua_pushboolean(L, b); } -void lua_pushlightuserdata (lua_State *L, void *p) { dlllua_pushlightuserdata(L, p); } -void lua_gettable (lua_State *L, int idx) { dlllua_gettable(L, idx); } -void lua_rawget (lua_State *L, int idx) { dlllua_rawget(L, idx); } -void lua_rawgeti (lua_State *L, int idx, int n) { dlllua_rawgeti(L, idx, n); } -void lua_newtable (lua_State *L) { dlllua_newtable(L); } -void *lua_newuserdata (lua_State *L, size_t sz) { return dlllua_newuserdata(L, sz); } -int lua_getmetatable (lua_State *L, int objindex) { return dlllua_getmetatable(L, objindex); } -void lua_getfenv (lua_State *L, int idx) { dlllua_getfenv(L, idx); } -void lua_settable (lua_State *L, int idx) { dlllua_settable(L, idx); } -void lua_rawset (lua_State *L, int idx) { dlllua_rawset(L, idx); } -void lua_rawseti (lua_State *L, int idx, int n) { dlllua_rawseti(L, idx, n); } -int lua_setmetatable (lua_State *L, int objindex) { return dlllua_setmetatable(L, objindex); } -int lua_setfenv (lua_State *L, int idx) { return dlllua_setfenv(L, idx); } -void lua_call (lua_State *L, int nargs, int nresults) { dlllua_call(L, nargs, nresults); } -int lua_pcall (lua_State *L, int nargs, int nresults, int errfunc) { return dlllua_pcall(L, nargs, nresults, errfunc); } -int lua_cpcall (lua_State *L, lua_CFunction func, void *ud) { return dlllua_cpcall(L, func, ud); } -int lua_load (lua_State *L, lua_Chunkreader reader, void *dt, const char *chunkname) -{ - return dlllua_load(L, reader, dt, chunkname); -} -int lua_dump (lua_State *L, lua_Chunkwriter writer, void *data) { return dlllua_dump(L, writer, data); } -int lua_yield (lua_State *L, int nresults) { return dlllua_yield(L, nresults); } -int lua_resume (lua_State *L, int narg) { return dlllua_resume(L, narg); } -int lua_getgcthreshold (lua_State *L) { return dlllua_getgcthreshold(L); } -int lua_getgccount (lua_State *L) { return dlllua_getgccount(L); } -void lua_setgcthreshold (lua_State *L, int newthreshold) { dlllua_setgcthreshold(L, newthreshold); } -const char *lua_version (void) { return dlllua_version(); } -int lua_error (lua_State *L) { return dlllua_error(L); } -int lua_next (lua_State *L, int idx) { return dlllua_next(L, idx); } -void lua_concat (lua_State *L, int n) { dlllua_concat(L, n); } -int lua_pushupvalues (lua_State *L) { return dlllua_pushupvalues(L); } -int lua_getstack (lua_State *L, int level, lua_Debug *ar) { return dlllua_getstack(L, level, ar); } -int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar) { return dlllua_getinfo(L, what, ar); } -const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n) { return dlllua_getlocal(L, ar, n); } -const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n) { return dlllua_setlocal(L, ar, n); } -const char *lua_getupvalue (lua_State *L, int funcindex, int n) { return dlllua_getupvalue(L, funcindex, n); } -const char *lua_setupvalue (lua_State *L, int funcindex, int n) { return dlllua_setupvalue(L, funcindex, n); } -int lua_sethook (lua_State *L, lua_Hook func, int mask, int count) { return dlllua_sethook(L, func, mask, count); } -lua_Hook lua_gethook (lua_State *L) { return dlllua_gethook(L); } -int lua_gethookmask (lua_State *L) { return dlllua_gethookmask(L); } -int lua_gethookcount (lua_State *L) { return dlllua_gethookcount(L); } - -// from lauxlib.h -void luaL_openlib (lua_State *L, const char *libname, const luaL_reg *l, int nup) { dllluaL_openlib(L, libname, l, nup); } -int luaL_getmetafield (lua_State *L, int obj, const char *e) { return dllluaL_getmetafield(L, obj, e); } -int luaL_callmeta (lua_State *L, int obj, const char *e) { return dllluaL_callmeta(L, obj, e); } -int luaL_typerror (lua_State *L, int narg, const char *tname) { return dllluaL_typerror(L, narg, tname); } -int luaL_argerror (lua_State *L, int numarg, const char *extramsg) { return dllluaL_argerror(L, numarg, extramsg); } -const char *luaL_checklstring (lua_State *L, int numArg, size_t *l) { return dllluaL_checklstring(L, numArg, l); } -const char *luaL_optlstring (lua_State *L, int numArg, const char *def, size_t *l) { return dllluaL_optlstring(L, numArg, def, l); } -lua_Number luaL_checknumber (lua_State *L, int numArg) { return dllluaL_checknumber(L, numArg); } -lua_Number luaL_optnumber (lua_State *L, int nArg, lua_Number def) { return dllluaL_optnumber(L, nArg, def); } -void luaL_checkstack (lua_State *L, int sz, const char *msg) { dllluaL_checkstack(L, sz, msg); } -void luaL_checktype (lua_State *L, int narg, int t) { dllluaL_checktype(L, narg, t); } -void luaL_checkany (lua_State *L, int narg) { dllluaL_checkany(L, narg); } -int luaL_newmetatable (lua_State *L, const char *tname) { return dllluaL_newmetatable(L, tname); } -void luaL_getmetatable (lua_State *L, const char *tname) { dllluaL_getmetatable(L, tname); } -void *luaL_checkudata (lua_State *L, int ud, const char *tname) { return dllluaL_checkudata(L, ud, tname); } -void luaL_where (lua_State *L, int lvl) { dllluaL_where(L, lvl); } - -int luaL_error (lua_State *L, const char *fmt, ...) -{ - int result; - va_list _args; - va_start (_args, fmt); - result = dllluaL_error(L, fmt, _args); - va_end(_args); - return result; -} -int luaL_findstring (const char *st, const char *const lst[]) { return dllluaL_findstring(st, lst); } -int luaL_ref (lua_State *L, int t) { return dllluaL_ref(L, t); } -void luaL_unref (lua_State *L, int t, int ref) { dllluaL_unref(L, t, ref); } -int luaL_getn (lua_State *L, int t) { return dllluaL_getn(L, t); } -void luaL_setn (lua_State *L, int t, int n) { dllluaL_setn(L, t, n); } -int luaL_loadfile (lua_State *L, const char *filename) { return dllluaL_loadfile(L, filename); } -int luaL_loadbuffer (lua_State *L, const char *buff, size_t sz, const char *name) { return dllluaL_loadbuffer(L, buff, sz, name); } - -void luaL_buffinit (lua_State *L, luaL_Buffer *B) { dllluaL_buffinit(L, B); } -char *luaL_prepbuffer (luaL_Buffer *B) { return dllluaL_prepbuffer(B); } - -void luaL_addlstring (luaL_Buffer *B, const char *s, size_t l) { dllluaL_addlstring(B, s, l); } -void luaL_addstring (luaL_Buffer *B, const char *s) { dllluaL_addstring(B, s); } -void luaL_addvalue (luaL_Buffer *B) { dllluaL_addvalue(B); } -void luaL_pushresult (luaL_Buffer *B) { dllluaL_pushresult(B); } -int lua_dofile (lua_State *L, const char *filename) { return dlllua_dofile(L, filename); } -int lua_dostring (lua_State *L, const char *str) { return dlllua_dostring(L, str); } -int lua_dobuffer (lua_State *L, const char *buff, size_t sz, const char *n) { return dlllua_dobuffer(L, buff, sz, n); } - -// from lualib.h -int luaopen_base (lua_State *L) { return dllluaopen_base(L); } -int luaopen_table (lua_State *L) { return dllluaopen_table(L); } -int luaopen_io (lua_State *L) { return dllluaopen_io(L); } -int luaopen_string (lua_State *L) { return dllluaopen_string(L); } -int luaopen_math (lua_State *L) { return dllluaopen_math(L); } -int luaopen_debug (lua_State *L) { return dllluaopen_debug(L); } -int luaopen_loadlib (lua_State *L) { return dllluaopen_loadlib(L); } - - -int loadLuaDLL() -{ - HMODULE libHandle = LoadLibrary("lua.dll"); - if (!libHandle) return 0; -#define GET_LUA_PROC(name) dll##name = (T##name) GetProcAddress(libHandle, #name); if (!dll##name) return 0; - // from lua.h - GET_LUA_PROC(lua_close) - GET_LUA_PROC(lua_newthread) - GET_LUA_PROC(lua_atpanic) - GET_LUA_PROC(lua_gettop) - GET_LUA_PROC(lua_settop) - GET_LUA_PROC(lua_pushvalue) - GET_LUA_PROC(lua_remove) - GET_LUA_PROC(lua_insert) - GET_LUA_PROC(lua_replace) - GET_LUA_PROC(lua_checkstack) - GET_LUA_PROC(lua_xmove) - GET_LUA_PROC(lua_isnumber) - GET_LUA_PROC(lua_isstring) - GET_LUA_PROC(lua_iscfunction) - GET_LUA_PROC(lua_isuserdata) - GET_LUA_PROC(lua_type) - GET_LUA_PROC(lua_typename) - GET_LUA_PROC(lua_equal) - GET_LUA_PROC(lua_rawequal) - GET_LUA_PROC(lua_lessthan) - GET_LUA_PROC(lua_tonumber) - GET_LUA_PROC(lua_toboolean) - GET_LUA_PROC(lua_tostring) - GET_LUA_PROC(lua_strlen) - GET_LUA_PROC(lua_tocfunction) - GET_LUA_PROC(lua_touserdata) - GET_LUA_PROC(lua_tothread) - GET_LUA_PROC(lua_topointer) - GET_LUA_PROC(lua_pushnil) - GET_LUA_PROC(lua_pushnumber) - GET_LUA_PROC(lua_pushlstring) - GET_LUA_PROC(lua_pushstring) - GET_LUA_PROC(lua_pushcclosure) - GET_LUA_PROC(lua_pushboolean) - GET_LUA_PROC(lua_pushlightuserdata) - GET_LUA_PROC(lua_gettable) - GET_LUA_PROC(lua_rawget) - GET_LUA_PROC(lua_rawgeti) - GET_LUA_PROC(lua_newtable) - GET_LUA_PROC(lua_newuserdata) - GET_LUA_PROC(lua_getmetatable) - GET_LUA_PROC(lua_getfenv) - GET_LUA_PROC(lua_settable) - GET_LUA_PROC(lua_rawset) - GET_LUA_PROC(lua_rawseti) - GET_LUA_PROC(lua_setmetatable) - GET_LUA_PROC(lua_setfenv) - GET_LUA_PROC(lua_call) - GET_LUA_PROC(lua_pcall) - GET_LUA_PROC(lua_cpcall) - GET_LUA_PROC(lua_load) - GET_LUA_PROC(lua_dump) - GET_LUA_PROC(lua_yield) - GET_LUA_PROC(lua_resume) - GET_LUA_PROC(lua_getgcthreshold) - GET_LUA_PROC(lua_getgccount) - GET_LUA_PROC(lua_setgcthreshold) - GET_LUA_PROC(lua_version) - GET_LUA_PROC(lua_error) - GET_LUA_PROC(lua_next) - GET_LUA_PROC(lua_concat) - GET_LUA_PROC(lua_pushupvalues) - GET_LUA_PROC(lua_getstack) - GET_LUA_PROC(lua_getinfo) - GET_LUA_PROC(lua_getlocal) - GET_LUA_PROC(lua_setlocal) - GET_LUA_PROC(lua_getupvalue) - GET_LUA_PROC(lua_setupvalue) - GET_LUA_PROC(lua_sethook) - GET_LUA_PROC(lua_gethook) - GET_LUA_PROC(lua_gethookmask) - GET_LUA_PROC(lua_gethookcount) - // from lauxlib.h - GET_LUA_PROC(luaL_openlib) - GET_LUA_PROC(luaL_getmetafield) - GET_LUA_PROC(luaL_callmeta) - GET_LUA_PROC(luaL_typerror) - GET_LUA_PROC(luaL_argerror) - GET_LUA_PROC(luaL_checklstring) - GET_LUA_PROC(luaL_optlstring) - GET_LUA_PROC(luaL_checknumber) - GET_LUA_PROC(luaL_optnumber) - GET_LUA_PROC(luaL_checkstack) - GET_LUA_PROC(luaL_checktype) - GET_LUA_PROC(luaL_checkany) - GET_LUA_PROC(luaL_newmetatable) - GET_LUA_PROC(luaL_getmetatable) - GET_LUA_PROC(luaL_checkudata) - GET_LUA_PROC(luaL_where) - GET_LUA_PROC(luaL_error) - GET_LUA_PROC(luaL_findstring) - GET_LUA_PROC(luaL_ref) - GET_LUA_PROC(luaL_unref) - GET_LUA_PROC(luaL_getn) - GET_LUA_PROC(luaL_setn) - GET_LUA_PROC(luaL_loadfile) - GET_LUA_PROC(luaL_loadbuffer) - GET_LUA_PROC(luaL_buffinit) - GET_LUA_PROC(luaL_prepbuffer) - GET_LUA_PROC(luaL_addlstring) - GET_LUA_PROC(luaL_addstring) - GET_LUA_PROC(luaL_addvalue) - GET_LUA_PROC(luaL_pushresult) - GET_LUA_PROC(lua_dofile) - GET_LUA_PROC(lua_dostring) - GET_LUA_PROC(lua_dobuffer) - // from lua lib.h - GET_LUA_PROC(luaopen_base) - GET_LUA_PROC(luaopen_table) - GET_LUA_PROC(luaopen_io) - GET_LUA_PROC(luaopen_string) - GET_LUA_PROC(luaopen_math) - GET_LUA_PROC(luaopen_debug) - GET_LUA_PROC(luaopen_loadlib) - - return 1; -} +// Ryzom - MMORPG Framework +// Copyright (C) 2010 Winch Gate Property Limited +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +#include "stdpch.h" +#include +#include +#include "lua_loadlib.h" + +typedef lua_State * (*Tlua_open) (void); +typedef void (*Tlua_close) (lua_State *L); +typedef lua_State *(*Tlua_newthread) (lua_State *L); +typedef lua_CFunction (*Tlua_atpanic) (lua_State *L, lua_CFunction panicf); +typedef int (*Tlua_gettop) (lua_State *L); +typedef void (*Tlua_settop) (lua_State *L, int idx); +typedef void (*Tlua_pushvalue) (lua_State *L, int idx); +typedef void (*Tlua_remove) (lua_State *L, int idx); +typedef void (*Tlua_insert )(lua_State *L, int idx); +typedef void (*Tlua_replace) (lua_State *L, int idx); +typedef int (*Tlua_checkstack) (lua_State *L, int sz); +typedef void (*Tlua_xmove) (lua_State *from, lua_State *to, int n); +typedef int (*Tlua_isnumber) (lua_State *L, int idx); +typedef int (*Tlua_isstring) (lua_State *L, int idx); +typedef int (*Tlua_iscfunction) (lua_State *L, int idx); +typedef int (*Tlua_isuserdata) (lua_State *L, int idx); +typedef int (*Tlua_type) (lua_State *L, int idx); +typedef const char *(*Tlua_typename) (lua_State *L, int tp); +typedef int (*Tlua_equal) (lua_State *L, int idx1, int idx2); +typedef int (*Tlua_rawequal) (lua_State *L, int idx1, int idx2); +typedef int (*Tlua_lessthan) (lua_State *L, int idx1, int idx2); +typedef lua_Number (*Tlua_tonumber) (lua_State *L, int idx); +typedef int (*Tlua_toboolean) (lua_State *L, int idx); +typedef const char *(*Tlua_tostring) (lua_State *L, int idx); +typedef size_t (*Tlua_strlen) (lua_State *L, int idx); +typedef lua_CFunction (*Tlua_tocfunction) (lua_State *L, int idx); +typedef void *(*Tlua_touserdata) (lua_State *L, int idx); +typedef lua_State *(*Tlua_tothread) (lua_State *L, int idx); +typedef const void *(*Tlua_topointer) (lua_State *L, int idx); +typedef void (*Tlua_pushnil) (lua_State *L); +typedef void (*Tlua_pushnumber) (lua_State *L, lua_Number n); +typedef void (*Tlua_pushlstring) (lua_State *L, const char *s, size_t l); +typedef void (*Tlua_pushstring) (lua_State *L, const char *s); +typedef const char *(*Tlua_pushvfstring) (lua_State *L, const char *fmt, va_list argp); +typedef const char *(*Tlua_pushfstring) (lua_State *L, const char *fmt, ...); +typedef void (*Tlua_pushcclosure) (lua_State *L, lua_CFunction fn, int n); +typedef void (*Tlua_pushboolean) (lua_State *L, int b); +typedef void (*Tlua_pushlightuserdata) (lua_State *L, void *p); +typedef void (*Tlua_gettable) (lua_State *L, int idx); +typedef void (*Tlua_rawget) (lua_State *L, int idx); +typedef void (*Tlua_rawgeti) (lua_State *L, int idx, int n); +typedef void (*Tlua_newtable) (lua_State *L); +typedef void *(*Tlua_newuserdata) (lua_State *L, size_t sz); +typedef int (*Tlua_getmetatable) (lua_State *L, int objindex); +typedef void (*Tlua_getfenv) (lua_State *L, int idx); +typedef void (*Tlua_settable) (lua_State *L, int idx); +typedef void (*Tlua_rawset) (lua_State *L, int idx); +typedef void (*Tlua_rawseti) (lua_State *L, int idx, int n); +typedef int (*Tlua_setmetatable) (lua_State *L, int objindex); +typedef int (*Tlua_setfenv) (lua_State *L, int idx); +typedef void (*Tlua_call) (lua_State *L, int nargs, int nresults); +typedef int (*Tlua_pcall) (lua_State *L, int nargs, int nresults, int errfunc); +typedef int (*Tlua_cpcall) (lua_State *L, lua_CFunction func, void *ud); +typedef int (*Tlua_load) (lua_State *L, lua_Chunkreader reader, void *dt, + const char *chunkname); +typedef int (*Tlua_dump) (lua_State *L, lua_Chunkwriter writer, void *data); +typedef int (*Tlua_yield) (lua_State *L, int nresults); +typedef int (*Tlua_resume) (lua_State *L, int narg); +typedef int (*Tlua_getgcthreshold) (lua_State *L); +typedef int (*Tlua_getgccount) (lua_State *L); +typedef void (*Tlua_setgcthreshold) (lua_State *L, int newthreshold); +typedef const char *(*Tlua_version) (void); +typedef int (*Tlua_error) (lua_State *L); +typedef int (*Tlua_next) (lua_State *L, int idx); +typedef void (*Tlua_concat) (lua_State *L, int n); +typedef int (*Tlua_pushupvalues) (lua_State *L); +typedef void (*Tlua_Hook) (lua_State *L, lua_Debug *ar); +typedef int (*Tlua_getstack) (lua_State *L, int level, lua_Debug *ar); +typedef int (*Tlua_getinfo) (lua_State *L, const char *what, lua_Debug *ar); +typedef const char *(*Tlua_getlocal) (lua_State *L, const lua_Debug *ar, int n); +typedef const char *(*Tlua_setlocal) (lua_State *L, const lua_Debug *ar, int n); +typedef const char *(*Tlua_getupvalue) (lua_State *L, int funcindex, int n); +typedef const char *(*Tlua_setupvalue) (lua_State *L, int funcindex, int n); +typedef int (*Tlua_sethook) (lua_State *L, lua_Hook func, int mask, int count); +typedef lua_Hook (*Tlua_gethook) (lua_State *L); +typedef int (*Tlua_gethookmask) (lua_State *L); +typedef int (*Tlua_gethookcount) (lua_State *L); + +// from lauxlib.h +typedef void (*TluaL_openlib) (lua_State *L, const char *libname, + const luaL_reg *l, int nup); +typedef int (*TluaL_getmetafield) (lua_State *L, int obj, const char *e); +typedef int (*TluaL_callmeta) (lua_State *L, int obj, const char *e); +typedef int (*TluaL_typerror) (lua_State *L, int narg, const char *tname); +typedef int (*TluaL_argerror) (lua_State *L, int numarg, const char *extramsg); +typedef const char *(*TluaL_checklstring) (lua_State *L, int numArg, size_t *l); +typedef const char *(*TluaL_optlstring) (lua_State *L, int numArg, + const char *def, size_t *l); +typedef lua_Number (*TluaL_checknumber) (lua_State *L, int numArg); +typedef lua_Number (*TluaL_optnumber) (lua_State *L, int nArg, lua_Number def); + +typedef void (*TluaL_checkstack) (lua_State *L, int sz, const char *msg); +typedef void (*TluaL_checktype) (lua_State *L, int narg, int t); +typedef void (*TluaL_checkany) (lua_State *L, int narg); + +typedef int (*TluaL_newmetatable) (lua_State *L, const char *tname); +typedef void (*TluaL_getmetatable) (lua_State *L, const char *tname); +typedef void *(*TluaL_checkudata) (lua_State *L, int ud, const char *tname); + +typedef void (*TluaL_where) (lua_State *L, int lvl); +typedef int (*TluaL_error) (lua_State *L, const char *fmt, ...); + +typedef int (*TluaL_findstring) (const char *st, const char *const lst[]); + +typedef int (*TluaL_ref) (lua_State *L, int t); +typedef void (*TluaL_unref) (lua_State *L, int t, int ref); + +typedef int (*TluaL_getn) (lua_State *L, int t); +typedef void (*TluaL_setn) (lua_State *L, int t, int n); + +typedef int (*TluaL_loadfile) (lua_State *L, const char *filename); +typedef int (*TluaL_loadbuffer) (lua_State *L, const char *buff, size_t sz, + const char *name); + +typedef void (*TluaL_buffinit) (lua_State *L, luaL_Buffer *B); +typedef char *(*TluaL_prepbuffer) (luaL_Buffer *B); +typedef void (*TluaL_addlstring) (luaL_Buffer *B, const char *s, size_t l); +typedef void (*TluaL_addstring) (luaL_Buffer *B, const char *s); +typedef void (*TluaL_addvalue) (luaL_Buffer *B); +typedef void (*TluaL_pushresult) (luaL_Buffer *B); +typedef int (*Tlua_dofile) (lua_State *L, const char *filename); +typedef int (*Tlua_dostring) (lua_State *L, const char *str); +typedef int (*Tlua_dobuffer) (lua_State *L, const char *buff, size_t sz, + const char *n); + +// from lualib.h +typedef int (*Tluaopen_base) (lua_State *L); +typedef int (*Tluaopen_table) (lua_State *L); +typedef int (*Tluaopen_io) (lua_State *L); +typedef int (*Tluaopen_string) (lua_State *L); +typedef int (*Tluaopen_math) (lua_State *L); +typedef int (*Tluaopen_debug) (lua_State *L); +typedef int (*Tluaopen_loadlib) (lua_State *L); + +// from lua.h +Tlua_open dlllua_open; +Tlua_close dlllua_close; +Tlua_newthread dlllua_newthread; +Tlua_atpanic dlllua_atpanic; +Tlua_gettop dlllua_gettop; +Tlua_settop dlllua_settop; +Tlua_pushvalue dlllua_pushvalue; +Tlua_remove dlllua_remove; +Tlua_insert dlllua_insert ; +Tlua_replace dlllua_replace; +Tlua_checkstack dlllua_checkstack; +Tlua_xmove dlllua_xmove; +Tlua_isnumber dlllua_isnumber; +Tlua_isstring dlllua_isstring; +Tlua_iscfunction dlllua_iscfunction; +Tlua_isuserdata dlllua_isuserdata; +Tlua_type dlllua_type; +Tlua_typename dlllua_typename; +Tlua_equal dlllua_equal; +Tlua_rawequal dlllua_rawequal; +Tlua_lessthan dlllua_lessthan; +Tlua_tonumber dlllua_tonumber; +Tlua_toboolean dlllua_toboolean; +Tlua_tostring dlllua_tostring; +Tlua_strlen dlllua_strlen; +Tlua_tocfunction dlllua_tocfunction; +Tlua_touserdata dlllua_touserdata; +Tlua_tothread dlllua_tothread; +Tlua_topointer dlllua_topointer; +Tlua_pushnil dlllua_pushnil; +Tlua_pushnumber dlllua_pushnumber; +Tlua_pushlstring dlllua_pushlstring; +Tlua_pushstring dlllua_pushstring; +Tlua_pushvfstring dlllua_pushvfstring; +Tlua_pushfstring dlllua_pushfstring; +Tlua_pushcclosure dlllua_pushcclosure; +Tlua_pushboolean dlllua_pushboolean; +Tlua_pushlightuserdata dlllua_pushlightuserdata; +Tlua_gettable dlllua_gettable; +Tlua_rawget dlllua_rawget; +Tlua_rawgeti dlllua_rawgeti; +Tlua_newtable dlllua_newtable; +Tlua_newuserdata dlllua_newuserdata; +Tlua_getmetatable dlllua_getmetatable; +Tlua_getfenv dlllua_getfenv; +Tlua_settable dlllua_settable; +Tlua_rawset dlllua_rawset; +Tlua_rawseti dlllua_rawseti; +Tlua_setmetatable dlllua_setmetatable; +Tlua_setfenv dlllua_setfenv; +Tlua_call dlllua_call; +Tlua_pcall dlllua_pcall; +Tlua_cpcall dlllua_cpcall; +Tlua_load dlllua_load; +Tlua_dump dlllua_dump; +Tlua_yield dlllua_yield; +Tlua_resume dlllua_resume; +Tlua_getgcthreshold dlllua_getgcthreshold; +Tlua_getgccount dlllua_getgccount; +Tlua_setgcthreshold dlllua_setgcthreshold; +Tlua_version dlllua_version; +Tlua_error dlllua_error; +Tlua_next dlllua_next; +Tlua_concat dlllua_concat; +Tlua_pushupvalues dlllua_pushupvalues; +Tlua_getstack dlllua_getstack; +Tlua_getinfo dlllua_getinfo; +Tlua_getlocal dlllua_getlocal; +Tlua_setlocal dlllua_setlocal; +Tlua_getupvalue dlllua_getupvalue; +Tlua_setupvalue dlllua_setupvalue; +Tlua_sethook dlllua_sethook; +Tlua_gethook dlllua_gethook; +Tlua_gethookmask dlllua_gethookmask; +Tlua_gethookcount dlllua_gethookcount; +// from lauxlib.h +TluaL_openlib dllluaL_openlib; +TluaL_getmetafield dllluaL_getmetafield; +TluaL_callmeta dllluaL_callmeta; +TluaL_typerror dllluaL_typerror; +TluaL_argerror dllluaL_argerror; +TluaL_checklstring dllluaL_checklstring; +TluaL_optlstring dllluaL_optlstring; +TluaL_checknumber dllluaL_checknumber; +TluaL_optnumber dllluaL_optnumber; +TluaL_checkstack dllluaL_checkstack; +TluaL_checktype dllluaL_checktype; +TluaL_checkany dllluaL_checkany; +TluaL_newmetatable dllluaL_newmetatable; +TluaL_getmetatable dllluaL_getmetatable; +TluaL_checkudata dllluaL_checkudata; +TluaL_where dllluaL_where; +TluaL_error dllluaL_error; +TluaL_findstring dllluaL_findstring; +TluaL_ref dllluaL_ref; +TluaL_unref dllluaL_unref; +TluaL_getn dllluaL_getn; +TluaL_setn dllluaL_setn; +TluaL_loadfile dllluaL_loadfile; +TluaL_loadbuffer dllluaL_loadbuffer; +TluaL_buffinit dllluaL_buffinit; +TluaL_prepbuffer dllluaL_prepbuffer; +TluaL_addlstring dllluaL_addlstring; +TluaL_addstring dllluaL_addstring; +TluaL_addvalue dllluaL_addvalue; +TluaL_pushresult dllluaL_pushresult; +Tlua_dofile dlllua_dofile; +Tlua_dostring dlllua_dostring; +Tlua_dobuffer dlllua_dobuffer; +// from lua lib.h +Tluaopen_base dllluaopen_base; +Tluaopen_table dllluaopen_table; +Tluaopen_io dllluaopen_io; +Tluaopen_string dllluaopen_string; +Tluaopen_math dllluaopen_math; +Tluaopen_debug dllluaopen_debug; +Tluaopen_loadlib dllluaopen_loadlib; + +// call to actual dll function +lua_State *lua_open (void) { return dlllua_open(); } +void lua_close (lua_State *L) { dlllua_close(L); } +lua_State *lua_newthread (lua_State *L) { return dlllua_newthread(L); } +lua_CFunction lua_atpanic (lua_State *L, lua_CFunction panicf) { return dlllua_atpanic(L, panicf); } +int lua_gettop (lua_State *L) { return dlllua_gettop(L); } +void lua_settop (lua_State *L, int idx) { dlllua_settop(L, idx); } +void lua_pushvalue (lua_State *L, int idx) { dlllua_pushvalue(L, idx); } +void lua_remove (lua_State *L, int idx) { dlllua_remove(L, idx); } +void lua_insert (lua_State *L, int idx) { dlllua_insert (L, idx); } +void lua_replace (lua_State *L, int idx) { dlllua_replace(L, idx); } +int lua_checkstack (lua_State *L, int sz) { return dlllua_checkstack(L, sz); } +void lua_xmove (lua_State *from, lua_State *to, int n) { dlllua_xmove(from, to, n); } +int lua_isnumber (lua_State *L, int idx) { return dlllua_isnumber(L, idx); } +int lua_isstring (lua_State *L, int idx) { return dlllua_isstring(L, idx); } +int lua_iscfunction (lua_State *L, int idx) { return dlllua_iscfunction(L, idx); } +int lua_isuserdata (lua_State *L, int idx) { return dlllua_isuserdata(L, idx); } +int lua_type (lua_State *L, int idx) { return dlllua_type(L, idx); } +const char *lua_typename (lua_State *L, int tp) { return dlllua_typename(L, tp); } +int lua_equal (lua_State *L, int idx1, int idx2) { return dlllua_equal(L, idx1, idx2); } +int lua_rawequal (lua_State *L, int idx1, int idx2) { return dlllua_rawequal(L, idx1, idx2); } +int lua_lessthan (lua_State *L, int idx1, int idx2) { return dlllua_lessthan(L, idx1, idx2); } +lua_Number lua_tonumber (lua_State *L, int idx) { return dlllua_tonumber(L, idx); } +int lua_toboolean (lua_State *L, int idx) { return dlllua_toboolean(L, idx); } +const char *lua_tostring (lua_State *L, int idx) { return dlllua_tostring(L, idx); } +size_t lua_strlen (lua_State *L, int idx) { return dlllua_strlen(L, idx); } +lua_CFunction lua_tocfunction (lua_State *L, int idx) { return dlllua_tocfunction(L, idx); } +void *lua_touserdata (lua_State *L, int idx) { return dlllua_touserdata(L, idx); } +lua_State *lua_tothread (lua_State *L, int idx) { return dlllua_tothread(L, idx); } +const void *lua_topointer (lua_State *L, int idx) { return dlllua_topointer(L, idx); } +void lua_pushnil (lua_State *L) { dlllua_pushnil(L); } +void lua_pushnumber (lua_State *L, lua_Number n) { dlllua_pushnumber(L, n); } +void lua_pushlstring (lua_State *L, const char *s, size_t l) { dlllua_pushlstring(L, s, l); } +void lua_pushstring (lua_State *L, const char *s) { dlllua_pushstring(L, s); } + +const char *lua_pushvfstring (lua_State *L, const char *fmt, va_list argp) +{ + const char *result; + va_list _args; + va_start (_args, fmt); + result = dlllua_pushvfstring(L, fmt, _args); + va_end(_args); + return result; +} + +const char *lua_pushfstring (lua_State *L, const char *fmt, ...) +{ + const char *result; + va_list _args; + va_start (_args, fmt); + result = dlllua_pushfstring(L, fmt, _args); + va_end(_args); + return result; +} + +void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n) { dlllua_pushcclosure(L, fn, n); } +void lua_pushboolean (lua_State *L, int b) { dlllua_pushboolean(L, b); } +void lua_pushlightuserdata (lua_State *L, void *p) { dlllua_pushlightuserdata(L, p); } +void lua_gettable (lua_State *L, int idx) { dlllua_gettable(L, idx); } +void lua_rawget (lua_State *L, int idx) { dlllua_rawget(L, idx); } +void lua_rawgeti (lua_State *L, int idx, int n) { dlllua_rawgeti(L, idx, n); } +void lua_newtable (lua_State *L) { dlllua_newtable(L); } +void *lua_newuserdata (lua_State *L, size_t sz) { return dlllua_newuserdata(L, sz); } +int lua_getmetatable (lua_State *L, int objindex) { return dlllua_getmetatable(L, objindex); } +void lua_getfenv (lua_State *L, int idx) { dlllua_getfenv(L, idx); } +void lua_settable (lua_State *L, int idx) { dlllua_settable(L, idx); } +void lua_rawset (lua_State *L, int idx) { dlllua_rawset(L, idx); } +void lua_rawseti (lua_State *L, int idx, int n) { dlllua_rawseti(L, idx, n); } +int lua_setmetatable (lua_State *L, int objindex) { return dlllua_setmetatable(L, objindex); } +int lua_setfenv (lua_State *L, int idx) { return dlllua_setfenv(L, idx); } +void lua_call (lua_State *L, int nargs, int nresults) { dlllua_call(L, nargs, nresults); } +int lua_pcall (lua_State *L, int nargs, int nresults, int errfunc) { return dlllua_pcall(L, nargs, nresults, errfunc); } +int lua_cpcall (lua_State *L, lua_CFunction func, void *ud) { return dlllua_cpcall(L, func, ud); } +int lua_load (lua_State *L, lua_Chunkreader reader, void *dt, const char *chunkname) +{ + return dlllua_load(L, reader, dt, chunkname); +} +int lua_dump (lua_State *L, lua_Chunkwriter writer, void *data) { return dlllua_dump(L, writer, data); } +int lua_yield (lua_State *L, int nresults) { return dlllua_yield(L, nresults); } +int lua_resume (lua_State *L, int narg) { return dlllua_resume(L, narg); } +int lua_getgcthreshold (lua_State *L) { return dlllua_getgcthreshold(L); } +int lua_getgccount (lua_State *L) { return dlllua_getgccount(L); } +void lua_setgcthreshold (lua_State *L, int newthreshold) { dlllua_setgcthreshold(L, newthreshold); } +const char *lua_version (void) { return dlllua_version(); } +int lua_error (lua_State *L) { return dlllua_error(L); } +int lua_next (lua_State *L, int idx) { return dlllua_next(L, idx); } +void lua_concat (lua_State *L, int n) { dlllua_concat(L, n); } +int lua_pushupvalues (lua_State *L) { return dlllua_pushupvalues(L); } +int lua_getstack (lua_State *L, int level, lua_Debug *ar) { return dlllua_getstack(L, level, ar); } +int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar) { return dlllua_getinfo(L, what, ar); } +const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n) { return dlllua_getlocal(L, ar, n); } +const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n) { return dlllua_setlocal(L, ar, n); } +const char *lua_getupvalue (lua_State *L, int funcindex, int n) { return dlllua_getupvalue(L, funcindex, n); } +const char *lua_setupvalue (lua_State *L, int funcindex, int n) { return dlllua_setupvalue(L, funcindex, n); } +int lua_sethook (lua_State *L, lua_Hook func, int mask, int count) { return dlllua_sethook(L, func, mask, count); } +lua_Hook lua_gethook (lua_State *L) { return dlllua_gethook(L); } +int lua_gethookmask (lua_State *L) { return dlllua_gethookmask(L); } +int lua_gethookcount (lua_State *L) { return dlllua_gethookcount(L); } + +// from lauxlib.h +void luaL_openlib (lua_State *L, const char *libname, const luaL_reg *l, int nup) { dllluaL_openlib(L, libname, l, nup); } +int luaL_getmetafield (lua_State *L, int obj, const char *e) { return dllluaL_getmetafield(L, obj, e); } +int luaL_callmeta (lua_State *L, int obj, const char *e) { return dllluaL_callmeta(L, obj, e); } +int luaL_typerror (lua_State *L, int narg, const char *tname) { return dllluaL_typerror(L, narg, tname); } +int luaL_argerror (lua_State *L, int numarg, const char *extramsg) { return dllluaL_argerror(L, numarg, extramsg); } +const char *luaL_checklstring (lua_State *L, int numArg, size_t *l) { return dllluaL_checklstring(L, numArg, l); } +const char *luaL_optlstring (lua_State *L, int numArg, const char *def, size_t *l) { return dllluaL_optlstring(L, numArg, def, l); } +lua_Number luaL_checknumber (lua_State *L, int numArg) { return dllluaL_checknumber(L, numArg); } +lua_Number luaL_optnumber (lua_State *L, int nArg, lua_Number def) { return dllluaL_optnumber(L, nArg, def); } +void luaL_checkstack (lua_State *L, int sz, const char *msg) { dllluaL_checkstack(L, sz, msg); } +void luaL_checktype (lua_State *L, int narg, int t) { dllluaL_checktype(L, narg, t); } +void luaL_checkany (lua_State *L, int narg) { dllluaL_checkany(L, narg); } +int luaL_newmetatable (lua_State *L, const char *tname) { return dllluaL_newmetatable(L, tname); } +void luaL_getmetatable (lua_State *L, const char *tname) { dllluaL_getmetatable(L, tname); } +void *luaL_checkudata (lua_State *L, int ud, const char *tname) { return dllluaL_checkudata(L, ud, tname); } +void luaL_where (lua_State *L, int lvl) { dllluaL_where(L, lvl); } + +int luaL_error (lua_State *L, const char *fmt, ...) +{ + int result; + va_list _args; + va_start (_args, fmt); + result = dllluaL_error(L, fmt, _args); + va_end(_args); + return result; +} +int luaL_findstring (const char *st, const char *const lst[]) { return dllluaL_findstring(st, lst); } +int luaL_ref (lua_State *L, int t) { return dllluaL_ref(L, t); } +void luaL_unref (lua_State *L, int t, int ref) { dllluaL_unref(L, t, ref); } +int luaL_getn (lua_State *L, int t) { return dllluaL_getn(L, t); } +void luaL_setn (lua_State *L, int t, int n) { dllluaL_setn(L, t, n); } +int luaL_loadfile (lua_State *L, const char *filename) { return dllluaL_loadfile(L, filename); } +int luaL_loadbuffer (lua_State *L, const char *buff, size_t sz, const char *name) { return dllluaL_loadbuffer(L, buff, sz, name); } + +void luaL_buffinit (lua_State *L, luaL_Buffer *B) { dllluaL_buffinit(L, B); } +char *luaL_prepbuffer (luaL_Buffer *B) { return dllluaL_prepbuffer(B); } + +void luaL_addlstring (luaL_Buffer *B, const char *s, size_t l) { dllluaL_addlstring(B, s, l); } +void luaL_addstring (luaL_Buffer *B, const char *s) { dllluaL_addstring(B, s); } +void luaL_addvalue (luaL_Buffer *B) { dllluaL_addvalue(B); } +void luaL_pushresult (luaL_Buffer *B) { dllluaL_pushresult(B); } +int lua_dofile (lua_State *L, const char *filename) { return dlllua_dofile(L, filename); } +int lua_dostring (lua_State *L, const char *str) { return dlllua_dostring(L, str); } +int lua_dobuffer (lua_State *L, const char *buff, size_t sz, const char *n) { return dlllua_dobuffer(L, buff, sz, n); } + +// from lualib.h +int luaopen_base (lua_State *L) { return dllluaopen_base(L); } +int luaopen_table (lua_State *L) { return dllluaopen_table(L); } +int luaopen_io (lua_State *L) { return dllluaopen_io(L); } +int luaopen_string (lua_State *L) { return dllluaopen_string(L); } +int luaopen_math (lua_State *L) { return dllluaopen_math(L); } +int luaopen_debug (lua_State *L) { return dllluaopen_debug(L); } +int luaopen_loadlib (lua_State *L) { return dllluaopen_loadlib(L); } + + +int loadLuaDLL() +{ + HMODULE libHandle = LoadLibrary("lua.dll"); + if (!libHandle) return 0; +#define GET_LUA_PROC(name) dll##name = (T##name) GetProcAddress(libHandle, #name); if (!dll##name) return 0; + // from lua.h + GET_LUA_PROC(lua_close) + GET_LUA_PROC(lua_newthread) + GET_LUA_PROC(lua_atpanic) + GET_LUA_PROC(lua_gettop) + GET_LUA_PROC(lua_settop) + GET_LUA_PROC(lua_pushvalue) + GET_LUA_PROC(lua_remove) + GET_LUA_PROC(lua_insert) + GET_LUA_PROC(lua_replace) + GET_LUA_PROC(lua_checkstack) + GET_LUA_PROC(lua_xmove) + GET_LUA_PROC(lua_isnumber) + GET_LUA_PROC(lua_isstring) + GET_LUA_PROC(lua_iscfunction) + GET_LUA_PROC(lua_isuserdata) + GET_LUA_PROC(lua_type) + GET_LUA_PROC(lua_typename) + GET_LUA_PROC(lua_equal) + GET_LUA_PROC(lua_rawequal) + GET_LUA_PROC(lua_lessthan) + GET_LUA_PROC(lua_tonumber) + GET_LUA_PROC(lua_toboolean) + GET_LUA_PROC(lua_tostring) + GET_LUA_PROC(lua_strlen) + GET_LUA_PROC(lua_tocfunction) + GET_LUA_PROC(lua_touserdata) + GET_LUA_PROC(lua_tothread) + GET_LUA_PROC(lua_topointer) + GET_LUA_PROC(lua_pushnil) + GET_LUA_PROC(lua_pushnumber) + GET_LUA_PROC(lua_pushlstring) + GET_LUA_PROC(lua_pushstring) + GET_LUA_PROC(lua_pushcclosure) + GET_LUA_PROC(lua_pushboolean) + GET_LUA_PROC(lua_pushlightuserdata) + GET_LUA_PROC(lua_gettable) + GET_LUA_PROC(lua_rawget) + GET_LUA_PROC(lua_rawgeti) + GET_LUA_PROC(lua_newtable) + GET_LUA_PROC(lua_newuserdata) + GET_LUA_PROC(lua_getmetatable) + GET_LUA_PROC(lua_getfenv) + GET_LUA_PROC(lua_settable) + GET_LUA_PROC(lua_rawset) + GET_LUA_PROC(lua_rawseti) + GET_LUA_PROC(lua_setmetatable) + GET_LUA_PROC(lua_setfenv) + GET_LUA_PROC(lua_call) + GET_LUA_PROC(lua_pcall) + GET_LUA_PROC(lua_cpcall) + GET_LUA_PROC(lua_load) + GET_LUA_PROC(lua_dump) + GET_LUA_PROC(lua_yield) + GET_LUA_PROC(lua_resume) + GET_LUA_PROC(lua_getgcthreshold) + GET_LUA_PROC(lua_getgccount) + GET_LUA_PROC(lua_setgcthreshold) + GET_LUA_PROC(lua_version) + GET_LUA_PROC(lua_error) + GET_LUA_PROC(lua_next) + GET_LUA_PROC(lua_concat) + GET_LUA_PROC(lua_pushupvalues) + GET_LUA_PROC(lua_getstack) + GET_LUA_PROC(lua_getinfo) + GET_LUA_PROC(lua_getlocal) + GET_LUA_PROC(lua_setlocal) + GET_LUA_PROC(lua_getupvalue) + GET_LUA_PROC(lua_setupvalue) + GET_LUA_PROC(lua_sethook) + GET_LUA_PROC(lua_gethook) + GET_LUA_PROC(lua_gethookmask) + GET_LUA_PROC(lua_gethookcount) + // from lauxlib.h + GET_LUA_PROC(luaL_openlib) + GET_LUA_PROC(luaL_getmetafield) + GET_LUA_PROC(luaL_callmeta) + GET_LUA_PROC(luaL_typerror) + GET_LUA_PROC(luaL_argerror) + GET_LUA_PROC(luaL_checklstring) + GET_LUA_PROC(luaL_optlstring) + GET_LUA_PROC(luaL_checknumber) + GET_LUA_PROC(luaL_optnumber) + GET_LUA_PROC(luaL_checkstack) + GET_LUA_PROC(luaL_checktype) + GET_LUA_PROC(luaL_checkany) + GET_LUA_PROC(luaL_newmetatable) + GET_LUA_PROC(luaL_getmetatable) + GET_LUA_PROC(luaL_checkudata) + GET_LUA_PROC(luaL_where) + GET_LUA_PROC(luaL_error) + GET_LUA_PROC(luaL_findstring) + GET_LUA_PROC(luaL_ref) + GET_LUA_PROC(luaL_unref) + GET_LUA_PROC(luaL_getn) + GET_LUA_PROC(luaL_setn) + GET_LUA_PROC(luaL_loadfile) + GET_LUA_PROC(luaL_loadbuffer) + GET_LUA_PROC(luaL_buffinit) + GET_LUA_PROC(luaL_prepbuffer) + GET_LUA_PROC(luaL_addlstring) + GET_LUA_PROC(luaL_addstring) + GET_LUA_PROC(luaL_addvalue) + GET_LUA_PROC(luaL_pushresult) + GET_LUA_PROC(lua_dofile) + GET_LUA_PROC(lua_dostring) + GET_LUA_PROC(lua_dobuffer) + // from lua lib.h + GET_LUA_PROC(luaopen_base) + GET_LUA_PROC(luaopen_table) + GET_LUA_PROC(luaopen_io) + GET_LUA_PROC(luaopen_string) + GET_LUA_PROC(luaopen_math) + GET_LUA_PROC(luaopen_debug) + GET_LUA_PROC(luaopen_loadlib) + + return 1; +} diff --git a/nel/tools/3d/build_gamedata/processes/anim/sh/export.sh b/nel/tools/3d/build_gamedata/processes/anim/sh/export.sh index 7bcd4ac35d..fe5ded0773 100644 --- a/nel/tools/3d/build_gamedata/processes/anim/sh/export.sh +++ b/nel/tools/3d/build_gamedata/processes/anim/sh/export.sh @@ -1,57 +1,57 @@ -#!/bin/bash -rm log.log 2> /dev/null - -# *** Export animation files (.anim) from Max - -exec_timeout='exec_timeout.exe' - -# Get the timeout -timeout=`cat ../../cfg/config.cfg | grep "anim_export_timeout" | sed -e 's/anim_export_timeout//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the database directory -database_directory=`cat ../../cfg/site.cfg | grep "database_directory" | sed -e 's/database_directory//g' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the build gamedata directory -build_gamedata_directory=`cat ../../cfg/site.cfg | grep "build_gamedata_directory" | sed -e 's/build_gamedata_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the anim directories -anim_source_directories=`cat ../../cfg/directories.cfg | grep "anim_source_directory" | sed -e 's/anim_source_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Maxdir -max_directory=`echo $MAX_DIR | sed -e 's&\\\&/&g'` - -# Log error -echo ------- > log.log -echo --- Export animation >> log.log -echo ------- >> log.log -echo ------- -echo --- Export animation -echo ------- -date >> log.log -date - -# For each directoy - -for i in $anim_source_directories ; do - # Copy the script - cat maxscript/anim_export.ms | sed -e "s&output_logfile&$build_gamedata_directory/processes/anim/log.log&g" | sed -e "s&anim_source_directory&$database_directory/$i&g" | sed -e "s&output_directory&$build_gamedata_directory/processes/anim/anim_export&g" > $max_directory/scripts/anim_export.ms - - # Start max - echo Try 1 >> log.log - $exec_timeout $timeout $max_directory/3dsmax.exe -U MAXScript anim_export.ms -q -mi -vn - - # Idle - ../../idle.bat - - echo Try 2 >> log.log - $exec_timeout $timeout $max_directory/3dsmax.exe -U MAXScript anim_export.ms -q -mi -vn - - # Idle - ../../idle.bat - - echo Try 3 >> log.log - $exec_timeout $timeout $max_directory/3dsmax.exe -U MAXScript anim_export.ms -q -mi -vn - - # Idle - ../../idle.bat -done +#!/bin/bash +rm log.log 2> /dev/null + +# *** Export animation files (.anim) from Max + +exec_timeout='exec_timeout.exe' + +# Get the timeout +timeout=`cat ../../cfg/config.cfg | grep "anim_export_timeout" | sed -e 's/anim_export_timeout//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the database directory +database_directory=`cat ../../cfg/site.cfg | grep "database_directory" | sed -e 's/database_directory//g' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the build gamedata directory +build_gamedata_directory=`cat ../../cfg/site.cfg | grep "build_gamedata_directory" | sed -e 's/build_gamedata_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the anim directories +anim_source_directories=`cat ../../cfg/directories.cfg | grep "anim_source_directory" | sed -e 's/anim_source_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Maxdir +max_directory=`echo $MAX_DIR | sed -e 's&\\\&/&g'` + +# Log error +echo ------- > log.log +echo --- Export animation >> log.log +echo ------- >> log.log +echo ------- +echo --- Export animation +echo ------- +date >> log.log +date + +# For each directoy + +for i in $anim_source_directories ; do + # Copy the script + cat maxscript/anim_export.ms | sed -e "s&output_logfile&$build_gamedata_directory/processes/anim/log.log&g" | sed -e "s&anim_source_directory&$database_directory/$i&g" | sed -e "s&output_directory&$build_gamedata_directory/processes/anim/anim_export&g" > $max_directory/scripts/anim_export.ms + + # Start max + echo Try 1 >> log.log + $exec_timeout $timeout $max_directory/3dsmax.exe -U MAXScript anim_export.ms -q -mi -vn + + # Idle + ../../idle.bat + + echo Try 2 >> log.log + $exec_timeout $timeout $max_directory/3dsmax.exe -U MAXScript anim_export.ms -q -mi -vn + + # Idle + ../../idle.bat + + echo Try 3 >> log.log + $exec_timeout $timeout $max_directory/3dsmax.exe -U MAXScript anim_export.ms -q -mi -vn + + # Idle + ../../idle.bat +done diff --git a/nel/tools/3d/build_gamedata/processes/anim/sh/install.sh b/nel/tools/3d/build_gamedata/processes/anim/sh/install.sh index a956d24c07..5c4a8dbe79 100644 --- a/nel/tools/3d/build_gamedata/processes/anim/sh/install.sh +++ b/nel/tools/3d/build_gamedata/processes/anim/sh/install.sh @@ -1,22 +1,22 @@ -#!/bin/bash -rm log.log 2> /dev/null - -# Install anim in the client data - -# Get the anim install directory -anim_install_directory=`cat ../../cfg/directories.cfg | grep "anim_install_directory" | sed -e 's/anim_install_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the client directory -client_directory=`cat ../../cfg/site.cfg | grep "client_directory" | sed -e 's/client_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Log error -echo ------- > log.log -echo --- Install animation >> log.log -echo ------- >> log.log -echo ------- -echo --- Install animation -echo ------- -date >> log.log -date - -cp -u -p -R anim/. $client_directory/$anim_install_directory 2>> log.log +#!/bin/bash +rm log.log 2> /dev/null + +# Install anim in the client data + +# Get the anim install directory +anim_install_directory=`cat ../../cfg/directories.cfg | grep "anim_install_directory" | sed -e 's/anim_install_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the client directory +client_directory=`cat ../../cfg/site.cfg | grep "client_directory" | sed -e 's/client_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Log error +echo ------- > log.log +echo --- Install animation >> log.log +echo ------- >> log.log +echo ------- +echo --- Install animation +echo ------- +date >> log.log +date + +cp -u -p -R anim/. $client_directory/$anim_install_directory 2>> log.log diff --git a/nel/tools/3d/build_gamedata/processes/clodbank/sh/build.sh b/nel/tools/3d/build_gamedata/processes/clodbank/sh/build.sh index f932e5aa77..e77fe82f5d 100644 --- a/nel/tools/3d/build_gamedata/processes/clodbank/sh/build.sh +++ b/nel/tools/3d/build_gamedata/processes/clodbank/sh/build.sh @@ -1,26 +1,26 @@ -#!/bin/bash -rm log.log 2> /dev/null - -# Log error -echo ------- > log.log -echo --- Build clod : build .clodbank >> log.log -echo ------- >> log.log -echo ------- -echo --- Build clod : build .clodbank -echo ------- -date >> log.log -date - -# Get the database directory -database_directory=`cat ../../cfg/site.cfg | grep "database_directory" | sed -e 's/database_directory//g' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the lod config file in the database -clod_config_file=`cat ../../cfg/config.cfg | grep "clod_config_file" | sed -e 's/clod_config_file//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the Lod character bank name -clod_bank_file_name=`cat ../../cfg/config.cfg | grep "clod_bank_file_name" | sed -e 's/clod_bank_file_name//' | sed -e 's/ //g' | sed -e 's/=//g'` - - -# Execute the build -build_clod_bank.exe cfg/local_path.cfg $database_directory/$clod_config_file clodbank/$clod_bank_file_name - +#!/bin/bash +rm log.log 2> /dev/null + +# Log error +echo ------- > log.log +echo --- Build clod : build .clodbank >> log.log +echo ------- >> log.log +echo ------- +echo --- Build clod : build .clodbank +echo ------- +date >> log.log +date + +# Get the database directory +database_directory=`cat ../../cfg/site.cfg | grep "database_directory" | sed -e 's/database_directory//g' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the lod config file in the database +clod_config_file=`cat ../../cfg/config.cfg | grep "clod_config_file" | sed -e 's/clod_config_file//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the Lod character bank name +clod_bank_file_name=`cat ../../cfg/config.cfg | grep "clod_bank_file_name" | sed -e 's/clod_bank_file_name//' | sed -e 's/ //g' | sed -e 's/=//g'` + + +# Execute the build +build_clod_bank.exe cfg/local_path.cfg $database_directory/$clod_config_file clodbank/$clod_bank_file_name + diff --git a/nel/tools/3d/build_gamedata/processes/clodbank/sh/export.sh b/nel/tools/3d/build_gamedata/processes/clodbank/sh/export.sh index e0480f3d57..007febdf0f 100644 --- a/nel/tools/3d/build_gamedata/processes/clodbank/sh/export.sh +++ b/nel/tools/3d/build_gamedata/processes/clodbank/sh/export.sh @@ -1,60 +1,60 @@ -#!/bin/bash -rm log.log 2> /dev/null - - -# *** Export character lod shape files (.clod) from Max - -exec_timeout='exec_timeout.exe' - -# Get the timeout -timeout=`cat ../../cfg/config.cfg | grep "shape_export_timeout" | sed -e 's/shape_export_timeout//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the database directory -database_directory=`cat ../../cfg/site.cfg | grep "database_directory" | sed -e 's/database_directory//g' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the build gamedata directory -build_gamedata_directory=`cat ../../cfg/site.cfg | grep "build_gamedata_directory" | sed -e 's/build_gamedata_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the shape directories -clod_source_directories=`cat ../../cfg/directories.cfg | grep "clod_source_directory" | sed -e 's/clod_source_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Maxdir -max_directory=`echo $MAX_DIR | sed -e 's&\\\&/&g'` - -# Log error -echo ------- > log.log -echo --- Export clod >> log.log -echo ------- >> log.log -echo ------- -echo --- Export clod -echo ------- -date >> log.log -date - -# For each directoy - -for i in $clod_source_directories ; do - # Copy the script - cat maxscript/clod_export.ms | sed -e "s&output_logfile&$build_gamedata_directory/processes/clodbank/log.log&g" | sed -e "s&shape_source_directory&$database_directory/$i&g" | sed -e "s&output_directory_clod&$build_gamedata_directory/processes/clodbank/clod&g" | sed -e "s&output_directory_tag&$build_gamedata_directory/processes/clodbank/tag&g" > $max_directory/scripts/clod_export.ms - - # Start max - echo Try 1 >> log.log - $exec_timeout $timeout $max_directory/3dsmax.exe -U MAXScript clod_export.ms -q -mi -vn - - # Idle - ../../idle.bat - - echo Try 2 >> log.log - $exec_timeout $timeout $max_directory/3dsmax.exe -U MAXScript clod_export.ms -q -mi -vn - - # Idle - ../../idle.bat - - echo Try 3 >> log.log - $exec_timeout $timeout $max_directory/3dsmax.exe -U MAXScript clod_export.ms -q -mi -vn - - # Idle - ../../idle.bat -done - - +#!/bin/bash +rm log.log 2> /dev/null + + +# *** Export character lod shape files (.clod) from Max + +exec_timeout='exec_timeout.exe' + +# Get the timeout +timeout=`cat ../../cfg/config.cfg | grep "shape_export_timeout" | sed -e 's/shape_export_timeout//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the database directory +database_directory=`cat ../../cfg/site.cfg | grep "database_directory" | sed -e 's/database_directory//g' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the build gamedata directory +build_gamedata_directory=`cat ../../cfg/site.cfg | grep "build_gamedata_directory" | sed -e 's/build_gamedata_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the shape directories +clod_source_directories=`cat ../../cfg/directories.cfg | grep "clod_source_directory" | sed -e 's/clod_source_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Maxdir +max_directory=`echo $MAX_DIR | sed -e 's&\\\&/&g'` + +# Log error +echo ------- > log.log +echo --- Export clod >> log.log +echo ------- >> log.log +echo ------- +echo --- Export clod +echo ------- +date >> log.log +date + +# For each directoy + +for i in $clod_source_directories ; do + # Copy the script + cat maxscript/clod_export.ms | sed -e "s&output_logfile&$build_gamedata_directory/processes/clodbank/log.log&g" | sed -e "s&shape_source_directory&$database_directory/$i&g" | sed -e "s&output_directory_clod&$build_gamedata_directory/processes/clodbank/clod&g" | sed -e "s&output_directory_tag&$build_gamedata_directory/processes/clodbank/tag&g" > $max_directory/scripts/clod_export.ms + + # Start max + echo Try 1 >> log.log + $exec_timeout $timeout $max_directory/3dsmax.exe -U MAXScript clod_export.ms -q -mi -vn + + # Idle + ../../idle.bat + + echo Try 2 >> log.log + $exec_timeout $timeout $max_directory/3dsmax.exe -U MAXScript clod_export.ms -q -mi -vn + + # Idle + ../../idle.bat + + echo Try 3 >> log.log + $exec_timeout $timeout $max_directory/3dsmax.exe -U MAXScript clod_export.ms -q -mi -vn + + # Idle + ../../idle.bat +done + + diff --git a/nel/tools/3d/build_gamedata/processes/clodbank/sh/install.sh b/nel/tools/3d/build_gamedata/processes/clodbank/sh/install.sh index 3eb96ca6b0..406af468da 100644 --- a/nel/tools/3d/build_gamedata/processes/clodbank/sh/install.sh +++ b/nel/tools/3d/build_gamedata/processes/clodbank/sh/install.sh @@ -1,22 +1,22 @@ -#!/bin/bash -rm log.log 2> /dev/null - -# Install clodbank in the client data, in the "shapes/" directory - -# Get the shape install directory -shape_install_directory=`cat ../../cfg/directories.cfg | grep "shape_install_directory" | sed -e 's/shape_install_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the client directory -client_directory=`cat ../../cfg/site.cfg | grep "client_directory" | sed -e 's/client_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Log error -echo ------- > log.log -echo --- Install clodbank >> log.log -echo ------- >> log.log -echo ------- -echo --- Install clodbank -echo ------- -date >> log.log -date - -cp -u -p -R clodbank/. $client_directory/$shape_install_directory 2>> log.log +#!/bin/bash +rm log.log 2> /dev/null + +# Install clodbank in the client data, in the "shapes/" directory + +# Get the shape install directory +shape_install_directory=`cat ../../cfg/directories.cfg | grep "shape_install_directory" | sed -e 's/shape_install_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the client directory +client_directory=`cat ../../cfg/site.cfg | grep "client_directory" | sed -e 's/client_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Log error +echo ------- > log.log +echo --- Install clodbank >> log.log +echo ------- >> log.log +echo ------- +echo --- Install clodbank +echo ------- +date >> log.log +date + +cp -u -p -R clodbank/. $client_directory/$shape_install_directory 2>> log.log diff --git a/nel/tools/3d/build_gamedata/processes/displace/sh/export.sh b/nel/tools/3d/build_gamedata/processes/displace/sh/export.sh index 648e5c9b5d..3b109ed296 100644 --- a/nel/tools/3d/build_gamedata/processes/displace/sh/export.sh +++ b/nel/tools/3d/build_gamedata/processes/displace/sh/export.sh @@ -1,29 +1,29 @@ -#!/bin/bash -rm log.log 2> /dev/null - -# *** Export displace tile (.tga) - -# Get the database directory -database_directory=`cat ../../cfg/site.cfg | grep "database_directory" | sed -e 's/database_directory//g' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the displace directories -displace_source_directories=`cat ../../cfg/directories.cfg | grep "displace_source_directories" | sed -e 's/displace_source_directories//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Log error -echo ------- > log.log -echo --- Export displace >> log.log -echo ------- >> log.log -echo ------- -echo --- Export displace -echo ------- -date >> log.log -date - -# For each displace directory -for i in $displace_source_directories ; do - # Copy - cp -u -p $database_directory/$i/*.[tT][gG][aA] tga 2>> log.log - - # Idle - ../../idle.bat -done +#!/bin/bash +rm log.log 2> /dev/null + +# *** Export displace tile (.tga) + +# Get the database directory +database_directory=`cat ../../cfg/site.cfg | grep "database_directory" | sed -e 's/database_directory//g' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the displace directories +displace_source_directories=`cat ../../cfg/directories.cfg | grep "displace_source_directories" | sed -e 's/displace_source_directories//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Log error +echo ------- > log.log +echo --- Export displace >> log.log +echo ------- >> log.log +echo ------- +echo --- Export displace +echo ------- +date >> log.log +date + +# For each displace directory +for i in $displace_source_directories ; do + # Copy + cp -u -p $database_directory/$i/*.[tT][gG][aA] tga 2>> log.log + + # Idle + ../../idle.bat +done diff --git a/nel/tools/3d/build_gamedata/processes/displace/sh/install.sh b/nel/tools/3d/build_gamedata/processes/displace/sh/install.sh index 9babbe05b8..8455e0216f 100644 --- a/nel/tools/3d/build_gamedata/processes/displace/sh/install.sh +++ b/nel/tools/3d/build_gamedata/processes/displace/sh/install.sh @@ -1,22 +1,22 @@ -#!/bin/bash -rm log.log 2> /dev/null - -# Install the displace in the client data - -# Get the displace install directory -displace_install_directory=`cat ../../cfg/directories.cfg | grep "displace_install_directory" | sed -e 's/displace_install_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the client directory -client_directory=`cat ../../cfg/site.cfg | grep "client_directory" | sed -e 's/client_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Log error -echo ------- > log.log -echo --- Install displace >> log.log -echo ------- >> log.log -echo ------- -echo --- Install displace -echo ------- -date >> log.log -date - -cp -u -p -R tga/. $client_directory/$displace_install_directory 2>> log.log +#!/bin/bash +rm log.log 2> /dev/null + +# Install the displace in the client data + +# Get the displace install directory +displace_install_directory=`cat ../../cfg/directories.cfg | grep "displace_install_directory" | sed -e 's/displace_install_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the client directory +client_directory=`cat ../../cfg/site.cfg | grep "client_directory" | sed -e 's/client_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Log error +echo ------- > log.log +echo --- Install displace >> log.log +echo ------- >> log.log +echo ------- +echo --- Install displace +echo ------- +date >> log.log +date + +cp -u -p -R tga/. $client_directory/$displace_install_directory 2>> log.log diff --git a/nel/tools/3d/build_gamedata/processes/farbank/sh/build.sh b/nel/tools/3d/build_gamedata/processes/farbank/sh/build.sh index 58af3f4ed7..c8dd64d022 100644 --- a/nel/tools/3d/build_gamedata/processes/farbank/sh/build.sh +++ b/nel/tools/3d/build_gamedata/processes/farbank/sh/build.sh @@ -1,89 +1,89 @@ -#!/bin/bash -rm log.log 2> /dev/null - -# Build the farbank - -build_farbank='build_far_bank.exe' -exec_timeout='exec_timeout.exe' - -# Get the timeout -timeout=`cat ../../cfg/config.cfg | grep "farbank_build_timeout" | sed -e 's/farbank_build_timeout//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the tiles root directories -tile_root_source_directory=`cat ../../cfg/directories.cfg | grep "tile_root_source_directory" | sed -e 's/tile_root_source_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the database directory -database_directory=`cat ../../cfg/site.cfg | grep "database_directory" | sed -e 's/database_directory//g' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the extension list -multiple_tiles_postfix=`cat ../../cfg/config.cfg | grep "multiple_tiles_postfix" | sed -e 's/multiple_tiles_postfix//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Log error -echo ------- > log.log -echo --- Build farbank >> log.log -echo ------- >> log.log -echo ------- -echo --- Build farbank -echo ------- -date >> log.log -date - -# list all the bank -bank_list=`ls -1 ../smallbank/smallbank/*.[sS][mM][aA][lL][lL][bB][aA][nN][kK]` - -# For each bank -for i in $bank_list ; do - - if ( test "$multiple_tiles_postfix" ) then - - for j in $multiple_tiles_postfix ; do - - # Destination the name - dest=`echo $i | sed -e "s&\.smallbank&\$j.farbank&g" | sed -e 's&../smallbank/smallbank&farbank&g'` - echo $i - echo $dest - - # Make the dependencies - if ( ! test -e $dest ) || ( test $i -nt $dest ) - then - $exec_timeout $timeout $build_farbank $i $dest -d$database_directory/$tile_root_source_directory$j/ -p$j - if ( test -e $dest ) - then - echo OK $dest >> log.log - else - echo ERROR building $dest >> log.log - fi - else - echo SKIPPED $dest >> log.log - fi - - # Idle - ../../idle.bat - - done - - else - - # Destination the name - dest=`echo $i | sed -e 's&\.smallbank&\.farbank&g' | sed -e 's&../smallbank/smallbank&farbank&g'` - echo $i - echo $dest - - # Make the dependencies - if ( ! test -e $dest ) || ( test $i -nt $dest ) - then - $exec_timeout $timeout $build_farbank $i $dest - if ( test -e $dest ) - then - echo OK $dest >> log.log - else - echo ERROR building $dest >> log.log - fi - else - echo SKIPPED $dest >> log.log - fi - fi - - # Idle - ../../idle.bat -done +#!/bin/bash +rm log.log 2> /dev/null + +# Build the farbank + +build_farbank='build_far_bank.exe' +exec_timeout='exec_timeout.exe' + +# Get the timeout +timeout=`cat ../../cfg/config.cfg | grep "farbank_build_timeout" | sed -e 's/farbank_build_timeout//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the tiles root directories +tile_root_source_directory=`cat ../../cfg/directories.cfg | grep "tile_root_source_directory" | sed -e 's/tile_root_source_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the database directory +database_directory=`cat ../../cfg/site.cfg | grep "database_directory" | sed -e 's/database_directory//g' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the extension list +multiple_tiles_postfix=`cat ../../cfg/config.cfg | grep "multiple_tiles_postfix" | sed -e 's/multiple_tiles_postfix//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Log error +echo ------- > log.log +echo --- Build farbank >> log.log +echo ------- >> log.log +echo ------- +echo --- Build farbank +echo ------- +date >> log.log +date + +# list all the bank +bank_list=`ls -1 ../smallbank/smallbank/*.[sS][mM][aA][lL][lL][bB][aA][nN][kK]` + +# For each bank +for i in $bank_list ; do + + if ( test "$multiple_tiles_postfix" ) then + + for j in $multiple_tiles_postfix ; do + + # Destination the name + dest=`echo $i | sed -e "s&\.smallbank&\$j.farbank&g" | sed -e 's&../smallbank/smallbank&farbank&g'` + echo $i + echo $dest + + # Make the dependencies + if ( ! test -e $dest ) || ( test $i -nt $dest ) + then + $exec_timeout $timeout $build_farbank $i $dest -d$database_directory/$tile_root_source_directory$j/ -p$j + if ( test -e $dest ) + then + echo OK $dest >> log.log + else + echo ERROR building $dest >> log.log + fi + else + echo SKIPPED $dest >> log.log + fi + + # Idle + ../../idle.bat + + done + + else + + # Destination the name + dest=`echo $i | sed -e 's&\.smallbank&\.farbank&g' | sed -e 's&../smallbank/smallbank&farbank&g'` + echo $i + echo $dest + + # Make the dependencies + if ( ! test -e $dest ) || ( test $i -nt $dest ) + then + $exec_timeout $timeout $build_farbank $i $dest + if ( test -e $dest ) + then + echo OK $dest >> log.log + else + echo ERROR building $dest >> log.log + fi + else + echo SKIPPED $dest >> log.log + fi + fi + + # Idle + ../../idle.bat +done diff --git a/nel/tools/3d/build_gamedata/processes/farbank/sh/install.sh b/nel/tools/3d/build_gamedata/processes/farbank/sh/install.sh index 0504193b75..6d748800e9 100644 --- a/nel/tools/3d/build_gamedata/processes/farbank/sh/install.sh +++ b/nel/tools/3d/build_gamedata/processes/farbank/sh/install.sh @@ -1,22 +1,22 @@ -#!/bin/bash -rm log.log 2> /dev/null - -# Install the farbank in the client data - -# Get the bank install directory -bank_install_directory=`cat ../../cfg/directories.cfg | grep "bank_install_directory" | sed -e 's/bank_install_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the client directory -client_directory=`cat ../../cfg/site.cfg | grep "client_directory" | sed -e 's/client_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Log error -echo ------- > log.log -echo --- Install farbank >> log.log -echo ------- >> log.log -echo ------- -echo --- Install farbank -echo ------- -date >> log.log -date - -cp -u -p -R farbank/. $client_directory/$bank_install_directory 2>> log.log +#!/bin/bash +rm log.log 2> /dev/null + +# Install the farbank in the client data + +# Get the bank install directory +bank_install_directory=`cat ../../cfg/directories.cfg | grep "bank_install_directory" | sed -e 's/bank_install_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the client directory +client_directory=`cat ../../cfg/site.cfg | grep "client_directory" | sed -e 's/client_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Log error +echo ------- > log.log +echo --- Install farbank >> log.log +echo ------- >> log.log +echo ------- +echo --- Install farbank +echo ------- +date >> log.log +date + +cp -u -p -R farbank/. $client_directory/$bank_install_directory 2>> log.log diff --git a/nel/tools/3d/build_gamedata/processes/font/sh/export.sh b/nel/tools/3d/build_gamedata/processes/font/sh/export.sh index 8bbbcfeac9..0a16e017e9 100644 --- a/nel/tools/3d/build_gamedata/processes/font/sh/export.sh +++ b/nel/tools/3d/build_gamedata/processes/font/sh/export.sh @@ -1,32 +1,32 @@ -#!/bin/bash -rm log.log 2> /dev/null - -# *** Export fonts - -# Get the database directory -database_directory=`cat ../../cfg/site.cfg | grep "database_directory" | sed -e 's/database_directory//g' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the ps directories -font_source_directories=`cat ../../cfg/directories.cfg | grep "font_source_directories" | sed -e 's/font_source_directories//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Log error -echo ------- > log.log -echo --- Export fonts >> log.log -echo ------- >> log.log -echo ------- -echo --- Export fonts -echo ------- -date >> log.log -date - -# For each font directory -for i in $font_source_directories ; do - # Copy - cp -u -p $database_directory/$i/*.[tT][tT][fF] fonts 2>> log.log - cp -u -p $database_directory/$i/*.[aA][fF][mM] fonts 2>> log.log - cp -u -p $database_directory/$i/*.[pP][fF][bB] fonts 2>> log.log - cp -u -p $database_directory/$i/*.[pP][fF][mM] fonts 2>> log.log - - # Idle - ../../idle.bat -done +#!/bin/bash +rm log.log 2> /dev/null + +# *** Export fonts + +# Get the database directory +database_directory=`cat ../../cfg/site.cfg | grep "database_directory" | sed -e 's/database_directory//g' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the ps directories +font_source_directories=`cat ../../cfg/directories.cfg | grep "font_source_directories" | sed -e 's/font_source_directories//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Log error +echo ------- > log.log +echo --- Export fonts >> log.log +echo ------- >> log.log +echo ------- +echo --- Export fonts +echo ------- +date >> log.log +date + +# For each font directory +for i in $font_source_directories ; do + # Copy + cp -u -p $database_directory/$i/*.[tT][tT][fF] fonts 2>> log.log + cp -u -p $database_directory/$i/*.[aA][fF][mM] fonts 2>> log.log + cp -u -p $database_directory/$i/*.[pP][fF][bB] fonts 2>> log.log + cp -u -p $database_directory/$i/*.[pP][fF][mM] fonts 2>> log.log + + # Idle + ../../idle.bat +done diff --git a/nel/tools/3d/build_gamedata/processes/font/sh/install.sh b/nel/tools/3d/build_gamedata/processes/font/sh/install.sh index b4eeb34a3c..b2f36bd1b7 100644 --- a/nel/tools/3d/build_gamedata/processes/font/sh/install.sh +++ b/nel/tools/3d/build_gamedata/processes/font/sh/install.sh @@ -1,22 +1,22 @@ -#!/bin/bash -rm log.log 2> /dev/null - -# Install the fonts in the client data - -# Get the fonts install directory -fonts_install_directory=`cat ../../cfg/directories.cfg | grep "fonts_install_directory" | sed -e 's/fonts_install_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the client directory -client_directory=`cat ../../cfg/site.cfg | grep "client_directory" | sed -e 's/client_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Log error -echo ------- > log.log -echo --- Install fonts >> log.log -echo ------- >> log.log -echo ------- -echo --- Install fonts -echo ------- -date >> log.log -date - -cp -u -p -R fonts/. $client_directory/$fonts_install_directory 2>> log.log +#!/bin/bash +rm log.log 2> /dev/null + +# Install the fonts in the client data + +# Get the fonts install directory +fonts_install_directory=`cat ../../cfg/directories.cfg | grep "fonts_install_directory" | sed -e 's/fonts_install_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the client directory +client_directory=`cat ../../cfg/site.cfg | grep "client_directory" | sed -e 's/client_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Log error +echo ------- > log.log +echo --- Install fonts >> log.log +echo ------- >> log.log +echo ------- +echo --- Install fonts +echo ------- +date >> log.log +date + +cp -u -p -R fonts/. $client_directory/$fonts_install_directory 2>> log.log diff --git a/nel/tools/3d/build_gamedata/processes/ig/sh/build.sh b/nel/tools/3d/build_gamedata/processes/ig/sh/build.sh index d2e618b8c5..73f946f40f 100644 --- a/nel/tools/3d/build_gamedata/processes/ig/sh/build.sh +++ b/nel/tools/3d/build_gamedata/processes/ig/sh/build.sh @@ -1,304 +1,304 @@ -#!/bin/bash -rm log.log 2> /dev/null - -# ig_land_max: landscape IG eported from 3dsmax not elevated by the heightmap -# ig_land_max_elev: landscape IG eported from 3dsmax elevated by the heightmap -# ig_land_ligo: landscape IG found in ligo bricks not elevated by the heightmap -# ig_land_ligo_elev: landscape IG found in ligo bricks from 3dsmax elevated by the heightmap -# ig_land_ld: landscape IG generated by the land exporter (already elevated by the land exporter) - -# ig_land: final IG directory for landscape IGs -# ig_land_compare: Tmp final IG directory for landscape IGs before comparison -# ig_other: final IG directory for village or construction IGs - -# Log error -echo ------- >> log.log -echo --- Build ig >> log.log -echo ------- >> log.log -echo ------- -echo --- Build ig -echo ------- -date >> log.log -date - -# ************************************************ -# Build the IG_LAND made with the LevelDesign Tool -# ************************************************ - -# Get the primitive directory -continentdir=`cat ../../cfg/config.cfg | grep "leveldesign_igexport_continent_dir" | sed -e 's/leveldesign_igexport_continent_dir//' | sed -e 's/ //g' | sed -e 's/=//g' | sed -e 's/;//g'` - -# Get the database directory -database_directory=`cat ../../cfg/site.cfg | grep "database_directory" | sed -e 's/database_directory//g' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the primitive directories -ligo_ig_primitive_directory=`cat ../../cfg/directories.cfg | grep "ligo_ig_primitive_directory" | sed -e 's/ligo_ig_primitive_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the form directory -form_dir=`cat ../../cfg/site.cfg | grep "level_design_directory" | sed -e 's/level_design_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - -if ( test "$continentdir" || test "$ligo_ig_primitive_directory" ) -then - land_name=`cat ../../cfg/config.cfg | grep "ligo_export_land" | sed -e 's/ligo_export_land//' | sed -e 's/ //g' | sed -e 's/=//g'` - - if ( test "$land_name" ) - then - echo [Prim IG] ON - echo [Prim IG] ON >> log.log - # create cfg file - # +++++++++++++++ - - rm prim_export.cfg - echo "// prim_export.cfg" > prim_export.cfg - - echo "OutIGDir = \"ig_land_ld\";" >> prim_export.cfg - echo "ZoneWDir = \"..\\zone\\zone_welded\";" >> prim_export.cfg - - name_bank=`cat ../../cfg/properties.cfg | grep "bank_name" | sed -e 's/bank_name//' | sed -e 's/ //g' | sed -e 's/=//g'` - echo "SmallBank = $name_bank" >> prim_export.cfg - name_farbank=`cat ../../cfg/properties.cfg | grep "bankfar_name" | sed -e 's/bankfar_name//' | sed -e 's/ //g' | sed -e 's/=//g'` - echo "FarBank = $name_farbank" >> prim_export.cfg - - displacedir=`cat ../../cfg/directories.cfg | grep "displace_source_directory" | sed -e 's/displace_source_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - dir_database=`cat ../../cfg/site.cfg | grep "database_directory" | sed -e 's/database_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - echo "DisplaceDir = \"$dir_database/$displacedir\";" >> prim_export.cfg - - echo "CellSize = 160.0;" >> prim_export.cfg - - # Set the continent directory to export - echo "PrimDirs = {" >> prim_export.cfg - echo " $continentdir," >> prim_export.cfg - for dir in $ligo_ig_primitive_directory ; do - echo " \"$database_directory/$dir\"," >> prim_export.cfg - done - echo "};" >> prim_export.cfg - - # Set the dfn directory to export - echo "FormDir = \"$form_dir\";" >> prim_export.cfg - - # ******************* - # Launch the exporter - # ******************* - - prim_export.exe prim_export.cfg - - # ******************* - # Merge it with the IG_LAND exported from Max + elvated with heightmap - # ******************* - - # elevation of the heightmap for land_max - # ++++++++++++++++++++++++++++++++++++++++++++ - - rm ig_elevation.cfg - echo "// ig_elevation.cfg" > ig_elevation.cfg - echo "OutputIGDir = \"ig_land_max_elev\";" >> ig_elevation.cfg - echo "InputIGDir = \"ig_land_max\";" >> ig_elevation.cfg - echo "CellSize = 160.0;" >> ig_elevation.cfg - - # HeightMapFile1 is the grayscale .tga file (127 is 0, 0 is -127*ZFactor and 255 is +128*ZFactor) - dir_database=`cat ../../cfg/site.cfg | grep "database_directory" | sed -e 's/database_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - dir_ligosrc=`cat ../../cfg/directories.cfg | grep "ligo_source_directory" | sed -e 's/ligo_source_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - hmf1=`cat ../../cfg/config.cfg | grep "ligo_export_heightmap1" | sed -e 's/ligo_export_heightmap1//' | sed -e 's/ //g' | sed -e 's/=//g'` - echo "HeightMapFile1 = \"$dir_database/$dir_ligosrc/$hmf1\";" >> ig_elevation.cfg - - # ZFactor1 is the heightmap factor - zf1=`cat ../../cfg/config.cfg | grep "ligo_export_zfactor1" | sed -e 's/ligo_export_zfactor1//' | sed -e 's/ //g' | sed -e 's/=//g'` - echo "ZFactor1 = $zf1;" >> ig_elevation.cfg - - # HeightMapFile2 is the grayscale .tga file (127 is 0, 0 is -127*ZFactor and 255 is +128*ZFactor) - hmf2=`cat ../../cfg/config.cfg | grep "ligo_export_heightmap2" | sed -e 's/ligo_export_heightmap2//' | sed -e 's/ //g' | sed -e 's/=//g'` - echo "HeightMapFile2 = \"$dir_database/$dir_ligosrc/$hmf2\";" >> ig_elevation.cfg - - # ZFactor2 is the heightmap factor - zf2=`cat ../../cfg/config.cfg | grep "ligo_export_zfactor2" | sed -e 's/ligo_export_zfactor2//' | sed -e 's/ //g' | sed -e 's/=//g'` - echo "ZFactor2 = $zf2;" >> ig_elevation.cfg - - echo "LandFile = \"$dir_database/$dir_ligosrc/$land_name\";" >> ig_elevation.cfg - - - ig_elevation ig_elevation.cfg - - # elevation of the heightmap for land_ligo - # ++++++++++++++++++++++++++++++++++++++++++++ - - rm ig_elevation.cfg - echo "// ig_elevation.cfg" > ig_elevation.cfg - echo "OutputIGDir = \"ig_land_ligo_elev\";" >> ig_elevation.cfg - echo "InputIGDir = \"ig_land_ligo\";" >> ig_elevation.cfg - echo "CellSize = 160.0;" >> ig_elevation.cfg - - # HeightMapFile1 is the grayscale .tga file (127 is 0, 0 is -127*ZFactor and 255 is +128*ZFactor) - dir_database=`cat ../../cfg/site.cfg | grep "database_directory" | sed -e 's/database_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - dir_ligosrc=`cat ../../cfg/directories.cfg | grep "ligo_source_directory" | sed -e 's/ligo_source_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - hmf1=`cat ../../cfg/config.cfg | grep "ligo_export_heightmap1" | sed -e 's/ligo_export_heightmap1//' | sed -e 's/ //g' | sed -e 's/=//g'` - echo "HeightMapFile1 = \"$dir_database/$dir_ligosrc/$hmf1\";" >> ig_elevation.cfg - - # ZFactor1 is the heightmap factor - zf1=`cat ../../cfg/config.cfg | grep "ligo_export_zfactor1" | sed -e 's/ligo_export_zfactor1//' | sed -e 's/ //g' | sed -e 's/=//g'` - echo "ZFactor1 = $zf1;" >> ig_elevation.cfg - - # HeightMapFile2 is the grayscale .tga file (127 is 0, 0 is -127*ZFactor and 255 is +128*ZFactor) - hmf2=`cat ../../cfg/config.cfg | grep "ligo_export_heightmap2" | sed -e 's/ligo_export_heightmap2//' | sed -e 's/ //g' | sed -e 's/=//g'` - echo "HeightMapFile2 = \"$dir_database/$dir_ligosrc/$hmf2\";" >> ig_elevation.cfg - - # ZFactor2 is the heightmap factor - zf2=`cat ../../cfg/config.cfg | grep "ligo_export_zfactor2" | sed -e 's/ligo_export_zfactor2//' | sed -e 's/ //g' | sed -e 's/=//g'` - echo "ZFactor2 = $zf2;" >> ig_elevation.cfg - - land_name=`cat ../../cfg/config.cfg | grep "ligo_export_land" | sed -e 's/ligo_export_land//' | sed -e 's/ //g' | sed -e 's/=//g'` - echo "LandFile = \"$dir_database/$dir_ligosrc/$land_name\";" >> ig_elevation.cfg - - ig_elevation ig_elevation.cfg - - else - echo [Prim IG] OFF - echo [Prim IG] OFF >> log.log - fi -else - echo [Prim IG] OFF - echo [Prim IG] OFF >> log.log -fi - -# Erase ig in ig_merge_tmp and ig_land_compare - -rm ig_merge_tmp/* -rm ig_land_compare/* - -# Merge ig in ig_land_ld with ig_land_max_elev in ig_merge_tmp - -dir_current=`pwd` -cd ig_land_ld -list_ig=`ls -1 *.[iI][gG] 2> /dev/null` -cd $dir_current -for filename in $list_ig ; do - # Does this file exist in ig_land_max_elev ? - if test -e ig_land_max_elev/$filename ; then - # Yes, lets merge it - ig_add ig_merge_tmp/$filename ig_land_max_elev/$filename ig_land_ld/$filename ; - else - # No, only copy it - cp ig_land_ld/$filename ig_merge_tmp/$filename ; - fi - - # Idle - ../../idle.bat -done - -# Merge ig in ig_land_max_elev with ig_land_ld in ig_merge_tmp - -cd ig_land_max_elev -list_ig=`ls -1 *.[iI][gG] 2> /dev/null` -cd $dir_current -for filename in $list_ig ; do - # Does this file exist in ig_land_ld ? - if !(test -e ig_land_ld/$filename) then - # No, only copy it - cp ig_land_max_elev/$filename ig_merge_tmp/$filename ; - fi - - # Idle - ../../idle.bat -done - -# Merge ig in ig_merge_tmp with ig_land_ligo_elev in ig_land_compare - -cd ig_merge_tmp -list_ig=`ls -1 *.[iI][gG] 2> /dev/null` -cd $dir_current -for filename in $list_ig ; do - # Does this file exist in ig_land_ligo_elev ? - if (test -e ig_land_ligo_elev/$filename) then - # Yes, lets merge it - ig_add ig_land_compare/$filename ig_merge_tmp/$filename ig_land_ligo_elev/$filename ; - else - # No, only copy it - cp ig_merge_tmp/$filename ig_land_compare/$filename ; - fi - - # Idle - ../../idle.bat -done - -# Merge ig in ig_land_ligo_elev with ig_merge_tmp in ig_land_compare - -cd ig_land_ligo_elev -list_ig=`ls -1 *.[iI][gG] 2> /dev/null` -cd $dir_current -for filename in $list_ig ; do - # Does this file exist in ig_merge_tmp ? - if !(test -e ig_merge_tmp/$filename) then - # No, only copy it - cp ig_land_ligo_elev/$filename ig_land_compare/$filename ; - fi - - # Idle - ../../idle.bat -done - -# Compare and update - -cd ig_land_compare -list_ig=`ls -1 *.[iI][gG]` -for filename in $list_ig ; do - echo "Checking $filename for update" - if test -e ../ig_land/$filename ; then - must_update=`diff --binary -q $filename ../ig_land/$filename` ; - else - must_update=YES ; - fi - - if test -n "$must_update" ; then - echo " Updating" - cp -u -p $filename ../ig_land/$filename ; - fi - - # Idle - ../../../idle.bat -done -cd ../ig_land -list_ig=`ls -1 *.[iI][gG]` -for filename in $list_ig ; do - if !(test -e ../ig_land_compare/$filename) then - echo "Remove $filename" - rm $filename ; - fi - - # Idle - ../../../idle.bat -done -cd $dir_current - - -# ****************** -# List all the zones -# ****************** - -# Get the landscape name -landscape_name=`cat ../../cfg/config.cfg | grep "landscape_name" | sed -e 's/landscape_name//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Landscape name exist ? -if ( test "$landscape_name" ) -then - # If the list file exists, erase it - if ( test -f "$landscape_name"_ig.txt ) - then - rm "$landscape_name"_ig.txt - fi - - cd ig_land - for i in *.[iI][gG] ; do - # Build an ig list - if ( test -f $i ) - then - echo $i >> ../"$landscape_name"_ig.txt - else - echo >> ../"$landscape_name"_ig.txt - fi - done - cd .. - - # Idle - ../../idle.bat -fi - - +#!/bin/bash +rm log.log 2> /dev/null + +# ig_land_max: landscape IG eported from 3dsmax not elevated by the heightmap +# ig_land_max_elev: landscape IG eported from 3dsmax elevated by the heightmap +# ig_land_ligo: landscape IG found in ligo bricks not elevated by the heightmap +# ig_land_ligo_elev: landscape IG found in ligo bricks from 3dsmax elevated by the heightmap +# ig_land_ld: landscape IG generated by the land exporter (already elevated by the land exporter) + +# ig_land: final IG directory for landscape IGs +# ig_land_compare: Tmp final IG directory for landscape IGs before comparison +# ig_other: final IG directory for village or construction IGs + +# Log error +echo ------- >> log.log +echo --- Build ig >> log.log +echo ------- >> log.log +echo ------- +echo --- Build ig +echo ------- +date >> log.log +date + +# ************************************************ +# Build the IG_LAND made with the LevelDesign Tool +# ************************************************ + +# Get the primitive directory +continentdir=`cat ../../cfg/config.cfg | grep "leveldesign_igexport_continent_dir" | sed -e 's/leveldesign_igexport_continent_dir//' | sed -e 's/ //g' | sed -e 's/=//g' | sed -e 's/;//g'` + +# Get the database directory +database_directory=`cat ../../cfg/site.cfg | grep "database_directory" | sed -e 's/database_directory//g' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the primitive directories +ligo_ig_primitive_directory=`cat ../../cfg/directories.cfg | grep "ligo_ig_primitive_directory" | sed -e 's/ligo_ig_primitive_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the form directory +form_dir=`cat ../../cfg/site.cfg | grep "level_design_directory" | sed -e 's/level_design_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + +if ( test "$continentdir" || test "$ligo_ig_primitive_directory" ) +then + land_name=`cat ../../cfg/config.cfg | grep "ligo_export_land" | sed -e 's/ligo_export_land//' | sed -e 's/ //g' | sed -e 's/=//g'` + + if ( test "$land_name" ) + then + echo [Prim IG] ON + echo [Prim IG] ON >> log.log + # create cfg file + # +++++++++++++++ + + rm prim_export.cfg + echo "// prim_export.cfg" > prim_export.cfg + + echo "OutIGDir = \"ig_land_ld\";" >> prim_export.cfg + echo "ZoneWDir = \"..\\zone\\zone_welded\";" >> prim_export.cfg + + name_bank=`cat ../../cfg/properties.cfg | grep "bank_name" | sed -e 's/bank_name//' | sed -e 's/ //g' | sed -e 's/=//g'` + echo "SmallBank = $name_bank" >> prim_export.cfg + name_farbank=`cat ../../cfg/properties.cfg | grep "bankfar_name" | sed -e 's/bankfar_name//' | sed -e 's/ //g' | sed -e 's/=//g'` + echo "FarBank = $name_farbank" >> prim_export.cfg + + displacedir=`cat ../../cfg/directories.cfg | grep "displace_source_directory" | sed -e 's/displace_source_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + dir_database=`cat ../../cfg/site.cfg | grep "database_directory" | sed -e 's/database_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + echo "DisplaceDir = \"$dir_database/$displacedir\";" >> prim_export.cfg + + echo "CellSize = 160.0;" >> prim_export.cfg + + # Set the continent directory to export + echo "PrimDirs = {" >> prim_export.cfg + echo " $continentdir," >> prim_export.cfg + for dir in $ligo_ig_primitive_directory ; do + echo " \"$database_directory/$dir\"," >> prim_export.cfg + done + echo "};" >> prim_export.cfg + + # Set the dfn directory to export + echo "FormDir = \"$form_dir\";" >> prim_export.cfg + + # ******************* + # Launch the exporter + # ******************* + + prim_export.exe prim_export.cfg + + # ******************* + # Merge it with the IG_LAND exported from Max + elvated with heightmap + # ******************* + + # elevation of the heightmap for land_max + # ++++++++++++++++++++++++++++++++++++++++++++ + + rm ig_elevation.cfg + echo "// ig_elevation.cfg" > ig_elevation.cfg + echo "OutputIGDir = \"ig_land_max_elev\";" >> ig_elevation.cfg + echo "InputIGDir = \"ig_land_max\";" >> ig_elevation.cfg + echo "CellSize = 160.0;" >> ig_elevation.cfg + + # HeightMapFile1 is the grayscale .tga file (127 is 0, 0 is -127*ZFactor and 255 is +128*ZFactor) + dir_database=`cat ../../cfg/site.cfg | grep "database_directory" | sed -e 's/database_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + dir_ligosrc=`cat ../../cfg/directories.cfg | grep "ligo_source_directory" | sed -e 's/ligo_source_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + hmf1=`cat ../../cfg/config.cfg | grep "ligo_export_heightmap1" | sed -e 's/ligo_export_heightmap1//' | sed -e 's/ //g' | sed -e 's/=//g'` + echo "HeightMapFile1 = \"$dir_database/$dir_ligosrc/$hmf1\";" >> ig_elevation.cfg + + # ZFactor1 is the heightmap factor + zf1=`cat ../../cfg/config.cfg | grep "ligo_export_zfactor1" | sed -e 's/ligo_export_zfactor1//' | sed -e 's/ //g' | sed -e 's/=//g'` + echo "ZFactor1 = $zf1;" >> ig_elevation.cfg + + # HeightMapFile2 is the grayscale .tga file (127 is 0, 0 is -127*ZFactor and 255 is +128*ZFactor) + hmf2=`cat ../../cfg/config.cfg | grep "ligo_export_heightmap2" | sed -e 's/ligo_export_heightmap2//' | sed -e 's/ //g' | sed -e 's/=//g'` + echo "HeightMapFile2 = \"$dir_database/$dir_ligosrc/$hmf2\";" >> ig_elevation.cfg + + # ZFactor2 is the heightmap factor + zf2=`cat ../../cfg/config.cfg | grep "ligo_export_zfactor2" | sed -e 's/ligo_export_zfactor2//' | sed -e 's/ //g' | sed -e 's/=//g'` + echo "ZFactor2 = $zf2;" >> ig_elevation.cfg + + echo "LandFile = \"$dir_database/$dir_ligosrc/$land_name\";" >> ig_elevation.cfg + + + ig_elevation ig_elevation.cfg + + # elevation of the heightmap for land_ligo + # ++++++++++++++++++++++++++++++++++++++++++++ + + rm ig_elevation.cfg + echo "// ig_elevation.cfg" > ig_elevation.cfg + echo "OutputIGDir = \"ig_land_ligo_elev\";" >> ig_elevation.cfg + echo "InputIGDir = \"ig_land_ligo\";" >> ig_elevation.cfg + echo "CellSize = 160.0;" >> ig_elevation.cfg + + # HeightMapFile1 is the grayscale .tga file (127 is 0, 0 is -127*ZFactor and 255 is +128*ZFactor) + dir_database=`cat ../../cfg/site.cfg | grep "database_directory" | sed -e 's/database_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + dir_ligosrc=`cat ../../cfg/directories.cfg | grep "ligo_source_directory" | sed -e 's/ligo_source_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + hmf1=`cat ../../cfg/config.cfg | grep "ligo_export_heightmap1" | sed -e 's/ligo_export_heightmap1//' | sed -e 's/ //g' | sed -e 's/=//g'` + echo "HeightMapFile1 = \"$dir_database/$dir_ligosrc/$hmf1\";" >> ig_elevation.cfg + + # ZFactor1 is the heightmap factor + zf1=`cat ../../cfg/config.cfg | grep "ligo_export_zfactor1" | sed -e 's/ligo_export_zfactor1//' | sed -e 's/ //g' | sed -e 's/=//g'` + echo "ZFactor1 = $zf1;" >> ig_elevation.cfg + + # HeightMapFile2 is the grayscale .tga file (127 is 0, 0 is -127*ZFactor and 255 is +128*ZFactor) + hmf2=`cat ../../cfg/config.cfg | grep "ligo_export_heightmap2" | sed -e 's/ligo_export_heightmap2//' | sed -e 's/ //g' | sed -e 's/=//g'` + echo "HeightMapFile2 = \"$dir_database/$dir_ligosrc/$hmf2\";" >> ig_elevation.cfg + + # ZFactor2 is the heightmap factor + zf2=`cat ../../cfg/config.cfg | grep "ligo_export_zfactor2" | sed -e 's/ligo_export_zfactor2//' | sed -e 's/ //g' | sed -e 's/=//g'` + echo "ZFactor2 = $zf2;" >> ig_elevation.cfg + + land_name=`cat ../../cfg/config.cfg | grep "ligo_export_land" | sed -e 's/ligo_export_land//' | sed -e 's/ //g' | sed -e 's/=//g'` + echo "LandFile = \"$dir_database/$dir_ligosrc/$land_name\";" >> ig_elevation.cfg + + ig_elevation ig_elevation.cfg + + else + echo [Prim IG] OFF + echo [Prim IG] OFF >> log.log + fi +else + echo [Prim IG] OFF + echo [Prim IG] OFF >> log.log +fi + +# Erase ig in ig_merge_tmp and ig_land_compare + +rm ig_merge_tmp/* +rm ig_land_compare/* + +# Merge ig in ig_land_ld with ig_land_max_elev in ig_merge_tmp + +dir_current=`pwd` +cd ig_land_ld +list_ig=`ls -1 *.[iI][gG] 2> /dev/null` +cd $dir_current +for filename in $list_ig ; do + # Does this file exist in ig_land_max_elev ? + if test -e ig_land_max_elev/$filename ; then + # Yes, lets merge it + ig_add ig_merge_tmp/$filename ig_land_max_elev/$filename ig_land_ld/$filename ; + else + # No, only copy it + cp ig_land_ld/$filename ig_merge_tmp/$filename ; + fi + + # Idle + ../../idle.bat +done + +# Merge ig in ig_land_max_elev with ig_land_ld in ig_merge_tmp + +cd ig_land_max_elev +list_ig=`ls -1 *.[iI][gG] 2> /dev/null` +cd $dir_current +for filename in $list_ig ; do + # Does this file exist in ig_land_ld ? + if !(test -e ig_land_ld/$filename) then + # No, only copy it + cp ig_land_max_elev/$filename ig_merge_tmp/$filename ; + fi + + # Idle + ../../idle.bat +done + +# Merge ig in ig_merge_tmp with ig_land_ligo_elev in ig_land_compare + +cd ig_merge_tmp +list_ig=`ls -1 *.[iI][gG] 2> /dev/null` +cd $dir_current +for filename in $list_ig ; do + # Does this file exist in ig_land_ligo_elev ? + if (test -e ig_land_ligo_elev/$filename) then + # Yes, lets merge it + ig_add ig_land_compare/$filename ig_merge_tmp/$filename ig_land_ligo_elev/$filename ; + else + # No, only copy it + cp ig_merge_tmp/$filename ig_land_compare/$filename ; + fi + + # Idle + ../../idle.bat +done + +# Merge ig in ig_land_ligo_elev with ig_merge_tmp in ig_land_compare + +cd ig_land_ligo_elev +list_ig=`ls -1 *.[iI][gG] 2> /dev/null` +cd $dir_current +for filename in $list_ig ; do + # Does this file exist in ig_merge_tmp ? + if !(test -e ig_merge_tmp/$filename) then + # No, only copy it + cp ig_land_ligo_elev/$filename ig_land_compare/$filename ; + fi + + # Idle + ../../idle.bat +done + +# Compare and update + +cd ig_land_compare +list_ig=`ls -1 *.[iI][gG]` +for filename in $list_ig ; do + echo "Checking $filename for update" + if test -e ../ig_land/$filename ; then + must_update=`diff --binary -q $filename ../ig_land/$filename` ; + else + must_update=YES ; + fi + + if test -n "$must_update" ; then + echo " Updating" + cp -u -p $filename ../ig_land/$filename ; + fi + + # Idle + ../../../idle.bat +done +cd ../ig_land +list_ig=`ls -1 *.[iI][gG]` +for filename in $list_ig ; do + if !(test -e ../ig_land_compare/$filename) then + echo "Remove $filename" + rm $filename ; + fi + + # Idle + ../../../idle.bat +done +cd $dir_current + + +# ****************** +# List all the zones +# ****************** + +# Get the landscape name +landscape_name=`cat ../../cfg/config.cfg | grep "landscape_name" | sed -e 's/landscape_name//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Landscape name exist ? +if ( test "$landscape_name" ) +then + # If the list file exists, erase it + if ( test -f "$landscape_name"_ig.txt ) + then + rm "$landscape_name"_ig.txt + fi + + cd ig_land + for i in *.[iI][gG] ; do + # Build an ig list + if ( test -f $i ) + then + echo $i >> ../"$landscape_name"_ig.txt + else + echo >> ../"$landscape_name"_ig.txt + fi + done + cd .. + + # Idle + ../../idle.bat +fi + + diff --git a/nel/tools/3d/build_gamedata/processes/ig/sh/export.sh b/nel/tools/3d/build_gamedata/processes/ig/sh/export.sh index 84c043e48f..c641296ec5 100644 --- a/nel/tools/3d/build_gamedata/processes/ig/sh/export.sh +++ b/nel/tools/3d/build_gamedata/processes/ig/sh/export.sh @@ -1,90 +1,90 @@ -#!/bin/bash -rm log.log 2> /dev/null - -# *** Export ig files (.ig) from Max - -exec_timeout='exec_timeout.exe' - -# Get the timeout -timeout=`cat ../../cfg/config.cfg | grep "ig_export_timeout" | sed -e 's/ig_export_timeout//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the database directory -database_directory=`cat ../../cfg/site.cfg | grep "database_directory" | sed -e 's/database_directory//g' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the build gamedata directory -build_gamedata_directory=`cat ../../cfg/site.cfg | grep "build_gamedata_directory" | sed -e 's/build_gamedata_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the ig directories -ig_land_source_directories=`cat ../../cfg/directories.cfg | grep "ig_land_source_directory" | sed -e 's/ig_land_source_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the ig directories -ig_other_source_directories=`cat ../../cfg/directories.cfg | grep "ig_other_source_directory" | sed -e 's/ig_other_source_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Maxdir -max_directory=`echo $MAX_DIR | sed -e 's&\\\&/&g'` - -# Log error -echo ------- > log.log -echo --- Export ig >> log.log -echo ------- >> log.log -echo ------- -echo --- Export ig -echo ------- -date >> log.log -date - -# For each directoy - -# List landscape ig - - -for i in $ig_land_source_directories ; do - # Copy the script - cat maxscript/ig_export.ms | sed -e "s&output_logfile&$build_gamedata_directory/processes/ig/log.log&g" | sed -e "s&ig_source_directory&$database_directory/$i&g" | sed -e "s&output_directory_tag&$build_gamedata_directory/processes/ig/tag&g" | sed -e "s&output_directory_ig&$build_gamedata_directory/processes/ig/ig_land_max&g" > $max_directory/scripts/ig_export.ms - - # Start max - echo Try 1 >> log.log - $exec_timeout $timeout $max_directory/3dsmax.exe -U MAXScript ig_export.ms -q -mi -vn - - # Idle - ../../idle.bat - - echo Try 2 >> log.log - $exec_timeout $timeout $max_directory/3dsmax.exe -U MAXScript ig_export.ms -q -mi -vn - - # Idle - ../../idle.bat - - echo Try 3 >> log.log - $exec_timeout $timeout $max_directory/3dsmax.exe -U MAXScript ig_export.ms -q -mi -vn - - # Idle - ../../idle.bat -done - - - - -for i in $ig_other_source_directories ; do - # Copy the script - cat maxscript/ig_export.ms | sed -e "s&output_logfile&$build_gamedata_directory/processes/ig/log.log&g" | sed -e "s&ig_source_directory&$database_directory/$i&g" | sed -e "s&output_directory_tag&$build_gamedata_directory/processes/ig/tag&g" | sed -e "s&output_directory_ig&$build_gamedata_directory/processes/ig/ig_other&g" > $max_directory/scripts/ig_export.ms - - # Start max - echo Try 1 >> log.log - $exec_timeout $timeout $max_directory/3dsmax.exe -U MAXScript ig_export.ms -q -mi -vn - - # Idle - ../../idle.bat - - echo Try 2 >> log.log - $exec_timeout $timeout $max_directory/3dsmax.exe -U MAXScript ig_export.ms -q -mi -vn - - # Idle - ../../idle.bat - - echo Try 3 >> log.log - $exec_timeout $timeout $max_directory/3dsmax.exe -U MAXScript ig_export.ms -q -mi -vn - - # Idle - ../../idle.bat -done +#!/bin/bash +rm log.log 2> /dev/null + +# *** Export ig files (.ig) from Max + +exec_timeout='exec_timeout.exe' + +# Get the timeout +timeout=`cat ../../cfg/config.cfg | grep "ig_export_timeout" | sed -e 's/ig_export_timeout//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the database directory +database_directory=`cat ../../cfg/site.cfg | grep "database_directory" | sed -e 's/database_directory//g' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the build gamedata directory +build_gamedata_directory=`cat ../../cfg/site.cfg | grep "build_gamedata_directory" | sed -e 's/build_gamedata_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the ig directories +ig_land_source_directories=`cat ../../cfg/directories.cfg | grep "ig_land_source_directory" | sed -e 's/ig_land_source_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the ig directories +ig_other_source_directories=`cat ../../cfg/directories.cfg | grep "ig_other_source_directory" | sed -e 's/ig_other_source_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Maxdir +max_directory=`echo $MAX_DIR | sed -e 's&\\\&/&g'` + +# Log error +echo ------- > log.log +echo --- Export ig >> log.log +echo ------- >> log.log +echo ------- +echo --- Export ig +echo ------- +date >> log.log +date + +# For each directoy + +# List landscape ig + + +for i in $ig_land_source_directories ; do + # Copy the script + cat maxscript/ig_export.ms | sed -e "s&output_logfile&$build_gamedata_directory/processes/ig/log.log&g" | sed -e "s&ig_source_directory&$database_directory/$i&g" | sed -e "s&output_directory_tag&$build_gamedata_directory/processes/ig/tag&g" | sed -e "s&output_directory_ig&$build_gamedata_directory/processes/ig/ig_land_max&g" > $max_directory/scripts/ig_export.ms + + # Start max + echo Try 1 >> log.log + $exec_timeout $timeout $max_directory/3dsmax.exe -U MAXScript ig_export.ms -q -mi -vn + + # Idle + ../../idle.bat + + echo Try 2 >> log.log + $exec_timeout $timeout $max_directory/3dsmax.exe -U MAXScript ig_export.ms -q -mi -vn + + # Idle + ../../idle.bat + + echo Try 3 >> log.log + $exec_timeout $timeout $max_directory/3dsmax.exe -U MAXScript ig_export.ms -q -mi -vn + + # Idle + ../../idle.bat +done + + + + +for i in $ig_other_source_directories ; do + # Copy the script + cat maxscript/ig_export.ms | sed -e "s&output_logfile&$build_gamedata_directory/processes/ig/log.log&g" | sed -e "s&ig_source_directory&$database_directory/$i&g" | sed -e "s&output_directory_tag&$build_gamedata_directory/processes/ig/tag&g" | sed -e "s&output_directory_ig&$build_gamedata_directory/processes/ig/ig_other&g" > $max_directory/scripts/ig_export.ms + + # Start max + echo Try 1 >> log.log + $exec_timeout $timeout $max_directory/3dsmax.exe -U MAXScript ig_export.ms -q -mi -vn + + # Idle + ../../idle.bat + + echo Try 2 >> log.log + $exec_timeout $timeout $max_directory/3dsmax.exe -U MAXScript ig_export.ms -q -mi -vn + + # Idle + ../../idle.bat + + echo Try 3 >> log.log + $exec_timeout $timeout $max_directory/3dsmax.exe -U MAXScript ig_export.ms -q -mi -vn + + # Idle + ../../idle.bat +done diff --git a/nel/tools/3d/build_gamedata/processes/ig/sh/install.sh b/nel/tools/3d/build_gamedata/processes/ig/sh/install.sh index 430326d2cf..056974dac7 100644 --- a/nel/tools/3d/build_gamedata/processes/ig/sh/install.sh +++ b/nel/tools/3d/build_gamedata/processes/ig/sh/install.sh @@ -1,30 +1,30 @@ -#!/bin/bash -rm log.log 2> /dev/null - -# Install ig in the client data - -# Get the ig install directory -ig_install_directory=`cat ../../cfg/directories.cfg | grep "ig_install_directory" | sed -e 's/ig_install_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the client directory -client_directory=`cat ../../cfg/site.cfg | grep "client_directory" | sed -e 's/client_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the landscape name -landscape_name=`cat ../../cfg/config.cfg | grep "landscape_name" | sed -e 's/landscape_name//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Log error -echo ------- > log.log -echo --- Install Ig >> log.log -echo ------- >> log.log -echo ------- -echo --- Install Ig -echo ------- -date >> log.log -date - -cp -u -p "$landscape_name"_ig.txt $client_directory/$ig_install_directory 2>> log.log - -# Do not copy ig_land, because zone process will copy zone ig lighted versions into client directory. -#cp -u -p ig_land/*.[iI][gG] $client_directory/$ig_install_directory 2>> log.log -# Do not copy ig_other, because ig_light process will copy ig lighted versions into client directory. -#cp -u -p ig_other/*.[iI][gG] $client_directory/$ig_install_directory 2>> log.log +#!/bin/bash +rm log.log 2> /dev/null + +# Install ig in the client data + +# Get the ig install directory +ig_install_directory=`cat ../../cfg/directories.cfg | grep "ig_install_directory" | sed -e 's/ig_install_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the client directory +client_directory=`cat ../../cfg/site.cfg | grep "client_directory" | sed -e 's/client_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the landscape name +landscape_name=`cat ../../cfg/config.cfg | grep "landscape_name" | sed -e 's/landscape_name//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Log error +echo ------- > log.log +echo --- Install Ig >> log.log +echo ------- >> log.log +echo ------- +echo --- Install Ig +echo ------- +date >> log.log +date + +cp -u -p "$landscape_name"_ig.txt $client_directory/$ig_install_directory 2>> log.log + +# Do not copy ig_land, because zone process will copy zone ig lighted versions into client directory. +#cp -u -p ig_land/*.[iI][gG] $client_directory/$ig_install_directory 2>> log.log +# Do not copy ig_other, because ig_light process will copy ig lighted versions into client directory. +#cp -u -p ig_other/*.[iI][gG] $client_directory/$ig_install_directory 2>> log.log diff --git a/nel/tools/3d/build_gamedata/processes/ig_light/sh/install.sh b/nel/tools/3d/build_gamedata/processes/ig_light/sh/install.sh index 2d1e823df3..9392454ecc 100644 --- a/nel/tools/3d/build_gamedata/processes/ig_light/sh/install.sh +++ b/nel/tools/3d/build_gamedata/processes/ig_light/sh/install.sh @@ -1,23 +1,23 @@ -#!/bin/bash -rm log.log 2> /dev/null - -# Install ig in the client data - -# Get the ig install directory -ig_install_directory=`cat ../../cfg/directories.cfg | grep "ig_install_directory" | sed -e 's/ig_install_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the client directory -client_directory=`cat ../../cfg/site.cfg | grep "client_directory" | sed -e 's/client_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Log error -echo ------- > log.log -echo --- Install Lighted Ig >> log.log -echo ------- >> log.log -echo ------- -echo --- Install Lighted Ig -echo ------- -date >> log.log -date - -cp -u -p -R ig_other_lighted/. $client_directory/$ig_install_directory 2>> log.log - +#!/bin/bash +rm log.log 2> /dev/null + +# Install ig in the client data + +# Get the ig install directory +ig_install_directory=`cat ../../cfg/directories.cfg | grep "ig_install_directory" | sed -e 's/ig_install_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the client directory +client_directory=`cat ../../cfg/site.cfg | grep "client_directory" | sed -e 's/client_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Log error +echo ------- > log.log +echo --- Install Lighted Ig >> log.log +echo ------- >> log.log +echo ------- +echo --- Install Lighted Ig +echo ------- +date >> log.log +date + +cp -u -p -R ig_other_lighted/. $client_directory/$ig_install_directory 2>> log.log + diff --git a/nel/tools/3d/build_gamedata/processes/interface/sh/build.sh b/nel/tools/3d/build_gamedata/processes/interface/sh/build.sh index d7e4c0b4db..d472dbc859 100644 --- a/nel/tools/3d/build_gamedata/processes/interface/sh/build.sh +++ b/nel/tools/3d/build_gamedata/processes/interface/sh/build.sh @@ -1,60 +1,60 @@ -#!/bin/bash -rm log.log 2> /dev/null - - -# *** Build interface - -# Get the database directory -database_directory=`cat ../../cfg/site.cfg | grep "database_directory" | sed -e 's/database_directory//g' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the interface directories -interface_source_directories=`cat ../../cfg/directories.cfg | grep "interface_source_directories" | sed -e 's/interface_source_directories//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the interface directories to compress in one DXTC only -interface_source_dxtc_directories=`cat ../../cfg/directories.cfg | grep "interface_source_dxtc_directories" | sed -e 's/interface_source_dxtc_directories//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Log error -echo ------- > log.log -echo --- Build interface >> log.log -echo ------- >> log.log -echo ------- -echo --- Build interface -echo ------- -date >> log.log -date - -# For each interface directory -for i in $interface_source_directories ; do - # Copy - niouname=`echo $i | sed -e 's&/&_&g'` - rm tga_tmp/*.[tT][gG][aA] - cp -u -p $database_directory/$i/*.[tT][gG][aA] tga_tmp 2>> log.log - build_interface.exe tga/texture_$niouname.tga tga_tmp - - # Idle - ../../idle.bat -done - - -# For each interface directory to compress in one DXTC -rm tga_tmp/*.[tT][gG][aA] -for i in $interface_source_dxtc_directories ; do - # Copy - cp -u -p $database_directory/$i/*.[tT][gG][aA] tga_tmp 2>> log.log -done - -# build all files in tga_tmp into one tga. Let the OpenGL compress it at runTime (better result for some important cases) -build_interface.exe tga/texture_interfaces_dxtc.tga tga_tmp -# DO NOT COMPRESS ../../bin/tga2dds tga_tmp/texture_interfaces_dxtc.tga -o tga/texture_interfaces_dxtc.dds -a 5 - - -# Compress animation. Important to avoid 'memory fragmentation' -mv -u 3d/*.[aA][nN][iI][mM] anim_tmp 2>> log.log -anim_builder.exe anim_tmp 3d ../../cfg/properties.cfg - - - -# Idle -../../idle.bat - - +#!/bin/bash +rm log.log 2> /dev/null + + +# *** Build interface + +# Get the database directory +database_directory=`cat ../../cfg/site.cfg | grep "database_directory" | sed -e 's/database_directory//g' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the interface directories +interface_source_directories=`cat ../../cfg/directories.cfg | grep "interface_source_directories" | sed -e 's/interface_source_directories//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the interface directories to compress in one DXTC only +interface_source_dxtc_directories=`cat ../../cfg/directories.cfg | grep "interface_source_dxtc_directories" | sed -e 's/interface_source_dxtc_directories//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Log error +echo ------- > log.log +echo --- Build interface >> log.log +echo ------- >> log.log +echo ------- +echo --- Build interface +echo ------- +date >> log.log +date + +# For each interface directory +for i in $interface_source_directories ; do + # Copy + niouname=`echo $i | sed -e 's&/&_&g'` + rm tga_tmp/*.[tT][gG][aA] + cp -u -p $database_directory/$i/*.[tT][gG][aA] tga_tmp 2>> log.log + build_interface.exe tga/texture_$niouname.tga tga_tmp + + # Idle + ../../idle.bat +done + + +# For each interface directory to compress in one DXTC +rm tga_tmp/*.[tT][gG][aA] +for i in $interface_source_dxtc_directories ; do + # Copy + cp -u -p $database_directory/$i/*.[tT][gG][aA] tga_tmp 2>> log.log +done + +# build all files in tga_tmp into one tga. Let the OpenGL compress it at runTime (better result for some important cases) +build_interface.exe tga/texture_interfaces_dxtc.tga tga_tmp +# DO NOT COMPRESS ../../bin/tga2dds tga_tmp/texture_interfaces_dxtc.tga -o tga/texture_interfaces_dxtc.dds -a 5 + + +# Compress animation. Important to avoid 'memory fragmentation' +mv -u 3d/*.[aA][nN][iI][mM] anim_tmp 2>> log.log +anim_builder.exe anim_tmp 3d ../../cfg/properties.cfg + + + +# Idle +../../idle.bat + + diff --git a/nel/tools/3d/build_gamedata/processes/interface/sh/export.sh b/nel/tools/3d/build_gamedata/processes/interface/sh/export.sh index be85e0e492..0f36bc621b 100644 --- a/nel/tools/3d/build_gamedata/processes/interface/sh/export.sh +++ b/nel/tools/3d/build_gamedata/processes/interface/sh/export.sh @@ -1,62 +1,62 @@ -#!/bin/bash -rm log.log 2> /dev/null - -# Bin -tga_2_dds='tga2dds.exe' - -# *** Export interface tile (.tga) - -# Get the database directory -database_directory=`cat ../../cfg/site.cfg | grep "database_directory" | sed -e 's/database_directory//g' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the interface fullscreen directories -interface_fullscreen_directories=`cat ../../cfg/directories.cfg | grep "interface_fullscreen_directories" | sed -e 's/interface_fullscreen_directories//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the interface 3d directories -interface_3d_directories=`cat ../../cfg/directories.cfg | grep "interface_3d_directories" | sed -e 's/interface_3d_directories//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Log error -echo ------- > log.log -echo --- Export interface >> log.log -echo ------- >> log.log -echo ------- -echo --- Export interface -echo ------- -date >> log.log -date - -# For each interface fullscreen directory compress independently all in dds -rm tga_tmp/*.[tT][gG][aA] -for i in $interface_fullscreen_directories; do - # Copy - cp -u -p $database_directory/$i/*.[tT][gG][aA] tga_tmp 2>> log.log - - # Idle - ../../idle.bat -done - -for i in tga_tmp/*.[tT][gG][aA] ; do - - # Destination file - dest=`echo $i | sed -e 's/tga_tmp/tga/g'` - dest=`echo $dest | sed -e 's/\.[tT][gG][aA]/.dds/g'` - - if ( ! test -e $dest ) || ( test $i -nt $dest ) - then - # Convert - $tga_2_dds $i -o $dest -a 5 2>> log.log - fi - - # Idle - ../../idle.bat -done - - -# For each interface 3d directory -for i in $interface_3d_directories; do - # Copy - cp -u -p $database_directory/$i/* 3d 2>> log.log - - # Idle - ../../idle.bat -done +#!/bin/bash +rm log.log 2> /dev/null + +# Bin +tga_2_dds='tga2dds.exe' + +# *** Export interface tile (.tga) + +# Get the database directory +database_directory=`cat ../../cfg/site.cfg | grep "database_directory" | sed -e 's/database_directory//g' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the interface fullscreen directories +interface_fullscreen_directories=`cat ../../cfg/directories.cfg | grep "interface_fullscreen_directories" | sed -e 's/interface_fullscreen_directories//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the interface 3d directories +interface_3d_directories=`cat ../../cfg/directories.cfg | grep "interface_3d_directories" | sed -e 's/interface_3d_directories//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Log error +echo ------- > log.log +echo --- Export interface >> log.log +echo ------- >> log.log +echo ------- +echo --- Export interface +echo ------- +date >> log.log +date + +# For each interface fullscreen directory compress independently all in dds +rm tga_tmp/*.[tT][gG][aA] +for i in $interface_fullscreen_directories; do + # Copy + cp -u -p $database_directory/$i/*.[tT][gG][aA] tga_tmp 2>> log.log + + # Idle + ../../idle.bat +done + +for i in tga_tmp/*.[tT][gG][aA] ; do + + # Destination file + dest=`echo $i | sed -e 's/tga_tmp/tga/g'` + dest=`echo $dest | sed -e 's/\.[tT][gG][aA]/.dds/g'` + + if ( ! test -e $dest ) || ( test $i -nt $dest ) + then + # Convert + $tga_2_dds $i -o $dest -a 5 2>> log.log + fi + + # Idle + ../../idle.bat +done + + +# For each interface 3d directory +for i in $interface_3d_directories; do + # Copy + cp -u -p $database_directory/$i/* 3d 2>> log.log + + # Idle + ../../idle.bat +done diff --git a/nel/tools/3d/build_gamedata/processes/interface/sh/install.sh b/nel/tools/3d/build_gamedata/processes/interface/sh/install.sh index bf8e62f95e..86e4df5b42 100644 --- a/nel/tools/3d/build_gamedata/processes/interface/sh/install.sh +++ b/nel/tools/3d/build_gamedata/processes/interface/sh/install.sh @@ -1,24 +1,24 @@ -#!/bin/bash -rm log.log 2> /dev/null - -# Install the interface in the client data - -# Get the interface install directory -interface_install_directory=`cat ../../cfg/directories.cfg | grep "interface_install_directory" | sed -e 's/interface_install_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the client directory -client_directory=`cat ../../cfg/site.cfg | grep "client_directory" | sed -e 's/client_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Log error -echo ------- > log.log -echo --- Install interface >> log.log -echo ------- >> log.log -echo ------- -echo --- Install interface -echo ------- -date >> log.log -date - -cp -u -p -R tga/. $client_directory/$interface_install_directory 2>> log.log -cp -u -p -R 3d/. $client_directory/$interface_install_directory 2>> log.log - +#!/bin/bash +rm log.log 2> /dev/null + +# Install the interface in the client data + +# Get the interface install directory +interface_install_directory=`cat ../../cfg/directories.cfg | grep "interface_install_directory" | sed -e 's/interface_install_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the client directory +client_directory=`cat ../../cfg/site.cfg | grep "client_directory" | sed -e 's/client_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Log error +echo ------- > log.log +echo --- Install interface >> log.log +echo ------- >> log.log +echo ------- +echo --- Install interface +echo ------- +date >> log.log +date + +cp -u -p -R tga/. $client_directory/$interface_install_directory 2>> log.log +cp -u -p -R 3d/. $client_directory/$interface_install_directory 2>> log.log + diff --git a/nel/tools/3d/build_gamedata/processes/ligo/sh/build.sh b/nel/tools/3d/build_gamedata/processes/ligo/sh/build.sh index 289d625c36..1cfddec61b 100644 --- a/nel/tools/3d/build_gamedata/processes/ligo/sh/build.sh +++ b/nel/tools/3d/build_gamedata/processes/ligo/sh/build.sh @@ -1,202 +1,202 @@ -#!/bin/bash -rm log.log 2> /dev/null - -echo > log.log - -# ******************** -# Make the config file -# ******************** - -exec_timeout='exec_timeout.exe' - -# Get the timeout -land_exporter_timeout=`cat ../../cfg/config.cfg | grep "ligo_build_timeout" | sed -e 's/ligo_build_timeout//' | sed -e 's/ //g' | sed -e 's/=//g'` - -rm land_exporter.cfg -echo "// land_exporter.cfg" > land_exporter.cfg - -# OutZoneDir is Where to put all .zone generated - -#dir_gamedata=`cat ../../cfg/site.cfg | grep "build_gamedata_directory" | sed -e 's/build_gamedata_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` -#echo "OutZoneDir = \"$dir_gamedata/processes/ligo/output\";" >> land_exporter.cfg -echo "OutZoneDir = \"output\";" >> land_exporter.cfg -echo "OutIGDir = \"../ig/ig_land_ligo\";" >> land_exporter.cfg -echo "AdditionnalIGOutDir = \"../ig/ig_other\";" >> land_exporter.cfg - -# RefZoneDir is Where the reference zones are - -dir_database=`cat ../../cfg/site.cfg | grep "database_directory" | sed -e 's/database_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` -dir_ligosrc=`cat ../../cfg/directories.cfg | grep "ligo_source_directory" | sed -e 's/ligo_source_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` -dir_ligobricks=`cat ../../cfg/directories.cfg | grep "ligo_bricks_directory" | sed -e 's/ligo_bricks_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` -dir_dfn=`cat ../../cfg/site.cfg | grep "level_design_dfn_directory" | sed -e 's/level_design_dfn_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` -continent_file=`cat ../../cfg/config.cfg | grep "continent_file" | sed -e 's/continent_file//' | sed -e 's/ //g' | sed -e 's/=//g'` -dir_world=`cat ../../cfg/site.cfg | grep "level_design_world_directory" | sed -e 's/level_design_world_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` -# dir_continents=`cat ../../cfg/site.cfg | grep "continents_directory" | sed -e 's/continents_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - - - - - - -echo "RefZoneDir = \"$dir_ligobricks/zones\";" >> land_exporter.cfg -echo "RefIGDir = \"$dir_ligobricks/igs\";" >> land_exporter.cfg -echo "AdditionnalIGInDir = \"$dir_ligobricks/igs\";" >> land_exporter.cfg -# echo "ContinentsDir = \"$dir_continents\";" >> land_exporter.cfg -echo "ContinentsDir = \"$dir_world\";" >> land_exporter.cfg - - - - -# LigoBankDir is Where all .ligozone are (those used by the .land) - -echo "LigoBankDir = \"$dir_ligobricks/zoneligos\";" >> land_exporter.cfg - -# TileBankFile is the .bank file (used to know if a tile is oriented and the like) - -name_bank=`cat ../../cfg/properties.cfg | grep "bank_name" | sed -e 's/bank_name//' | sed -e 's/ //g' | sed -e 's/=//g'` -echo "TileBankFile = $name_bank" >> land_exporter.cfg - -# ColorMapFile - -cmf=`cat ../../cfg/config.cfg | grep "ligo_export_colormap" | sed -e 's/ligo_export_colormap//' | sed -e 's/ //g' | sed -e 's/=//g'` -echo "ColorMapFile = \"$dir_database/$dir_ligosrc/$cmf\";" >> land_exporter.cfg - -# HeightMapFile1 is the grayscale .tga file (127 is 0, 0 is -127*ZFactor and 255 is +128*ZFactor) - -hmf1=`cat ../../cfg/config.cfg | grep "ligo_export_heightmap1" | sed -e 's/ligo_export_heightmap1//' | sed -e 's/ //g' | sed -e 's/=//g'` -echo "HeightMapFile1 = \"$dir_database/$dir_ligosrc/$hmf1\";" >> land_exporter.cfg - -# ZFactor1 is the heightmap factor - -zf1=`cat ../../cfg/config.cfg | grep "ligo_export_zfactor1" | sed -e 's/ligo_export_zfactor1//' | sed -e 's/ //g' | sed -e 's/=//g'` -echo "ZFactor1 = $zf1;" >> land_exporter.cfg - -# HeightMapFile2 is the grayscale .tga file (127 is 0, 0 is -127*ZFactor and 255 is +128*ZFactor) - -hmf2=`cat ../../cfg/config.cfg | grep "ligo_export_heightmap2" | sed -e 's/ligo_export_heightmap2//' | sed -e 's/ //g' | sed -e 's/=//g'` -echo "HeightMapFile2 = \"$dir_database/$dir_ligosrc/$hmf2\";" >> land_exporter.cfg - -# ZFactor2 is the heightmap factor - -zf2=`cat ../../cfg/config.cfg | grep "ligo_export_zfactor2" | sed -e 's/ligo_export_zfactor2//' | sed -e 's/ //g' | sed -e 's/=//g'` -echo "ZFactor2 = $zf2;" >> land_exporter.cfg - -# ZoneLight is Roughly light the zone (0-none, 1-patch, 2-noise) - -echo "ZoneLight = 0;" >> land_exporter.cfg - -# CellSize is the size of the cell (zone size) in meter - -echo "CellSize = 160;" >> land_exporter.cfg - -# Threshild is the weld threshold in meter - -echo "Threshold = 1;" >> land_exporter.cfg - -# Where to take dfn files -echo "DFNDir = \"$dir_dfn\";" >> land_exporter.cfg - -# CMB input directory -echo "RefCMBDir = \"$dir_ligobricks/cmb\";" >> land_exporter.cfg - -# CMB output directory -echo "OutCMBDir = \"../rbank/cmb\";" >> land_exporter.cfg - -#input .continent file -echo "ContinentFile = \"$dir_world/$continent_file\";" >> land_exporter.cfg - -# Force export of collisions and additionnal igs -echo "ExportCollisions = 1;" >> land_exporter.cfg -echo "ExportAdditionnalIGs = 1;" >> land_exporter.cfg - - - -# ZoneRegionFile is the .land to compute - -dir_current=`pwd` - -land_name=`cat ../../cfg/config.cfg | grep "ligo_export_land" | sed -e 's/ligo_export_land//' | sed -e 's/ //g' | sed -e 's/=//g'` -echo "ZoneRegionFile = \"$dir_database/$dir_ligosrc/$land_name\";" >> land_exporter.cfg - -# if there is no .land then do not generate all zones and zone welded - -if test -z "$land_name" ; then - echo No .land set -- Exiting -- - exit; -fi - -# ******************* -# launch the exporter -# ******************* - -echo ------- >> log.log -echo --- Generate ligo zone >> log.log -echo ------- >> log.log -echo ------- -echo --- Generate ligo zone -echo ------- -date >> log.log -date - -echo Exporting -$exec_timeout $land_exporter_timeout land_export.exe land_exporter.cfg - -# rename *.[zZ][oO][nN][eE][lL] *.[zZ][oO][nN][eE] -# script is just too slow to do renaming... And we can't call directly dos command - -cd output -../sh/renametozone.bat -cd .. - -# ************** -# Copy the zones -# ************** - -cd ../zone -mkdir zone_exported 2> /dev/null - -# Try to copy ligo zone if any -# **************************** - -ligo_flag=`cat ../../cfg/config.cfg | grep "process_to_complete" | grep "ligo"` - -dir_current=`pwd` -cd ../ligo/output -list_zone=`ls -1 *.[zZ][oO][nN][eE]*` -for filename in $list_zone ; do - echo "Checking $filename for update" - if test -e ../../zone/zone_exported/$filename ; then - must_update=`diff --binary -q $filename ../../zone/zone_exported/$filename` ; - else - must_update=YES ; - fi - - if test -n "$must_update" ; then - echo " Updating" - cp -u -p $filename ../../zone/zone_exported/$filename ; - fi - - # Idle - ../../../idle.bat -done -cd $dir_current - -# delete files only present in the zone_exported directory - -if ( test "$ligo_flag" ) -then - cd ./zone_exported - list_zone=`ls -1 *.[zZ][oO][nN][eE]*` - for filename in $list_zone ; do - if test -e ../../ligo/output/$filename ; then - must_update=NO ; - else - echo "Removing $filename" - rm $filename ; - fi - - # Idle - ../../../idle.bat - done - cd .. -fi +#!/bin/bash +rm log.log 2> /dev/null + +echo > log.log + +# ******************** +# Make the config file +# ******************** + +exec_timeout='exec_timeout.exe' + +# Get the timeout +land_exporter_timeout=`cat ../../cfg/config.cfg | grep "ligo_build_timeout" | sed -e 's/ligo_build_timeout//' | sed -e 's/ //g' | sed -e 's/=//g'` + +rm land_exporter.cfg +echo "// land_exporter.cfg" > land_exporter.cfg + +# OutZoneDir is Where to put all .zone generated + +#dir_gamedata=`cat ../../cfg/site.cfg | grep "build_gamedata_directory" | sed -e 's/build_gamedata_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` +#echo "OutZoneDir = \"$dir_gamedata/processes/ligo/output\";" >> land_exporter.cfg +echo "OutZoneDir = \"output\";" >> land_exporter.cfg +echo "OutIGDir = \"../ig/ig_land_ligo\";" >> land_exporter.cfg +echo "AdditionnalIGOutDir = \"../ig/ig_other\";" >> land_exporter.cfg + +# RefZoneDir is Where the reference zones are + +dir_database=`cat ../../cfg/site.cfg | grep "database_directory" | sed -e 's/database_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` +dir_ligosrc=`cat ../../cfg/directories.cfg | grep "ligo_source_directory" | sed -e 's/ligo_source_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` +dir_ligobricks=`cat ../../cfg/directories.cfg | grep "ligo_bricks_directory" | sed -e 's/ligo_bricks_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` +dir_dfn=`cat ../../cfg/site.cfg | grep "level_design_dfn_directory" | sed -e 's/level_design_dfn_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` +continent_file=`cat ../../cfg/config.cfg | grep "continent_file" | sed -e 's/continent_file//' | sed -e 's/ //g' | sed -e 's/=//g'` +dir_world=`cat ../../cfg/site.cfg | grep "level_design_world_directory" | sed -e 's/level_design_world_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` +# dir_continents=`cat ../../cfg/site.cfg | grep "continents_directory" | sed -e 's/continents_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + + + + + + +echo "RefZoneDir = \"$dir_ligobricks/zones\";" >> land_exporter.cfg +echo "RefIGDir = \"$dir_ligobricks/igs\";" >> land_exporter.cfg +echo "AdditionnalIGInDir = \"$dir_ligobricks/igs\";" >> land_exporter.cfg +# echo "ContinentsDir = \"$dir_continents\";" >> land_exporter.cfg +echo "ContinentsDir = \"$dir_world\";" >> land_exporter.cfg + + + + +# LigoBankDir is Where all .ligozone are (those used by the .land) + +echo "LigoBankDir = \"$dir_ligobricks/zoneligos\";" >> land_exporter.cfg + +# TileBankFile is the .bank file (used to know if a tile is oriented and the like) + +name_bank=`cat ../../cfg/properties.cfg | grep "bank_name" | sed -e 's/bank_name//' | sed -e 's/ //g' | sed -e 's/=//g'` +echo "TileBankFile = $name_bank" >> land_exporter.cfg + +# ColorMapFile + +cmf=`cat ../../cfg/config.cfg | grep "ligo_export_colormap" | sed -e 's/ligo_export_colormap//' | sed -e 's/ //g' | sed -e 's/=//g'` +echo "ColorMapFile = \"$dir_database/$dir_ligosrc/$cmf\";" >> land_exporter.cfg + +# HeightMapFile1 is the grayscale .tga file (127 is 0, 0 is -127*ZFactor and 255 is +128*ZFactor) + +hmf1=`cat ../../cfg/config.cfg | grep "ligo_export_heightmap1" | sed -e 's/ligo_export_heightmap1//' | sed -e 's/ //g' | sed -e 's/=//g'` +echo "HeightMapFile1 = \"$dir_database/$dir_ligosrc/$hmf1\";" >> land_exporter.cfg + +# ZFactor1 is the heightmap factor + +zf1=`cat ../../cfg/config.cfg | grep "ligo_export_zfactor1" | sed -e 's/ligo_export_zfactor1//' | sed -e 's/ //g' | sed -e 's/=//g'` +echo "ZFactor1 = $zf1;" >> land_exporter.cfg + +# HeightMapFile2 is the grayscale .tga file (127 is 0, 0 is -127*ZFactor and 255 is +128*ZFactor) + +hmf2=`cat ../../cfg/config.cfg | grep "ligo_export_heightmap2" | sed -e 's/ligo_export_heightmap2//' | sed -e 's/ //g' | sed -e 's/=//g'` +echo "HeightMapFile2 = \"$dir_database/$dir_ligosrc/$hmf2\";" >> land_exporter.cfg + +# ZFactor2 is the heightmap factor + +zf2=`cat ../../cfg/config.cfg | grep "ligo_export_zfactor2" | sed -e 's/ligo_export_zfactor2//' | sed -e 's/ //g' | sed -e 's/=//g'` +echo "ZFactor2 = $zf2;" >> land_exporter.cfg + +# ZoneLight is Roughly light the zone (0-none, 1-patch, 2-noise) + +echo "ZoneLight = 0;" >> land_exporter.cfg + +# CellSize is the size of the cell (zone size) in meter + +echo "CellSize = 160;" >> land_exporter.cfg + +# Threshild is the weld threshold in meter + +echo "Threshold = 1;" >> land_exporter.cfg + +# Where to take dfn files +echo "DFNDir = \"$dir_dfn\";" >> land_exporter.cfg + +# CMB input directory +echo "RefCMBDir = \"$dir_ligobricks/cmb\";" >> land_exporter.cfg + +# CMB output directory +echo "OutCMBDir = \"../rbank/cmb\";" >> land_exporter.cfg + +#input .continent file +echo "ContinentFile = \"$dir_world/$continent_file\";" >> land_exporter.cfg + +# Force export of collisions and additionnal igs +echo "ExportCollisions = 1;" >> land_exporter.cfg +echo "ExportAdditionnalIGs = 1;" >> land_exporter.cfg + + + +# ZoneRegionFile is the .land to compute + +dir_current=`pwd` + +land_name=`cat ../../cfg/config.cfg | grep "ligo_export_land" | sed -e 's/ligo_export_land//' | sed -e 's/ //g' | sed -e 's/=//g'` +echo "ZoneRegionFile = \"$dir_database/$dir_ligosrc/$land_name\";" >> land_exporter.cfg + +# if there is no .land then do not generate all zones and zone welded + +if test -z "$land_name" ; then + echo No .land set -- Exiting -- + exit; +fi + +# ******************* +# launch the exporter +# ******************* + +echo ------- >> log.log +echo --- Generate ligo zone >> log.log +echo ------- >> log.log +echo ------- +echo --- Generate ligo zone +echo ------- +date >> log.log +date + +echo Exporting +$exec_timeout $land_exporter_timeout land_export.exe land_exporter.cfg + +# rename *.[zZ][oO][nN][eE][lL] *.[zZ][oO][nN][eE] +# script is just too slow to do renaming... And we can't call directly dos command + +cd output +../sh/renametozone.bat +cd .. + +# ************** +# Copy the zones +# ************** + +cd ../zone +mkdir zone_exported 2> /dev/null + +# Try to copy ligo zone if any +# **************************** + +ligo_flag=`cat ../../cfg/config.cfg | grep "process_to_complete" | grep "ligo"` + +dir_current=`pwd` +cd ../ligo/output +list_zone=`ls -1 *.[zZ][oO][nN][eE]*` +for filename in $list_zone ; do + echo "Checking $filename for update" + if test -e ../../zone/zone_exported/$filename ; then + must_update=`diff --binary -q $filename ../../zone/zone_exported/$filename` ; + else + must_update=YES ; + fi + + if test -n "$must_update" ; then + echo " Updating" + cp -u -p $filename ../../zone/zone_exported/$filename ; + fi + + # Idle + ../../../idle.bat +done +cd $dir_current + +# delete files only present in the zone_exported directory + +if ( test "$ligo_flag" ) +then + cd ./zone_exported + list_zone=`ls -1 *.[zZ][oO][nN][eE]*` + for filename in $list_zone ; do + if test -e ../../ligo/output/$filename ; then + must_update=NO ; + else + echo "Removing $filename" + rm $filename ; + fi + + # Idle + ../../../idle.bat + done + cd .. +fi diff --git a/nel/tools/3d/build_gamedata/processes/ligo/sh/export.sh b/nel/tools/3d/build_gamedata/processes/ligo/sh/export.sh index 4bf0f4d152..080bac484a 100644 --- a/nel/tools/3d/build_gamedata/processes/ligo/sh/export.sh +++ b/nel/tools/3d/build_gamedata/processes/ligo/sh/export.sh @@ -1,72 +1,72 @@ -#!/bin/bash -rm log.log 2> /dev/null - -echo > log.log - -# *** Export ligo zone files from Max *** -# *** ******************************* *** - -echo ------- >> log.log -echo --- Export ligo zone >> log.log -echo ------- >> log.log -echo ------- -echo --- Export ligo zone -echo ------- -date >> log.log -date - -exec_timeout='exec_timeout.exe' - -# Get the timeout -timeout=`cat ../../cfg/config.cfg | grep "ligo_export_timeout" | sed -e 's/ligo_export_timeout//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get current directory -dir_gamedata=`cat ../../cfg/site.cfg | grep "build_gamedata_directory" | sed -e 's/build_gamedata_directory//' | sed -e 's/ //g' | sed -e 's/=//g' | sed -e 's&\/&\\\&g'` -dir_gamedata_maxscript=`cat ../../cfg/site.cfg | grep "build_gamedata_directory" | sed -e 's/build_gamedata_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the bank filename -bank_filename=`cat ../../cfg/properties.cfg | grep "bank_name" | sed -e 's/bank_name//' | sed -e 's/ //g' | sed -e 's/=//g' | sed -e 's/"//g' | sed -e 's/;//g'` -bankfar_filename=`cat ../../cfg/properties.cfg | grep "bankfar_name" | sed -e 's/bankfar_name//' | sed -e 's/ //g' | sed -e 's/=//g' | sed -e 's/"//g' | sed -e 's/;//g'` - -# Copy the bank file -cp $bank_filename smallbank/ligo.smallbank 2>> log.log -cp $bankfar_filename smallbank/ligo.farbank 2>> log.log - -# Maxdir -max_directory=`echo $MAX_DIR | sed -e 's&\\\&/&g'` - -# delete ini file - -rm $max_directory/plugcfg/nelligo.ini -# echo "$max_directory/plugcfg/nelligo.ini" >> log.log - -# create the ini file - -echo "[LigoConfig]" > $max_directory/plugcfg/nelligo.ini - -# copy the ligo export script -cat maxscript/nel_ligo_export.ms | sed -e "s&output_directory_tag&$dir_gamedata_maxscript/processes/ligo/tag&g" | sed -e "s&output_logfile&$dir_gamedata_maxscript/processes/ligo/log.log&g" | sed -e "s&bankFilename&$dir_gamedata_maxscript/processes/ligo/smallbank/ligo.smallbank&g" > $max_directory/scripts/nel_ligo_export.ms - -dir_database=`cat ../../cfg/site.cfg | grep "database_directory" | sed -e 's/database_directory//' | sed -e 's/ //g' | sed -e 's/=//g' | sed -e 's&\/&\\\&g'` -dir_ligosrc=`cat ../../cfg/directories.cfg | grep "ligo_source_directory" | sed -e 's/ligo_source_directory//' | sed -e 's/ //g' | sed -e 's/=//g' | sed -e 's&\/&\\\&g'` - -echo "LigoPath=$dir_database\\$dir_ligosrc\\max\\" >> $max_directory/plugcfg/nelligo.ini -#echo "LigoExportPath=$dir_database\\$dir_ligosrc\\" >> $max_directory/plugcfg/nelligo.ini - -echo "LigoExportPath=$dir_gamedata\\processes\\ligo\\" >> $max_directory/plugcfg/nelligo.ini - -# export only if no .land set - -land_name=`cat ../../cfg/config.cfg | grep "ligo_export_land" | sed -e 's/ligo_export_land//' | sed -e 's/ //g' | sed -e 's/=//g'` -ligo_export_one_pass=`cat ../../cfg/config.cfg | grep "ligo_export_one_pass" | sed -e 's/ligo_export_one_pass//' | sed -e 's/ //g' | sed -e 's/=//g' | sed -e 's/"//g' | sed -e 's/;//g'` - -if [ -z "$land_name" -o "$ligo_export_one_pass" == "1" ] ; then - echo Try 1 >> log.log - $exec_timeout $timeout $max_directory/3dsmax.exe -U MAXScript nel_ligo_export.ms -q -mi -vn - - echo Try 2 >> log.log - $exec_timeout $timeout $max_directory/3dsmax.exe -U MAXScript nel_ligo_export.ms -q -mi -vn - - echo Try 3 >> log.log - $exec_timeout $timeout $max_directory/3dsmax.exe -U MAXScript nel_ligo_export.ms -q -mi -vn -fi +#!/bin/bash +rm log.log 2> /dev/null + +echo > log.log + +# *** Export ligo zone files from Max *** +# *** ******************************* *** + +echo ------- >> log.log +echo --- Export ligo zone >> log.log +echo ------- >> log.log +echo ------- +echo --- Export ligo zone +echo ------- +date >> log.log +date + +exec_timeout='exec_timeout.exe' + +# Get the timeout +timeout=`cat ../../cfg/config.cfg | grep "ligo_export_timeout" | sed -e 's/ligo_export_timeout//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get current directory +dir_gamedata=`cat ../../cfg/site.cfg | grep "build_gamedata_directory" | sed -e 's/build_gamedata_directory//' | sed -e 's/ //g' | sed -e 's/=//g' | sed -e 's&\/&\\\&g'` +dir_gamedata_maxscript=`cat ../../cfg/site.cfg | grep "build_gamedata_directory" | sed -e 's/build_gamedata_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the bank filename +bank_filename=`cat ../../cfg/properties.cfg | grep "bank_name" | sed -e 's/bank_name//' | sed -e 's/ //g' | sed -e 's/=//g' | sed -e 's/"//g' | sed -e 's/;//g'` +bankfar_filename=`cat ../../cfg/properties.cfg | grep "bankfar_name" | sed -e 's/bankfar_name//' | sed -e 's/ //g' | sed -e 's/=//g' | sed -e 's/"//g' | sed -e 's/;//g'` + +# Copy the bank file +cp $bank_filename smallbank/ligo.smallbank 2>> log.log +cp $bankfar_filename smallbank/ligo.farbank 2>> log.log + +# Maxdir +max_directory=`echo $MAX_DIR | sed -e 's&\\\&/&g'` + +# delete ini file + +rm $max_directory/plugcfg/nelligo.ini +# echo "$max_directory/plugcfg/nelligo.ini" >> log.log + +# create the ini file + +echo "[LigoConfig]" > $max_directory/plugcfg/nelligo.ini + +# copy the ligo export script +cat maxscript/nel_ligo_export.ms | sed -e "s&output_directory_tag&$dir_gamedata_maxscript/processes/ligo/tag&g" | sed -e "s&output_logfile&$dir_gamedata_maxscript/processes/ligo/log.log&g" | sed -e "s&bankFilename&$dir_gamedata_maxscript/processes/ligo/smallbank/ligo.smallbank&g" > $max_directory/scripts/nel_ligo_export.ms + +dir_database=`cat ../../cfg/site.cfg | grep "database_directory" | sed -e 's/database_directory//' | sed -e 's/ //g' | sed -e 's/=//g' | sed -e 's&\/&\\\&g'` +dir_ligosrc=`cat ../../cfg/directories.cfg | grep "ligo_source_directory" | sed -e 's/ligo_source_directory//' | sed -e 's/ //g' | sed -e 's/=//g' | sed -e 's&\/&\\\&g'` + +echo "LigoPath=$dir_database\\$dir_ligosrc\\max\\" >> $max_directory/plugcfg/nelligo.ini +#echo "LigoExportPath=$dir_database\\$dir_ligosrc\\" >> $max_directory/plugcfg/nelligo.ini + +echo "LigoExportPath=$dir_gamedata\\processes\\ligo\\" >> $max_directory/plugcfg/nelligo.ini + +# export only if no .land set + +land_name=`cat ../../cfg/config.cfg | grep "ligo_export_land" | sed -e 's/ligo_export_land//' | sed -e 's/ //g' | sed -e 's/=//g'` +ligo_export_one_pass=`cat ../../cfg/config.cfg | grep "ligo_export_one_pass" | sed -e 's/ligo_export_one_pass//' | sed -e 's/ //g' | sed -e 's/=//g' | sed -e 's/"//g' | sed -e 's/;//g'` + +if [ -z "$land_name" -o "$ligo_export_one_pass" == "1" ] ; then + echo Try 1 >> log.log + $exec_timeout $timeout $max_directory/3dsmax.exe -U MAXScript nel_ligo_export.ms -q -mi -vn + + echo Try 2 >> log.log + $exec_timeout $timeout $max_directory/3dsmax.exe -U MAXScript nel_ligo_export.ms -q -mi -vn + + echo Try 3 >> log.log + $exec_timeout $timeout $max_directory/3dsmax.exe -U MAXScript nel_ligo_export.ms -q -mi -vn +fi diff --git a/nel/tools/3d/build_gamedata/processes/map/sh/build.sh b/nel/tools/3d/build_gamedata/processes/map/sh/build.sh index 626767ac57..1c57da67eb 100644 --- a/nel/tools/3d/build_gamedata/processes/map/sh/build.sh +++ b/nel/tools/3d/build_gamedata/processes/map/sh/build.sh @@ -1,140 +1,140 @@ -#!/bin/bash -rm log.log 2> /dev/null - -# *** Build map files (.tga / .dds) - -# Bin -tga_2_dds='tga2dds.exe' - -# Log error -echo ------- > log.log -echo --- Build map >> log.log -echo ------- >> log.log -echo ------- -echo --- Build map -echo ------- -date >> log.log -date - - -#*** Build panoply files (.tga / .dds), and copy the result in the tga directory - -# Copy panoply containt into cache if the process as been stopped before the end of build. -echo Copy panoply into cache -cp -u -p -R panoply/. cache 2>> log.log -echo Remove panoply directory -rm -r panoply 2>> log.log -echo Copy hlsinfo into cache -cp -u -p -R hlsinfo/. cache 2>> log.log -echo Remove hlsinfo directory -rm -r hlsinfo 2>> log.log - -mkdir panoply -mkdir hlsinfo - -# Bin -panoply_maker='panoply_maker.exe' - -# Log error -echo ------- > log.log -echo --- Build panoply >> log.log -echo ------- >> log.log -echo ------- -echo --- Build panoply -echo ------- -date >> log.log -date - -database_directory=`cat ../../cfg/site.cfg | grep "database_directory" | sed -e 's/database_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Reduce bitmap size factor -reduce_bitmap_factor=`cat ../../cfg/config.cfg | grep "reduce_bitmap_factor" | sed -e 's/reduce_bitmap_factor//' | sed -e 's/ //g' | sed -e 's/=//g'` - -panoply_file_list=`cat ../../cfg/config.cfg | grep "panoply_file_list" | sed -e 's/panoply_file_list//' | sed -e 's/ //g' | sed -e 's/=//g'` -if test "$panoply_file_list" ; then - rm $panoply_file_list - panoply_config_file=`cat ../../cfg/directories.cfg | grep "panoply_config_file" | sed -e 's/panoply_config_file//' | sed -e 's/ //g' | sed -e 's/=//g'` - for psource in $panoply_config_file ; do - cp $database_directory/$psource current_panoply.cfg - echo "output_path=\"panoply\";" >> current_panoply.cfg - echo "cache_path=\"cache\";" >> current_panoply.cfg - panoply_maker.exe current_panoply.cfg - - # Idle - ../../idle.bat - done - ls panoply >> $panoply_file_list -fi - -# For each directoy -for i in tga/*.[tT][gG][aA] ; do - - # Destination file - dest=`echo $i | sed -e 's/[tT][gG][aA]/dds/' | sed -e 's/\.[tT][gG][aA]/.dds/g'` - dds=`echo $i | sed -e 's/\.[tT][gG][aA]/.dds/g'` - - # Convert the lightmap in 16 bits mode - if ( ! test -e $dest ) || ( test $i -nt $dest ) - then - # Copy the dds file - if (test -f $dds) - then - cp $dds $dest - fi - - # Convert - $tga_2_dds $i -o $dest -m -r$reduce_bitmap_factor 2>> log.log - fi - - # Idle - ../../idle.bat -done - -for i in panoply/*.[tT][gG][aA] ; do - - # Destination file - dest=`echo $i | sed -e 's%panoply/%dds/%g' | sed -e 's/[tT][gG][aA]/dds/g'` - dds=`echo $i | sed -e 's/\.[tT][gG][aA]/.dds/g'` - - # Convert the lightmap in 16 bits mode - if ( ! test -e $dest ) || ( test $i -nt $dest ) - then - # Copy the dds file - if (test -f $dds) - then - cp $dds $dest - fi - - # Convert - $tga_2_dds $i -o $dest -m -r$reduce_bitmap_factor 2>> log.log - fi - - # Idle - ../../idle.bat -done - - -# Bin -hls_bank_maker='hls_bank_maker.exe' - -# build the HLSBank (if hlsInfo present, and if build wanted) -hls_bank_file_name=`cat ../../cfg/config.cfg | grep "hls_bank_file_name" | sed -e 's/hls_bank_file_name//' | sed -e 's/ //g' | sed -e 's/=//g'` -if test "$hls_bank_file_name" ; then - rm $hls_bank_file_name - $hls_bank_maker hlsinfo $hls_bank_file_name -fi - - -# Put old panoply in cache - -echo Remove the panoply cache -rm -r cache 2>> log.log - -echo Rename panoply as cache -mv panoply cache 2>> log.log - -echo Move hlsinfo into cache -cp -u -p -R hlsinfo/. cache 2>> log.log - -echo Remove the hlsinfo -rm -r hlsinfo 2>> log.log +#!/bin/bash +rm log.log 2> /dev/null + +# *** Build map files (.tga / .dds) + +# Bin +tga_2_dds='tga2dds.exe' + +# Log error +echo ------- > log.log +echo --- Build map >> log.log +echo ------- >> log.log +echo ------- +echo --- Build map +echo ------- +date >> log.log +date + + +#*** Build panoply files (.tga / .dds), and copy the result in the tga directory + +# Copy panoply containt into cache if the process as been stopped before the end of build. +echo Copy panoply into cache +cp -u -p -R panoply/. cache 2>> log.log +echo Remove panoply directory +rm -r panoply 2>> log.log +echo Copy hlsinfo into cache +cp -u -p -R hlsinfo/. cache 2>> log.log +echo Remove hlsinfo directory +rm -r hlsinfo 2>> log.log + +mkdir panoply +mkdir hlsinfo + +# Bin +panoply_maker='panoply_maker.exe' + +# Log error +echo ------- > log.log +echo --- Build panoply >> log.log +echo ------- >> log.log +echo ------- +echo --- Build panoply +echo ------- +date >> log.log +date + +database_directory=`cat ../../cfg/site.cfg | grep "database_directory" | sed -e 's/database_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Reduce bitmap size factor +reduce_bitmap_factor=`cat ../../cfg/config.cfg | grep "reduce_bitmap_factor" | sed -e 's/reduce_bitmap_factor//' | sed -e 's/ //g' | sed -e 's/=//g'` + +panoply_file_list=`cat ../../cfg/config.cfg | grep "panoply_file_list" | sed -e 's/panoply_file_list//' | sed -e 's/ //g' | sed -e 's/=//g'` +if test "$panoply_file_list" ; then + rm $panoply_file_list + panoply_config_file=`cat ../../cfg/directories.cfg | grep "panoply_config_file" | sed -e 's/panoply_config_file//' | sed -e 's/ //g' | sed -e 's/=//g'` + for psource in $panoply_config_file ; do + cp $database_directory/$psource current_panoply.cfg + echo "output_path=\"panoply\";" >> current_panoply.cfg + echo "cache_path=\"cache\";" >> current_panoply.cfg + panoply_maker.exe current_panoply.cfg + + # Idle + ../../idle.bat + done + ls panoply >> $panoply_file_list +fi + +# For each directoy +for i in tga/*.[tT][gG][aA] ; do + + # Destination file + dest=`echo $i | sed -e 's/[tT][gG][aA]/dds/' | sed -e 's/\.[tT][gG][aA]/.dds/g'` + dds=`echo $i | sed -e 's/\.[tT][gG][aA]/.dds/g'` + + # Convert the lightmap in 16 bits mode + if ( ! test -e $dest ) || ( test $i -nt $dest ) + then + # Copy the dds file + if (test -f $dds) + then + cp $dds $dest + fi + + # Convert + $tga_2_dds $i -o $dest -m -r$reduce_bitmap_factor 2>> log.log + fi + + # Idle + ../../idle.bat +done + +for i in panoply/*.[tT][gG][aA] ; do + + # Destination file + dest=`echo $i | sed -e 's%panoply/%dds/%g' | sed -e 's/[tT][gG][aA]/dds/g'` + dds=`echo $i | sed -e 's/\.[tT][gG][aA]/.dds/g'` + + # Convert the lightmap in 16 bits mode + if ( ! test -e $dest ) || ( test $i -nt $dest ) + then + # Copy the dds file + if (test -f $dds) + then + cp $dds $dest + fi + + # Convert + $tga_2_dds $i -o $dest -m -r$reduce_bitmap_factor 2>> log.log + fi + + # Idle + ../../idle.bat +done + + +# Bin +hls_bank_maker='hls_bank_maker.exe' + +# build the HLSBank (if hlsInfo present, and if build wanted) +hls_bank_file_name=`cat ../../cfg/config.cfg | grep "hls_bank_file_name" | sed -e 's/hls_bank_file_name//' | sed -e 's/ //g' | sed -e 's/=//g'` +if test "$hls_bank_file_name" ; then + rm $hls_bank_file_name + $hls_bank_maker hlsinfo $hls_bank_file_name +fi + + +# Put old panoply in cache + +echo Remove the panoply cache +rm -r cache 2>> log.log + +echo Rename panoply as cache +mv panoply cache 2>> log.log + +echo Move hlsinfo into cache +cp -u -p -R hlsinfo/. cache 2>> log.log + +echo Remove the hlsinfo +rm -r hlsinfo 2>> log.log diff --git a/nel/tools/3d/build_gamedata/processes/map/sh/export.sh b/nel/tools/3d/build_gamedata/processes/map/sh/export.sh index e66432f113..116cbb083e 100644 --- a/nel/tools/3d/build_gamedata/processes/map/sh/export.sh +++ b/nel/tools/3d/build_gamedata/processes/map/sh/export.sh @@ -1,57 +1,57 @@ -#!/bin/bash -rm log.log 2> /dev/null - -# *** Export maps files (.tga / *.[dD][dD][sS]) from the database - -# Get the database directory -database_directory=`cat ../../cfg/site.cfg | grep "database_directory" | sed -e 's/database_directory//g' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the maps directories -map_source_directories=`cat ../../cfg/directories.cfg | grep "map_source_directory" | sed -e 's/map_source_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` -map_uncompressed_source_directories=`cat ../../cfg/directories.cfg | grep "map_uncompressed_source_directory" | sed -e 's/map_uncompressed_source_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - - -# Log error -echo ------- > log.log -echo --- Export map >> log.log -echo ------- >> log.log -echo ------- -echo --- Export map -echo ------- -date >> log.log -date - -# For each directoy - -for i in $map_source_directories; do - for j in $database_directory/$i/*.[tT][gG][aA]; do - if ( test -f $j ) - then - # Get the dds version - dds=`echo $j | sed -e 's&.tga&.dds&g'` - - # Copy the dds and the tga - cp -u -p $j tga 2>> log.log - if ( test -f $dds ) - then - cp -u -p $dds tga 2>> log.log - fi - fi - done - # Idle - ../../idle.bat -done - -for i in $map_uncompressed_source_directories; do - for j in $database_directory/$i/*.[tT][gG][aA]; do - if ( test -f $j ) - then - # Copy the dds and the tga - cp -u -p $j tga_uncompressed 2>> log.log - fi - done - # Idle - ../../idle.bat -done - - +#!/bin/bash +rm log.log 2> /dev/null + +# *** Export maps files (.tga / *.[dD][dD][sS]) from the database + +# Get the database directory +database_directory=`cat ../../cfg/site.cfg | grep "database_directory" | sed -e 's/database_directory//g' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the maps directories +map_source_directories=`cat ../../cfg/directories.cfg | grep "map_source_directory" | sed -e 's/map_source_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` +map_uncompressed_source_directories=`cat ../../cfg/directories.cfg | grep "map_uncompressed_source_directory" | sed -e 's/map_uncompressed_source_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + + +# Log error +echo ------- > log.log +echo --- Export map >> log.log +echo ------- >> log.log +echo ------- +echo --- Export map +echo ------- +date >> log.log +date + +# For each directoy + +for i in $map_source_directories; do + for j in $database_directory/$i/*.[tT][gG][aA]; do + if ( test -f $j ) + then + # Get the dds version + dds=`echo $j | sed -e 's&.tga&.dds&g'` + + # Copy the dds and the tga + cp -u -p $j tga 2>> log.log + if ( test -f $dds ) + then + cp -u -p $dds tga 2>> log.log + fi + fi + done + # Idle + ../../idle.bat +done + +for i in $map_uncompressed_source_directories; do + for j in $database_directory/$i/*.[tT][gG][aA]; do + if ( test -f $j ) + then + # Copy the dds and the tga + cp -u -p $j tga_uncompressed 2>> log.log + fi + done + # Idle + ../../idle.bat +done + + diff --git a/nel/tools/3d/build_gamedata/processes/map/sh/install.sh b/nel/tools/3d/build_gamedata/processes/map/sh/install.sh index 434563d2fb..51bbc97e8a 100644 --- a/nel/tools/3d/build_gamedata/processes/map/sh/install.sh +++ b/nel/tools/3d/build_gamedata/processes/map/sh/install.sh @@ -1,55 +1,55 @@ -#!/bin/bash -rm log.log 2> /dev/null - -# Install maps in the client data - -# Get the skel install directory -bitmap_install_directory=`cat ../../cfg/directories.cfg | grep "bitmap_install_directory" | sed -e 's/bitmap_install_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the client directory -client_directory=`cat ../../cfg/site.cfg | grep "client_directory" | sed -e 's/client_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the database directory -database_directory=`cat ../../cfg/site.cfg | grep "database_directory" | sed -e 's/database_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Log error -echo ------- > log.log -echo --- Install maps >> log.log -echo ------- >> log.log -echo ------- -echo --- Install maps -echo ------- -date >> log.log -date - -cp -u -p -R dds/. $client_directory/$bitmap_install_directory 2>> log.log -cp -u -p -R tga_uncompressed/. $client_directory/$bitmap_install_directory 2>> log.log - -panoply_file_list=`cat ../../cfg/config.cfg | grep "panoply_file_list" | sed -e 's/panoply_file_list//' | sed -e 's/ //g' | sed -e 's/=//g'` -if test "$panoply_file_list" ; then - cp -u -p $panoply_file_list $client_directory/$bitmap_install_directory 2>> log.log - panoply_config_file=`cat ../../cfg/directories.cfg | grep "panoply_config_file" | sed -e 's/panoply_config_file//' | sed -e 's/ //g' | sed -e 's/=//g'` - for psource in $panoply_config_file ; do - cp $database_directory/$psource $client_directory/$bitmap_install_directory/panoply.cfg - done - ls panoply >> $panoply_file_list -fi - - -# Install hlsbank in the client data, in the "maps/" directory - -# Log error -echo --- Install hlsbank >> log.log -echo ------- >> log.log -echo ------- -echo --- Install hlsbank -echo ------- -date >> log.log -date - -# build the HLSBank (if hlsInfo present, and if build wanted) -hls_bank_file_name=`cat ../../cfg/config.cfg | grep "hls_bank_file_name" | sed -e 's/hls_bank_file_name//' | sed -e 's/ //g' | sed -e 's/=//g'` -if test "$hls_bank_file_name" ; then - cp -u -p -R $hls_bank_file_name $client_directory/$bitmap_install_directory 2>> log.log -fi - +#!/bin/bash +rm log.log 2> /dev/null + +# Install maps in the client data + +# Get the skel install directory +bitmap_install_directory=`cat ../../cfg/directories.cfg | grep "bitmap_install_directory" | sed -e 's/bitmap_install_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the client directory +client_directory=`cat ../../cfg/site.cfg | grep "client_directory" | sed -e 's/client_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the database directory +database_directory=`cat ../../cfg/site.cfg | grep "database_directory" | sed -e 's/database_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Log error +echo ------- > log.log +echo --- Install maps >> log.log +echo ------- >> log.log +echo ------- +echo --- Install maps +echo ------- +date >> log.log +date + +cp -u -p -R dds/. $client_directory/$bitmap_install_directory 2>> log.log +cp -u -p -R tga_uncompressed/. $client_directory/$bitmap_install_directory 2>> log.log + +panoply_file_list=`cat ../../cfg/config.cfg | grep "panoply_file_list" | sed -e 's/panoply_file_list//' | sed -e 's/ //g' | sed -e 's/=//g'` +if test "$panoply_file_list" ; then + cp -u -p $panoply_file_list $client_directory/$bitmap_install_directory 2>> log.log + panoply_config_file=`cat ../../cfg/directories.cfg | grep "panoply_config_file" | sed -e 's/panoply_config_file//' | sed -e 's/ //g' | sed -e 's/=//g'` + for psource in $panoply_config_file ; do + cp $database_directory/$psource $client_directory/$bitmap_install_directory/panoply.cfg + done + ls panoply >> $panoply_file_list +fi + + +# Install hlsbank in the client data, in the "maps/" directory + +# Log error +echo --- Install hlsbank >> log.log +echo ------- >> log.log +echo ------- +echo --- Install hlsbank +echo ------- +date >> log.log +date + +# build the HLSBank (if hlsInfo present, and if build wanted) +hls_bank_file_name=`cat ../../cfg/config.cfg | grep "hls_bank_file_name" | sed -e 's/hls_bank_file_name//' | sed -e 's/ //g' | sed -e 's/=//g'` +if test "$hls_bank_file_name" ; then + cp -u -p -R $hls_bank_file_name $client_directory/$bitmap_install_directory 2>> log.log +fi + diff --git a/nel/tools/3d/build_gamedata/processes/pacs_prim/sh/export.sh b/nel/tools/3d/build_gamedata/processes/pacs_prim/sh/export.sh index e4bdd3c3b3..f234588a4f 100644 --- a/nel/tools/3d/build_gamedata/processes/pacs_prim/sh/export.sh +++ b/nel/tools/3d/build_gamedata/processes/pacs_prim/sh/export.sh @@ -1,59 +1,59 @@ -#!/bin/bash -rm log.log 2> /dev/null - -# *** Export pacs_prim files (.pacs_prim) from Max - -exec_timeout='exec_timeout.exe' - -# Get the timeout -timeout=`cat ../../cfg/config.cfg | grep "pacs_prim_export_timeout" | sed -e 's/pacs_prim_export_timeout//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the database directory -database_directory=`cat ../../cfg/site.cfg | grep "database_directory" | sed -e 's/database_directory//g' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the build gamedata directory -build_gamedata_directory=`cat ../../cfg/site.cfg | grep "build_gamedata_directory" | sed -e 's/build_gamedata_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the collision directories -pacs_prim_source_directories=`cat ../../cfg/directories.cfg | grep "pacs_prim_source_directories" | sed -e 's/pacs_prim_source_directories//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Maxdir -max_directory=`echo $MAX_DIR | sed -e 's&\\\&/&g'` - -# Log error -echo ------- > log.log -echo --- Export pacs_prim for pacs_prim >> log.log -echo ------- >> log.log -echo ------- -echo --- Export pacs_prim for pacs_prim -echo ------- -date >> log.log -date - -# For each directoy - -for i in $pacs_prim_source_directories ; do - # Copy the script - cat maxscript/pacs_prim_export.ms | sed -e "s&output_logfile&$build_gamedata_directory/processes/pacs_prim/log.log&g" | sed -e "s&pacs_prim_source_directory&$database_directory/$i&g" | sed -e "s&output_directory&$build_gamedata_directory/processes/pacs_prim/pacs_prim&g" > $max_directory/scripts/pacs_prim_export.ms - - # Start max - echo Try 1 >> log.log - $exec_timeout $timeout $max_directory/3dsmax.exe -U MAXScript pacs_prim_export.ms -q -mi -vn - - # Idle - ../../idle.bat - - echo Try 2 >> log.log - $exec_timeout $timeout $max_directory/3dsmax.exe -U MAXScript pacs_prim_export.ms -q -mi -vn - - # Idle - ../../idle.bat - - echo Try 3 >> log.log - $exec_timeout $timeout $max_directory/3dsmax.exe -U MAXScript pacs_prim_export.ms -q -mi -vn - - # Idle - ../../idle.bat -done - -rm landscape_col_prim_pacs_list.txt +#!/bin/bash +rm log.log 2> /dev/null + +# *** Export pacs_prim files (.pacs_prim) from Max + +exec_timeout='exec_timeout.exe' + +# Get the timeout +timeout=`cat ../../cfg/config.cfg | grep "pacs_prim_export_timeout" | sed -e 's/pacs_prim_export_timeout//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the database directory +database_directory=`cat ../../cfg/site.cfg | grep "database_directory" | sed -e 's/database_directory//g' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the build gamedata directory +build_gamedata_directory=`cat ../../cfg/site.cfg | grep "build_gamedata_directory" | sed -e 's/build_gamedata_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the collision directories +pacs_prim_source_directories=`cat ../../cfg/directories.cfg | grep "pacs_prim_source_directories" | sed -e 's/pacs_prim_source_directories//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Maxdir +max_directory=`echo $MAX_DIR | sed -e 's&\\\&/&g'` + +# Log error +echo ------- > log.log +echo --- Export pacs_prim for pacs_prim >> log.log +echo ------- >> log.log +echo ------- +echo --- Export pacs_prim for pacs_prim +echo ------- +date >> log.log +date + +# For each directoy + +for i in $pacs_prim_source_directories ; do + # Copy the script + cat maxscript/pacs_prim_export.ms | sed -e "s&output_logfile&$build_gamedata_directory/processes/pacs_prim/log.log&g" | sed -e "s&pacs_prim_source_directory&$database_directory/$i&g" | sed -e "s&output_directory&$build_gamedata_directory/processes/pacs_prim/pacs_prim&g" > $max_directory/scripts/pacs_prim_export.ms + + # Start max + echo Try 1 >> log.log + $exec_timeout $timeout $max_directory/3dsmax.exe -U MAXScript pacs_prim_export.ms -q -mi -vn + + # Idle + ../../idle.bat + + echo Try 2 >> log.log + $exec_timeout $timeout $max_directory/3dsmax.exe -U MAXScript pacs_prim_export.ms -q -mi -vn + + # Idle + ../../idle.bat + + echo Try 3 >> log.log + $exec_timeout $timeout $max_directory/3dsmax.exe -U MAXScript pacs_prim_export.ms -q -mi -vn + + # Idle + ../../idle.bat +done + +rm landscape_col_prim_pacs_list.txt diff --git a/nel/tools/3d/build_gamedata/processes/pacs_prim/sh/install.sh b/nel/tools/3d/build_gamedata/processes/pacs_prim/sh/install.sh index 5aee55fb92..bcfea1aff5 100644 --- a/nel/tools/3d/build_gamedata/processes/pacs_prim/sh/install.sh +++ b/nel/tools/3d/build_gamedata/processes/pacs_prim/sh/install.sh @@ -1,30 +1,30 @@ -#!/bin/bash -rm log.log 2> /dev/null - -# Install the zonels in the client data - -# Get the zone install directory -pacs_primitive_install_directory=`cat ../../cfg/directories.cfg | grep "pacs_primitive_install_directory" | sed -e 's/pacs_primitive_install_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the client directory -client_directory=`cat ../../cfg/site.cfg | grep "client_directory" | sed -e 's/client_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Test if there is a need for the prim pacs directory -want_landscape_col_prim_pacs_list=`cat ../../cfg/config.cfg | grep "want_landscape_col_prim_pacs_list"` - -# Log error -echo ------- > log.log -echo --- Install zone >> log.log -echo ------- >> log.log -echo ------- -echo --- Install zone -echo ------- -date >> log.log -date - -cp -u -p -R pacs_prim/. $client_directory/$pacs_primitive_install_directory 2>> log.log - -if test "$want_landscape_col_prim_pacs_list" ; then - ls pacs_prim | grep ".pacs_prim" >> $client_directory/landscape_col_prim_pacs_list.txt -fi - +#!/bin/bash +rm log.log 2> /dev/null + +# Install the zonels in the client data + +# Get the zone install directory +pacs_primitive_install_directory=`cat ../../cfg/directories.cfg | grep "pacs_primitive_install_directory" | sed -e 's/pacs_primitive_install_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the client directory +client_directory=`cat ../../cfg/site.cfg | grep "client_directory" | sed -e 's/client_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Test if there is a need for the prim pacs directory +want_landscape_col_prim_pacs_list=`cat ../../cfg/config.cfg | grep "want_landscape_col_prim_pacs_list"` + +# Log error +echo ------- > log.log +echo --- Install zone >> log.log +echo ------- >> log.log +echo ------- +echo --- Install zone +echo ------- +date >> log.log +date + +cp -u -p -R pacs_prim/. $client_directory/$pacs_primitive_install_directory 2>> log.log + +if test "$want_landscape_col_prim_pacs_list" ; then + ls pacs_prim | grep ".pacs_prim" >> $client_directory/landscape_col_prim_pacs_list.txt +fi + diff --git a/nel/tools/3d/build_gamedata/processes/ps/sh/export.sh b/nel/tools/3d/build_gamedata/processes/ps/sh/export.sh index c1699a6257..94d490c2e2 100644 --- a/nel/tools/3d/build_gamedata/processes/ps/sh/export.sh +++ b/nel/tools/3d/build_gamedata/processes/ps/sh/export.sh @@ -1,31 +1,31 @@ -#!/bin/bash -rm log.log 2> /dev/null - -# *** Export particle system file (.ps) - -# Get the database directory -database_directory=`cat ../../cfg/site.cfg | grep "database_directory" | sed -e 's/database_directory//g' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the ps directories -ps_source_directories=`cat ../../cfg/directories.cfg | grep "ps_source_directory" | sed -e 's/ps_source_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Log error -echo ------- > log.log -echo --- Export ps >> log.log -echo ------- >> log.log -echo ------- -echo --- Export ps -echo ------- -date >> log.log -date - -# For each ps directory -for i in $ps_source_directories ; do - # Copy - cp -u -p $database_directory/$i/*.[pP][sS] ps 2>> log.log - cp -u -p $database_directory/$i/*.[sS][hH][aA][pP][eE] ps 2>> log.log - cp -u -p $database_directory/$i/*.[pP][rR][iI][mM][iI][tT][iI][vV][eE] ps 2>> log.log - - # Idle - ../../idle.bat -done +#!/bin/bash +rm log.log 2> /dev/null + +# *** Export particle system file (.ps) + +# Get the database directory +database_directory=`cat ../../cfg/site.cfg | grep "database_directory" | sed -e 's/database_directory//g' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the ps directories +ps_source_directories=`cat ../../cfg/directories.cfg | grep "ps_source_directory" | sed -e 's/ps_source_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Log error +echo ------- > log.log +echo --- Export ps >> log.log +echo ------- >> log.log +echo ------- +echo --- Export ps +echo ------- +date >> log.log +date + +# For each ps directory +for i in $ps_source_directories ; do + # Copy + cp -u -p $database_directory/$i/*.[pP][sS] ps 2>> log.log + cp -u -p $database_directory/$i/*.[sS][hH][aA][pP][eE] ps 2>> log.log + cp -u -p $database_directory/$i/*.[pP][rR][iI][mM][iI][tT][iI][vV][eE] ps 2>> log.log + + # Idle + ../../idle.bat +done diff --git a/nel/tools/3d/build_gamedata/processes/ps/sh/install.sh b/nel/tools/3d/build_gamedata/processes/ps/sh/install.sh index 9ab0cfad02..171b7c72d3 100644 --- a/nel/tools/3d/build_gamedata/processes/ps/sh/install.sh +++ b/nel/tools/3d/build_gamedata/processes/ps/sh/install.sh @@ -1,22 +1,22 @@ -#!/bin/bash -rm log.log 2> /dev/null - -# Install the particule system in the client data - -# Get the ps install directory -ps_install_directory=`cat ../../cfg/directories.cfg | grep "ps_install_directory" | sed -e 's/ps_install_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the client directory -client_directory=`cat ../../cfg/site.cfg | grep "client_directory" | sed -e 's/client_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Log error -echo ------- > log.log -echo --- Install ps >> log.log -echo ------- >> log.log -echo ------- -echo --- Install ps -echo ------- -date >> log.log -date - -cp -u -p -R ps/. $client_directory/$ps_install_directory 2>> log.log +#!/bin/bash +rm log.log 2> /dev/null + +# Install the particule system in the client data + +# Get the ps install directory +ps_install_directory=`cat ../../cfg/directories.cfg | grep "ps_install_directory" | sed -e 's/ps_install_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the client directory +client_directory=`cat ../../cfg/site.cfg | grep "client_directory" | sed -e 's/client_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Log error +echo ------- > log.log +echo --- Install ps >> log.log +echo ------- >> log.log +echo ------- +echo --- Install ps +echo ------- +date >> log.log +date + +cp -u -p -R ps/. $client_directory/$ps_install_directory 2>> log.log diff --git a/nel/tools/3d/build_gamedata/processes/rbank/sh/build.sh b/nel/tools/3d/build_gamedata/processes/rbank/sh/build.sh index 1ba877899d..26abaa796b 100644 --- a/nel/tools/3d/build_gamedata/processes/rbank/sh/build.sh +++ b/nel/tools/3d/build_gamedata/processes/rbank/sh/build.sh @@ -1,358 +1,358 @@ -#!/bin/bash -rm log.log 2> /dev/null - -# Build zone - -build_rbank='build_rbank.exe' -build_indoor_rbank='build_indoor_rbank.exe' -build_ig_boxes='build_ig_boxes.exe' -ai_build_wmap='ai_build_wmap_r.exe' -get_neighbors='get_neighbors.exe' -exec_timeout='exec_timeout.exe' - -# Get the timeout -tessel_timeout=`cat ../../cfg/config.cfg | grep "rbank_build_tessel_timeout" | sed -e 's/rbank_build_tessel_timeout//' | sed -e 's/ //g' | sed -e 's/=//g'` -smooth_timeout=`cat ../../cfg/config.cfg | grep "rbank_build_smooth_timeout" | sed -e 's/rbank_build_smooth_timeout//' | sed -e 's/ //g' | sed -e 's/=//g'` -proclocal_timeout=`cat ../../cfg/config.cfg | grep "rbank_build_proclocal_timeout" | sed -e 's/rbank_build_proclocal_timeout//' | sed -e 's/ //g' | sed -e 's/=//g'` -procglobal_timeout=`cat ../../cfg/config.cfg | grep "rbank_build_procglobal_timeout" | sed -e 's/rbank_build_procglobal_timeout//' | sed -e 's/ //g' | sed -e 's/=//g'` -indoor_timeout=`cat ../../cfg/config.cfg | grep "rbank_build_indoor_timeout" | sed -e 's/rbank_build_indoor_timeout//' | sed -e 's/ //g' | sed -e 's/=//g'` -build_wmap_timeout=`cat ../../cfg/config.cfg | grep "build_wmap_timeout" | sed -e 's/build_wmap_timeout//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the quality option to choose the goor properties.cfg file -quality_flag=`cat ../../cfg/site.cfg | grep "build_quality" | grep "1"` - -# **** Copy ig and shapes - -# Log error -echo >> log.log -echo ------- > log.log -echo --- Generate config script >> log.log -echo ------- >> log.log -echo >> log.log -echo -echo ------- -echo --- Generate config script -echo ------- -echo -date >> log.log -date - -# Get arguments -rbank_bank_name=`cat ../../cfg/properties.cfg | grep "bank_name" | sed -e 's/bank_name//' | sed -e 's/ //g' | sed -e 's/=//g' | sed -e 's/"//g' | sed -e 's/;//g'` -rbank_reduce_surfaces=`cat ../../cfg/config.cfg | grep "rbank_reduce_surfaces" | sed -e 's/rbank_reduce_surfaces//' | sed -e 's/ //g' | sed -e 's/=//g'` -rbank_smooth_borders=`cat ../../cfg/config.cfg | grep "rbank_smooth_borders" | sed -e 's/rbank_smooth_borders//' | sed -e 's/ //g' | sed -e 's/=//g'` -rbank_compute_elevation=`cat ../../cfg/config.cfg | grep "rbank_compute_elevation" | sed -e 's/rbank_compute_elevation//' | sed -e 's/ //g' | sed -e 's/=//g'` -rbank_compute_levels=`cat ../../cfg/config.cfg | grep "rbank_compute_levels" | sed -e 's/rbank_compute_levels//' | sed -e 's/ //g' | sed -e 's/=//g'` -rbank_link_elements=`cat ../../cfg/config.cfg | grep "rbank_link_elements" | sed -e 's/rbank_link_elements//' | sed -e 's/ //g' | sed -e 's/=//g'` -rbank_cut_edges=`cat ../../cfg/config.cfg | grep "rbank_cut_edges" | sed -e 's/rbank_cut_edges//' | sed -e 's/ //g' | sed -e 's/=//g'` -rbank_use_zone_square=`cat ../../cfg/config.cfg | grep "rbank_use_zone_square" | sed -e 's/rbank_use_zone_square//' | sed -e 's/ //g' | sed -e 's/=//g'` -rbank_zone_ul=`cat ../../cfg/config.cfg | grep "rbank_zone_ul" | sed -e 's/rbank_zone_ul//' | sed -e 's/ //g' | sed -e 's/=//g'` -rbank_zone_dr=`cat ../../cfg/config.cfg | grep "rbank_zone_dr" | sed -e 's/rbank_zone_dr//' | sed -e 's/ //g' | sed -e 's/=//g'` -rbank_rbank_name=`cat ../../cfg/config.cfg | grep "rbank_rbank_name" | sed -e 's/rbank_rbank_name//' | sed -e 's/ //g' | sed -e 's/=//g'` -rbank_ig_pathes=`cat ../../cfg/config.cfg | grep "rbank_ig_path" | sed -e 's/rbank_ig_path//' | sed -e 's/ //g' | sed -e 's/=//g'` -rbank_shape_pathes=`cat ../../cfg/config.cfg | grep "rbank_shape_path" | sed -e 's/rbank_shape_path//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Global options -build_gamedata_directory=`cat ../../cfg/site.cfg | grep "build_gamedata_directory" | sed -e 's/build_gamedata_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Log error -echo >> log.log -echo ------- >> log.log -echo --- Build RBank : Build the bbox file >> log.log -echo ------- >> log.log -echo >> log.log -echo -echo ------- -echo --- Build RBank : Build the bbox file -echo ------- -echo -date >> log.log -date - -# ***** Build the bbox file - -# Remove the config file -rm build_ig_boxes.cfg - -# List ig pathes -echo Pathes = \{ >> build_ig_boxes.cfg -for i in $rbank_ig_pathes ; do - echo \"$i\"\, >> build_ig_boxes.cfg -done -for i in $rbank_shape_pathes ; do - echo \"$i\"\, >> build_ig_boxes.cfg -done -echo \}\; >> build_ig_boxes.cfg - -# List igs -echo IGs = \{ >> build_ig_boxes.cfg -for i in $rbank_ig_pathes ; do - cd $i - list_ig=`ls -1 *.[iI][gG]` - cd $build_gamedata_directory"/processes/rbank" - for j in $list_ig ; do - n=`echo $j | sed -e 's/.ig//'` - echo \"$n\"\, >> build_ig_boxes.cfg - done - - # Idle - ../../idle.bat -done -echo \}\; >> build_ig_boxes.cfg -echo Output = \"bbox/temp.bbox\"\; >> build_ig_boxes.cfg - -# -- NOT NEEDED ANYMORE -$build_ig_boxes - -# ***** Build the rbank, gr files - -# Copy the good template file -if ( test "$quality_flag" ) -then - # We are in BEST mode - `cat cfg/template_final.cfg | sed -e "s&rbank_bank_name&$rbank_bank_name&g" | sed -e "s&rbank_reduce_surfaces&$rbank_reduce_surfaces&g" | sed -e "s&rbank_smooth_borders&$rbank_smooth_borders&g" | sed -e "s&rbank_compute_elevation&$rbank_compute_elevation&g" | sed -e "s&rbank_compute_levels&$rbank_compute_levels&g" | sed -e "s&rbank_link_elements&$rbank_link_elements&g" | sed -e "s&rbank_cut_edges&$rbank_cut_edges&g" | sed -e "s&rbank_use_zone_square&$rbank_use_zone_square&g" | sed -e "s&rbank_zone_ul&$rbank_zone_ul&g" | sed -e "s&rbank_zone_dr&$rbank_zone_dr&g" > build_rbank.cfg` -else - # We are in DRAFT mode - `cat cfg/template_draft.cfg | sed -e "s&rbank_bank_name&$rbank_bank_name&g" | sed -e "s&rbank_reduce_surfaces&$rbank_reduce_surfaces&g" | sed -e "s&rbank_smooth_borders&$rbank_smooth_borders&g" | sed -e "s&rbank_compute_elevation&$rbank_compute_elevation&g" | sed -e "s&rbank_compute_levels&$rbank_compute_levels&g" | sed -e "s&rbank_link_elements&$rbank_link_elements&g" | sed -e "s&rbank_cut_edges&$rbank_cut_edges&g" | sed -e "s&rbank_use_zone_square&$rbank_use_zone_square&g" | sed -e "s&rbank_zone_ul&$rbank_zone_ul&g" | sed -e "s&rbank_zone_dr&$rbank_zone_dr&g" > build_rbank.cfg` -fi - -# List the zones to add -cd ../zone/zone_welded -list_zone=`ls -1 *.[zZ][oO][nN][eE][wW]` -cd ../../rbank - -# Make a zone list -for i in $list_zone ; do - echo \"$i\", >> build_rbank.cfg -done - -# Close the file -echo "};" >> build_rbank.cfg -echo " " >> build_rbank.cfg - -# List ig pathes -echo Pathes = \{ >> build_rbank.cfg -for i in $rbank_ig_pathes ; do - echo \"$i\"\, >> build_rbank.cfg -done -for i in $rbank_shape_pathes ; do - echo \"$i\"\, >> build_rbank.cfg -done -echo \}\; >> build_rbank.cfg - -echo " " >> build_rbank.cfg - - -# Log error -echo >> log.log -echo ------- >> log.log -echo --- Build RBank : Check pacs primitives consistency >> log.log -echo ------- >> log.log -echo >> log.log -echo -echo ------- -echo --- Build RBank : Check pacs primitives consistency -echo ------- -echo -date >> log.log -date - -# ******* PASS 1 Generate smooth lr - -# For each ../zone/zone_welded/*.[zZ][oO][nN][eE][wW] files, checks if the associated scratch/tesselation/*.[tT][eE][sS][sS][eE][lL] file -# are up to date with the .zonew and the 8 neighbor .zonew file. If note, tesselate it. - -$exec_timeout $tessel_timeout $build_rbank -C -p -g - -# Log error -echo >> log.log -echo ------- >> log.log -echo --- Build RBank : Generate lr >> log.log -echo ------- >> log.log -echo >> log.log -echo -echo ------- -echo --- Build RBank : Generate lr -echo ------- -echo -date >> log.log -date - -for i in $list_zone ; do - - # Get destination file - zone=`echo $i | sed -e 's/.zonew//'` - - # Lr final - lr1=`echo "smooth/"$zone".lr"` - - # Get the 9 zones list - near_zone=`$get_neighbors $zone` - - # Zone to build - zone_to_build=`echo ""` - - # For each zone near - if ( ! test -e $lr1 ) - then - zone_to_build=`echo "../zone/zone_welded/"$i` - else - for j in $near_zone ; do - if ( test "../zone/zone_welded/"$j.zonew -nt $lr1 ) - then - zone_to_build=`echo "../zone/zone_welded/"$i` - fi - done - fi - - # Build it only if the file exist - if ( test "$zone_to_build" ) - then - # Build lr - $exec_timeout $tessel_timeout $build_rbank -c -P -g $i - - echo - echo >> log.log - else - echo SKIPPED $dest - echo - echo SKIPPED $lr1 >> log.log - echo >> log.log - fi - - - # Idle - ../../idle.bat -done - - - -# Log error -echo >> log.log -echo ------- >> log.log -echo --- Build RBank : Procglobal >> log.log -echo ------- >> log.log -echo >> log.log -echo -echo ------- -echo --- Build RBank : Procglobal -echo ------- -echo -date >> log.log -date - -# Procglobal -$exec_timeout $procglobal_timeout $build_rbank -c -p -G - - - - - -# ***** Build the cfg for interiors - -rm build_indoor_rbank.cfg -echo MeshPath = \"cmb/\"\; >> build_indoor_rbank.cfg -echo Meshes = { >> build_indoor_rbank.cfg - -# List the cmb to merge -cd cmb -list_cmb=`ls -1 *.[cC][mM][bB]` -cd .. -for i in $list_cmb ; do - n=`echo $i | sed -e 's/.cmb//'` - echo \"$n\", >> build_indoor_rbank.cfg - - # Idle - ../../idle.bat -done - -echo "};" >> build_indoor_rbank.cfg -echo OutputPath = \""retrievers/"\"\; >> build_indoor_rbank.cfg -echo OutputPrefix = "unused"\; >> build_indoor_rbank.cfg -echo Merge = 1\; >> build_indoor_rbank.cfg -echo MergePath = \""smooth/"\"\; >> build_indoor_rbank.cfg -echo MergeInputPrefix = \"temp\"\; >> build_indoor_rbank.cfg -echo MergeOutputPrefix = \"tempMerged\"\; >> build_indoor_rbank.cfg -echo AddToRetriever = \"1\"\; >> build_indoor_rbank.cfg - -# Log error -echo >> log.log -echo ------- >> log.log -echo --- Build RBank : Merge cmb in rbank >> log.log -echo ------- >> log.log -echo >> log.log -echo -echo ------- -echo --- Build RBank : Merge cmb in rbank -echo ------- -echo -date >> log.log -date - -$exec_timeout $indoor_timeout $build_indoor_rbank - - - - - - -echo >> log.log -echo ------- >> log.log -echo --- Build RBank : Copy gr, rbank and lr >> log.log -echo ------- >> log.log -echo >> log.log -echo -echo ------- -echo --- Build RBank : Copy gr, rbank and lr -echo ------- -echo -date >> log.log -date - - - -# Copy the files -mv "retrievers"/tempMerged.rbank output/$rbank_rbank_name".rbank" 2>> log.log -mv "retrievers"/tempMerged.gr output/$rbank_rbank_name".gr" 2>> log.log -for i in "retrievers"/tempMerged_*.lr ; do - finalname=`echo $i | sed -e "s/tempMerged/$rbank_rbank_name/" | sed -e 's/retrievers/output/'` - mv $i $finalname -done - - -# -# removed from pacs process, ai_build_wmap is built later, independently -# - -# Check ai_build_wmap exist -#if ( test -f $ai_build_wmap ) -#then -# # setup config file for ai_build_wmap -# rm ./ai_build_wmap.cfg -# cp cfg/ai_build_wmap.cfg ./ai_build_wmap.cfg -# -# # generate wmap -# $exec_timeout $build_wmap_timeout $ai_build_wmap "pacsCrunch $rbank_rbank_name" -# -# # generate sizes -# $exec_timeout $build_wmap_timeout $ai_build_wmap "pacsBuildGabarit $rbank_rbank_name" -# -# # generate cwmaps for each size -# $exec_timeout $build_wmap_timeout $ai_build_wmap "pacsBuildWmap ${rbank_rbank_name}_0" -# $exec_timeout $build_wmap_timeout $ai_build_wmap "pacsBuildWmap ${rbank_rbank_name}_1" -# $exec_timeout $build_wmap_timeout $ai_build_wmap "pacsBuildWmap ${rbank_rbank_name}_2" -# -# # generate bitmap for each size -# $exec_timeout $build_wmap_timeout $ai_build_wmap "pacsBuildBitmap ${rbank_rbank_name}_0" -# $exec_timeout $build_wmap_timeout $ai_build_wmap "pacsBuildBitmap ${rbank_rbank_name}_1" -# $exec_timeout $build_wmap_timeout $ai_build_wmap "pacsBuildBitmap ${rbank_rbank_name}_2" -# -# # clear height maps for size 1 and 2 -# $exec_timeout $build_wmap_timeout $ai_build_wmap "pacsClearHeightmap ${rbank_rbank_name}_1" -# $exec_timeout $build_wmap_timeout $ai_build_wmap "pacsClearHeightmap ${rbank_rbank_name}_2" -# -# rm output/$rbank_rbank_name.wmap -# rm output/${rbank_rbank_name}_0.wmap -# rm output/${rbank_rbank_name}_1.wmap -# rm output/${rbank_rbank_name}_2.wmap -#fi +#!/bin/bash +rm log.log 2> /dev/null + +# Build zone + +build_rbank='build_rbank.exe' +build_indoor_rbank='build_indoor_rbank.exe' +build_ig_boxes='build_ig_boxes.exe' +ai_build_wmap='ai_build_wmap_r.exe' +get_neighbors='get_neighbors.exe' +exec_timeout='exec_timeout.exe' + +# Get the timeout +tessel_timeout=`cat ../../cfg/config.cfg | grep "rbank_build_tessel_timeout" | sed -e 's/rbank_build_tessel_timeout//' | sed -e 's/ //g' | sed -e 's/=//g'` +smooth_timeout=`cat ../../cfg/config.cfg | grep "rbank_build_smooth_timeout" | sed -e 's/rbank_build_smooth_timeout//' | sed -e 's/ //g' | sed -e 's/=//g'` +proclocal_timeout=`cat ../../cfg/config.cfg | grep "rbank_build_proclocal_timeout" | sed -e 's/rbank_build_proclocal_timeout//' | sed -e 's/ //g' | sed -e 's/=//g'` +procglobal_timeout=`cat ../../cfg/config.cfg | grep "rbank_build_procglobal_timeout" | sed -e 's/rbank_build_procglobal_timeout//' | sed -e 's/ //g' | sed -e 's/=//g'` +indoor_timeout=`cat ../../cfg/config.cfg | grep "rbank_build_indoor_timeout" | sed -e 's/rbank_build_indoor_timeout//' | sed -e 's/ //g' | sed -e 's/=//g'` +build_wmap_timeout=`cat ../../cfg/config.cfg | grep "build_wmap_timeout" | sed -e 's/build_wmap_timeout//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the quality option to choose the goor properties.cfg file +quality_flag=`cat ../../cfg/site.cfg | grep "build_quality" | grep "1"` + +# **** Copy ig and shapes + +# Log error +echo >> log.log +echo ------- > log.log +echo --- Generate config script >> log.log +echo ------- >> log.log +echo >> log.log +echo +echo ------- +echo --- Generate config script +echo ------- +echo +date >> log.log +date + +# Get arguments +rbank_bank_name=`cat ../../cfg/properties.cfg | grep "bank_name" | sed -e 's/bank_name//' | sed -e 's/ //g' | sed -e 's/=//g' | sed -e 's/"//g' | sed -e 's/;//g'` +rbank_reduce_surfaces=`cat ../../cfg/config.cfg | grep "rbank_reduce_surfaces" | sed -e 's/rbank_reduce_surfaces//' | sed -e 's/ //g' | sed -e 's/=//g'` +rbank_smooth_borders=`cat ../../cfg/config.cfg | grep "rbank_smooth_borders" | sed -e 's/rbank_smooth_borders//' | sed -e 's/ //g' | sed -e 's/=//g'` +rbank_compute_elevation=`cat ../../cfg/config.cfg | grep "rbank_compute_elevation" | sed -e 's/rbank_compute_elevation//' | sed -e 's/ //g' | sed -e 's/=//g'` +rbank_compute_levels=`cat ../../cfg/config.cfg | grep "rbank_compute_levels" | sed -e 's/rbank_compute_levels//' | sed -e 's/ //g' | sed -e 's/=//g'` +rbank_link_elements=`cat ../../cfg/config.cfg | grep "rbank_link_elements" | sed -e 's/rbank_link_elements//' | sed -e 's/ //g' | sed -e 's/=//g'` +rbank_cut_edges=`cat ../../cfg/config.cfg | grep "rbank_cut_edges" | sed -e 's/rbank_cut_edges//' | sed -e 's/ //g' | sed -e 's/=//g'` +rbank_use_zone_square=`cat ../../cfg/config.cfg | grep "rbank_use_zone_square" | sed -e 's/rbank_use_zone_square//' | sed -e 's/ //g' | sed -e 's/=//g'` +rbank_zone_ul=`cat ../../cfg/config.cfg | grep "rbank_zone_ul" | sed -e 's/rbank_zone_ul//' | sed -e 's/ //g' | sed -e 's/=//g'` +rbank_zone_dr=`cat ../../cfg/config.cfg | grep "rbank_zone_dr" | sed -e 's/rbank_zone_dr//' | sed -e 's/ //g' | sed -e 's/=//g'` +rbank_rbank_name=`cat ../../cfg/config.cfg | grep "rbank_rbank_name" | sed -e 's/rbank_rbank_name//' | sed -e 's/ //g' | sed -e 's/=//g'` +rbank_ig_pathes=`cat ../../cfg/config.cfg | grep "rbank_ig_path" | sed -e 's/rbank_ig_path//' | sed -e 's/ //g' | sed -e 's/=//g'` +rbank_shape_pathes=`cat ../../cfg/config.cfg | grep "rbank_shape_path" | sed -e 's/rbank_shape_path//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Global options +build_gamedata_directory=`cat ../../cfg/site.cfg | grep "build_gamedata_directory" | sed -e 's/build_gamedata_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Log error +echo >> log.log +echo ------- >> log.log +echo --- Build RBank : Build the bbox file >> log.log +echo ------- >> log.log +echo >> log.log +echo +echo ------- +echo --- Build RBank : Build the bbox file +echo ------- +echo +date >> log.log +date + +# ***** Build the bbox file + +# Remove the config file +rm build_ig_boxes.cfg + +# List ig pathes +echo Pathes = \{ >> build_ig_boxes.cfg +for i in $rbank_ig_pathes ; do + echo \"$i\"\, >> build_ig_boxes.cfg +done +for i in $rbank_shape_pathes ; do + echo \"$i\"\, >> build_ig_boxes.cfg +done +echo \}\; >> build_ig_boxes.cfg + +# List igs +echo IGs = \{ >> build_ig_boxes.cfg +for i in $rbank_ig_pathes ; do + cd $i + list_ig=`ls -1 *.[iI][gG]` + cd $build_gamedata_directory"/processes/rbank" + for j in $list_ig ; do + n=`echo $j | sed -e 's/.ig//'` + echo \"$n\"\, >> build_ig_boxes.cfg + done + + # Idle + ../../idle.bat +done +echo \}\; >> build_ig_boxes.cfg +echo Output = \"bbox/temp.bbox\"\; >> build_ig_boxes.cfg + +# -- NOT NEEDED ANYMORE +$build_ig_boxes + +# ***** Build the rbank, gr files + +# Copy the good template file +if ( test "$quality_flag" ) +then + # We are in BEST mode + `cat cfg/template_final.cfg | sed -e "s&rbank_bank_name&$rbank_bank_name&g" | sed -e "s&rbank_reduce_surfaces&$rbank_reduce_surfaces&g" | sed -e "s&rbank_smooth_borders&$rbank_smooth_borders&g" | sed -e "s&rbank_compute_elevation&$rbank_compute_elevation&g" | sed -e "s&rbank_compute_levels&$rbank_compute_levels&g" | sed -e "s&rbank_link_elements&$rbank_link_elements&g" | sed -e "s&rbank_cut_edges&$rbank_cut_edges&g" | sed -e "s&rbank_use_zone_square&$rbank_use_zone_square&g" | sed -e "s&rbank_zone_ul&$rbank_zone_ul&g" | sed -e "s&rbank_zone_dr&$rbank_zone_dr&g" > build_rbank.cfg` +else + # We are in DRAFT mode + `cat cfg/template_draft.cfg | sed -e "s&rbank_bank_name&$rbank_bank_name&g" | sed -e "s&rbank_reduce_surfaces&$rbank_reduce_surfaces&g" | sed -e "s&rbank_smooth_borders&$rbank_smooth_borders&g" | sed -e "s&rbank_compute_elevation&$rbank_compute_elevation&g" | sed -e "s&rbank_compute_levels&$rbank_compute_levels&g" | sed -e "s&rbank_link_elements&$rbank_link_elements&g" | sed -e "s&rbank_cut_edges&$rbank_cut_edges&g" | sed -e "s&rbank_use_zone_square&$rbank_use_zone_square&g" | sed -e "s&rbank_zone_ul&$rbank_zone_ul&g" | sed -e "s&rbank_zone_dr&$rbank_zone_dr&g" > build_rbank.cfg` +fi + +# List the zones to add +cd ../zone/zone_welded +list_zone=`ls -1 *.[zZ][oO][nN][eE][wW]` +cd ../../rbank + +# Make a zone list +for i in $list_zone ; do + echo \"$i\", >> build_rbank.cfg +done + +# Close the file +echo "};" >> build_rbank.cfg +echo " " >> build_rbank.cfg + +# List ig pathes +echo Pathes = \{ >> build_rbank.cfg +for i in $rbank_ig_pathes ; do + echo \"$i\"\, >> build_rbank.cfg +done +for i in $rbank_shape_pathes ; do + echo \"$i\"\, >> build_rbank.cfg +done +echo \}\; >> build_rbank.cfg + +echo " " >> build_rbank.cfg + + +# Log error +echo >> log.log +echo ------- >> log.log +echo --- Build RBank : Check pacs primitives consistency >> log.log +echo ------- >> log.log +echo >> log.log +echo +echo ------- +echo --- Build RBank : Check pacs primitives consistency +echo ------- +echo +date >> log.log +date + +# ******* PASS 1 Generate smooth lr + +# For each ../zone/zone_welded/*.[zZ][oO][nN][eE][wW] files, checks if the associated scratch/tesselation/*.[tT][eE][sS][sS][eE][lL] file +# are up to date with the .zonew and the 8 neighbor .zonew file. If note, tesselate it. + +$exec_timeout $tessel_timeout $build_rbank -C -p -g + +# Log error +echo >> log.log +echo ------- >> log.log +echo --- Build RBank : Generate lr >> log.log +echo ------- >> log.log +echo >> log.log +echo +echo ------- +echo --- Build RBank : Generate lr +echo ------- +echo +date >> log.log +date + +for i in $list_zone ; do + + # Get destination file + zone=`echo $i | sed -e 's/.zonew//'` + + # Lr final + lr1=`echo "smooth/"$zone".lr"` + + # Get the 9 zones list + near_zone=`$get_neighbors $zone` + + # Zone to build + zone_to_build=`echo ""` + + # For each zone near + if ( ! test -e $lr1 ) + then + zone_to_build=`echo "../zone/zone_welded/"$i` + else + for j in $near_zone ; do + if ( test "../zone/zone_welded/"$j.zonew -nt $lr1 ) + then + zone_to_build=`echo "../zone/zone_welded/"$i` + fi + done + fi + + # Build it only if the file exist + if ( test "$zone_to_build" ) + then + # Build lr + $exec_timeout $tessel_timeout $build_rbank -c -P -g $i + + echo + echo >> log.log + else + echo SKIPPED $dest + echo + echo SKIPPED $lr1 >> log.log + echo >> log.log + fi + + + # Idle + ../../idle.bat +done + + + +# Log error +echo >> log.log +echo ------- >> log.log +echo --- Build RBank : Procglobal >> log.log +echo ------- >> log.log +echo >> log.log +echo +echo ------- +echo --- Build RBank : Procglobal +echo ------- +echo +date >> log.log +date + +# Procglobal +$exec_timeout $procglobal_timeout $build_rbank -c -p -G + + + + + +# ***** Build the cfg for interiors + +rm build_indoor_rbank.cfg +echo MeshPath = \"cmb/\"\; >> build_indoor_rbank.cfg +echo Meshes = { >> build_indoor_rbank.cfg + +# List the cmb to merge +cd cmb +list_cmb=`ls -1 *.[cC][mM][bB]` +cd .. +for i in $list_cmb ; do + n=`echo $i | sed -e 's/.cmb//'` + echo \"$n\", >> build_indoor_rbank.cfg + + # Idle + ../../idle.bat +done + +echo "};" >> build_indoor_rbank.cfg +echo OutputPath = \""retrievers/"\"\; >> build_indoor_rbank.cfg +echo OutputPrefix = "unused"\; >> build_indoor_rbank.cfg +echo Merge = 1\; >> build_indoor_rbank.cfg +echo MergePath = \""smooth/"\"\; >> build_indoor_rbank.cfg +echo MergeInputPrefix = \"temp\"\; >> build_indoor_rbank.cfg +echo MergeOutputPrefix = \"tempMerged\"\; >> build_indoor_rbank.cfg +echo AddToRetriever = \"1\"\; >> build_indoor_rbank.cfg + +# Log error +echo >> log.log +echo ------- >> log.log +echo --- Build RBank : Merge cmb in rbank >> log.log +echo ------- >> log.log +echo >> log.log +echo +echo ------- +echo --- Build RBank : Merge cmb in rbank +echo ------- +echo +date >> log.log +date + +$exec_timeout $indoor_timeout $build_indoor_rbank + + + + + + +echo >> log.log +echo ------- >> log.log +echo --- Build RBank : Copy gr, rbank and lr >> log.log +echo ------- >> log.log +echo >> log.log +echo +echo ------- +echo --- Build RBank : Copy gr, rbank and lr +echo ------- +echo +date >> log.log +date + + + +# Copy the files +mv "retrievers"/tempMerged.rbank output/$rbank_rbank_name".rbank" 2>> log.log +mv "retrievers"/tempMerged.gr output/$rbank_rbank_name".gr" 2>> log.log +for i in "retrievers"/tempMerged_*.lr ; do + finalname=`echo $i | sed -e "s/tempMerged/$rbank_rbank_name/" | sed -e 's/retrievers/output/'` + mv $i $finalname +done + + +# +# removed from pacs process, ai_build_wmap is built later, independently +# + +# Check ai_build_wmap exist +#if ( test -f $ai_build_wmap ) +#then +# # setup config file for ai_build_wmap +# rm ./ai_build_wmap.cfg +# cp cfg/ai_build_wmap.cfg ./ai_build_wmap.cfg +# +# # generate wmap +# $exec_timeout $build_wmap_timeout $ai_build_wmap "pacsCrunch $rbank_rbank_name" +# +# # generate sizes +# $exec_timeout $build_wmap_timeout $ai_build_wmap "pacsBuildGabarit $rbank_rbank_name" +# +# # generate cwmaps for each size +# $exec_timeout $build_wmap_timeout $ai_build_wmap "pacsBuildWmap ${rbank_rbank_name}_0" +# $exec_timeout $build_wmap_timeout $ai_build_wmap "pacsBuildWmap ${rbank_rbank_name}_1" +# $exec_timeout $build_wmap_timeout $ai_build_wmap "pacsBuildWmap ${rbank_rbank_name}_2" +# +# # generate bitmap for each size +# $exec_timeout $build_wmap_timeout $ai_build_wmap "pacsBuildBitmap ${rbank_rbank_name}_0" +# $exec_timeout $build_wmap_timeout $ai_build_wmap "pacsBuildBitmap ${rbank_rbank_name}_1" +# $exec_timeout $build_wmap_timeout $ai_build_wmap "pacsBuildBitmap ${rbank_rbank_name}_2" +# +# # clear height maps for size 1 and 2 +# $exec_timeout $build_wmap_timeout $ai_build_wmap "pacsClearHeightmap ${rbank_rbank_name}_1" +# $exec_timeout $build_wmap_timeout $ai_build_wmap "pacsClearHeightmap ${rbank_rbank_name}_2" +# +# rm output/$rbank_rbank_name.wmap +# rm output/${rbank_rbank_name}_0.wmap +# rm output/${rbank_rbank_name}_1.wmap +# rm output/${rbank_rbank_name}_2.wmap +#fi diff --git a/nel/tools/3d/build_gamedata/processes/rbank/sh/clean.sh b/nel/tools/3d/build_gamedata/processes/rbank/sh/clean.sh index 82e48430cd..7e4189aabc 100644 --- a/nel/tools/3d/build_gamedata/processes/rbank/sh/clean.sh +++ b/nel/tools/3d/build_gamedata/processes/rbank/sh/clean.sh @@ -1,31 +1,31 @@ -#!/bin/bash -rm log.log 2> /dev/null - - -# Log error -echo >> log.log -echo ------- > log.log -echo --- Clean rbank >> log.log -echo ------- >> log.log -echo >> log.log -echo -echo ------- -echo --- Clean rbank -echo ------- -echo -date >> log.log -date - -# Get arguments -rbank_rbank_name=`cat ../../cfg/config.cfg | grep "rbank_rbank_name" | sed -e 's/rbank_rbank_name//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Delete temp files -rm tesselation/*.[tT][eE][sS][sS][eE][lL] -rm smooth/*.[lL][rR] -rm smooth/*.[oO][cC][hH][aA][iI][nN] -rm smooth/*.[gG][rR] -rm smooth/*.[rR][bB][aA][nN][kK] -rm smooth/preproc/*.[lL][rR] -rm retrievers/*.[gG][rR] -rm retrievers/*.[rR][bB][aA][nN][kK] - +#!/bin/bash +rm log.log 2> /dev/null + + +# Log error +echo >> log.log +echo ------- > log.log +echo --- Clean rbank >> log.log +echo ------- >> log.log +echo >> log.log +echo +echo ------- +echo --- Clean rbank +echo ------- +echo +date >> log.log +date + +# Get arguments +rbank_rbank_name=`cat ../../cfg/config.cfg | grep "rbank_rbank_name" | sed -e 's/rbank_rbank_name//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Delete temp files +rm tesselation/*.[tT][eE][sS][sS][eE][lL] +rm smooth/*.[lL][rR] +rm smooth/*.[oO][cC][hH][aA][iI][nN] +rm smooth/*.[gG][rR] +rm smooth/*.[rR][bB][aA][nN][kK] +rm smooth/preproc/*.[lL][rR] +rm retrievers/*.[gG][rR] +rm retrievers/*.[rR][bB][aA][nN][kK] + diff --git a/nel/tools/3d/build_gamedata/processes/rbank/sh/export.sh b/nel/tools/3d/build_gamedata/processes/rbank/sh/export.sh index fed89c0446..0afefe687a 100644 --- a/nel/tools/3d/build_gamedata/processes/rbank/sh/export.sh +++ b/nel/tools/3d/build_gamedata/processes/rbank/sh/export.sh @@ -1,57 +1,57 @@ -#!/bin/bash -rm log.log 2> /dev/null - -# *** Export cmb files (.cmb) from Max - -exec_timeout='exec_timeout.exe' - -# Get the timeout -timeout=`cat ../../cfg/config.cfg | grep "cmb_export_timeout" | sed -e 's/cmb_export_timeout//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the database directory -database_directory=`cat ../../cfg/site.cfg | grep "database_directory" | sed -e 's/database_directory//g' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the build gamedata directory -build_gamedata_directory=`cat ../../cfg/site.cfg | grep "build_gamedata_directory" | sed -e 's/build_gamedata_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the collision directories -collision_source_directories=`cat ../../cfg/directories.cfg | grep "cmb_source_directory" | sed -e 's/cmb_source_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Maxdir -max_directory=`echo $MAX_DIR | sed -e 's&\\\&/&g'` - -# Log error -echo ------- > log.log -echo --- Export cmb for rbank >> log.log -echo ------- >> log.log -echo ------- -echo --- Export cmb for rbank -echo ------- -date >> log.log -date - -# For each directoy - -for i in $collision_source_directories ; do - # Copy the script - cat maxscript/rbank_export.ms | sed -e "s&output_logfile&$build_gamedata_directory/processes/rbank/log.log&g" | sed -e "s&collision_source_directory&$database_directory/$i&g" | sed -e "s&output_directory_rbank&$build_gamedata_directory/processes/rbank/cmb&g" | sed -e "s&output_directory_tag&$build_gamedata_directory/processes/rbank/tag&g" > $max_directory/scripts/rbank_export.ms - - # Start max - echo Try 1 >> log.log - $exec_timeout $timeout $max_directory/3dsmax.exe -U MAXScript rbank_export.ms -q -mi -vn - - # Idle - ../../idle.bat - - echo Try 2 >> log.log - $exec_timeout $timeout $max_directory/3dsmax.exe -U MAXScript rbank_export.ms -q -mi -vn - - # Idle - ../../idle.bat - - echo Try 3 >> log.log - $exec_timeout $timeout $max_directory/3dsmax.exe -U MAXScript rbank_export.ms -q -mi -vn - - # Idle - ../../idle.bat -done +#!/bin/bash +rm log.log 2> /dev/null + +# *** Export cmb files (.cmb) from Max + +exec_timeout='exec_timeout.exe' + +# Get the timeout +timeout=`cat ../../cfg/config.cfg | grep "cmb_export_timeout" | sed -e 's/cmb_export_timeout//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the database directory +database_directory=`cat ../../cfg/site.cfg | grep "database_directory" | sed -e 's/database_directory//g' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the build gamedata directory +build_gamedata_directory=`cat ../../cfg/site.cfg | grep "build_gamedata_directory" | sed -e 's/build_gamedata_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the collision directories +collision_source_directories=`cat ../../cfg/directories.cfg | grep "cmb_source_directory" | sed -e 's/cmb_source_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Maxdir +max_directory=`echo $MAX_DIR | sed -e 's&\\\&/&g'` + +# Log error +echo ------- > log.log +echo --- Export cmb for rbank >> log.log +echo ------- >> log.log +echo ------- +echo --- Export cmb for rbank +echo ------- +date >> log.log +date + +# For each directoy + +for i in $collision_source_directories ; do + # Copy the script + cat maxscript/rbank_export.ms | sed -e "s&output_logfile&$build_gamedata_directory/processes/rbank/log.log&g" | sed -e "s&collision_source_directory&$database_directory/$i&g" | sed -e "s&output_directory_rbank&$build_gamedata_directory/processes/rbank/cmb&g" | sed -e "s&output_directory_tag&$build_gamedata_directory/processes/rbank/tag&g" > $max_directory/scripts/rbank_export.ms + + # Start max + echo Try 1 >> log.log + $exec_timeout $timeout $max_directory/3dsmax.exe -U MAXScript rbank_export.ms -q -mi -vn + + # Idle + ../../idle.bat + + echo Try 2 >> log.log + $exec_timeout $timeout $max_directory/3dsmax.exe -U MAXScript rbank_export.ms -q -mi -vn + + # Idle + ../../idle.bat + + echo Try 3 >> log.log + $exec_timeout $timeout $max_directory/3dsmax.exe -U MAXScript rbank_export.ms -q -mi -vn + + # Idle + ../../idle.bat +done diff --git a/nel/tools/3d/build_gamedata/processes/rbank/sh/install.sh b/nel/tools/3d/build_gamedata/processes/rbank/sh/install.sh index 986d65225f..b3f832a34c 100644 --- a/nel/tools/3d/build_gamedata/processes/rbank/sh/install.sh +++ b/nel/tools/3d/build_gamedata/processes/rbank/sh/install.sh @@ -1,22 +1,22 @@ -#!/bin/bash -rm log.log 2> /dev/null - -# Install the zonels in the client data - -# Get the zone install directory -pacs_install_directory=`cat ../../cfg/directories.cfg | grep "pacs_install_directory" | sed -e 's/pacs_install_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the client directory -client_directory=`cat ../../cfg/site.cfg | grep "client_directory" | sed -e 's/client_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Log error -echo ------- > log.log -echo --- Install zone >> log.log -echo ------- >> log.log -echo ------- -echo --- Install zone -echo ------- -date >> log.log -date - -cp -u -p -R output/. $client_directory/$pacs_install_directory 2>> log.log +#!/bin/bash +rm log.log 2> /dev/null + +# Install the zonels in the client data + +# Get the zone install directory +pacs_install_directory=`cat ../../cfg/directories.cfg | grep "pacs_install_directory" | sed -e 's/pacs_install_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the client directory +client_directory=`cat ../../cfg/site.cfg | grep "client_directory" | sed -e 's/client_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Log error +echo ------- > log.log +echo --- Install zone >> log.log +echo ------- >> log.log +echo ------- +echo --- Install zone +echo ------- +date >> log.log +date + +cp -u -p -R output/. $client_directory/$pacs_install_directory 2>> log.log diff --git a/nel/tools/3d/build_gamedata/processes/shape/sh/build.sh b/nel/tools/3d/build_gamedata/processes/shape/sh/build.sh index 8d97cff1f4..c1c77984ca 100644 --- a/nel/tools/3d/build_gamedata/processes/shape/sh/build.sh +++ b/nel/tools/3d/build_gamedata/processes/shape/sh/build.sh @@ -1,236 +1,236 @@ -#!/bin/bash -rm log.log 2> /dev/null - -# *** Build shape files (.shape) - -# Get the database directory -database_directory=`cat ../../cfg/site.cfg | grep "database_directory" | sed -e 's/database_directory//g' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Bin -tga_2_dds='tga2dds.exe' -build_coarse_mesh='build_coarse_mesh.exe' -lightmap_optimizer='lightmap_optimizer.exe' -build_clodtex='build_clodtex.exe' -build_shadow_skin='build_shadow_skin.exe' - -# Log error -echo ------- > log.log -echo --- Build ShadowSkin shape >> log.log -echo ------- >> log.log -echo ------- -echo --- Build ShadowSkin shape -echo ------- -date >> log.log -date - -# build shadow skin? -do_build_shadow_skin=`cat ../../cfg/config.cfg | grep -w "build_shadow_skin" | sed -e 's/build_shadow_skin//' | sed -e 's/ //g' | sed -e 's/=//g'` -build_shadow_skin_ratio=`cat ../../cfg/config.cfg | grep "build_shadow_skin_ratio" | sed -e 's/build_shadow_skin_ratio//' | sed -e 's/ //g' | sed -e 's/=//g'` -build_shadow_skin_maxface=`cat ../../cfg/config.cfg | grep "build_shadow_skin_maxface" | sed -e 's/build_shadow_skin_maxface//' | sed -e 's/ //g' | sed -e 's/=//g'` - - -# if config wanted then must compute shadowSkin -if ( test "$do_build_shadow_skin" = "1" ) -then - for i in shape_not_optimized/*.[sS][hH][aA][pP][eE] ; do - if ( test -f $i ) - then - dest=`echo $i | sed -e 's/shape_not_optimized/shape/g'` - # if date is newer in shape_not_optimized than in shape, compute - if ( ! test -e $dest ) || ( test $i -nt $dest ) - then - # NB: overwrite shape_not_optimized, because will be cloded/copied below to shapes/ - $build_shadow_skin $i $i $build_shadow_skin_ratio $build_shadow_skin_maxface - fi - fi - done -fi - - -# Log error -echo ------- >> log.log -echo --- Build shape : Copy Shape / build CLodTex >> log.log -echo ------- >> log.log -echo ------- -echo --- Build shape : Copy Shape / build CLodTex -echo ------- -date >> log.log -date - -# Get the lod config file in the database -clod_config_file=`cat ../../cfg/config.cfg | grep "clod_config_file" | sed -e 's/clod_config_file//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# if clod cfg is setup, build clod -if (test -f $database_directory/$clod_config_file) -then - # build the shape with clod texture. convert from 'shape_not_optimized' to 'shape' - $build_clodtex -d $database_directory/$clod_config_file clod shape_not_optimized shape -else - # just copy shape_not_optimized to shape - ./sh/transfert_shape_optimize.bat -fi - -# Log error -echo ------- >> log.log -echo --- Build shape : optimize lightmaps >> log.log -echo ------- >> log.log -echo ------- -echo --- Build shape : optimize lightmaps -echo ------- -date >> log.log -date - - -# copy lightmap_not_optimized to lightmap -./sh/transfert_lightmap_optimize.bat - -quality_flag=`cat ../../cfg/site.cfg | grep "build_quality" | grep "1"` - -# Optimize lightmaps if any. Additionnaly, output a file indicating which lightmaps are 8 bits -$lightmap_optimizer ./lightmap ./shape ./tag ./list_lm_8bit.txt - -# Convert lightmap in 16 bits mode if they are not 8 bits lightmap - -echo ------- >> log.log -echo --- Build shape : convert lightmaps in 16 or 8 bits >> log.log -echo ------- >> log.log -echo ------- -echo --- Build shape : convert lightmaps in 16 or 8 bits -echo ------- -date >> log.log -date - -for i in lightmap/*.[tT][gG][aA] ; do - - if ( test -f $i ) - then - # Destination file - dest=`echo $i | sed -e 's/lightmap/lightmap_16_bits/g'` - - # Convert the lightmap in 16 bits mode - if ( ! test -e $dest ) || ( test $i -nt $dest ) - then - fileTest=`echo $i | sed -e 's&lightmap/&&g'` - file8Bit=`cat ./list_lm_8bit.txt | grep "$fileTest"` - if ( test "$file8Bit" = "$fileTest" ) - then - echo "export $fileTest in 8bit format" - $tga_2_dds $i -o $dest -a tga8 2>> log.log - else - echo "export $fileTest in 16bit format" - $tga_2_dds $i -o $dest -a tga16 2>> log.log - fi - fi - fi - - # Idle - ../../idle.bat -done - -# Log error -echo ------- >> log.log -echo --- Build shape : build coarse meshes >> log.log -echo ------- >> log.log -echo ------- -echo --- Build shape : build coarse meshes -echo ------- -date >> log.log -date - -# Get the build gamedata directory -build_gamedata_directory=`cat ../../cfg/site.cfg | grep "build_gamedata_directory" | sed -e 's/build_gamedata_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get texture pathes -map_source_directories=`cat ../../cfg/directories.cfg | grep "map_source_directory" | sed -e 's/map_source_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the texture mul size -texture_mul_size_value=`cat ../../cfg/config.cfg | grep "texture_mul_size_value" | sed -e 's/texture_mul_size_value//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the coarse mesh texture name -coarse_mesh_texture_names=`cat ../../cfg/config.cfg | grep "coarse_mesh_texture_names" | sed -e 's/coarse_mesh_texture_names//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Copy the config file header -cat cfg/config_header.cfg | sed -e "s/texture_mul_size_value/$texture_mul_size_value/g" > cfg/config_generated.cfg - -# Corse meshes for this process ? -if ( test "$coarse_mesh_texture_names" ) then - - # Add the shape directory - echo ' "'shape_with_coarse_mesh'"', >> cfg/config_generated.cfg - - # For each texture path - for i in $map_source_directories ; do - - # Add the path - echo ' "'$database_directory/$i'"', >> cfg/config_generated.cfg - - # Idle - ../../idle.bat - done - - # Add the shape list header - echo '};' >> cfg/config_generated.cfg - echo ' ' >> cfg/config_generated.cfg - echo 'list_mesh =' >> cfg/config_generated.cfg - echo '{' >> cfg/config_generated.cfg - - # For each shape with coarse mesh - for i in shape_with_coarse_mesh/*.[sS][hH][aA][pP][eE]; do - - if ( test -f $i ) - then - # Destination file - src=`echo $i | sed -e 's&shape_with_coarse_mesh/&&g'` - dest=`echo $i | sed -e 's&shape_with_coarse_mesh&shape_with_coarse_mesh_builded&g'` - - # Add the shape - echo ' "'$src'", "'$dest'",' >> cfg/config_generated.cfg - - # Destination file - dest=`echo $i | sed -e 's/lightmap/lightmap_16_bits/g'` - fi - - # Idle - ../../idle.bat - done - echo '};' >> cfg/config_generated.cfg - - # Add output bitmap list - echo ' ' >> cfg/config_generated.cfg - echo 'output_textures = {' >> cfg/config_generated.cfg - # For each shape with coarse mesh - for i in $coarse_mesh_texture_names ; do - # Add the path - echo ' "shape_with_coarse_mesh/'$i'.tga"', >> cfg/config_generated.cfg - done - - # Close the config file - echo '};' >> cfg/config_generated.cfg - - # Execute the build - $build_coarse_mesh cfg/config_generated.cfg - - # Log error - echo ------- >> log.log - echo --- Build shape : convert coarse texture to dds without mipmaps >> log.log - echo ------- >> log.log - echo ------- - echo --- Build shape : convert coarse texture to dds without mipmaps - echo ------- - date >> log.log - date - - # Convert the coarse texture to dds - for i in $coarse_mesh_texture_names ; do - if ( test -f shape_with_coarse_mesh/$i.tga ) - then - $tga_2_dds shape_with_coarse_mesh/$i.tga -o shape_with_coarse_mesh_builded/$i.dds -a 5 2>> log.log - fi - done - -else - - echo --- No coarse meshes texture defined >> log.log - echo --- No coarse meshes texture defined - -fi +#!/bin/bash +rm log.log 2> /dev/null + +# *** Build shape files (.shape) + +# Get the database directory +database_directory=`cat ../../cfg/site.cfg | grep "database_directory" | sed -e 's/database_directory//g' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Bin +tga_2_dds='tga2dds.exe' +build_coarse_mesh='build_coarse_mesh.exe' +lightmap_optimizer='lightmap_optimizer.exe' +build_clodtex='build_clodtex.exe' +build_shadow_skin='build_shadow_skin.exe' + +# Log error +echo ------- > log.log +echo --- Build ShadowSkin shape >> log.log +echo ------- >> log.log +echo ------- +echo --- Build ShadowSkin shape +echo ------- +date >> log.log +date + +# build shadow skin? +do_build_shadow_skin=`cat ../../cfg/config.cfg | grep -w "build_shadow_skin" | sed -e 's/build_shadow_skin//' | sed -e 's/ //g' | sed -e 's/=//g'` +build_shadow_skin_ratio=`cat ../../cfg/config.cfg | grep "build_shadow_skin_ratio" | sed -e 's/build_shadow_skin_ratio//' | sed -e 's/ //g' | sed -e 's/=//g'` +build_shadow_skin_maxface=`cat ../../cfg/config.cfg | grep "build_shadow_skin_maxface" | sed -e 's/build_shadow_skin_maxface//' | sed -e 's/ //g' | sed -e 's/=//g'` + + +# if config wanted then must compute shadowSkin +if ( test "$do_build_shadow_skin" = "1" ) +then + for i in shape_not_optimized/*.[sS][hH][aA][pP][eE] ; do + if ( test -f $i ) + then + dest=`echo $i | sed -e 's/shape_not_optimized/shape/g'` + # if date is newer in shape_not_optimized than in shape, compute + if ( ! test -e $dest ) || ( test $i -nt $dest ) + then + # NB: overwrite shape_not_optimized, because will be cloded/copied below to shapes/ + $build_shadow_skin $i $i $build_shadow_skin_ratio $build_shadow_skin_maxface + fi + fi + done +fi + + +# Log error +echo ------- >> log.log +echo --- Build shape : Copy Shape / build CLodTex >> log.log +echo ------- >> log.log +echo ------- +echo --- Build shape : Copy Shape / build CLodTex +echo ------- +date >> log.log +date + +# Get the lod config file in the database +clod_config_file=`cat ../../cfg/config.cfg | grep "clod_config_file" | sed -e 's/clod_config_file//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# if clod cfg is setup, build clod +if (test -f $database_directory/$clod_config_file) +then + # build the shape with clod texture. convert from 'shape_not_optimized' to 'shape' + $build_clodtex -d $database_directory/$clod_config_file clod shape_not_optimized shape +else + # just copy shape_not_optimized to shape + ./sh/transfert_shape_optimize.bat +fi + +# Log error +echo ------- >> log.log +echo --- Build shape : optimize lightmaps >> log.log +echo ------- >> log.log +echo ------- +echo --- Build shape : optimize lightmaps +echo ------- +date >> log.log +date + + +# copy lightmap_not_optimized to lightmap +./sh/transfert_lightmap_optimize.bat + +quality_flag=`cat ../../cfg/site.cfg | grep "build_quality" | grep "1"` + +# Optimize lightmaps if any. Additionnaly, output a file indicating which lightmaps are 8 bits +$lightmap_optimizer ./lightmap ./shape ./tag ./list_lm_8bit.txt + +# Convert lightmap in 16 bits mode if they are not 8 bits lightmap + +echo ------- >> log.log +echo --- Build shape : convert lightmaps in 16 or 8 bits >> log.log +echo ------- >> log.log +echo ------- +echo --- Build shape : convert lightmaps in 16 or 8 bits +echo ------- +date >> log.log +date + +for i in lightmap/*.[tT][gG][aA] ; do + + if ( test -f $i ) + then + # Destination file + dest=`echo $i | sed -e 's/lightmap/lightmap_16_bits/g'` + + # Convert the lightmap in 16 bits mode + if ( ! test -e $dest ) || ( test $i -nt $dest ) + then + fileTest=`echo $i | sed -e 's&lightmap/&&g'` + file8Bit=`cat ./list_lm_8bit.txt | grep "$fileTest"` + if ( test "$file8Bit" = "$fileTest" ) + then + echo "export $fileTest in 8bit format" + $tga_2_dds $i -o $dest -a tga8 2>> log.log + else + echo "export $fileTest in 16bit format" + $tga_2_dds $i -o $dest -a tga16 2>> log.log + fi + fi + fi + + # Idle + ../../idle.bat +done + +# Log error +echo ------- >> log.log +echo --- Build shape : build coarse meshes >> log.log +echo ------- >> log.log +echo ------- +echo --- Build shape : build coarse meshes +echo ------- +date >> log.log +date + +# Get the build gamedata directory +build_gamedata_directory=`cat ../../cfg/site.cfg | grep "build_gamedata_directory" | sed -e 's/build_gamedata_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get texture pathes +map_source_directories=`cat ../../cfg/directories.cfg | grep "map_source_directory" | sed -e 's/map_source_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the texture mul size +texture_mul_size_value=`cat ../../cfg/config.cfg | grep "texture_mul_size_value" | sed -e 's/texture_mul_size_value//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the coarse mesh texture name +coarse_mesh_texture_names=`cat ../../cfg/config.cfg | grep "coarse_mesh_texture_names" | sed -e 's/coarse_mesh_texture_names//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Copy the config file header +cat cfg/config_header.cfg | sed -e "s/texture_mul_size_value/$texture_mul_size_value/g" > cfg/config_generated.cfg + +# Corse meshes for this process ? +if ( test "$coarse_mesh_texture_names" ) then + + # Add the shape directory + echo ' "'shape_with_coarse_mesh'"', >> cfg/config_generated.cfg + + # For each texture path + for i in $map_source_directories ; do + + # Add the path + echo ' "'$database_directory/$i'"', >> cfg/config_generated.cfg + + # Idle + ../../idle.bat + done + + # Add the shape list header + echo '};' >> cfg/config_generated.cfg + echo ' ' >> cfg/config_generated.cfg + echo 'list_mesh =' >> cfg/config_generated.cfg + echo '{' >> cfg/config_generated.cfg + + # For each shape with coarse mesh + for i in shape_with_coarse_mesh/*.[sS][hH][aA][pP][eE]; do + + if ( test -f $i ) + then + # Destination file + src=`echo $i | sed -e 's&shape_with_coarse_mesh/&&g'` + dest=`echo $i | sed -e 's&shape_with_coarse_mesh&shape_with_coarse_mesh_builded&g'` + + # Add the shape + echo ' "'$src'", "'$dest'",' >> cfg/config_generated.cfg + + # Destination file + dest=`echo $i | sed -e 's/lightmap/lightmap_16_bits/g'` + fi + + # Idle + ../../idle.bat + done + echo '};' >> cfg/config_generated.cfg + + # Add output bitmap list + echo ' ' >> cfg/config_generated.cfg + echo 'output_textures = {' >> cfg/config_generated.cfg + # For each shape with coarse mesh + for i in $coarse_mesh_texture_names ; do + # Add the path + echo ' "shape_with_coarse_mesh/'$i'.tga"', >> cfg/config_generated.cfg + done + + # Close the config file + echo '};' >> cfg/config_generated.cfg + + # Execute the build + $build_coarse_mesh cfg/config_generated.cfg + + # Log error + echo ------- >> log.log + echo --- Build shape : convert coarse texture to dds without mipmaps >> log.log + echo ------- >> log.log + echo ------- + echo --- Build shape : convert coarse texture to dds without mipmaps + echo ------- + date >> log.log + date + + # Convert the coarse texture to dds + for i in $coarse_mesh_texture_names ; do + if ( test -f shape_with_coarse_mesh/$i.tga ) + then + $tga_2_dds shape_with_coarse_mesh/$i.tga -o shape_with_coarse_mesh_builded/$i.dds -a 5 2>> log.log + fi + done + +else + + echo --- No coarse meshes texture defined >> log.log + echo --- No coarse meshes texture defined + +fi diff --git a/nel/tools/3d/build_gamedata/processes/shape/sh/export.sh b/nel/tools/3d/build_gamedata/processes/shape/sh/export.sh index 73ab93589d..d00c71ac71 100644 --- a/nel/tools/3d/build_gamedata/processes/shape/sh/export.sh +++ b/nel/tools/3d/build_gamedata/processes/shape/sh/export.sh @@ -1,140 +1,140 @@ -#!/bin/bash -rm log.log 2> /dev/null - -# ********************************************* -# ********************************************* -# *** Export shape files (.shape) from Max -# ********************************************* -# ********************************************* - -exec_timeout='exec_timeout.exe' - -# Get the timeout -timeout=`cat ../../cfg/config.cfg | grep "shape_export_timeout" | sed -e 's/shape_export_timeout//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the database directory -database_directory=`cat ../../cfg/site.cfg | grep "database_directory" | sed -e 's/database_directory//g' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the build gamedata directory -build_gamedata_directory=`cat ../../cfg/site.cfg | grep "build_gamedata_directory" | sed -e 's/build_gamedata_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the shape directories -shape_source_directories=`cat ../../cfg/directories.cfg | grep "shape_source_directory" | sed -e 's/shape_source_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the quality option to choose the goor properties.cfg file -quality_flag=`cat ../../cfg/site.cfg | grep "build_quality" | grep "1"` - -# Maxdir -max_directory=`echo $MAX_DIR | sed -e 's&\\\&/&g'` - -# Get the options -if ( test "$quality_flag" ) -then - # We are in BEST mode - seoel=`cat ../../cfg/config.cfg | grep "shape_export_opt_export_lighting" | sed -e 's/shape_export_opt_export_lighting//' | sed -e 's/ //g' | sed -e 's/=//g'` - seos=`cat ../../cfg/config.cfg | grep "shape_export_opt_shadow" | sed -e 's/shape_export_opt_shadow//' | sed -e 's/ //g' | sed -e 's/=//g'` - seoll=`cat ../../cfg/config.cfg | grep "shape_export_opt_lighting_limit" | sed -e 's/shape_export_opt_lighting_limit//' | sed -e 's/ //g' | sed -e 's/=//g'` - seols=`cat ../../cfg/config.cfg | grep "shape_export_opt_lumel_size" | sed -e 's/shape_export_opt_lumel_size//' | sed -e 's/ //g' | sed -e 's/=//g'` - seoo=`cat ../../cfg/config.cfg | grep "shape_export_opt_oversampling" | sed -e 's/shape_export_opt_oversampling//' | sed -e 's/ //g' | sed -e 's/=//g'` -else - # We are in DRAFT mode - seoel='false' - seos='false' - seoll='0' - seols='0.25' - seoo='1' -fi - seolog=`cat ../../cfg/config.cfg | grep "shape_export_opt_lightmap_log" | sed -e 's/shape_export_opt_lightmap_log//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Log error -echo ------- > log.log -echo --- Export shape >> log.log -echo ------- >> log.log -echo ------- -echo --- Export shape -echo ------- -date >> log.log -date - -# For each directoy - -for i in $shape_source_directories ; do - # Copy the script - cat maxscript/shape_export.ms | sed -e "s&output_logfile&$build_gamedata_directory/processes/shape/log.log&g" | sed -e "s&shape_source_directory&$database_directory/$i&g" | sed -e "s&output_directory_tag&$build_gamedata_directory/processes/shape/tag&g" | sed -e "s&output_directory_without_coarse_mesh&$build_gamedata_directory/processes/shape/shape_not_optimized&g" | sed -e "s&output_directory_with_coarse_mesh&$build_gamedata_directory/processes/shape/shape_with_coarse_mesh&g" | sed -e "s&shape_export_opt_export_lighting&$seoel&g" | sed -e "s&shape_export_opt_shadow&$seos&g" | sed -e "s&shape_export_opt_lighting_limit&$seoll&g" | sed -e "s&shape_export_opt_lumel_size&$seols&g" | sed -e "s&shape_export_opt_oversampling&$seoo&g"| sed -e "s&shape_export_opt_lightmap_log&$seolog&g" | sed -e "s&shape_lightmap_path&$build_gamedata_directory/processes/shape/lightmap_not_optimized&g" | sed -e "s&output_directory_anim&$build_gamedata_directory/processes/shape/anim&g" > $max_directory/scripts/shape_export.ms - - # Start max - echo Try 1 >> log.log - $exec_timeout $timeout $max_directory/3dsmax.exe -U MAXScript shape_export.ms -q -mi -vn - - # Idle - ../../idle.bat - - echo Try 2 >> log.log - $exec_timeout $timeout $max_directory/3dsmax.exe -U MAXScript shape_export.ms -q -mi -vn - - # Idle - ../../idle.bat - - echo Try 3 >> log.log - $exec_timeout $timeout $max_directory/3dsmax.exe -U MAXScript shape_export.ms -q -mi -vn - - # Idle - ../../idle.bat -done - - -# ********************************************* -# ********************************************* -# *** Export character lod shape files (.clod) from Max -# ********************************************* -# ********************************************* - -# Get the clod directories -clod_source_directories=`cat ../../cfg/directories.cfg | grep "clod_source_directory" | sed -e 's/clod_source_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Log error -echo ------- >> log.log -echo --- Export clod >> log.log -echo ------- >> log.log -echo ------- -echo --- Export clod -echo ------- -date >> log.log -date - -# For each directoy - -for i in $clod_source_directories ; do - # Copy the script. TAKE IT FROM clodbank process. But write it here. - cat ../clodbank/maxscript/clod_export.ms | sed -e "s&shape_source_directory&$database_directory/$i&g" | sed -e "s&output_directory_clod&$build_gamedata_directory/processes/shape/clod&g" | sed -e "s&output_directory_tag&$build_gamedata_directory/processes/shape/tag&g" > $max_directory/scripts/clod_export.ms - - # Start max - $exec_timeout $timeout $max_directory/3dsmax.exe -U MAXScript clod_export.ms -q -mi -vn - - # Concat log.log files - echo Try 1 >> log.log - cat $max_directory/log.log >> log.log - - # Idle - ../../idle.bat - - $exec_timeout $timeout $max_directory/3dsmax.exe -U MAXScript clod_export.ms -q -mi -vn - - # Concat log.log files - echo Try 2 >> log.log - cat $max_directory/log.log >> log.log - - # Idle - ../../idle.bat - - $exec_timeout $timeout $max_directory/3dsmax.exe -U MAXScript clod_export.ms -q -mi -vn - - # Concat log.log files - echo Try 3 >> log.log - cat $max_directory/log.log >> log.log - - # Idle - ../../idle.bat -done - - +#!/bin/bash +rm log.log 2> /dev/null + +# ********************************************* +# ********************************************* +# *** Export shape files (.shape) from Max +# ********************************************* +# ********************************************* + +exec_timeout='exec_timeout.exe' + +# Get the timeout +timeout=`cat ../../cfg/config.cfg | grep "shape_export_timeout" | sed -e 's/shape_export_timeout//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the database directory +database_directory=`cat ../../cfg/site.cfg | grep "database_directory" | sed -e 's/database_directory//g' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the build gamedata directory +build_gamedata_directory=`cat ../../cfg/site.cfg | grep "build_gamedata_directory" | sed -e 's/build_gamedata_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the shape directories +shape_source_directories=`cat ../../cfg/directories.cfg | grep "shape_source_directory" | sed -e 's/shape_source_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the quality option to choose the goor properties.cfg file +quality_flag=`cat ../../cfg/site.cfg | grep "build_quality" | grep "1"` + +# Maxdir +max_directory=`echo $MAX_DIR | sed -e 's&\\\&/&g'` + +# Get the options +if ( test "$quality_flag" ) +then + # We are in BEST mode + seoel=`cat ../../cfg/config.cfg | grep "shape_export_opt_export_lighting" | sed -e 's/shape_export_opt_export_lighting//' | sed -e 's/ //g' | sed -e 's/=//g'` + seos=`cat ../../cfg/config.cfg | grep "shape_export_opt_shadow" | sed -e 's/shape_export_opt_shadow//' | sed -e 's/ //g' | sed -e 's/=//g'` + seoll=`cat ../../cfg/config.cfg | grep "shape_export_opt_lighting_limit" | sed -e 's/shape_export_opt_lighting_limit//' | sed -e 's/ //g' | sed -e 's/=//g'` + seols=`cat ../../cfg/config.cfg | grep "shape_export_opt_lumel_size" | sed -e 's/shape_export_opt_lumel_size//' | sed -e 's/ //g' | sed -e 's/=//g'` + seoo=`cat ../../cfg/config.cfg | grep "shape_export_opt_oversampling" | sed -e 's/shape_export_opt_oversampling//' | sed -e 's/ //g' | sed -e 's/=//g'` +else + # We are in DRAFT mode + seoel='false' + seos='false' + seoll='0' + seols='0.25' + seoo='1' +fi + seolog=`cat ../../cfg/config.cfg | grep "shape_export_opt_lightmap_log" | sed -e 's/shape_export_opt_lightmap_log//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Log error +echo ------- > log.log +echo --- Export shape >> log.log +echo ------- >> log.log +echo ------- +echo --- Export shape +echo ------- +date >> log.log +date + +# For each directoy + +for i in $shape_source_directories ; do + # Copy the script + cat maxscript/shape_export.ms | sed -e "s&output_logfile&$build_gamedata_directory/processes/shape/log.log&g" | sed -e "s&shape_source_directory&$database_directory/$i&g" | sed -e "s&output_directory_tag&$build_gamedata_directory/processes/shape/tag&g" | sed -e "s&output_directory_without_coarse_mesh&$build_gamedata_directory/processes/shape/shape_not_optimized&g" | sed -e "s&output_directory_with_coarse_mesh&$build_gamedata_directory/processes/shape/shape_with_coarse_mesh&g" | sed -e "s&shape_export_opt_export_lighting&$seoel&g" | sed -e "s&shape_export_opt_shadow&$seos&g" | sed -e "s&shape_export_opt_lighting_limit&$seoll&g" | sed -e "s&shape_export_opt_lumel_size&$seols&g" | sed -e "s&shape_export_opt_oversampling&$seoo&g"| sed -e "s&shape_export_opt_lightmap_log&$seolog&g" | sed -e "s&shape_lightmap_path&$build_gamedata_directory/processes/shape/lightmap_not_optimized&g" | sed -e "s&output_directory_anim&$build_gamedata_directory/processes/shape/anim&g" > $max_directory/scripts/shape_export.ms + + # Start max + echo Try 1 >> log.log + $exec_timeout $timeout $max_directory/3dsmax.exe -U MAXScript shape_export.ms -q -mi -vn + + # Idle + ../../idle.bat + + echo Try 2 >> log.log + $exec_timeout $timeout $max_directory/3dsmax.exe -U MAXScript shape_export.ms -q -mi -vn + + # Idle + ../../idle.bat + + echo Try 3 >> log.log + $exec_timeout $timeout $max_directory/3dsmax.exe -U MAXScript shape_export.ms -q -mi -vn + + # Idle + ../../idle.bat +done + + +# ********************************************* +# ********************************************* +# *** Export character lod shape files (.clod) from Max +# ********************************************* +# ********************************************* + +# Get the clod directories +clod_source_directories=`cat ../../cfg/directories.cfg | grep "clod_source_directory" | sed -e 's/clod_source_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Log error +echo ------- >> log.log +echo --- Export clod >> log.log +echo ------- >> log.log +echo ------- +echo --- Export clod +echo ------- +date >> log.log +date + +# For each directoy + +for i in $clod_source_directories ; do + # Copy the script. TAKE IT FROM clodbank process. But write it here. + cat ../clodbank/maxscript/clod_export.ms | sed -e "s&shape_source_directory&$database_directory/$i&g" | sed -e "s&output_directory_clod&$build_gamedata_directory/processes/shape/clod&g" | sed -e "s&output_directory_tag&$build_gamedata_directory/processes/shape/tag&g" > $max_directory/scripts/clod_export.ms + + # Start max + $exec_timeout $timeout $max_directory/3dsmax.exe -U MAXScript clod_export.ms -q -mi -vn + + # Concat log.log files + echo Try 1 >> log.log + cat $max_directory/log.log >> log.log + + # Idle + ../../idle.bat + + $exec_timeout $timeout $max_directory/3dsmax.exe -U MAXScript clod_export.ms -q -mi -vn + + # Concat log.log files + echo Try 2 >> log.log + cat $max_directory/log.log >> log.log + + # Idle + ../../idle.bat + + $exec_timeout $timeout $max_directory/3dsmax.exe -U MAXScript clod_export.ms -q -mi -vn + + # Concat log.log files + echo Try 3 >> log.log + cat $max_directory/log.log >> log.log + + # Idle + ../../idle.bat +done + + diff --git a/nel/tools/3d/build_gamedata/processes/shape/sh/install.sh b/nel/tools/3d/build_gamedata/processes/shape/sh/install.sh index 542138370e..a7e3ba255a 100644 --- a/nel/tools/3d/build_gamedata/processes/shape/sh/install.sh +++ b/nel/tools/3d/build_gamedata/processes/shape/sh/install.sh @@ -1,36 +1,36 @@ -#!/bin/bash -rm log.log 2> /dev/null - -# Install shapes in the client data - -# Get the shape install directory -shape_install_directory=`cat ../../cfg/directories.cfg | grep "shape_install_directory" | sed -e 's/shape_install_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the lightmaps install directory -lightmap_install_directory=`cat ../../cfg/directories.cfg | grep "lightmap_install_directory" | sed -e 's/lightmap_install_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the client directory -client_directory=`cat ../../cfg/site.cfg | grep "client_directory" | sed -e 's/client_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Log error -echo ------- > log.log -echo --- Install Shape >> log.log -echo ------- >> log.log -echo ------- -echo --- Install Shape -echo ------- -date >> log.log -date - - -cp -u -p -R shape/. $client_directory/$shape_install_directory 2>> log.log -cp -u -p -R shape_with_coarse_mesh_builded/. $client_directory/$shape_install_directory 2>> log.log - -if test "$lightmap_install_directory"; then - mkdir $client_directory/$lightmap_install_directory 2>> log.log 2> /dev/null - cp -u -p -R lightmap_16_bits/. $client_directory/$lightmap_install_directory 2>> log.log -fi - -cp -u -p -R anim/. $client_directory/$shape_install_directory 2>> log.log - -ls anim | grep ".anim" >> $client_directory/auto_animations_list.txt +#!/bin/bash +rm log.log 2> /dev/null + +# Install shapes in the client data + +# Get the shape install directory +shape_install_directory=`cat ../../cfg/directories.cfg | grep "shape_install_directory" | sed -e 's/shape_install_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the lightmaps install directory +lightmap_install_directory=`cat ../../cfg/directories.cfg | grep "lightmap_install_directory" | sed -e 's/lightmap_install_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the client directory +client_directory=`cat ../../cfg/site.cfg | grep "client_directory" | sed -e 's/client_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Log error +echo ------- > log.log +echo --- Install Shape >> log.log +echo ------- >> log.log +echo ------- +echo --- Install Shape +echo ------- +date >> log.log +date + + +cp -u -p -R shape/. $client_directory/$shape_install_directory 2>> log.log +cp -u -p -R shape_with_coarse_mesh_builded/. $client_directory/$shape_install_directory 2>> log.log + +if test "$lightmap_install_directory"; then + mkdir $client_directory/$lightmap_install_directory 2>> log.log 2> /dev/null + cp -u -p -R lightmap_16_bits/. $client_directory/$lightmap_install_directory 2>> log.log +fi + +cp -u -p -R anim/. $client_directory/$shape_install_directory 2>> log.log + +ls anim | grep ".anim" >> $client_directory/auto_animations_list.txt diff --git a/nel/tools/3d/build_gamedata/processes/skel/sh/export.sh b/nel/tools/3d/build_gamedata/processes/skel/sh/export.sh index 5039f8ffd6..f3a1a7e4f5 100644 --- a/nel/tools/3d/build_gamedata/processes/skel/sh/export.sh +++ b/nel/tools/3d/build_gamedata/processes/skel/sh/export.sh @@ -1,80 +1,80 @@ -#!/bin/bash -rm log.log 2> /dev/null - -# *** Export skeleton files (.skel) from Max - -exec_timeout='exec_timeout.exe' - -# Get the timeout -timeout=`cat ../../cfg/config.cfg | grep "skel_export_timeout" | sed -e 's/skel_export_timeout//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the database directory -database_directory=`cat ../../cfg/site.cfg | grep "database_directory" | sed -e 's/database_directory//g' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the build gamedata directory -build_gamedata_directory=`cat ../../cfg/site.cfg | grep "build_gamedata_directory" | sed -e 's/build_gamedata_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the skel directories -skel_source_directories=`cat ../../cfg/directories.cfg | grep "skel_source_directory" | sed -e 's/skel_source_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Maxdir -max_directory=`echo $MAX_DIR | sed -e 's&\\\&/&g'` - -# Log error -echo ------- > log.log -echo --- Export skeleton from MAX>> log.log -echo ------- >> log.log -echo ------- -echo --- Export skeleton from MAX -echo ------- -date >> log.log -date - -# For each directoy - -for i in $skel_source_directories ; do - # Copy the script - cat maxscript/skel_export.ms | sed -e "s&output_logfile&$build_gamedata_directory/processes/skel/log.log&g" | sed -e "s&skel_source_directory&$database_directory/$i&g" | sed -e "s&output_directory&$build_gamedata_directory/processes/skel/skel&g" > $max_directory/scripts/skel_export.ms - - # Start max - echo Try 1 >> log.log - $exec_timeout $timeout $max_directory/3dsmax.exe -U MAXScript skel_export.ms -q -mi -vn - - # Idle - ../../idle.bat - - echo Try 2 >> log.log - $exec_timeout $timeout $max_directory/3dsmax.exe -U MAXScript skel_export.ms -q -mi -vn - - # Idle - ../../idle.bat - - echo Try 3 >> log.log - $exec_timeout $timeout $max_directory/3dsmax.exe -U MAXScript skel_export.ms -q -mi -vn - - # Idle - ../../idle.bat -done - - -# *** Export skeleton files (.skel) directly from .skel version - -# Log error -echo ------- >> log.log -echo --- Copy skeleton from .skel>> log.log -echo ------- >> log.log -echo ------- -echo --- Copy skeleton from .skel -echo ------- -date >> log.log -date - -# For each directoy - -for i in $skel_source_directories ; do - # copy - cp -u -p $database_directory/$i/*.[sS][kK][eE][lL] skel 2>> log.log - - # Idle - ../../idle.bat -done +#!/bin/bash +rm log.log 2> /dev/null + +# *** Export skeleton files (.skel) from Max + +exec_timeout='exec_timeout.exe' + +# Get the timeout +timeout=`cat ../../cfg/config.cfg | grep "skel_export_timeout" | sed -e 's/skel_export_timeout//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the database directory +database_directory=`cat ../../cfg/site.cfg | grep "database_directory" | sed -e 's/database_directory//g' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the build gamedata directory +build_gamedata_directory=`cat ../../cfg/site.cfg | grep "build_gamedata_directory" | sed -e 's/build_gamedata_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the skel directories +skel_source_directories=`cat ../../cfg/directories.cfg | grep "skel_source_directory" | sed -e 's/skel_source_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Maxdir +max_directory=`echo $MAX_DIR | sed -e 's&\\\&/&g'` + +# Log error +echo ------- > log.log +echo --- Export skeleton from MAX>> log.log +echo ------- >> log.log +echo ------- +echo --- Export skeleton from MAX +echo ------- +date >> log.log +date + +# For each directoy + +for i in $skel_source_directories ; do + # Copy the script + cat maxscript/skel_export.ms | sed -e "s&output_logfile&$build_gamedata_directory/processes/skel/log.log&g" | sed -e "s&skel_source_directory&$database_directory/$i&g" | sed -e "s&output_directory&$build_gamedata_directory/processes/skel/skel&g" > $max_directory/scripts/skel_export.ms + + # Start max + echo Try 1 >> log.log + $exec_timeout $timeout $max_directory/3dsmax.exe -U MAXScript skel_export.ms -q -mi -vn + + # Idle + ../../idle.bat + + echo Try 2 >> log.log + $exec_timeout $timeout $max_directory/3dsmax.exe -U MAXScript skel_export.ms -q -mi -vn + + # Idle + ../../idle.bat + + echo Try 3 >> log.log + $exec_timeout $timeout $max_directory/3dsmax.exe -U MAXScript skel_export.ms -q -mi -vn + + # Idle + ../../idle.bat +done + + +# *** Export skeleton files (.skel) directly from .skel version + +# Log error +echo ------- >> log.log +echo --- Copy skeleton from .skel>> log.log +echo ------- >> log.log +echo ------- +echo --- Copy skeleton from .skel +echo ------- +date >> log.log +date + +# For each directoy + +for i in $skel_source_directories ; do + # copy + cp -u -p $database_directory/$i/*.[sS][kK][eE][lL] skel 2>> log.log + + # Idle + ../../idle.bat +done diff --git a/nel/tools/3d/build_gamedata/processes/skel/sh/install.sh b/nel/tools/3d/build_gamedata/processes/skel/sh/install.sh index f93c9e4316..d1ce0a9de6 100644 --- a/nel/tools/3d/build_gamedata/processes/skel/sh/install.sh +++ b/nel/tools/3d/build_gamedata/processes/skel/sh/install.sh @@ -1,22 +1,22 @@ -#!/bin/bash -rm log.log 2> /dev/null - -# Install skel in the client data - -# Get the skel install directory -skel_install_directory=`cat ../../cfg/directories.cfg | grep "skel_install_directory" | sed -e 's/skel_install_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the client directory -client_directory=`cat ../../cfg/site.cfg | grep "client_directory" | sed -e 's/client_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Log error -echo ------- > log.log -echo --- Install skeleton >> log.log -echo ------- >> log.log -echo ------- -echo --- Install skeleton -echo ------- -date >> log.log -date - -cp -u -p -R skel/. $client_directory/$skel_install_directory 2>> log.log +#!/bin/bash +rm log.log 2> /dev/null + +# Install skel in the client data + +# Get the skel install directory +skel_install_directory=`cat ../../cfg/directories.cfg | grep "skel_install_directory" | sed -e 's/skel_install_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the client directory +client_directory=`cat ../../cfg/site.cfg | grep "client_directory" | sed -e 's/client_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Log error +echo ------- > log.log +echo --- Install skeleton >> log.log +echo ------- >> log.log +echo ------- +echo --- Install skeleton +echo ------- +date >> log.log +date + +cp -u -p -R skel/. $client_directory/$skel_install_directory 2>> log.log diff --git a/nel/tools/3d/build_gamedata/processes/smallbank/sh/export.sh b/nel/tools/3d/build_gamedata/processes/smallbank/sh/export.sh index c07fc24e36..1c594ef5d7 100644 --- a/nel/tools/3d/build_gamedata/processes/smallbank/sh/export.sh +++ b/nel/tools/3d/build_gamedata/processes/smallbank/sh/export.sh @@ -1,72 +1,72 @@ -#!/bin/bash -rm log.log 2> /dev/null - -# *** Export bank file (.bank) from Max - -# Some exe -build_smallbank='build_smallbank.exe' -exec_timeout='exec_timeout.exe' - -# Get the database directory -database_directory=`cat ../../cfg/site.cfg | grep "database_directory" | sed -e 's/database_directory//g' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the swt directories -bank_source_directory=`cat ../../cfg/directories.cfg | grep "bank_source_directory" | sed -e 's/bank_source_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the timeout -timeout=`cat ../../cfg/config.cfg | grep "smallbank_build_timeout" | sed -e 's/smallbank_build_timeout//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the tiles root directories -tile_root_source_directory=`cat ../../cfg/directories.cfg | grep "tile_root_source_directory" | sed -e 's/tile_root_source_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Log error -echo ------- > log.log -echo --- Export bank >> log.log -echo ------- >> log.log -echo ------- -echo --- Export bank -echo ------- -date >> log.log -date - -# Copy the bank -cp -u -p $database_directory/$bank_source_directory/*.[bB][aA][nN][kK] bank 2>> log.log - -# Build the small bank - -# Log error -echo ------- > log.log -echo --- Build bank >> log.log -echo ------- >> log.log -echo ------- -echo --- Build bank -echo ------- -date >> log.log -date - -# list all the bank -bank_list=`ls -1 bank/*.[bB][aA][nN][kK]` - -# For each bank -for i in $bank_list ; do - # Destination the name - dest=`echo $i | sed -e 's&bank&smallbank&g'` - - # Make the dependencies - if ( ! test -e $dest ) || ( test $i -nt $dest ) - then - $exec_timeout $timeout $build_smallbank $i $dest $database_directory/$tile_root_source_directory/ - if ( test -e $dest ) - then - echo OK $dest >> log.log - else - echo ERROR building $dest >> log.log - fi - else - echo SKIPPED $dest >> log.log - fi - - # Idle - ../../idle.bat -done - +#!/bin/bash +rm log.log 2> /dev/null + +# *** Export bank file (.bank) from Max + +# Some exe +build_smallbank='build_smallbank.exe' +exec_timeout='exec_timeout.exe' + +# Get the database directory +database_directory=`cat ../../cfg/site.cfg | grep "database_directory" | sed -e 's/database_directory//g' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the swt directories +bank_source_directory=`cat ../../cfg/directories.cfg | grep "bank_source_directory" | sed -e 's/bank_source_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the timeout +timeout=`cat ../../cfg/config.cfg | grep "smallbank_build_timeout" | sed -e 's/smallbank_build_timeout//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the tiles root directories +tile_root_source_directory=`cat ../../cfg/directories.cfg | grep "tile_root_source_directory" | sed -e 's/tile_root_source_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Log error +echo ------- > log.log +echo --- Export bank >> log.log +echo ------- >> log.log +echo ------- +echo --- Export bank +echo ------- +date >> log.log +date + +# Copy the bank +cp -u -p $database_directory/$bank_source_directory/*.[bB][aA][nN][kK] bank 2>> log.log + +# Build the small bank + +# Log error +echo ------- > log.log +echo --- Build bank >> log.log +echo ------- >> log.log +echo ------- +echo --- Build bank +echo ------- +date >> log.log +date + +# list all the bank +bank_list=`ls -1 bank/*.[bB][aA][nN][kK]` + +# For each bank +for i in $bank_list ; do + # Destination the name + dest=`echo $i | sed -e 's&bank&smallbank&g'` + + # Make the dependencies + if ( ! test -e $dest ) || ( test $i -nt $dest ) + then + $exec_timeout $timeout $build_smallbank $i $dest $database_directory/$tile_root_source_directory/ + if ( test -e $dest ) + then + echo OK $dest >> log.log + else + echo ERROR building $dest >> log.log + fi + else + echo SKIPPED $dest >> log.log + fi + + # Idle + ../../idle.bat +done + diff --git a/nel/tools/3d/build_gamedata/processes/smallbank/sh/install.sh b/nel/tools/3d/build_gamedata/processes/smallbank/sh/install.sh index 1bf7035811..d0e4634fb1 100644 --- a/nel/tools/3d/build_gamedata/processes/smallbank/sh/install.sh +++ b/nel/tools/3d/build_gamedata/processes/smallbank/sh/install.sh @@ -1,22 +1,22 @@ -#!/bin/bash -rm log.log 2> /dev/null - -# Install the bank in the client data - -# Get the bank install directory -bank_install_directory=`cat ../../cfg/directories.cfg | grep "bank_install_directory" | sed -e 's/bank_install_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the client directory -client_directory=`cat ../../cfg/site.cfg | grep "client_directory" | sed -e 's/client_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Log error -echo ------- > log.log -echo --- Install smallbank >> log.log -echo ------- >> log.log -echo ------- -echo --- Install smallbank -echo ------- -date >> log.log -date - -cp -u -p -R smallbank/. $client_directory/$bank_install_directory 2>> log.log +#!/bin/bash +rm log.log 2> /dev/null + +# Install the bank in the client data + +# Get the bank install directory +bank_install_directory=`cat ../../cfg/directories.cfg | grep "bank_install_directory" | sed -e 's/bank_install_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the client directory +client_directory=`cat ../../cfg/site.cfg | grep "client_directory" | sed -e 's/client_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Log error +echo ------- > log.log +echo --- Install smallbank >> log.log +echo ------- >> log.log +echo ------- +echo --- Install smallbank +echo ------- +date >> log.log +date + +cp -u -p -R smallbank/. $client_directory/$bank_install_directory 2>> log.log diff --git a/nel/tools/3d/build_gamedata/processes/swt/sh/export.sh b/nel/tools/3d/build_gamedata/processes/swt/sh/export.sh index 2855f8548d..3b33cf45b9 100644 --- a/nel/tools/3d/build_gamedata/processes/swt/sh/export.sh +++ b/nel/tools/3d/build_gamedata/processes/swt/sh/export.sh @@ -1,57 +1,57 @@ -#!/bin/bash -rm log.log 2> /dev/null - -# *** Export skeleton weight files (.swt) from Max - -exec_timeout='exec_timeout.exe' - -# Get the timeout -timeout=`cat ../../cfg/config.cfg | grep "swt_export_timeout" | sed -e 's/swt_export_timeout//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the database directory -database_directory=`cat ../../cfg/site.cfg | grep "database_directory" | sed -e 's/database_directory//g' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the build gamedata directory -build_gamedata_directory=`cat ../../cfg/site.cfg | grep "build_gamedata_directory" | sed -e 's/build_gamedata_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the swt directories -swt_source_directories=`cat ../../cfg/directories.cfg | grep "swt_source_directory" | sed -e 's/swt_source_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Maxdir -max_directory=`echo $MAX_DIR | sed -e 's&\\\&/&g'` - -# Log error -echo ------- > log.log -echo --- Export skeleton weight >> log.log -echo ------- >> log.log -echo ------- -echo --- Export skeleton weight -echo ------- -date >> log.log -date - -# For each directoy - -for i in $swt_source_directories ; do - # Copy the script - cat maxscript/swt_export.ms | sed -e "s&output_logfile&$build_gamedata_directory/processes/swt/log.log&g" | sed -e "s&swt_source_directory&$database_directory/$i&g" | sed -e "s&output_directory&$build_gamedata_directory/processes/swt/swt&g" > $max_directory/scripts/swt_export.ms - - # Start max - echo Try 1 >> log.log - $exec_timeout $timeout $max_directory/3dsmax.exe -U MAXScript swt_export.ms -q -mi -vn - - # Idle - ../../idle.bat - - echo Try 2 >> log.log - $exec_timeout $timeout $max_directory/3dsmax.exe -U MAXScript swt_export.ms -q -mi -vn - - # Idle - ../../idle.bat - - echo Try 3 >> log.log - $exec_timeout $timeout $max_directory/3dsmax.exe -U MAXScript swt_export.ms -q -mi -vn - - # Idle - ../../idle.bat -done +#!/bin/bash +rm log.log 2> /dev/null + +# *** Export skeleton weight files (.swt) from Max + +exec_timeout='exec_timeout.exe' + +# Get the timeout +timeout=`cat ../../cfg/config.cfg | grep "swt_export_timeout" | sed -e 's/swt_export_timeout//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the database directory +database_directory=`cat ../../cfg/site.cfg | grep "database_directory" | sed -e 's/database_directory//g' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the build gamedata directory +build_gamedata_directory=`cat ../../cfg/site.cfg | grep "build_gamedata_directory" | sed -e 's/build_gamedata_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the swt directories +swt_source_directories=`cat ../../cfg/directories.cfg | grep "swt_source_directory" | sed -e 's/swt_source_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Maxdir +max_directory=`echo $MAX_DIR | sed -e 's&\\\&/&g'` + +# Log error +echo ------- > log.log +echo --- Export skeleton weight >> log.log +echo ------- >> log.log +echo ------- +echo --- Export skeleton weight +echo ------- +date >> log.log +date + +# For each directoy + +for i in $swt_source_directories ; do + # Copy the script + cat maxscript/swt_export.ms | sed -e "s&output_logfile&$build_gamedata_directory/processes/swt/log.log&g" | sed -e "s&swt_source_directory&$database_directory/$i&g" | sed -e "s&output_directory&$build_gamedata_directory/processes/swt/swt&g" > $max_directory/scripts/swt_export.ms + + # Start max + echo Try 1 >> log.log + $exec_timeout $timeout $max_directory/3dsmax.exe -U MAXScript swt_export.ms -q -mi -vn + + # Idle + ../../idle.bat + + echo Try 2 >> log.log + $exec_timeout $timeout $max_directory/3dsmax.exe -U MAXScript swt_export.ms -q -mi -vn + + # Idle + ../../idle.bat + + echo Try 3 >> log.log + $exec_timeout $timeout $max_directory/3dsmax.exe -U MAXScript swt_export.ms -q -mi -vn + + # Idle + ../../idle.bat +done diff --git a/nel/tools/3d/build_gamedata/processes/swt/sh/install.sh b/nel/tools/3d/build_gamedata/processes/swt/sh/install.sh index 78aacb4be9..a7882ce26f 100644 --- a/nel/tools/3d/build_gamedata/processes/swt/sh/install.sh +++ b/nel/tools/3d/build_gamedata/processes/swt/sh/install.sh @@ -1,22 +1,22 @@ -#!/bin/bash -rm log.log 2> /dev/null - -# Install swt in the client data - -# Get the swt install directory -swt_install_directory=`cat ../../cfg/directories.cfg | grep "swt_install_directory" | sed -e 's/swt_install_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the client directory -client_directory=`cat ../../cfg/site.cfg | grep "client_directory" | sed -e 's/client_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Log error -echo ------- > log.log -echo --- Install skeleton weight >> log.log -echo ------- >> log.log -echo ------- -echo --- Install skeleton weight -echo ------- -date >> log.log -date - -cp -u -p -R swt/. $client_directory/$swt_install_directory 2>> log.log +#!/bin/bash +rm log.log 2> /dev/null + +# Install swt in the client data + +# Get the swt install directory +swt_install_directory=`cat ../../cfg/directories.cfg | grep "swt_install_directory" | sed -e 's/swt_install_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the client directory +client_directory=`cat ../../cfg/site.cfg | grep "client_directory" | sed -e 's/client_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Log error +echo ------- > log.log +echo --- Install skeleton weight >> log.log +echo ------- >> log.log +echo ------- +echo --- Install skeleton weight +echo ------- +date >> log.log +date + +cp -u -p -R swt/. $client_directory/$swt_install_directory 2>> log.log diff --git a/nel/tools/3d/build_gamedata/processes/tiles/sh/build.sh b/nel/tools/3d/build_gamedata/processes/tiles/sh/build.sh index 99be397c32..a8e346450b 100644 --- a/nel/tools/3d/build_gamedata/processes/tiles/sh/build.sh +++ b/nel/tools/3d/build_gamedata/processes/tiles/sh/build.sh @@ -1,43 +1,43 @@ -#!/bin/bash -rm log.log 2> /dev/null - -tga_2_dds='tga2dds.exe' -exec_timeout='exec_timeout.exe' - -# Get the timeout -timeout=`cat ../../cfg/config.cfg | grep "maps_build_timeout" | sed -e 's/maps_build_timeout//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Build the tile textures - -# Log error -echo ------- > log.log -echo --- Build tiles >> log.log -echo ------- >> log.log -echo ------- -echo --- Build tiles -echo ------- -date >> log.log -date - -# For each texture -for i in maps_tga/*.[tT][gG][aA] ; do - if ( test -e $i ) - then - dest=`echo $i | sed -e 's/maps_tga/maps_final/g' | sed -e 's/.tga/.dds/g'` - if ( ! test -e $dest ) || ( test $i -nt $dest ) - then - $exec_timeout $timeout $tga_2_dds $i -o $dest -a 5 -m - if ( test -e $dest ) - then - echo OK $dest >> log.log - else - echo ERROR building $dest >> log.log - fi - else - echo SKIPPED $dest >> log.log - fi - fi - - # Idle - ../../idle.bat -done +#!/bin/bash +rm log.log 2> /dev/null + +tga_2_dds='tga2dds.exe' +exec_timeout='exec_timeout.exe' + +# Get the timeout +timeout=`cat ../../cfg/config.cfg | grep "maps_build_timeout" | sed -e 's/maps_build_timeout//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Build the tile textures + +# Log error +echo ------- > log.log +echo --- Build tiles >> log.log +echo ------- >> log.log +echo ------- +echo --- Build tiles +echo ------- +date >> log.log +date + +# For each texture +for i in maps_tga/*.[tT][gG][aA] ; do + if ( test -e $i ) + then + dest=`echo $i | sed -e 's/maps_tga/maps_final/g' | sed -e 's/.tga/.dds/g'` + if ( ! test -e $dest ) || ( test $i -nt $dest ) + then + $exec_timeout $timeout $tga_2_dds $i -o $dest -a 5 -m + if ( test -e $dest ) + then + echo OK $dest >> log.log + else + echo ERROR building $dest >> log.log + fi + else + echo SKIPPED $dest >> log.log + fi + fi + + # Idle + ../../idle.bat +done diff --git a/nel/tools/3d/build_gamedata/processes/tiles/sh/export.sh b/nel/tools/3d/build_gamedata/processes/tiles/sh/export.sh index b26e5adf0e..a6e03995fd 100644 --- a/nel/tools/3d/build_gamedata/processes/tiles/sh/export.sh +++ b/nel/tools/3d/build_gamedata/processes/tiles/sh/export.sh @@ -1,33 +1,33 @@ -#!/bin/bash -rm log.log 2> /dev/null - -# Export the tile textures - -# Get the database directory -database_directory=`cat ../../cfg/site.cfg | grep "database_directory" | sed -e 's/database_directory//g' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the tile directories -tile_source_directories=`cat ../../cfg/directories.cfg | grep "tile_source_directories" | sed -e 's/tile_source_directories//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Log error -echo ------- > log.log -echo --- Export tiles >> log.log -echo ------- >> log.log -echo ------- -echo --- Export tiles -echo ------- -date >> log.log -date - -# For each directoy -for i in $tile_source_directories ; do - list_textures=`find $database_directory/$i -type f -name '*.[tT][gG][aA]'` - - # For each textures - for j in $list_textures ; do - cp -u -p $j maps_tga/ 2>> log.log - done - - # Idle - ../../idle.bat -done +#!/bin/bash +rm log.log 2> /dev/null + +# Export the tile textures + +# Get the database directory +database_directory=`cat ../../cfg/site.cfg | grep "database_directory" | sed -e 's/database_directory//g' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the tile directories +tile_source_directories=`cat ../../cfg/directories.cfg | grep "tile_source_directories" | sed -e 's/tile_source_directories//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Log error +echo ------- > log.log +echo --- Export tiles >> log.log +echo ------- >> log.log +echo ------- +echo --- Export tiles +echo ------- +date >> log.log +date + +# For each directoy +for i in $tile_source_directories ; do + list_textures=`find $database_directory/$i -type f -name '*.[tT][gG][aA]'` + + # For each textures + for j in $list_textures ; do + cp -u -p $j maps_tga/ 2>> log.log + done + + # Idle + ../../idle.bat +done diff --git a/nel/tools/3d/build_gamedata/processes/tiles/sh/install.sh b/nel/tools/3d/build_gamedata/processes/tiles/sh/install.sh index bb5263f3e9..6168aa3e43 100644 --- a/nel/tools/3d/build_gamedata/processes/tiles/sh/install.sh +++ b/nel/tools/3d/build_gamedata/processes/tiles/sh/install.sh @@ -1,22 +1,22 @@ -#!/bin/bash -rm log.log 2> /dev/null - -# Install tiles in the client data - -# Get the tile install directory -tile_install_directory=`cat ../../cfg/directories.cfg | grep "tile_install_directory" | sed -e 's/tile_install_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the client directory -client_directory=`cat ../../cfg/site.cfg | grep "client_directory" | sed -e 's/client_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Log error -echo ------- > log.log -echo --- Install Tiles >> log.log -echo ------- >> log.log -echo ------- -echo --- Install Tiles -echo ------- -date >> log.log -date - -cp -u -p -R maps_final/. $client_directory/$tile_install_directory 2>> log.log +#!/bin/bash +rm log.log 2> /dev/null + +# Install tiles in the client data + +# Get the tile install directory +tile_install_directory=`cat ../../cfg/directories.cfg | grep "tile_install_directory" | sed -e 's/tile_install_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the client directory +client_directory=`cat ../../cfg/site.cfg | grep "client_directory" | sed -e 's/client_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Log error +echo ------- > log.log +echo --- Install Tiles >> log.log +echo ------- >> log.log +echo ------- +echo --- Install Tiles +echo ------- +date >> log.log +date + +cp -u -p -R maps_final/. $client_directory/$tile_install_directory 2>> log.log diff --git a/nel/tools/3d/build_gamedata/processes/veget/sh/export.sh b/nel/tools/3d/build_gamedata/processes/veget/sh/export.sh index 036a53b170..2bb35f60df 100644 --- a/nel/tools/3d/build_gamedata/processes/veget/sh/export.sh +++ b/nel/tools/3d/build_gamedata/processes/veget/sh/export.sh @@ -1,52 +1,52 @@ -#!/bin/bash -rm log.log 2> /dev/null - -# *** Export veget files (.veget) from Max - -# Get the database directory -database_directory=`cat ../../cfg/site.cfg | grep "database_directory" | sed -e 's/database_directory//g' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the build gamedata directory -build_gamedata_directory=`cat ../../cfg/site.cfg | grep "build_gamedata_directory" | sed -e 's/build_gamedata_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the veget directories -veget_source_directories=`cat ../../cfg/directories.cfg | grep "veget_source_directory" | sed -e 's/veget_source_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Maxdir -max_directory=`echo $MAX_DIR | sed -e 's&\\\&/&g'` - -# Log error -echo ------- > log.log -echo --- Export veget >> log.log -echo ------- >> log.log -echo ------- -echo --- Export veget -echo ------- -date >> log.log -date - -# For each directoy - -for i in $veget_source_directories ; do - # Copy the script - cat maxscript/veget_export.ms | sed -e "s&output_logfile&$build_gamedata_directory/processes/veget/log.log&g" | sed -e "s&veget_source_directory&$database_directory/$i&g" | sed -e "s&output_directory_veget&$build_gamedata_directory/processes/veget/veget&g" | sed -e "s&output_directory_tag&$build_gamedata_directory/processes/veget/tag&g" > $max_directory/scripts/veget_export.ms - - # Start max - echo Try 1 >> log.log - $max_directory/3dsmax.exe -U MAXScript veget_export.ms -q -mi -vn - - # Idle - ../../idle.bat - - echo Try 2 >> log.log - $max_directory/3dsmax.exe -U MAXScript veget_export.ms -q -mi -vn - - # Idle - ../../idle.bat - - echo Try 3 >> log.log - $max_directory/3dsmax.exe -U MAXScript veget_export.ms -q -mi -vn - - # Idle - ../../idle.bat -done +#!/bin/bash +rm log.log 2> /dev/null + +# *** Export veget files (.veget) from Max + +# Get the database directory +database_directory=`cat ../../cfg/site.cfg | grep "database_directory" | sed -e 's/database_directory//g' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the build gamedata directory +build_gamedata_directory=`cat ../../cfg/site.cfg | grep "build_gamedata_directory" | sed -e 's/build_gamedata_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the veget directories +veget_source_directories=`cat ../../cfg/directories.cfg | grep "veget_source_directory" | sed -e 's/veget_source_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Maxdir +max_directory=`echo $MAX_DIR | sed -e 's&\\\&/&g'` + +# Log error +echo ------- > log.log +echo --- Export veget >> log.log +echo ------- >> log.log +echo ------- +echo --- Export veget +echo ------- +date >> log.log +date + +# For each directoy + +for i in $veget_source_directories ; do + # Copy the script + cat maxscript/veget_export.ms | sed -e "s&output_logfile&$build_gamedata_directory/processes/veget/log.log&g" | sed -e "s&veget_source_directory&$database_directory/$i&g" | sed -e "s&output_directory_veget&$build_gamedata_directory/processes/veget/veget&g" | sed -e "s&output_directory_tag&$build_gamedata_directory/processes/veget/tag&g" > $max_directory/scripts/veget_export.ms + + # Start max + echo Try 1 >> log.log + $max_directory/3dsmax.exe -U MAXScript veget_export.ms -q -mi -vn + + # Idle + ../../idle.bat + + echo Try 2 >> log.log + $max_directory/3dsmax.exe -U MAXScript veget_export.ms -q -mi -vn + + # Idle + ../../idle.bat + + echo Try 3 >> log.log + $max_directory/3dsmax.exe -U MAXScript veget_export.ms -q -mi -vn + + # Idle + ../../idle.bat +done diff --git a/nel/tools/3d/build_gamedata/processes/veget/sh/install.sh b/nel/tools/3d/build_gamedata/processes/veget/sh/install.sh index dc45510409..509a07960b 100644 --- a/nel/tools/3d/build_gamedata/processes/veget/sh/install.sh +++ b/nel/tools/3d/build_gamedata/processes/veget/sh/install.sh @@ -1,22 +1,22 @@ -#!/bin/bash -rm log.log 2> /dev/null - -# Install vegets in the client data - -# Get the veget install directory -veget_install_directory=`cat ../../cfg/directories.cfg | grep "veget_install_directory" | sed -e 's/veget_install_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the client directory -client_directory=`cat ../../cfg/site.cfg | grep "client_directory" | sed -e 's/client_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Log error -echo ------- > log.log -echo --- Install veget >> log.log -echo ------- >> log.log -echo ------- -echo --- Install veget -echo ------- -date >> log.log -date - -cp -u -p -R veget/. $client_directory/$veget_install_directory 2>> log.log +#!/bin/bash +rm log.log 2> /dev/null + +# Install vegets in the client data + +# Get the veget install directory +veget_install_directory=`cat ../../cfg/directories.cfg | grep "veget_install_directory" | sed -e 's/veget_install_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the client directory +client_directory=`cat ../../cfg/site.cfg | grep "client_directory" | sed -e 's/client_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Log error +echo ------- > log.log +echo --- Install veget >> log.log +echo ------- >> log.log +echo ------- +echo --- Install veget +echo ------- +date >> log.log +date + +cp -u -p -R veget/. $client_directory/$veget_install_directory 2>> log.log diff --git a/nel/tools/3d/build_gamedata/processes/vegetset/sh/export.sh b/nel/tools/3d/build_gamedata/processes/vegetset/sh/export.sh index 57c42cab01..fffb864166 100644 --- a/nel/tools/3d/build_gamedata/processes/vegetset/sh/export.sh +++ b/nel/tools/3d/build_gamedata/processes/vegetset/sh/export.sh @@ -1,29 +1,29 @@ -#!/bin/bash -rm log.log 2> /dev/null - -# *** Export vegetset file (.vegetset) - -# Get the database directory -database_directory=`cat ../../cfg/site.cfg | grep "database_directory" | sed -e 's/database_directory//g' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the vegetset directories -vegetset_source_directories=`cat ../../cfg/directories.cfg | grep "vegetset_source_directory" | sed -e 's/vegetset_source_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Log error -echo ------- > log.log -echo --- Export vegetset >> log.log -echo ------- >> log.log -echo ------- -echo --- Export vegetset -echo ------- -date >> log.log -date - -# For each vegetset directory -for i in $vegetset_source_directories ; do - # Copy - cp -u -p $database_directory/$i/*.[vV][eE][gG][eE][tT][sS][eE][tT] vegetset 2>> log.log - - # Idle - ../../idle.bat -done +#!/bin/bash +rm log.log 2> /dev/null + +# *** Export vegetset file (.vegetset) + +# Get the database directory +database_directory=`cat ../../cfg/site.cfg | grep "database_directory" | sed -e 's/database_directory//g' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the vegetset directories +vegetset_source_directories=`cat ../../cfg/directories.cfg | grep "vegetset_source_directory" | sed -e 's/vegetset_source_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Log error +echo ------- > log.log +echo --- Export vegetset >> log.log +echo ------- >> log.log +echo ------- +echo --- Export vegetset +echo ------- +date >> log.log +date + +# For each vegetset directory +for i in $vegetset_source_directories ; do + # Copy + cp -u -p $database_directory/$i/*.[vV][eE][gG][eE][tT][sS][eE][tT] vegetset 2>> log.log + + # Idle + ../../idle.bat +done diff --git a/nel/tools/3d/build_gamedata/processes/vegetset/sh/install.sh b/nel/tools/3d/build_gamedata/processes/vegetset/sh/install.sh index 8aa214eb6e..44678768ff 100644 --- a/nel/tools/3d/build_gamedata/processes/vegetset/sh/install.sh +++ b/nel/tools/3d/build_gamedata/processes/vegetset/sh/install.sh @@ -1,22 +1,22 @@ -#!/bin/bash -rm log.log 2> /dev/null - -# Install the vegetable set in the client data - -# Get the vegetset install directory -vegetset_install_directory=`cat ../../cfg/directories.cfg | grep "vegetset_install_directory" | sed -e 's/vegetset_install_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the client directory -client_directory=`cat ../../cfg/site.cfg | grep "client_directory" | sed -e 's/client_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Log error -echo ------- > log.log -echo --- Install vegetset >> log.log -echo ------- >> log.log -echo ------- -echo --- Install vegetset -echo ------- -date >> log.log -date - -cp -u -p -R vegetset/. $client_directory/$vegetset_install_directory 2>> log.log +#!/bin/bash +rm log.log 2> /dev/null + +# Install the vegetable set in the client data + +# Get the vegetset install directory +vegetset_install_directory=`cat ../../cfg/directories.cfg | grep "vegetset_install_directory" | sed -e 's/vegetset_install_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the client directory +client_directory=`cat ../../cfg/site.cfg | grep "client_directory" | sed -e 's/client_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Log error +echo ------- > log.log +echo --- Install vegetset >> log.log +echo ------- >> log.log +echo ------- +echo --- Install vegetset +echo ------- +date >> log.log +date + +cp -u -p -R vegetset/. $client_directory/$vegetset_install_directory 2>> log.log diff --git a/nel/tools/3d/build_gamedata/processes/zone/sh/build.sh b/nel/tools/3d/build_gamedata/processes/zone/sh/build.sh index f3b32f17dc..2657c0b42e 100644 --- a/nel/tools/3d/build_gamedata/processes/zone/sh/build.sh +++ b/nel/tools/3d/build_gamedata/processes/zone/sh/build.sh @@ -1,149 +1,149 @@ -#!/bin/bash -rm log.log 2> /dev/null - -# Build zone - -zone_dependencies='zone_dependencies.exe' -zone_welder='zone_welder.exe' -exec_timeout='exec_timeout.exe' - -# Get the timeout -depend_timeout=`cat ../../cfg/config.cfg | grep "zone_build_depend_timeout" | sed -e 's/zone_build_depend_timeout//' | sed -e 's/ //g' | sed -e 's/=//g'` -weld_timeout=`cat ../../cfg/config.cfg | grep "zone_build_weld_timeout" | sed -e 's/zone_build_weld_timeout//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the quality option to choose the goor properties.cfg file -quality_flag=`cat ../../cfg/site.cfg | grep "build_quality" | grep "1"` - -# **** Build dependencies - -if ( test "$quality_flag" ) -then - # We are in BEST mode - - # Log error - echo ------- >> log.log - echo --- Build zone : dependencies >> log.log - echo ------- >> log.log - echo ------- - echo --- Build zone : dependencies - echo ------- - date >> log.log - date - - cp ../../cfg/properties.cfg zone_depencies_properties.cfg - #append the level design directory at the end of the config file - ld_dir=`cat ../../cfg/site.cfg | grep "level_design_directory" | sed -e 's/level_design_directory//g' | sed -e 's/ //g' | sed -e 's/=//g'` - ld_world_dir=`cat ../../cfg/site.cfg | grep "level_design_world_directory" | sed -e 's/level_design_world_directory//g' | sed -e 's/ //g' | sed -e 's/=//g'` - ld_dfn_dir=`cat ../../cfg/site.cfg | grep "level_design_dfn_directory" | sed -e 's/level_design_dfn_directory//g' | sed -e 's/ //g' | sed -e 's/=//g'` - continent_file_name=`cat ../../cfg/config.cfg | grep "continent_file" | sed -e 's/continent_file//g' | sed -e 's/ //g' | sed -e 's/=//g'` - echo "level_design_directory = \"$ld_dir\";" >> zone_depencies_properties.cfg - echo "level_design_world_directory = \"$ld_world_dir\";" >> zone_depencies_properties.cfg - echo "level_design_dfn_directory = \"$ld_dfn_dir\";" >> zone_depencies_properties.cfg - echo "continent_name = \"$continent_file_name\";" >> zone_depencies_properties.cfg - - - # list all the dependencies regions - zone_regions=`cat ../../cfg/config.cfg | grep "zone_region" | sed -e 's/zone_region//' | sed -e 's/ //g' | sed -e 's/=//g'` - - # For each dependencies region - for i in $zone_regions ; do - # Extract the name - arg=`echo zone_exported/$zone_regions | sed -e 's&,&.zone zone_exported/&g'` - # Make the dependencies - $exec_timeout $depend_timeout $zone_dependencies zone_depencies_properties.cfg $arg.zone zone_depend/doomy.depend - - # Idle - ../../idle.bat - done -fi - -# **** Weld - -# Log error -echo ------- >> log.log -echo --- Build zone : weld >> log.log -echo ------- >> log.log -echo ------- -echo --- Build zone : weld -echo ------- -date >> log.log -date - -# List the zones to weld -list_zone=`ls -1 zone_exported/*.[zZ][oO][nN][eE]` - -# Build a zones list to weld -echo -- Build a list of file to weld -rm zone_to_weld.txt 2> /dev/null -for i in $list_zone ; do - dest=`echo $i | sed -e 's/zone_exported/zone_welded/g' | sed -e 's/.zone/.zonew/g'` - if ( ! test -e $dest ) || ( test $i -nt $dest ) - then - echo $i >> zone_to_weld.txt - rm $dest - fi - - # Idle - ../../idle.bat -done - -# Weld the zone -if (test -f zone_to_weld.txt) -then - list_zone=`cat zone_to_weld.txt` - for i in $list_zone ; do - echo -- Weld $i - echo -- Weld $i >> log.log - $exec_timeout $weld_timeout $zone_welder $i $dest - echo - - # Idle - ../../idle.bat - done -fi - -# Log error -echo ------- >> log.log -echo --- Build zone : weld zones without heightmap >> log.log -echo ------- >> log.log -echo ------- -echo --- Build zone : weld zones without heightmap -echo ------- -date >> log.log -date - -# List the zones to weld -list_zone=`ls -1 zone_exported/*.[zZ][oO][nN][eE][nN][hH]` - -# Build a zones list to weld -echo -- Build a list of file to weld -rm zone_to_weld.txt 2> /dev/null -for i in $list_zone ; do - dest=`echo $i | sed -e 's/zone_exported/zone_welded/g' | sed -e 's/.zonenh/.zonenhw/g'` - if ( ! test -e $dest ) || ( test $i -nt $dest ) - then - echo $i >> zone_to_weld.txt - rm $dest - fi - - # Idle - ../../idle.bat -done - -# Weld the zone -if (test -f zone_to_weld.txt) -then - list_zone=`cat zone_to_weld.txt` - for i in $list_zone ; do - echo -- Weld $i - echo -- Weld $i >> log.log - $exec_timeout $weld_timeout $zone_welder $i $dest - echo - - # Idle - ../../idle.bat - done -fi - -# Build a zones list to weld -rm zone_to_weld.txt 2> /dev/null +#!/bin/bash +rm log.log 2> /dev/null + +# Build zone + +zone_dependencies='zone_dependencies.exe' +zone_welder='zone_welder.exe' +exec_timeout='exec_timeout.exe' + +# Get the timeout +depend_timeout=`cat ../../cfg/config.cfg | grep "zone_build_depend_timeout" | sed -e 's/zone_build_depend_timeout//' | sed -e 's/ //g' | sed -e 's/=//g'` +weld_timeout=`cat ../../cfg/config.cfg | grep "zone_build_weld_timeout" | sed -e 's/zone_build_weld_timeout//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the quality option to choose the goor properties.cfg file +quality_flag=`cat ../../cfg/site.cfg | grep "build_quality" | grep "1"` + +# **** Build dependencies + +if ( test "$quality_flag" ) +then + # We are in BEST mode + + # Log error + echo ------- >> log.log + echo --- Build zone : dependencies >> log.log + echo ------- >> log.log + echo ------- + echo --- Build zone : dependencies + echo ------- + date >> log.log + date + + cp ../../cfg/properties.cfg zone_depencies_properties.cfg + #append the level design directory at the end of the config file + ld_dir=`cat ../../cfg/site.cfg | grep "level_design_directory" | sed -e 's/level_design_directory//g' | sed -e 's/ //g' | sed -e 's/=//g'` + ld_world_dir=`cat ../../cfg/site.cfg | grep "level_design_world_directory" | sed -e 's/level_design_world_directory//g' | sed -e 's/ //g' | sed -e 's/=//g'` + ld_dfn_dir=`cat ../../cfg/site.cfg | grep "level_design_dfn_directory" | sed -e 's/level_design_dfn_directory//g' | sed -e 's/ //g' | sed -e 's/=//g'` + continent_file_name=`cat ../../cfg/config.cfg | grep "continent_file" | sed -e 's/continent_file//g' | sed -e 's/ //g' | sed -e 's/=//g'` + echo "level_design_directory = \"$ld_dir\";" >> zone_depencies_properties.cfg + echo "level_design_world_directory = \"$ld_world_dir\";" >> zone_depencies_properties.cfg + echo "level_design_dfn_directory = \"$ld_dfn_dir\";" >> zone_depencies_properties.cfg + echo "continent_name = \"$continent_file_name\";" >> zone_depencies_properties.cfg + + + # list all the dependencies regions + zone_regions=`cat ../../cfg/config.cfg | grep "zone_region" | sed -e 's/zone_region//' | sed -e 's/ //g' | sed -e 's/=//g'` + + # For each dependencies region + for i in $zone_regions ; do + # Extract the name + arg=`echo zone_exported/$zone_regions | sed -e 's&,&.zone zone_exported/&g'` + # Make the dependencies + $exec_timeout $depend_timeout $zone_dependencies zone_depencies_properties.cfg $arg.zone zone_depend/doomy.depend + + # Idle + ../../idle.bat + done +fi + +# **** Weld + +# Log error +echo ------- >> log.log +echo --- Build zone : weld >> log.log +echo ------- >> log.log +echo ------- +echo --- Build zone : weld +echo ------- +date >> log.log +date + +# List the zones to weld +list_zone=`ls -1 zone_exported/*.[zZ][oO][nN][eE]` + +# Build a zones list to weld +echo -- Build a list of file to weld +rm zone_to_weld.txt 2> /dev/null +for i in $list_zone ; do + dest=`echo $i | sed -e 's/zone_exported/zone_welded/g' | sed -e 's/.zone/.zonew/g'` + if ( ! test -e $dest ) || ( test $i -nt $dest ) + then + echo $i >> zone_to_weld.txt + rm $dest + fi + + # Idle + ../../idle.bat +done + +# Weld the zone +if (test -f zone_to_weld.txt) +then + list_zone=`cat zone_to_weld.txt` + for i in $list_zone ; do + echo -- Weld $i + echo -- Weld $i >> log.log + $exec_timeout $weld_timeout $zone_welder $i $dest + echo + + # Idle + ../../idle.bat + done +fi + +# Log error +echo ------- >> log.log +echo --- Build zone : weld zones without heightmap >> log.log +echo ------- >> log.log +echo ------- +echo --- Build zone : weld zones without heightmap +echo ------- +date >> log.log +date + +# List the zones to weld +list_zone=`ls -1 zone_exported/*.[zZ][oO][nN][eE][nN][hH]` + +# Build a zones list to weld +echo -- Build a list of file to weld +rm zone_to_weld.txt 2> /dev/null +for i in $list_zone ; do + dest=`echo $i | sed -e 's/zone_exported/zone_welded/g' | sed -e 's/.zonenh/.zonenhw/g'` + if ( ! test -e $dest ) || ( test $i -nt $dest ) + then + echo $i >> zone_to_weld.txt + rm $dest + fi + + # Idle + ../../idle.bat +done + +# Weld the zone +if (test -f zone_to_weld.txt) +then + list_zone=`cat zone_to_weld.txt` + for i in $list_zone ; do + echo -- Weld $i + echo -- Weld $i >> log.log + $exec_timeout $weld_timeout $zone_welder $i $dest + echo + + # Idle + ../../idle.bat + done +fi + +# Build a zones list to weld +rm zone_to_weld.txt 2> /dev/null diff --git a/nel/tools/3d/build_gamedata/processes/zone/sh/export.sh b/nel/tools/3d/build_gamedata/processes/zone/sh/export.sh index db05207668..642c7e0852 100644 --- a/nel/tools/3d/build_gamedata/processes/zone/sh/export.sh +++ b/nel/tools/3d/build_gamedata/processes/zone/sh/export.sh @@ -1,109 +1,109 @@ -#!/bin/bash -rm log.log 2> /dev/null - -# *** Export zone files (.zone) from Max - -exec_timeout='exec_timeout.exe' - -# Get the timeout -timeout=`cat ../../cfg/config.cfg | grep "zone_export_timeout" | sed -e 's/zone_export_timeout//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the database directory -database_directory=`cat ../../cfg/site.cfg | grep "database_directory" | sed -e 's/database_directory//g' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the build gamedata directory -build_gamedata_directory=`cat ../../cfg/site.cfg | grep "build_gamedata_directory" | sed -e 's/build_gamedata_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the zone directories -zone_source_directories=`cat ../../cfg/directories.cfg | grep "zone_source_directory" | sed -e 's/zone_source_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the ligo value -ligo_flag=`cat ../../cfg/config.cfg | grep "process_to_complete" | grep "ligo"` - -# Maxdir -max_directory=`echo $MAX_DIR | sed -e 's&\\\&/&g'` - -if ( test "$ligo_flag" ) -then - echo [Ligo] ON - echo [Ligo] ON >> log.log -else - echo [Ligo] OFF - echo [Ligo] OFF >> log.log -fi - - -# Log error -echo ------- > log.log -echo --- Export zone >> log.log -echo ------- >> log.log -echo ------- -echo --- Export zone -echo ------- -date >> log.log -date - -# Try to export from Max zone if any - -for i in $zone_source_directories ; do - # Copy the script - cat maxscript/zone_export.ms | sed -e "s&output_logfile&$build_gamedata_directory/processes/zone/log.log&g" | sed -e "s&zone_source_directory&$database_directory/$i&g" | sed -e "s&output_directory&$build_gamedata_directory/processes/zone/zone_exported&g" > $max_directory/scripts/zone_export.ms - - # Start max - echo Try 1 >> log.log - $exec_timeout $timeout $max_directory/3dsmax.exe -U MAXScript zone_export.ms -q -mi -vn - - echo Try 2 >> log.log - $exec_timeout $timeout $max_directory/3dsmax.exe -U MAXScript zone_export.ms -q -mi -vn - - echo Try 3 >> log.log - $exec_timeout $timeout $max_directory/3dsmax.exe -U MAXScript zone_export.ms -q -mi -vn - - # Idle - ../../idle.bat -done - -# **************************** -# Try to copy ligo zone if any -# **************************** - -dir_current=`pwd` -cd ../ligo/output -list_zone=`ls -1 *.[zZ][oO][nN][eE]` -for filename in $list_zone ; do - echo "Checking $filename for update" - if test -e ../../zone/zone_exported/$filename ; then - must_update=`diff --binary -q $filename ../../zone/zone_exported/$filename` ; - else - must_update=YES ; - fi - - if test -n "$must_update" ; then - echo " Updating" - cp -u -p $filename ../../zone/zone_exported/$filename ; - fi - - # Idle - ../../../idle.bat -done -cd $dir_current - -# delete files only present in the zone_exported directory - -if ( test "$ligo_flag" ) -then - cd ./zone_exported - list_zone=`ls -1 *.[zZ][oO][nN][eE]` - for filename in $list_zone ; do - if test -e ../../ligo/output/$filename ; then - must_update=NO ; - else - echo "Removing $filename" - rm $filename ; - fi - - # Idle - ../../../idle.bat - done - cd .. -fi +#!/bin/bash +rm log.log 2> /dev/null + +# *** Export zone files (.zone) from Max + +exec_timeout='exec_timeout.exe' + +# Get the timeout +timeout=`cat ../../cfg/config.cfg | grep "zone_export_timeout" | sed -e 's/zone_export_timeout//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the database directory +database_directory=`cat ../../cfg/site.cfg | grep "database_directory" | sed -e 's/database_directory//g' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the build gamedata directory +build_gamedata_directory=`cat ../../cfg/site.cfg | grep "build_gamedata_directory" | sed -e 's/build_gamedata_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the zone directories +zone_source_directories=`cat ../../cfg/directories.cfg | grep "zone_source_directory" | sed -e 's/zone_source_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the ligo value +ligo_flag=`cat ../../cfg/config.cfg | grep "process_to_complete" | grep "ligo"` + +# Maxdir +max_directory=`echo $MAX_DIR | sed -e 's&\\\&/&g'` + +if ( test "$ligo_flag" ) +then + echo [Ligo] ON + echo [Ligo] ON >> log.log +else + echo [Ligo] OFF + echo [Ligo] OFF >> log.log +fi + + +# Log error +echo ------- > log.log +echo --- Export zone >> log.log +echo ------- >> log.log +echo ------- +echo --- Export zone +echo ------- +date >> log.log +date + +# Try to export from Max zone if any + +for i in $zone_source_directories ; do + # Copy the script + cat maxscript/zone_export.ms | sed -e "s&output_logfile&$build_gamedata_directory/processes/zone/log.log&g" | sed -e "s&zone_source_directory&$database_directory/$i&g" | sed -e "s&output_directory&$build_gamedata_directory/processes/zone/zone_exported&g" > $max_directory/scripts/zone_export.ms + + # Start max + echo Try 1 >> log.log + $exec_timeout $timeout $max_directory/3dsmax.exe -U MAXScript zone_export.ms -q -mi -vn + + echo Try 2 >> log.log + $exec_timeout $timeout $max_directory/3dsmax.exe -U MAXScript zone_export.ms -q -mi -vn + + echo Try 3 >> log.log + $exec_timeout $timeout $max_directory/3dsmax.exe -U MAXScript zone_export.ms -q -mi -vn + + # Idle + ../../idle.bat +done + +# **************************** +# Try to copy ligo zone if any +# **************************** + +dir_current=`pwd` +cd ../ligo/output +list_zone=`ls -1 *.[zZ][oO][nN][eE]` +for filename in $list_zone ; do + echo "Checking $filename for update" + if test -e ../../zone/zone_exported/$filename ; then + must_update=`diff --binary -q $filename ../../zone/zone_exported/$filename` ; + else + must_update=YES ; + fi + + if test -n "$must_update" ; then + echo " Updating" + cp -u -p $filename ../../zone/zone_exported/$filename ; + fi + + # Idle + ../../../idle.bat +done +cd $dir_current + +# delete files only present in the zone_exported directory + +if ( test "$ligo_flag" ) +then + cd ./zone_exported + list_zone=`ls -1 *.[zZ][oO][nN][eE]` + for filename in $list_zone ; do + if test -e ../../ligo/output/$filename ; then + must_update=NO ; + else + echo "Removing $filename" + rm $filename ; + fi + + # Idle + ../../../idle.bat + done + cd .. +fi diff --git a/nel/tools/3d/build_gamedata/processes/zone_light/sh/build.sh b/nel/tools/3d/build_gamedata/processes/zone_light/sh/build.sh index 446baca98a..34645f2959 100644 --- a/nel/tools/3d/build_gamedata/processes/zone_light/sh/build.sh +++ b/nel/tools/3d/build_gamedata/processes/zone_light/sh/build.sh @@ -1,119 +1,119 @@ -#!/bin/bash -rm log.log 2> /dev/null - -# Build zone - -zone_lighter='zone_lighter.exe' -zone_ig_lighter='zone_ig_lighter.exe' -exec_timeout='exec_timeout.exe' - -# Get the timeout -light_timeout=`cat ../../cfg/config.cfg | grep "zone_build_light_timeout" | sed -e 's/zone_build_light_timeout//' | sed -e 's/ //g' | sed -e 's/=//g'` -ig_light_timeout=`cat ../../cfg/config.cfg | grep "zone_build_ig_light_timeout" | sed -e 's/zone_build_ig_light_timeout//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# **** Light - -# Log error -echo ------- >> log.log -echo --- Zone lighting >> log.log -echo ------- >> log.log -echo ------- -echo --- Zone lighting -echo ------- -date >> log.log -date - -#append the level design directory at the end of the config file -ld_dir=`cat ../../cfg/site.cfg | grep "level_design_directory" | sed -e 's/level_design_directory//g' | sed -e 's/ //g' | sed -e 's/=//g'` -ld_world_dir=`cat ../../cfg/site.cfg | grep "level_design_world_directory" | sed -e 's/level_design_world_directory//g' | sed -e 's/ //g' | sed -e 's/=//g'` -ld_dfn_dir=`cat ../../cfg/site.cfg | grep "level_design_dfn_directory" | sed -e 's/level_design_dfn_directory//g' | sed -e 's/ //g' | sed -e 's/=//g'` -continent_file_name=`cat ../../cfg/config.cfg | grep "continent_file" | sed -e 's/continent_file//g' | sed -e 's/ //g' | sed -e 's/=//g'` -cp ../../cfg/properties.cfg zone_lighter_properties.cfg -echo "level_design_directory = \"$ld_dir\";" >> zone_lighter_properties.cfg -echo "level_design_world_directory = \"$ld_world_dir\";" >> zone_lighter_properties.cfg -echo "level_design_dfn_directory = \"$ld_dfn_dir\";" >> zone_lighter_properties.cfg -echo "continent_name = \"$continent_file_name\";" >> zone_lighter_properties.cfg - -# List the zones to light -list_zone_welded=`ls -1 ../zone/zone_welded/*.[zZ][oO][nN][eE][wW]` - -# Light zones -for i in $list_zone_welded ; do - dest=`echo $i | sed -e 's&../zone/zone_welded&zone_lighted&g' | sed -e 's/.zonew/.zonel/g'` - depend=`echo $i | sed -e 's&../zone/zone_welded&../zone/zone_depend&g' | sed -e 's/.zonew/.depend/g'` - if ( ! test -e $dest ) || ( test $i -nt $dest ) - then - echo LIGHT $i - echo LIGHT $i >> log.log - $exec_timeout $light_timeout $zone_lighter $i $dest zone_lighter_properties.cfg $depend - echo - echo - else - echo SKIP $dest - echo SKIP $dest >> log.log - fi - - # Idle - ../../idle.bat -done - -# List the zones lighted -list_zone_lighted_remove=`ls -1 zone_lighted/*.[zZ][oO][nN][eE][lL]` - -# Remove old lighted zones -for i in $list_zone_lighted_remove ; do - source=`echo $i | sed -e 's&zone_lighted&../zone/zone_welded&g' | sed -e 's/.zonel/.zonew/g'` - if ( ! test -e $source ) - then - echo REMOVE $i - echo REMOVE $i >> log.log - rm $i - fi - - # Idle - ../../idle.bat -done - - -# **** IgLight - -# Log error -echo ------- >> log.log -echo --- Build zone : IgLight >> log.log -echo ------- >> log.log -echo ------- -echo --- Build zone : IgLight -echo ------- -date >> log.log -date - -# List the zones lighted -list_zone_lighted=`ls -1 zone_lighted/*.[zZ][oO][nN][eE][lL]` - -# Light zones -for i in $list_zone_lighted ; do - dest=`echo $i | sed -e 's/zone_lighted/ig_land_lighted/g' | sed -e 's/.zonel/.ig/g'` - depend=`echo $i | sed -e 's&zone_lighted&../zone/zone_depend&g' | sed -e 's/.zonel/.depend/g'` - igsrc=`echo $i | sed -e 's&zone_lighted&../ig/ig_land&g' | sed -e 's/.zonel/.ig/g'` - if ( test -f $igsrc ) - then - if ( ! test -e $dest ) || ( test $i -nt $dest ) || ( test $igsrc -nt $dest ) - then - echo -- IgLight $i - echo -- IgLight $i >> log.log - $exec_timeout $ig_light_timeout $zone_ig_lighter $i $dest ../../cfg/properties.cfg $depend - echo - echo - fi - else - if ( test -f $dest ) - then - echo "-- Remove" $dest - rm $dest - fi - fi - - # Idle - ../../idle.bat -done - +#!/bin/bash +rm log.log 2> /dev/null + +# Build zone + +zone_lighter='zone_lighter.exe' +zone_ig_lighter='zone_ig_lighter.exe' +exec_timeout='exec_timeout.exe' + +# Get the timeout +light_timeout=`cat ../../cfg/config.cfg | grep "zone_build_light_timeout" | sed -e 's/zone_build_light_timeout//' | sed -e 's/ //g' | sed -e 's/=//g'` +ig_light_timeout=`cat ../../cfg/config.cfg | grep "zone_build_ig_light_timeout" | sed -e 's/zone_build_ig_light_timeout//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# **** Light + +# Log error +echo ------- >> log.log +echo --- Zone lighting >> log.log +echo ------- >> log.log +echo ------- +echo --- Zone lighting +echo ------- +date >> log.log +date + +#append the level design directory at the end of the config file +ld_dir=`cat ../../cfg/site.cfg | grep "level_design_directory" | sed -e 's/level_design_directory//g' | sed -e 's/ //g' | sed -e 's/=//g'` +ld_world_dir=`cat ../../cfg/site.cfg | grep "level_design_world_directory" | sed -e 's/level_design_world_directory//g' | sed -e 's/ //g' | sed -e 's/=//g'` +ld_dfn_dir=`cat ../../cfg/site.cfg | grep "level_design_dfn_directory" | sed -e 's/level_design_dfn_directory//g' | sed -e 's/ //g' | sed -e 's/=//g'` +continent_file_name=`cat ../../cfg/config.cfg | grep "continent_file" | sed -e 's/continent_file//g' | sed -e 's/ //g' | sed -e 's/=//g'` +cp ../../cfg/properties.cfg zone_lighter_properties.cfg +echo "level_design_directory = \"$ld_dir\";" >> zone_lighter_properties.cfg +echo "level_design_world_directory = \"$ld_world_dir\";" >> zone_lighter_properties.cfg +echo "level_design_dfn_directory = \"$ld_dfn_dir\";" >> zone_lighter_properties.cfg +echo "continent_name = \"$continent_file_name\";" >> zone_lighter_properties.cfg + +# List the zones to light +list_zone_welded=`ls -1 ../zone/zone_welded/*.[zZ][oO][nN][eE][wW]` + +# Light zones +for i in $list_zone_welded ; do + dest=`echo $i | sed -e 's&../zone/zone_welded&zone_lighted&g' | sed -e 's/.zonew/.zonel/g'` + depend=`echo $i | sed -e 's&../zone/zone_welded&../zone/zone_depend&g' | sed -e 's/.zonew/.depend/g'` + if ( ! test -e $dest ) || ( test $i -nt $dest ) + then + echo LIGHT $i + echo LIGHT $i >> log.log + $exec_timeout $light_timeout $zone_lighter $i $dest zone_lighter_properties.cfg $depend + echo + echo + else + echo SKIP $dest + echo SKIP $dest >> log.log + fi + + # Idle + ../../idle.bat +done + +# List the zones lighted +list_zone_lighted_remove=`ls -1 zone_lighted/*.[zZ][oO][nN][eE][lL]` + +# Remove old lighted zones +for i in $list_zone_lighted_remove ; do + source=`echo $i | sed -e 's&zone_lighted&../zone/zone_welded&g' | sed -e 's/.zonel/.zonew/g'` + if ( ! test -e $source ) + then + echo REMOVE $i + echo REMOVE $i >> log.log + rm $i + fi + + # Idle + ../../idle.bat +done + + +# **** IgLight + +# Log error +echo ------- >> log.log +echo --- Build zone : IgLight >> log.log +echo ------- >> log.log +echo ------- +echo --- Build zone : IgLight +echo ------- +date >> log.log +date + +# List the zones lighted +list_zone_lighted=`ls -1 zone_lighted/*.[zZ][oO][nN][eE][lL]` + +# Light zones +for i in $list_zone_lighted ; do + dest=`echo $i | sed -e 's/zone_lighted/ig_land_lighted/g' | sed -e 's/.zonel/.ig/g'` + depend=`echo $i | sed -e 's&zone_lighted&../zone/zone_depend&g' | sed -e 's/.zonel/.depend/g'` + igsrc=`echo $i | sed -e 's&zone_lighted&../ig/ig_land&g' | sed -e 's/.zonel/.ig/g'` + if ( test -f $igsrc ) + then + if ( ! test -e $dest ) || ( test $i -nt $dest ) || ( test $igsrc -nt $dest ) + then + echo -- IgLight $i + echo -- IgLight $i >> log.log + $exec_timeout $ig_light_timeout $zone_ig_lighter $i $dest ../../cfg/properties.cfg $depend + echo + echo + fi + else + if ( test -f $dest ) + then + echo "-- Remove" $dest + rm $dest + fi + fi + + # Idle + ../../idle.bat +done + diff --git a/nel/tools/3d/build_gamedata/processes/zone_light/sh/export.sh b/nel/tools/3d/build_gamedata/processes/zone_light/sh/export.sh index 26f4225ef5..29cb5a57f5 100644 --- a/nel/tools/3d/build_gamedata/processes/zone_light/sh/export.sh +++ b/nel/tools/3d/build_gamedata/processes/zone_light/sh/export.sh @@ -1,28 +1,28 @@ -#!/bin/bash -rm log.log 2> /dev/null - -# *** Export zone files (.zone) from Max - -# Get the database directory -database_directory=`cat ../../cfg/site.cfg | grep "database_directory" | sed -e 's/database_directory//g' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the water maps directories -water_map_directories=`cat ../../cfg/directories.cfg | grep "water_map_directory" | sed -e 's/water_map_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Log error -echo ------- > log.log -echo --- Export water shape >> log.log -echo ------- >> log.log -echo ------- -echo --- Export water shape -echo ------- -date >> log.log -date - -#copy each water map before lightmapping -for i in $water_map_directories ; do - cp -u -p $database_directory/$i/*.[tT][gG][aA] water_shapes_lighted 2>> log.log - - # Idle - ../../idle.bat -done +#!/bin/bash +rm log.log 2> /dev/null + +# *** Export zone files (.zone) from Max + +# Get the database directory +database_directory=`cat ../../cfg/site.cfg | grep "database_directory" | sed -e 's/database_directory//g' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the water maps directories +water_map_directories=`cat ../../cfg/directories.cfg | grep "water_map_directory" | sed -e 's/water_map_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Log error +echo ------- > log.log +echo --- Export water shape >> log.log +echo ------- >> log.log +echo ------- +echo --- Export water shape +echo ------- +date >> log.log +date + +#copy each water map before lightmapping +for i in $water_map_directories ; do + cp -u -p $database_directory/$i/*.[tT][gG][aA] water_shapes_lighted 2>> log.log + + # Idle + ../../idle.bat +done diff --git a/nel/tools/3d/build_gamedata/processes/zone_light/sh/install.sh b/nel/tools/3d/build_gamedata/processes/zone_light/sh/install.sh index c5ddb88314..abfa1ab1de 100644 --- a/nel/tools/3d/build_gamedata/processes/zone_light/sh/install.sh +++ b/nel/tools/3d/build_gamedata/processes/zone_light/sh/install.sh @@ -1,44 +1,44 @@ -#!/bin/bash -rm log.log 2> /dev/null - -# Install the zonels in the client data - -# Get the zone install directory -zone_install_directory=`cat ../../cfg/directories.cfg | grep "zone_install_directory" | sed -e 's/zone_install_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the client directory -client_directory=`cat ../../cfg/site.cfg | grep "client_directory" | sed -e 's/client_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Log error -echo ------- > log.log -echo --- Install zone >> log.log -echo ------- >> log.log -echo ------- -echo --- Install zone -echo ------- -date >> log.log -date - -cp -u -p -R zone_lighted/. $client_directory/$zone_install_directory 2>> log.log - -# copy the water maps once they have been lighted -cp -u -p -R water_shapes_lighted/. $client_directory/$water_maps_directories - - - -# Install zone ig lighted in the client data - -# Get the ig install directory -ig_install_directory=`cat ../../cfg/directories.cfg | grep "ig_install_directory" | sed -e 's/ig_install_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Log error -echo ------- > log.log -echo --- Install Zone Ig >> log.log -echo ------- >> log.log -echo ------- -echo --- Install Zone Ig -echo ------- -date >> log.log -date - -cp -u -p -R ig_land_lighted/. $client_directory/$ig_install_directory 2>> log.log +#!/bin/bash +rm log.log 2> /dev/null + +# Install the zonels in the client data + +# Get the zone install directory +zone_install_directory=`cat ../../cfg/directories.cfg | grep "zone_install_directory" | sed -e 's/zone_install_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the client directory +client_directory=`cat ../../cfg/site.cfg | grep "client_directory" | sed -e 's/client_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Log error +echo ------- > log.log +echo --- Install zone >> log.log +echo ------- >> log.log +echo ------- +echo --- Install zone +echo ------- +date >> log.log +date + +cp -u -p -R zone_lighted/. $client_directory/$zone_install_directory 2>> log.log + +# copy the water maps once they have been lighted +cp -u -p -R water_shapes_lighted/. $client_directory/$water_maps_directories + + + +# Install zone ig lighted in the client data + +# Get the ig install directory +ig_install_directory=`cat ../../cfg/directories.cfg | grep "ig_install_directory" | sed -e 's/ig_install_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Log error +echo ------- > log.log +echo --- Install Zone Ig >> log.log +echo ------- >> log.log +echo ------- +echo --- Install Zone Ig +echo ------- +date >> log.log +date + +cp -u -p -R ig_land_lighted/. $client_directory/$ig_install_directory 2>> log.log diff --git a/nel/tools/3d/build_gamedata/processes/zone_light/sh/patch_tile_water.sh b/nel/tools/3d/build_gamedata/processes/zone_light/sh/patch_tile_water.sh index 205a4048d7..87ebd9eacc 100644 --- a/nel/tools/3d/build_gamedata/processes/zone_light/sh/patch_tile_water.sh +++ b/nel/tools/3d/build_gamedata/processes/zone_light/sh/patch_tile_water.sh @@ -1,63 +1,63 @@ -#!/bin/bash -rm log.log 2> /dev/null - -# Build zone - -zone_lighter='zone_lighter.exe' -zone_ig_lighter='zone_ig_lighter.exe' -exec_timeout='exec_timeout.exe' - -# Get the timeout -light_timeout=`cat ../../cfg/config.cfg | grep "zone_build_light_timeout" | sed -e 's/zone_build_light_timeout//' | sed -e 's/ //g' | sed -e 's/=//g'` -ig_light_timeout=`cat ../../cfg/config.cfg | grep "zone_build_ig_light_timeout" | sed -e 's/zone_build_ig_light_timeout//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# **** Light - -# Log error -echo ------- >> log.log -echo --- Zone lighting >> log.log -echo ------- >> log.log -echo ------- -echo --- Zone lighting -echo ------- -date >> log.log -date - -#append the level design directory at the end of the config file -ld_dir=`cat ../../cfg/site.cfg | grep "level_design_directory" | sed -e 's/level_design_directory//g' | sed -e 's/ //g' | sed -e 's/=//g'` -ld_world_dir=`cat ../../cfg/site.cfg | grep "level_design_world_directory" | sed -e 's/level_design_world_directory//g' | sed -e 's/ //g' | sed -e 's/=//g'` -ld_dfn_dir=`cat ../../cfg/site.cfg | grep "level_design_dfn_directory" | sed -e 's/level_design_dfn_directory//g' | sed -e 's/ //g' | sed -e 's/=//g'` -continent_file_name=`cat ../../cfg/config.cfg | grep "continent_file" | sed -e 's/continent_file//g' | sed -e 's/ //g' | sed -e 's/=//g'` -cp ../../cfg/properties.cfg zone_lighter_properties.cfg -echo "level_design_directory = \"$ld_dir\";" >> zone_lighter_properties.cfg -echo "level_design_world_directory = \"$ld_world_dir\";" >> zone_lighter_properties.cfg -echo "level_design_dfn_directory = \"$ld_dfn_dir\";" >> zone_lighter_properties.cfg -echo "continent_name = \"$continent_file_name\";" >> zone_lighter_properties.cfg - -# List the zones to light -list_zone_welded=`ls -1 ../zone/zone_welded/*.[zZ][oO][nN][eE][wW]` - -# create a bkup directory -mkdir bkup_tile_water - -# Light zones -for i in $list_zone_welded ; do - dest=`echo $i | sed -e 's&../zone/zone_welded&zone_lighted&g' | sed -e 's/.zonew/.zonel/g'` - depend=`echo $i | sed -e 's&../zone/zone_welded&../zone/zone_depend&g' | sed -e 's/.zonew/.depend/g'` - if ( test -e $dest ) - then - echo PATCH $dest - echo PATCH $dest >> log.log - # patch, and bkup if necessary - $exec_timeout $light_timeout $zone_lighter $i $dest zone_lighter_properties.cfg $depend -waterpatch bkup_tile_water - echo - echo - else - echo SKIP $dest cause not found - echo SKIP $dest cause not found >> log.log - fi - - # Idle - ../../idle.bat -done - +#!/bin/bash +rm log.log 2> /dev/null + +# Build zone + +zone_lighter='zone_lighter.exe' +zone_ig_lighter='zone_ig_lighter.exe' +exec_timeout='exec_timeout.exe' + +# Get the timeout +light_timeout=`cat ../../cfg/config.cfg | grep "zone_build_light_timeout" | sed -e 's/zone_build_light_timeout//' | sed -e 's/ //g' | sed -e 's/=//g'` +ig_light_timeout=`cat ../../cfg/config.cfg | grep "zone_build_ig_light_timeout" | sed -e 's/zone_build_ig_light_timeout//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# **** Light + +# Log error +echo ------- >> log.log +echo --- Zone lighting >> log.log +echo ------- >> log.log +echo ------- +echo --- Zone lighting +echo ------- +date >> log.log +date + +#append the level design directory at the end of the config file +ld_dir=`cat ../../cfg/site.cfg | grep "level_design_directory" | sed -e 's/level_design_directory//g' | sed -e 's/ //g' | sed -e 's/=//g'` +ld_world_dir=`cat ../../cfg/site.cfg | grep "level_design_world_directory" | sed -e 's/level_design_world_directory//g' | sed -e 's/ //g' | sed -e 's/=//g'` +ld_dfn_dir=`cat ../../cfg/site.cfg | grep "level_design_dfn_directory" | sed -e 's/level_design_dfn_directory//g' | sed -e 's/ //g' | sed -e 's/=//g'` +continent_file_name=`cat ../../cfg/config.cfg | grep "continent_file" | sed -e 's/continent_file//g' | sed -e 's/ //g' | sed -e 's/=//g'` +cp ../../cfg/properties.cfg zone_lighter_properties.cfg +echo "level_design_directory = \"$ld_dir\";" >> zone_lighter_properties.cfg +echo "level_design_world_directory = \"$ld_world_dir\";" >> zone_lighter_properties.cfg +echo "level_design_dfn_directory = \"$ld_dfn_dir\";" >> zone_lighter_properties.cfg +echo "continent_name = \"$continent_file_name\";" >> zone_lighter_properties.cfg + +# List the zones to light +list_zone_welded=`ls -1 ../zone/zone_welded/*.[zZ][oO][nN][eE][wW]` + +# create a bkup directory +mkdir bkup_tile_water + +# Light zones +for i in $list_zone_welded ; do + dest=`echo $i | sed -e 's&../zone/zone_welded&zone_lighted&g' | sed -e 's/.zonew/.zonel/g'` + depend=`echo $i | sed -e 's&../zone/zone_welded&../zone/zone_depend&g' | sed -e 's/.zonew/.depend/g'` + if ( test -e $dest ) + then + echo PATCH $dest + echo PATCH $dest >> log.log + # patch, and bkup if necessary + $exec_timeout $light_timeout $zone_lighter $i $dest zone_lighter_properties.cfg $depend -waterpatch bkup_tile_water + echo + echo + else + echo SKIP $dest cause not found + echo SKIP $dest cause not found >> log.log + fi + + # Idle + ../../idle.bat +done + diff --git a/nel/tools/3d/build_gamedata/sh/build.sh b/nel/tools/3d/build_gamedata/sh/build.sh index 00787e5b41..cfbd89fd5d 100644 --- a/nel/tools/3d/build_gamedata/sh/build.sh +++ b/nel/tools/3d/build_gamedata/sh/build.sh @@ -1,33 +1,33 @@ -#!/bin/bash -rm log.log 2> /dev/null - -# Build the processes - -# Get the process list -process_to_complete=`cat cfg/config.cfg | grep "process_to_complete" | sed -e 's/process_to_complete//' | sed -e 's/ //g' | sed -e 's/=//g' | sed -e 's/,/ /g'` - -# Log error -echo > log.log -date >> log.log -date - -# For each process -for i in $process_to_complete ; do - # Open the directory - cd processes/$i - - # Excecute the command - ./3_build.bat - - # Get back - cd ../.. - - # Concat log.log files - cat processes/$i/log.log >> log.log - - # Idle - ./idle.bat -done - -# Copy the log file -cp log.log build.log +#!/bin/bash +rm log.log 2> /dev/null + +# Build the processes + +# Get the process list +process_to_complete=`cat cfg/config.cfg | grep "process_to_complete" | sed -e 's/process_to_complete//' | sed -e 's/ //g' | sed -e 's/=//g' | sed -e 's/,/ /g'` + +# Log error +echo > log.log +date >> log.log +date + +# For each process +for i in $process_to_complete ; do + # Open the directory + cd processes/$i + + # Excecute the command + ./3_build.bat + + # Get back + cd ../.. + + # Concat log.log files + cat processes/$i/log.log >> log.log + + # Idle + ./idle.bat +done + +# Copy the log file +cp log.log build.log diff --git a/nel/tools/3d/build_gamedata/sh/clean.sh b/nel/tools/3d/build_gamedata/sh/clean.sh index ab2ef5800e..b2ece6d873 100644 --- a/nel/tools/3d/build_gamedata/sh/clean.sh +++ b/nel/tools/3d/build_gamedata/sh/clean.sh @@ -1,29 +1,29 @@ -#!/bin/bash -rm log.log 2> /dev/null - -# Clean the processes - -# Get the process list -process_to_complete=`cat cfg/config.cfg | grep "process_to_complete" | sed -e 's/process_to_complete//' | sed -e 's/ //g' | sed -e 's/=//g' | sed -e 's/,/ /g'` - -# Log error -echo > log.log - -# For each process -for i in $process_to_complete ; do - # Open the directory - cd processes/$i - - # Excecute the command - ./1_clean.bat - - # Get back - cd ../.. - - # Concat log.log files - # cat processes/$i/log.log >> log.log - - # Idle - ./idle.bat -done - +#!/bin/bash +rm log.log 2> /dev/null + +# Clean the processes + +# Get the process list +process_to_complete=`cat cfg/config.cfg | grep "process_to_complete" | sed -e 's/process_to_complete//' | sed -e 's/ //g' | sed -e 's/=//g' | sed -e 's/,/ /g'` + +# Log error +echo > log.log + +# For each process +for i in $process_to_complete ; do + # Open the directory + cd processes/$i + + # Excecute the command + ./1_clean.bat + + # Get back + cd ../.. + + # Concat log.log files + # cat processes/$i/log.log >> log.log + + # Idle + ./idle.bat +done + diff --git a/nel/tools/3d/build_gamedata/sh/client_clean.sh b/nel/tools/3d/build_gamedata/sh/client_clean.sh index 08c9d97b82..2ec474fa2d 100644 --- a/nel/tools/3d/build_gamedata/sh/client_clean.sh +++ b/nel/tools/3d/build_gamedata/sh/client_clean.sh @@ -1,27 +1,27 @@ -#!/bin/bash -rm log.log 2> /dev/null - -# Clean the client - -# Get the client directory -client_directory=`cat cfg/site.cfg | grep "client_directory" | sed -e 's/client_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the client setup directories -client_setup_directories=`cat cfg/directories.cfg | grep "client_setup_directory" | sed -e 's/client_setup_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Log error -echo \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* > log.log -echo \*\*\*\*\*\*\* CLIENT CLEAN>> log.log -echo \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* >> log.log -echo \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* -echo \*\*\*\*\*\*\* CLIENT CLEAN -echo \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* - -# For each directory -for i in $client_setup_directories ; do - # Create the directory - rm $client_directory/$i/* - - # Idle - ./idle.bat +#!/bin/bash +rm log.log 2> /dev/null + +# Clean the client + +# Get the client directory +client_directory=`cat cfg/site.cfg | grep "client_directory" | sed -e 's/client_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the client setup directories +client_setup_directories=`cat cfg/directories.cfg | grep "client_setup_directory" | sed -e 's/client_setup_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Log error +echo \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* > log.log +echo \*\*\*\*\*\*\* CLIENT CLEAN>> log.log +echo \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* >> log.log +echo \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* +echo \*\*\*\*\*\*\* CLIENT CLEAN +echo \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* + +# For each directory +for i in $client_setup_directories ; do + # Create the directory + rm $client_directory/$i/* + + # Idle + ./idle.bat done \ No newline at end of file diff --git a/nel/tools/3d/build_gamedata/sh/client_setup.sh b/nel/tools/3d/build_gamedata/sh/client_setup.sh index 33cb1c2bfe..f9c6f1688f 100644 --- a/nel/tools/3d/build_gamedata/sh/client_setup.sh +++ b/nel/tools/3d/build_gamedata/sh/client_setup.sh @@ -1,24 +1,24 @@ -#!/bin/bash -rm log.log 2> /dev/null - -# Setup the client - -# Get the client directory -client_directory=`cat cfg/site.cfg | grep "client_directory" | sed -e 's/client_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the client setup directories -client_setup_directories=`cat cfg/directories.cfg | grep "client_setup_directory" | sed -e 's/client_setup_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Log error -echo > log.log - -# Create the file - -# For each directory -for i in $client_setup_directories ; do - # Create the directory - mkdir $client_directory/$i 2> /dev/null - - # Idle - ./idle.bat +#!/bin/bash +rm log.log 2> /dev/null + +# Setup the client + +# Get the client directory +client_directory=`cat cfg/site.cfg | grep "client_directory" | sed -e 's/client_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the client setup directories +client_setup_directories=`cat cfg/directories.cfg | grep "client_setup_directory" | sed -e 's/client_setup_directory//' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Log error +echo > log.log + +# Create the file + +# For each directory +for i in $client_setup_directories ; do + # Create the directory + mkdir $client_directory/$i 2> /dev/null + + # Idle + ./idle.bat done \ No newline at end of file diff --git a/nel/tools/3d/build_gamedata/sh/export.sh b/nel/tools/3d/build_gamedata/sh/export.sh index 836a3bfe52..16a22a0008 100644 --- a/nel/tools/3d/build_gamedata/sh/export.sh +++ b/nel/tools/3d/build_gamedata/sh/export.sh @@ -1,33 +1,33 @@ -#!/bin/bash -rm log.log 2> /dev/null - -# Export the processes - -# Get the process list -process_to_complete=`cat cfg/config.cfg | grep "process_to_complete" | sed -e 's/process_to_complete//' | sed -e 's/ //g' | sed -e 's/=//g' | sed -e 's/,/ /g'` - -# Log error -echo > log.log -date >> log.log -date - -# For each process -for i in $process_to_complete ; do - # Open the directory - cd processes/$i - - # Excecute the command - ./2_export.bat - - # Get back - cd ../.. - - # Concat log.log files - cat processes/$i/log.log >> log.log - - # Idle - ./idle.bat -done - -# Copy the log file -cp log.log export.log +#!/bin/bash +rm log.log 2> /dev/null + +# Export the processes + +# Get the process list +process_to_complete=`cat cfg/config.cfg | grep "process_to_complete" | sed -e 's/process_to_complete//' | sed -e 's/ //g' | sed -e 's/=//g' | sed -e 's/,/ /g'` + +# Log error +echo > log.log +date >> log.log +date + +# For each process +for i in $process_to_complete ; do + # Open the directory + cd processes/$i + + # Excecute the command + ./2_export.bat + + # Get back + cd ../.. + + # Concat log.log files + cat processes/$i/log.log >> log.log + + # Idle + ./idle.bat +done + +# Copy the log file +cp log.log export.log diff --git a/nel/tools/3d/build_gamedata/sh/install.sh b/nel/tools/3d/build_gamedata/sh/install.sh index 25b56685d8..28d6c4803f 100644 --- a/nel/tools/3d/build_gamedata/sh/install.sh +++ b/nel/tools/3d/build_gamedata/sh/install.sh @@ -1,33 +1,33 @@ -#!/bin/bash -rm log.log 2> /dev/null - -# Install the processes - -# Get the process list -process_to_complete=`cat cfg/config.cfg | grep "process_to_complete" | sed -e 's/process_to_complete//' | sed -e 's/ //g' | sed -e 's/=//g' | sed -e 's/,/ /g'` - -# Log error -echo > log.log -date >> log.log -date - -# For each process -for i in $process_to_complete ; do - # Open the directory - cd processes/$i - - # Excecute the command - ./4_install.bat - - # Get back - cd ../.. - - # Concat log.log files - cat processes/$i/log.log >> log.log - - # Idle - ./idle.bat -done - -# Copy the log file -cp log.log install.log +#!/bin/bash +rm log.log 2> /dev/null + +# Install the processes + +# Get the process list +process_to_complete=`cat cfg/config.cfg | grep "process_to_complete" | sed -e 's/process_to_complete//' | sed -e 's/ //g' | sed -e 's/=//g' | sed -e 's/,/ /g'` + +# Log error +echo > log.log +date >> log.log +date + +# For each process +for i in $process_to_complete ; do + # Open the directory + cd processes/$i + + # Excecute the command + ./4_install.bat + + # Get back + cd ../.. + + # Concat log.log files + cat processes/$i/log.log >> log.log + + # Idle + ./idle.bat +done + +# Copy the log file +cp log.log install.log diff --git a/nel/tools/3d/build_gamedata/sh/setup.sh b/nel/tools/3d/build_gamedata/sh/setup.sh index 8330c6cb8b..6e83ca7b8f 100644 --- a/nel/tools/3d/build_gamedata/sh/setup.sh +++ b/nel/tools/3d/build_gamedata/sh/setup.sh @@ -1,62 +1,62 @@ -#!/bin/bash -rm log.log 2> /dev/null - -# Setup the processes - -# Get the process list -process_to_complete=`cat cfg/config.cfg | grep "process_to_complete" | sed -e 's/process_to_complete//' | sed -e 's/ //g' | sed -e 's/=//g' | sed -e 's/,/ /g'` - -# Get the update directory -update_directory=`cat cfg/config.cfg | grep "update_directory" | sed -e 's/update_directory//' | sed -e 's/ //g' | sed -e 's/=//g' | sed -e 's/,/ /g'` - -# Get the database directory -database_directory=`cat cfg/site.cfg | grep "database_directory" | sed -e 's/database_directory//g' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the database letter -database_letter=`cat cfg/site.cfg | grep "database_letter" | sed -e 's/database_letter//g' | sed -e 's/ //g' | sed -e 's/=//g'` - -# Get the database server -database_server=`cat cfg/site.cfg | grep "database_server" | sed -e 's/database_server//g' | sed -e 's/ //g' | sed -e 's/=//g'` - -`cat _idle.bat | sed -e "s&database_directory&$database_directory&g" | sed -e "s&database_letter&$database_letter&g" | sed -e "s&database_server&$database_server&g" > idle.bat` - -# Log error -echo > log.log -date >> log.log -date - -# Create a bin dir -mkdir bin 2> /dev/null - -# For each process -for i in $process_to_complete ; do - # Open the directory - cd processes/$i - - # Excecute the command - ./0_setup.bat - - # Get back - cd ../.. - - # Concat log.log files - # cat processes/$i/log.log >> log.log - - # Idle - ./idle.bat -done - -# Get the quality option to choose the goor properties.cfg file -quality_flag=`cat cfg/site.cfg | grep "build_quality" | grep "1"` - -# Copy the good properties.cfg file -if ( test "$quality_flag" ) -then - # We are in BEST mode - echo [Quality] BEST - cp cfg/properties_final.cfg cfg/properties.cfg -else - # We are not DRAFT mode - echo [Quality] DRAFT - cp cfg/properties_draft.cfg cfg/properties.cfg -fi +#!/bin/bash +rm log.log 2> /dev/null + +# Setup the processes + +# Get the process list +process_to_complete=`cat cfg/config.cfg | grep "process_to_complete" | sed -e 's/process_to_complete//' | sed -e 's/ //g' | sed -e 's/=//g' | sed -e 's/,/ /g'` + +# Get the update directory +update_directory=`cat cfg/config.cfg | grep "update_directory" | sed -e 's/update_directory//' | sed -e 's/ //g' | sed -e 's/=//g' | sed -e 's/,/ /g'` + +# Get the database directory +database_directory=`cat cfg/site.cfg | grep "database_directory" | sed -e 's/database_directory//g' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the database letter +database_letter=`cat cfg/site.cfg | grep "database_letter" | sed -e 's/database_letter//g' | sed -e 's/ //g' | sed -e 's/=//g'` + +# Get the database server +database_server=`cat cfg/site.cfg | grep "database_server" | sed -e 's/database_server//g' | sed -e 's/ //g' | sed -e 's/=//g'` + +`cat _idle.bat | sed -e "s&database_directory&$database_directory&g" | sed -e "s&database_letter&$database_letter&g" | sed -e "s&database_server&$database_server&g" > idle.bat` + +# Log error +echo > log.log +date >> log.log +date + +# Create a bin dir +mkdir bin 2> /dev/null + +# For each process +for i in $process_to_complete ; do + # Open the directory + cd processes/$i + + # Excecute the command + ./0_setup.bat + + # Get back + cd ../.. + + # Concat log.log files + # cat processes/$i/log.log >> log.log + + # Idle + ./idle.bat +done + +# Get the quality option to choose the goor properties.cfg file +quality_flag=`cat cfg/site.cfg | grep "build_quality" | grep "1"` + +# Copy the good properties.cfg file +if ( test "$quality_flag" ) +then + # We are in BEST mode + echo [Quality] BEST + cp cfg/properties_final.cfg cfg/properties.cfg +else + # We are not DRAFT mode + echo [Quality] DRAFT + cp cfg/properties_draft.cfg cfg/properties.cfg +fi From 017ac8c68c2d85a3ffc8dbcd6804b53ffce1b88d Mon Sep 17 00:00:00 2001 From: Josh Santos Date: Mon, 29 Jan 2024 10:49:26 +0000 Subject: [PATCH 119/126] Convert line endings for some files --- web/docs/admin/shard_restart/H38.css | 212 +- web/docs/admin/shard_restart/Hu37.js | 1522 +++---- web/public_php/admin/overlib/overlib.js | 2982 ++++++------- .../admin/overlib/overlib_anchor.js | 664 +-- .../admin/overlib/overlib_anchor_mini.js | 196 +- .../admin/overlib/overlib_draggable.js | 348 +- .../admin/overlib/overlib_draggable_mini.js | 16 +- web/public_php/admin/overlib/overlib_mini.js | 34 +- web/public_php/ams/css/custom.css | 276 +- web/public_php/ams/css/uploadify.css | 182 +- web/public_php/ams/js/jquery.uploadify-3.1.js | 3940 ++++++++--------- .../ams/js/jquery.uploadify-3.1.min.js | 30 +- web/public_php/ams/js/masonry.pkgd.min.js | 16 +- 13 files changed, 5209 insertions(+), 5209 deletions(-) diff --git a/web/docs/admin/shard_restart/H38.css b/web/docs/admin/shard_restart/H38.css index f14991eb49..704622119e 100644 --- a/web/docs/admin/shard_restart/H38.css +++ b/web/docs/admin/shard_restart/H38.css @@ -1,106 +1,106 @@ -BODY {background:#FFFFFF} - -.menuItem { - font-family:sans-serif; font-size:small; - width:220;padding-left:20; - background-color:menu; - color:black -} - -.highlightItem { - font-family:sans-serif; font-size:small; - width:220; padding-left:20; - background-Color:highlight; color:white; -} - -.navBar { - background-Color:buttonface; -} - -.oldNavBar { - background-Color:black; -} - -.pageView { - background-Color:white; -} - -.propViewer { - background-Color:white; - color: black; - font-family: Verdana; - font-style: italic; - font-weight: bold; - font-size: medium; - text-align: center; -} - -.propViewerTABLE { - background-Color: black; - font-weight: medium; - border-width: 1pt; - border-color: black; -} - -.propViewerTHEAD { - background-Color: rgb(230,230,230); - color: black; - font-family: Verdana; - font-style: italic; - font-weight: medium; - font-size: small; -} - -.propViewerHeaderSep { - background-Color: black; - height: 0pt; -} - -.propViewerLines { - background-Color: black; - height: 2pt; -} - -.propViewerTD { - font-family: Verdana; - color: black; - font-size: x-small; - font-style: normal; - align: center; -} - -.propViewerEvenRow { - background-Color: rgb(253,254,238); -} - -.propViewerOddRow { - background-Color: rgb(254,254,247); -} - -.clTab { - cursor:hand; - background:buttonface; - font: 0.7em Arial; - padding-left:3px; - padding-right:3px; - text-align:center; -} - -.clBorder { - background:windowframe; - font:1pt; -} - -.clScroll { - font:8pt Courier New; - color:threeddarkshadow; - cursor:default; - line-height:10pt; -} - -.clScroll2 { - font:10pt Arial; - color:threeddarkshadow; - cursor:default; - line-height:11pt; -} +BODY {background:#FFFFFF} + +.menuItem { + font-family:sans-serif; font-size:small; + width:220;padding-left:20; + background-color:menu; + color:black +} + +.highlightItem { + font-family:sans-serif; font-size:small; + width:220; padding-left:20; + background-Color:highlight; color:white; +} + +.navBar { + background-Color:buttonface; +} + +.oldNavBar { + background-Color:black; +} + +.pageView { + background-Color:white; +} + +.propViewer { + background-Color:white; + color: black; + font-family: Verdana; + font-style: italic; + font-weight: bold; + font-size: medium; + text-align: center; +} + +.propViewerTABLE { + background-Color: black; + font-weight: medium; + border-width: 1pt; + border-color: black; +} + +.propViewerTHEAD { + background-Color: rgb(230,230,230); + color: black; + font-family: Verdana; + font-style: italic; + font-weight: medium; + font-size: small; +} + +.propViewerHeaderSep { + background-Color: black; + height: 0pt; +} + +.propViewerLines { + background-Color: black; + height: 2pt; +} + +.propViewerTD { + font-family: Verdana; + color: black; + font-size: x-small; + font-style: normal; + align: center; +} + +.propViewerEvenRow { + background-Color: rgb(253,254,238); +} + +.propViewerOddRow { + background-Color: rgb(254,254,247); +} + +.clTab { + cursor:hand; + background:buttonface; + font: 0.7em Arial; + padding-left:3px; + padding-right:3px; + text-align:center; +} + +.clBorder { + background:windowframe; + font:1pt; +} + +.clScroll { + font:8pt Courier New; + color:threeddarkshadow; + cursor:default; + line-height:10pt; +} + +.clScroll2 { + font:10pt Arial; + color:threeddarkshadow; + cursor:default; + line-height:11pt; +} diff --git a/web/docs/admin/shard_restart/Hu37.js b/web/docs/admin/shard_restart/Hu37.js index ad988e049c..ad21c0336c 100644 --- a/web/docs/admin/shard_restart/Hu37.js +++ b/web/docs/admin/shard_restart/Hu37.js @@ -1,761 +1,761 @@ - -var g_theApp = parent.g_theApp; - -var layerRef=""; -var layerStyleRef = ""; -var styleSwitch = ""; -var FILEProtocol = "file://"; -var HTTPProtocol = "http://"; - -if (navigator.appName == "Netscape") - { - layerStyleRef="layer."; - layerRef="document.layers"; - styleSwitch=""; - } -else - { - layerStyleRef="layer.style."; - layerRef="document.all"; - styleSwitch=".style"; - } - -function CImage(id) - { - this.id = id; - - if ( g_theApp.isIE ) - this.image = eval('document.images.' + this.id); - else - this.image = eval('document.images["' + this.id + '"]'); - - this.put_Source = SetSource; - this.get_Source = GetSource; - this.put_Title = put_Title; - this.get_Title = get_Title; - } - -function SetSource(newsrc) - { - if ( this.image ) - this.image.src = newsrc; - } - -function GetSource() - { - if ( this.image ) - return this.image.src; - } - -function put_Title(txt) - { - if ( this.image && g_theApp.isIE ) - this.image.title = txt; - } - -function get_Title(txt) - { - if ( this.image && g_theApp.isIE ) - return this.image.title; - } - -function CDiv(id, doc) - { - this.id = id; - this.layer = FindLayer(id, doc); - - this.Show = Show; - this.Hide = Hide; - this.IsHidden = IsHidden; - this.put_innerHTML = put_innerHTML; - } - -function Show() - { - if ( this.layer ) - eval('this.' + layerStyleRef + 'visibility' + '= "visible"'); - } - -function Hide() - { - if ( this.layer ) - eval('this.' + layerStyleRef + 'visibility' + '= "hidden"'); - } - -function IsHidden() - { - if ( this.layer && - (-1 != eval('this.' + layerStyleRef + 'visibility').indexOf("hid")) ) - return true; - - return false; - } - -function put_innerHTML(txt) - { - if ( this.layer ) - { - if ( g_theApp.isIE ) - this.layer.innerHTML = txt; - else - { - this.layer.document.writeln(txt); - this.layer.document.close(); - } - } - } - -function SetZoomControl(f) - { - if ( !parent.g_NavBarLoaded ) - return; - - var formZoom = FindForm("zoomForm", parent.frmZoomBox.document); - if (formZoom != null) - { - s = formZoom.zoomFactor; - - if ( -1 != f ) - f *= 100; - - for ( i = 0 ; i < s.options.length ; i++ ) - { - if ( s.options[i].value == f ) - { - s.selectedIndex = i; - break; - } - } - } - } - -function zoom_onchange(val) -{ - if ( g_theApp.ActiveViewMgr ) - { - if ( g_theApp.ActiveViewMgr.ZoomIsPresent == true) - { - g_theApp.ActiveViewMgr.put_Zoom(parseInt(val)); - } - } -} - -function CViewMgr() - { -//Set all zoom functions to null assuming the addons related -//to the data will provide their own functions. - this.onResize = null; - this.put_Zoom = null; - this.get_Zoom = null; - this.ApplyZoom = null; - - //General functions. - this.onLoad = ViewMgrOnLoad; - this.put_Location = ViewMgrDefaultFind; //MUST BE SET FOR FIND FEATURE - this.ZoomIsPresent = false; - } - -function ViewMgrOnLoad() - { - this.id = "ConvertedImage"; - this.zoomFactor = -1; - this.zoomLast = -1; - this.origWH = 1; - this.origWidth = 100; - - if ( g_theApp.isIE ) - { - p = document.all; - this.s = document.all(this.id).style; - - - if ( this.s ) - { - this.s.position = "absolute"; - this.origWidth = this.s.pixelWidth; - this.origWH = this.s.pixelWidth / this.s.pixelHeight; - } - } - else - { - this.s = null; - } - SetZoomControl(this.zoomFactor); -} - -function ViewMgrDefaultFind() -{ - return; -} - -function handleResize() - { - location.reload(); - return false; - } - -function IsFrame(frameName) - { - return window.name == frameName; - } - -function UpdNavBar() - { - if (g_theApp.PageUpdateFunc != null) - g_theApp.PageUpdateFunc (); - - if ( parent.g_NavBarLoaded ) - //parent.frmZoomBox.UpdateNavBar(); - parent.frmNavBar.UpdateNavBar(); - } - -function UpdZoom() - { - if (g_theApp.ZoomResetFunc != null) - g_theApp.ZoomResetFunc (); - } - -function UpdCPViewer() - { - if (g_theApp.CPResetFunc != null) - g_theApp.CPResetFunc (); - } - -function UpdTitleBar() - { - if ( parent.g_TitleBarLoaded ) - parent.frmTitleBar.UpdateTitleBar(); - } - -function GetCurPageNum() { return g_theApp.CurrentPageIX; } -function GetNumPages() { return g_theApp.FileList.length; } - -function GoToNextPage() { GoToPage(g_theApp.CurrentPageIX + 1); } -function GoToPrevPage() { GoToPage(g_theApp.CurrentPageIX - 1); } -function GoToFirstPage() { GoToPage(0); } -function GoToLastPage() { GoToPage(gDocTable.length - 1) }; - -function GoToPage(ix) - { - var entry; - - if ( (g_theApp != null) && - (ix != g_theApp.CurrentPageIX) && - (null != (entry = g_theApp.FileList[ix])) ) - { - var newPage; - - if (SupportsPriOutputType ()) - { - newPage = entry.PriImage; - - if ( "" == newPage ) - newPage = newPage = entry.SecImage; - } - else - newPage = entry.SecImage; - - if (frames["frmPageView"] != null) - { - frames["frmPageView"].window.location = newPage; - } - else - { - parent.frmPageView.location = newPage; - } - - PageUpdated (ix); - } - } - -function PageUpdated (ix) -{ - g_theApp.CurrentPageIX = ix; - NotifyPageSyncs(ix); -} - -function GoToPageByName(pageName) -{ - var pageIndex = PageIndexFromName (pageName); - if (pageIndex >= 0) - { - GoToPage (pageIndex); - } -} - -function GoToPageByID(pageID) -{ - var pageIndex = PageIndexFromID (pageID); - if (pageIndex >= 0) - { - GoToPage (pageIndex); - } -} - -function PageIndexFromName (pageName) -{ - if (g_theApp != null) - { - var entry; - - var count; - var fileEntry; - var bFoundEntry = false; - for (count = 0; - count < g_theApp.FileList.length && !bFoundEntry; - count++) - { - fileEntry = g_theApp.FileList[count]; - if (pageName == fileEntry.PageName) - { - return count; - } - } - } - - return -1; -} - -function PageIndexFromID (pageID) -{ - if (g_theApp != null) - { - var entry; - - var count; - var fileEntry; - var bFoundEntry = false; - for (count = 0; - count < g_theApp.FileList.length && !bFoundEntry; - count++) - { - fileEntry = g_theApp.FileList[count]; - if (pageID == fileEntry.PageID) - { - return count; - } - } - } - return -1; -} - -function ZoomAvailable() -{ - if (SupportsPriOutputType () && g_theApp.FileList[0].PriImage != "") - { - return g_theApp.PriFormatSupportsZoom; - } - else - { - return (g_theApp.SecFormatSupportsZoom && g_theApp.FileList[0].SecImage != ""); - } -} - -function NotifyPageSyncs(ix) - { - UpdNavBar(); - UpdTitleBar(); - UpdZoom(); - UpdCPViewer(); - } - -function HasPrevSld() { return (GetCurPageNum() > 0); } -function HasNextSld() { return ((GetCurPageNum() + 1) < GetNumPages()); } - -function CancelDrag() - { - window.event.cancelBubble=true; - window.event.returnValue=false - } - -function html_escape(txt) - { - var result = ""; - - for ( var i = 0 ; i < txt.length ; i++ ) - { - if ( txt.charAt(i) == '&' ) - result += "&"; - else if ( txt.charAt(i) == '<' ) - result += "<"; - else if ( txt.charAt(i) == '>' ) - result += ">"; - else - result += txt.charAt(i); - } - - return result; - } - -function FindForm(form, doc) - { - if ( g_theApp.isIE ) - return doc.forms[form]; - else if ( null != doc ) - { - if ( null != doc.forms ) - { - for ( i = 0 ; i < doc.forms.length ; i++ ) - { - if ( form == doc.forms[i].name ) - return doc.forms[i]; - } - } - - if ( null != doc.layers ) - { - for ( i = 0 ; i < doc.layers.length ; i++ ) - { - result = FindForm(form, doc.layers[i].document); - - if ( null != result ) - return result; - } - } - } - - return null; - } - -function FindLayer(layer, doc) - { - var result = null; - - if ( g_theApp.isIE ) - return doc.all(layer); - else if ( (null != doc) && (null != doc.layers) ) - { - for ( i = 0 ; i < doc.layers.length ; i++ ) - { - result = doc.layers[i]; - - if ( layer == result.name ) - return result; - - result = FindLayer(layer, result.document); - - if ( null != result ) - return result; - } - } - - return null; - } - -function Unquote (str) -{ - var nStartIndex = 0; - var nEndIndex = str.length; - - if (str.charAt (0) == '"') - { - nStartIndex = 1; - } - - if (str.charAt (nEndIndex - 1) == '"') - { - nEndIndex -= 1; - } - - return str.substring (nStartIndex, nEndIndex); -} - -function ConvertXorYCoordinate(PosValue, OldMin, OldMax, NewMin, NewMax, MapBackwards) -{ -//This is a simple conversion routine that changes from one system to another. - var OldMid = (OldMax - OldMin) / 2; - var NewMid = (NewMax - NewMin) / 2; - var ConvertResult = 1 * PosValue; - ConvertResult = ConvertResult - (OldMin + OldMid); - ConvertResult = ConvertResult / OldMid; - if(MapBackwards != 0) - { - ConvertResult = 0 - ConvertResult; - } - ConvertResult = ConvertResult * NewMid; - ConvertResult = ConvertResult + (NewMin + NewMid); - return ConvertResult; -} - -function GoToURL (defURL) -{ - if ((g_theApp == null) || !SupportsXML () || (g_theApp.objParser == null)) - { - if (defURL.indexOf ("javascript:") == 0) - { - // This is actually a function call, not a URL. - eval (defURL); - return; - } - - parent.location = defURL; - } -} - -var el; -function showMenu(pageID, shapeID) { - - if (SupportsXML ()) - { - var shapeXML = FindShapeXML (pageID, shapeID); - if (shapeXML != null) - { - CreateHLMenu (shapeXML); - - //ContextElement=window.event.srcElement; - parent.frmPageView.menu1.style.leftPos += 10; - parent.frmPageView.menu1.style.posLeft = event.clientX; - parent.frmPageView.menu1.style.posTop = event.clientY; - parent.frmPageView.menu1.style.display = ""; - - var clientWidth = event.srcElement.document.body.clientWidth; - var clientHeight = event.srcElement.document.body.clientHeight; - - var menuWidth = parseInt (parent.frmPageView.menu1.style.width); - var margin = 10; - - // Figure out where to place the menu (X). - var menuX = event.clientX; - if (event.clientX + parent.frmPageView.menu1.clientWidth > clientWidth) - { - menuX = clientWidth - parent.frmPageView.menu1.clientWidth - margin; - if (menuX < margin) - { - menuX = margin; - } - } - - // Figure out where to place the menu (Y). - var menuY = event.clientY; - if (event.clientY + parent.frmPageView.menu1.clientHeight > clientHeight) - { - menuY = clientHeight - parent.frmPageView.menu1.clientHeight - margin; - if (menuY < margin) - { - menuY = margin; - } - } - - parent.frmPageView.menu1.style.posLeft = menuX; - parent.frmPageView.menu1.style.posTop = menuY; - - parent.frmPageView.menu1.setCapture(); - - event.cancelBubble = true; - } - } -} - -function toggleMenu() { - el=event.srcElement; - if (el.className=="menuItem") { - el.className="highlightItem"; - } else if (el.className=="highlightItem") { - el.className="menuItem"; - } -} - -function clickMenu() -{ - if (parent.frmPageView.menu1.style.display != "none") - { - parent.frmPageView.menu1.releaseCapture(); - parent.frmPageView.menu1.style.display="none"; - el=event.srcElement; - if (el.doFunction != null) { - eval(el.doFunction); - } - } -} - -function CreateHLMenu (shapeNode) -{ - // Create the HTML string. - var strHLMenuHTML = ""; - - if (shapeNode != null) - { - // Look up all the Hyperlink nodes. - var hlColl = shapeNode.selectNodes ("Scratch/B/SolutionXML/HLURL:Hyperlinks/HLURL:Hyperlink"); - - // Walk the list of Hyperlink nodes to generate the menu. - var hlCount = hlColl.length; - for (var count = 0; count < hlCount; count++) - { - var strDoFunction = ""; - var strDesc = ""; - var strAddress = ""; - - var hlAddress = hlColl.item(count).selectSingleNode("HLURL:Address/textnode()"); - if (hlAddress != null && hlAddress.text.length > 0 && IsValidAddress (hlAddress.text)) - { - strDoFunction = "'parent.location.href="; - - // Get the absolute URL. - var absoluteURL = hlColl.item(count).selectSingleNode("HLURL:AbsoluteURL/textnode()"); - if (g_theApp.DocHasBaseHL && absoluteURL != null && absoluteURL.text.length > 0) - { - // Use the absolute URL for our hyperlink. - strAddress = absoluteURL.text; - } - else - { - // Just use the address field. - strAddress = hlAddress.text; - } - - strDoFunction += '"' + EscapePath (strAddress) + '"' + ";'"; - - // Now try to get the description field. If empty, use the address as the description. - hlDesc = hlColl.item(count).selectSingleNode("HLURL:Description/textnode()"); - if (hlDesc != null && hlDesc.text.length > 0) - { - strDesc = hlDesc.text; - } - else - { - strDesc = strAddress; - } - } - else // Address is not present, assume it's a link into a different page in this document. - { - hlAddress = hlColl.item(count).selectSingleNode("HLURL:SubAddress/textnode()"); - if (hlAddress != null && hlAddress.text.length > 0) - { - strAddress = hlAddress.text; - - // Strip off the shape id (if present). - var pageShapeSep = strAddress.lastIndexOf ('/'); - if (pageShapeSep > 0) - { - strAddress = strAddress.substring (0, pageShapeSep); - } - - strAddress = unescape(strAddress); - - var pageIndex = PageIndexFromName (strAddress); - - strDoFunction = "'GoToPage (" + pageIndex + ");'"; - - // Just set the description to the page name as well. - strDesc = strAddress; - } - } - - if (strDoFunction.length > 0 && strDesc.length > 0) - { - strHLMenuHTML += ""; - } - } - } - - parent.frmPageView.menu1.innerHTML = strHLMenuHTML; -} - -function IsValidAddress (strAddress) -{ - var ret = false; - - if (strAddress != null && strAddress.length > 0) - { - var strFullPath = g_theApp.VisDocPath + g_theApp.VisDocName; - - if (strAddress != strFullPath && - strAddress != g_theApp.VisDocName) - { - // Points to something other than this file, go ahead - // and consider it valid. - ret = true; - } - } - - return ret; -} - -function FindShapeXML (pageID, shapeID) -{ - var shapeObj = null; - - if (g_theApp != null && g_theApp.objParser != null) - { - // Get the Pages collection. - var pagesObj = g_theApp.objParser.selectSingleNode("VisioDocument/Pages"); - if(!pagesObj) - { - return null; - } - - // Get the correct page. - var pageQuerryString = './/Page[@ID = "' + pageID + '"]'; - var pageObj = pagesObj.selectSingleNode(pageQuerryString); - if(!pageObj) - { - return null; - } - - // Get the correct shape. - var shapeQuerryString = './/Shape[@ID = "' + shapeID + '"]'; - shapeObj = pageObj.selectSingleNode(shapeQuerryString); - } - - return shapeObj; -} - -function UpdateProps(pageID, shapeID) -{ - // Check to see if we should ignore this event. - if (window.event != null && - window.event.ctrlKey) - { - // If the control key is down, do nothing! - return; - } - - if (SupportsXML ()) - { - var shape = FindShapeXML (pageID, shapeID); - - if (g_theApp.custPropEntryPoint != null) - g_theApp.custPropEntryPoint (shape); - } -} - -function SupportsXML () -{ - return (g_theApp != null && g_theApp.isIE && g_theApp.verIE >= 5.0); -} - -function SupportsPriOutputType () -{ - if (g_theApp.isIE) // IE - { - return ((g_theApp.verIE >= g_theApp.PriFormatMinIE) && (g_theApp.PriFormatMinIE > 0.0)); - } - else if (g_theApp.isNav) // Nav - { - return ((g_theApp.verNav >= g_theApp.PriFormatMinNav) && (g_theApp.PriFormatMinNav > 0.0)); - } - - // Unsupported browser. - return false; -} - -function EscapePath (strPath) -{ - var strResult = ""; - - for ( var i = 0 ; i < strPath.length ; i++ ) - { - if ( strPath.charAt(i) == '\\' ) - { - strResult += "\\\\"; - } - else - { - strResult += strPath.charAt(i); - } - } - - return strResult; -} + +var g_theApp = parent.g_theApp; + +var layerRef=""; +var layerStyleRef = ""; +var styleSwitch = ""; +var FILEProtocol = "file://"; +var HTTPProtocol = "http://"; + +if (navigator.appName == "Netscape") + { + layerStyleRef="layer."; + layerRef="document.layers"; + styleSwitch=""; + } +else + { + layerStyleRef="layer.style."; + layerRef="document.all"; + styleSwitch=".style"; + } + +function CImage(id) + { + this.id = id; + + if ( g_theApp.isIE ) + this.image = eval('document.images.' + this.id); + else + this.image = eval('document.images["' + this.id + '"]'); + + this.put_Source = SetSource; + this.get_Source = GetSource; + this.put_Title = put_Title; + this.get_Title = get_Title; + } + +function SetSource(newsrc) + { + if ( this.image ) + this.image.src = newsrc; + } + +function GetSource() + { + if ( this.image ) + return this.image.src; + } + +function put_Title(txt) + { + if ( this.image && g_theApp.isIE ) + this.image.title = txt; + } + +function get_Title(txt) + { + if ( this.image && g_theApp.isIE ) + return this.image.title; + } + +function CDiv(id, doc) + { + this.id = id; + this.layer = FindLayer(id, doc); + + this.Show = Show; + this.Hide = Hide; + this.IsHidden = IsHidden; + this.put_innerHTML = put_innerHTML; + } + +function Show() + { + if ( this.layer ) + eval('this.' + layerStyleRef + 'visibility' + '= "visible"'); + } + +function Hide() + { + if ( this.layer ) + eval('this.' + layerStyleRef + 'visibility' + '= "hidden"'); + } + +function IsHidden() + { + if ( this.layer && + (-1 != eval('this.' + layerStyleRef + 'visibility').indexOf("hid")) ) + return true; + + return false; + } + +function put_innerHTML(txt) + { + if ( this.layer ) + { + if ( g_theApp.isIE ) + this.layer.innerHTML = txt; + else + { + this.layer.document.writeln(txt); + this.layer.document.close(); + } + } + } + +function SetZoomControl(f) + { + if ( !parent.g_NavBarLoaded ) + return; + + var formZoom = FindForm("zoomForm", parent.frmZoomBox.document); + if (formZoom != null) + { + s = formZoom.zoomFactor; + + if ( -1 != f ) + f *= 100; + + for ( i = 0 ; i < s.options.length ; i++ ) + { + if ( s.options[i].value == f ) + { + s.selectedIndex = i; + break; + } + } + } + } + +function zoom_onchange(val) +{ + if ( g_theApp.ActiveViewMgr ) + { + if ( g_theApp.ActiveViewMgr.ZoomIsPresent == true) + { + g_theApp.ActiveViewMgr.put_Zoom(parseInt(val)); + } + } +} + +function CViewMgr() + { +//Set all zoom functions to null assuming the addons related +//to the data will provide their own functions. + this.onResize = null; + this.put_Zoom = null; + this.get_Zoom = null; + this.ApplyZoom = null; + + //General functions. + this.onLoad = ViewMgrOnLoad; + this.put_Location = ViewMgrDefaultFind; //MUST BE SET FOR FIND FEATURE + this.ZoomIsPresent = false; + } + +function ViewMgrOnLoad() + { + this.id = "ConvertedImage"; + this.zoomFactor = -1; + this.zoomLast = -1; + this.origWH = 1; + this.origWidth = 100; + + if ( g_theApp.isIE ) + { + p = document.all; + this.s = document.all(this.id).style; + + + if ( this.s ) + { + this.s.position = "absolute"; + this.origWidth = this.s.pixelWidth; + this.origWH = this.s.pixelWidth / this.s.pixelHeight; + } + } + else + { + this.s = null; + } + SetZoomControl(this.zoomFactor); +} + +function ViewMgrDefaultFind() +{ + return; +} + +function handleResize() + { + location.reload(); + return false; + } + +function IsFrame(frameName) + { + return window.name == frameName; + } + +function UpdNavBar() + { + if (g_theApp.PageUpdateFunc != null) + g_theApp.PageUpdateFunc (); + + if ( parent.g_NavBarLoaded ) + //parent.frmZoomBox.UpdateNavBar(); + parent.frmNavBar.UpdateNavBar(); + } + +function UpdZoom() + { + if (g_theApp.ZoomResetFunc != null) + g_theApp.ZoomResetFunc (); + } + +function UpdCPViewer() + { + if (g_theApp.CPResetFunc != null) + g_theApp.CPResetFunc (); + } + +function UpdTitleBar() + { + if ( parent.g_TitleBarLoaded ) + parent.frmTitleBar.UpdateTitleBar(); + } + +function GetCurPageNum() { return g_theApp.CurrentPageIX; } +function GetNumPages() { return g_theApp.FileList.length; } + +function GoToNextPage() { GoToPage(g_theApp.CurrentPageIX + 1); } +function GoToPrevPage() { GoToPage(g_theApp.CurrentPageIX - 1); } +function GoToFirstPage() { GoToPage(0); } +function GoToLastPage() { GoToPage(gDocTable.length - 1) }; + +function GoToPage(ix) + { + var entry; + + if ( (g_theApp != null) && + (ix != g_theApp.CurrentPageIX) && + (null != (entry = g_theApp.FileList[ix])) ) + { + var newPage; + + if (SupportsPriOutputType ()) + { + newPage = entry.PriImage; + + if ( "" == newPage ) + newPage = newPage = entry.SecImage; + } + else + newPage = entry.SecImage; + + if (frames["frmPageView"] != null) + { + frames["frmPageView"].window.location = newPage; + } + else + { + parent.frmPageView.location = newPage; + } + + PageUpdated (ix); + } + } + +function PageUpdated (ix) +{ + g_theApp.CurrentPageIX = ix; + NotifyPageSyncs(ix); +} + +function GoToPageByName(pageName) +{ + var pageIndex = PageIndexFromName (pageName); + if (pageIndex >= 0) + { + GoToPage (pageIndex); + } +} + +function GoToPageByID(pageID) +{ + var pageIndex = PageIndexFromID (pageID); + if (pageIndex >= 0) + { + GoToPage (pageIndex); + } +} + +function PageIndexFromName (pageName) +{ + if (g_theApp != null) + { + var entry; + + var count; + var fileEntry; + var bFoundEntry = false; + for (count = 0; + count < g_theApp.FileList.length && !bFoundEntry; + count++) + { + fileEntry = g_theApp.FileList[count]; + if (pageName == fileEntry.PageName) + { + return count; + } + } + } + + return -1; +} + +function PageIndexFromID (pageID) +{ + if (g_theApp != null) + { + var entry; + + var count; + var fileEntry; + var bFoundEntry = false; + for (count = 0; + count < g_theApp.FileList.length && !bFoundEntry; + count++) + { + fileEntry = g_theApp.FileList[count]; + if (pageID == fileEntry.PageID) + { + return count; + } + } + } + return -1; +} + +function ZoomAvailable() +{ + if (SupportsPriOutputType () && g_theApp.FileList[0].PriImage != "") + { + return g_theApp.PriFormatSupportsZoom; + } + else + { + return (g_theApp.SecFormatSupportsZoom && g_theApp.FileList[0].SecImage != ""); + } +} + +function NotifyPageSyncs(ix) + { + UpdNavBar(); + UpdTitleBar(); + UpdZoom(); + UpdCPViewer(); + } + +function HasPrevSld() { return (GetCurPageNum() > 0); } +function HasNextSld() { return ((GetCurPageNum() + 1) < GetNumPages()); } + +function CancelDrag() + { + window.event.cancelBubble=true; + window.event.returnValue=false + } + +function html_escape(txt) + { + var result = ""; + + for ( var i = 0 ; i < txt.length ; i++ ) + { + if ( txt.charAt(i) == '&' ) + result += "&"; + else if ( txt.charAt(i) == '<' ) + result += "<"; + else if ( txt.charAt(i) == '>' ) + result += ">"; + else + result += txt.charAt(i); + } + + return result; + } + +function FindForm(form, doc) + { + if ( g_theApp.isIE ) + return doc.forms[form]; + else if ( null != doc ) + { + if ( null != doc.forms ) + { + for ( i = 0 ; i < doc.forms.length ; i++ ) + { + if ( form == doc.forms[i].name ) + return doc.forms[i]; + } + } + + if ( null != doc.layers ) + { + for ( i = 0 ; i < doc.layers.length ; i++ ) + { + result = FindForm(form, doc.layers[i].document); + + if ( null != result ) + return result; + } + } + } + + return null; + } + +function FindLayer(layer, doc) + { + var result = null; + + if ( g_theApp.isIE ) + return doc.all(layer); + else if ( (null != doc) && (null != doc.layers) ) + { + for ( i = 0 ; i < doc.layers.length ; i++ ) + { + result = doc.layers[i]; + + if ( layer == result.name ) + return result; + + result = FindLayer(layer, result.document); + + if ( null != result ) + return result; + } + } + + return null; + } + +function Unquote (str) +{ + var nStartIndex = 0; + var nEndIndex = str.length; + + if (str.charAt (0) == '"') + { + nStartIndex = 1; + } + + if (str.charAt (nEndIndex - 1) == '"') + { + nEndIndex -= 1; + } + + return str.substring (nStartIndex, nEndIndex); +} + +function ConvertXorYCoordinate(PosValue, OldMin, OldMax, NewMin, NewMax, MapBackwards) +{ +//This is a simple conversion routine that changes from one system to another. + var OldMid = (OldMax - OldMin) / 2; + var NewMid = (NewMax - NewMin) / 2; + var ConvertResult = 1 * PosValue; + ConvertResult = ConvertResult - (OldMin + OldMid); + ConvertResult = ConvertResult / OldMid; + if(MapBackwards != 0) + { + ConvertResult = 0 - ConvertResult; + } + ConvertResult = ConvertResult * NewMid; + ConvertResult = ConvertResult + (NewMin + NewMid); + return ConvertResult; +} + +function GoToURL (defURL) +{ + if ((g_theApp == null) || !SupportsXML () || (g_theApp.objParser == null)) + { + if (defURL.indexOf ("javascript:") == 0) + { + // This is actually a function call, not a URL. + eval (defURL); + return; + } + + parent.location = defURL; + } +} + +var el; +function showMenu(pageID, shapeID) { + + if (SupportsXML ()) + { + var shapeXML = FindShapeXML (pageID, shapeID); + if (shapeXML != null) + { + CreateHLMenu (shapeXML); + + //ContextElement=window.event.srcElement; + parent.frmPageView.menu1.style.leftPos += 10; + parent.frmPageView.menu1.style.posLeft = event.clientX; + parent.frmPageView.menu1.style.posTop = event.clientY; + parent.frmPageView.menu1.style.display = ""; + + var clientWidth = event.srcElement.document.body.clientWidth; + var clientHeight = event.srcElement.document.body.clientHeight; + + var menuWidth = parseInt (parent.frmPageView.menu1.style.width); + var margin = 10; + + // Figure out where to place the menu (X). + var menuX = event.clientX; + if (event.clientX + parent.frmPageView.menu1.clientWidth > clientWidth) + { + menuX = clientWidth - parent.frmPageView.menu1.clientWidth - margin; + if (menuX < margin) + { + menuX = margin; + } + } + + // Figure out where to place the menu (Y). + var menuY = event.clientY; + if (event.clientY + parent.frmPageView.menu1.clientHeight > clientHeight) + { + menuY = clientHeight - parent.frmPageView.menu1.clientHeight - margin; + if (menuY < margin) + { + menuY = margin; + } + } + + parent.frmPageView.menu1.style.posLeft = menuX; + parent.frmPageView.menu1.style.posTop = menuY; + + parent.frmPageView.menu1.setCapture(); + + event.cancelBubble = true; + } + } +} + +function toggleMenu() { + el=event.srcElement; + if (el.className=="menuItem") { + el.className="highlightItem"; + } else if (el.className=="highlightItem") { + el.className="menuItem"; + } +} + +function clickMenu() +{ + if (parent.frmPageView.menu1.style.display != "none") + { + parent.frmPageView.menu1.releaseCapture(); + parent.frmPageView.menu1.style.display="none"; + el=event.srcElement; + if (el.doFunction != null) { + eval(el.doFunction); + } + } +} + +function CreateHLMenu (shapeNode) +{ + // Create the HTML string. + var strHLMenuHTML = ""; + + if (shapeNode != null) + { + // Look up all the Hyperlink nodes. + var hlColl = shapeNode.selectNodes ("Scratch/B/SolutionXML/HLURL:Hyperlinks/HLURL:Hyperlink"); + + // Walk the list of Hyperlink nodes to generate the menu. + var hlCount = hlColl.length; + for (var count = 0; count < hlCount; count++) + { + var strDoFunction = ""; + var strDesc = ""; + var strAddress = ""; + + var hlAddress = hlColl.item(count).selectSingleNode("HLURL:Address/textnode()"); + if (hlAddress != null && hlAddress.text.length > 0 && IsValidAddress (hlAddress.text)) + { + strDoFunction = "'parent.location.href="; + + // Get the absolute URL. + var absoluteURL = hlColl.item(count).selectSingleNode("HLURL:AbsoluteURL/textnode()"); + if (g_theApp.DocHasBaseHL && absoluteURL != null && absoluteURL.text.length > 0) + { + // Use the absolute URL for our hyperlink. + strAddress = absoluteURL.text; + } + else + { + // Just use the address field. + strAddress = hlAddress.text; + } + + strDoFunction += '"' + EscapePath (strAddress) + '"' + ";'"; + + // Now try to get the description field. If empty, use the address as the description. + hlDesc = hlColl.item(count).selectSingleNode("HLURL:Description/textnode()"); + if (hlDesc != null && hlDesc.text.length > 0) + { + strDesc = hlDesc.text; + } + else + { + strDesc = strAddress; + } + } + else // Address is not present, assume it's a link into a different page in this document. + { + hlAddress = hlColl.item(count).selectSingleNode("HLURL:SubAddress/textnode()"); + if (hlAddress != null && hlAddress.text.length > 0) + { + strAddress = hlAddress.text; + + // Strip off the shape id (if present). + var pageShapeSep = strAddress.lastIndexOf ('/'); + if (pageShapeSep > 0) + { + strAddress = strAddress.substring (0, pageShapeSep); + } + + strAddress = unescape(strAddress); + + var pageIndex = PageIndexFromName (strAddress); + + strDoFunction = "'GoToPage (" + pageIndex + ");'"; + + // Just set the description to the page name as well. + strDesc = strAddress; + } + } + + if (strDoFunction.length > 0 && strDesc.length > 0) + { + strHLMenuHTML += ""; + } + } + } + + parent.frmPageView.menu1.innerHTML = strHLMenuHTML; +} + +function IsValidAddress (strAddress) +{ + var ret = false; + + if (strAddress != null && strAddress.length > 0) + { + var strFullPath = g_theApp.VisDocPath + g_theApp.VisDocName; + + if (strAddress != strFullPath && + strAddress != g_theApp.VisDocName) + { + // Points to something other than this file, go ahead + // and consider it valid. + ret = true; + } + } + + return ret; +} + +function FindShapeXML (pageID, shapeID) +{ + var shapeObj = null; + + if (g_theApp != null && g_theApp.objParser != null) + { + // Get the Pages collection. + var pagesObj = g_theApp.objParser.selectSingleNode("VisioDocument/Pages"); + if(!pagesObj) + { + return null; + } + + // Get the correct page. + var pageQuerryString = './/Page[@ID = "' + pageID + '"]'; + var pageObj = pagesObj.selectSingleNode(pageQuerryString); + if(!pageObj) + { + return null; + } + + // Get the correct shape. + var shapeQuerryString = './/Shape[@ID = "' + shapeID + '"]'; + shapeObj = pageObj.selectSingleNode(shapeQuerryString); + } + + return shapeObj; +} + +function UpdateProps(pageID, shapeID) +{ + // Check to see if we should ignore this event. + if (window.event != null && + window.event.ctrlKey) + { + // If the control key is down, do nothing! + return; + } + + if (SupportsXML ()) + { + var shape = FindShapeXML (pageID, shapeID); + + if (g_theApp.custPropEntryPoint != null) + g_theApp.custPropEntryPoint (shape); + } +} + +function SupportsXML () +{ + return (g_theApp != null && g_theApp.isIE && g_theApp.verIE >= 5.0); +} + +function SupportsPriOutputType () +{ + if (g_theApp.isIE) // IE + { + return ((g_theApp.verIE >= g_theApp.PriFormatMinIE) && (g_theApp.PriFormatMinIE > 0.0)); + } + else if (g_theApp.isNav) // Nav + { + return ((g_theApp.verNav >= g_theApp.PriFormatMinNav) && (g_theApp.PriFormatMinNav > 0.0)); + } + + // Unsupported browser. + return false; +} + +function EscapePath (strPath) +{ + var strResult = ""; + + for ( var i = 0 ; i < strPath.length ; i++ ) + { + if ( strPath.charAt(i) == '\\' ) + { + strResult += "\\\\"; + } + else + { + strResult += strPath.charAt(i); + } + } + + return strResult; +} diff --git a/web/public_php/admin/overlib/overlib.js b/web/public_php/admin/overlib/overlib.js index 7fc66d4a3a..e9e1823f5e 100644 --- a/web/public_php/admin/overlib/overlib.js +++ b/web/public_php/admin/overlib/overlib.js @@ -1,1491 +1,1491 @@ -//\///// -//\ overLIB 4.21 - You may not remove or change this notice. -//\ Copyright Erik Bosrup 1998-2004. All rights reserved. -//\ -//\ Contributors are listed on the homepage. -//\ This file might be old, always check for the latest version at: -//\ http://www.bosrup.com/web/overlib/ -//\ -//\ Please read the license agreement (available through the link above) -//\ before using overLIB. Direct any licensing questions to erik@bosrup.com. -//\ -//\ Do not sell this as your own work or remove this copyright notice. -//\ For full details on copying or changing this script please read the -//\ license agreement at the link above. Please give credit on sites that -//\ use overLIB and submit changes of the script so other people can use -//\ them as well. -// $Revision: 1.1 $ $Date: 2006/05/29 16:38:21 $ -//\///// -//\mini - -//////// -// PRE-INIT -// Ignore these lines, configuration is below. -//////// -var olLoaded = 0;var pmStart = 10000000; var pmUpper = 10001000; var pmCount = pmStart+1; var pmt=''; var pms = new Array(); var olInfo = new Info('4.21', 1); -var FREPLACE = 0; var FBEFORE = 1; var FAFTER = 2; var FALTERNATE = 3; var FCHAIN=4; -var olHideForm=0; // parameter for hiding SELECT and ActiveX elements in IE5.5+ -var olHautoFlag = 0; // flags for over-riding VAUTO and HAUTO if corresponding -var olVautoFlag = 0; // positioning commands are used on the command line -var hookPts = new Array(), postParse = new Array(), cmdLine = new Array(), runTime = new Array(); -// for plugins -registerCommands('donothing,inarray,caparray,sticky,background,noclose,caption,left,right,center,offsetx,offsety,fgcolor,bgcolor,textcolor,capcolor,closecolor,width,border,cellpad,status,autostatus,autostatuscap,height,closetext,snapx,snapy,fixx,fixy,relx,rely,fgbackground,bgbackground,padx,pady,fullhtml,above,below,capicon,textfont,captionfont,closefont,textsize,captionsize,closesize,timeout,function,delay,hauto,vauto,closeclick,wrap,followmouse,mouseoff,closetitle,cssoff,compatmode,cssclass,fgclass,bgclass,textfontclass,captionfontclass,closefontclass'); - -//////// -// DEFAULT CONFIGURATION -// Settings you want everywhere are set here. All of this can also be -// changed on your html page or through an overLIB call. -//////// -if (typeof ol_fgcolor=='undefined') var ol_fgcolor="#99BBDD"; -if (typeof ol_bgcolor=='undefined') var ol_bgcolor="#7799BB"; -if (typeof ol_textcolor=='undefined') var ol_textcolor="#000000"; -if (typeof ol_capcolor=='undefined') var ol_capcolor="#000033"; -if (typeof ol_closecolor=='undefined') var ol_closecolor="#000000"; -if (typeof ol_textfont=='undefined') var ol_textfont="Verdana,Arial,Helvetica"; -if (typeof ol_captionfont=='undefined') var ol_captionfont="Verdana,Arial,Helvetica"; -if (typeof ol_closefont=='undefined') var ol_closefont="Verdana,Arial,Helvetica"; -if (typeof ol_textsize=='undefined') var ol_textsize="1"; -if (typeof ol_captionsize=='undefined') var ol_captionsize="1"; -if (typeof ol_closesize=='undefined') var ol_closesize="1"; -if (typeof ol_width=='undefined') var ol_width="200"; -if (typeof ol_border=='undefined') var ol_border="1"; -if (typeof ol_cellpad=='undefined') var ol_cellpad=2; -if (typeof ol_offsetx=='undefined') var ol_offsetx=10; -if (typeof ol_offsety=='undefined') var ol_offsety=10; -if (typeof ol_text=='undefined') var ol_text="Default Text"; -if (typeof ol_cap=='undefined') var ol_cap=""; -if (typeof ol_sticky=='undefined') var ol_sticky=0; -if (typeof ol_background=='undefined') var ol_background=""; -if (typeof ol_close=='undefined') var ol_close="Close"; -if (typeof ol_hpos=='undefined') var ol_hpos=RIGHT; -if (typeof ol_status=='undefined') var ol_status=""; -if (typeof ol_autostatus=='undefined') var ol_autostatus=0; -if (typeof ol_height=='undefined') var ol_height=-1; -if (typeof ol_snapx=='undefined') var ol_snapx=0; -if (typeof ol_snapy=='undefined') var ol_snapy=0; -if (typeof ol_fixx=='undefined') var ol_fixx=-1; -if (typeof ol_fixy=='undefined') var ol_fixy=-1; -if (typeof ol_relx=='undefined') var ol_relx=null; -if (typeof ol_rely=='undefined') var ol_rely=null; -if (typeof ol_fgbackground=='undefined') var ol_fgbackground=""; -if (typeof ol_bgbackground=='undefined') var ol_bgbackground=""; -if (typeof ol_padxl=='undefined') var ol_padxl=1; -if (typeof ol_padxr=='undefined') var ol_padxr=1; -if (typeof ol_padyt=='undefined') var ol_padyt=1; -if (typeof ol_padyb=='undefined') var ol_padyb=1; -if (typeof ol_fullhtml=='undefined') var ol_fullhtml=0; -if (typeof ol_vpos=='undefined') var ol_vpos=BELOW; -if (typeof ol_aboveheight=='undefined') var ol_aboveheight=0; -if (typeof ol_capicon=='undefined') var ol_capicon=""; -if (typeof ol_frame=='undefined') var ol_frame=self; -if (typeof ol_timeout=='undefined') var ol_timeout=0; -if (typeof ol_function=='undefined') var ol_function=null; -if (typeof ol_delay=='undefined') var ol_delay=0; -if (typeof ol_hauto=='undefined') var ol_hauto=0; -if (typeof ol_vauto=='undefined') var ol_vauto=0; -if (typeof ol_closeclick=='undefined') var ol_closeclick=0; -if (typeof ol_wrap=='undefined') var ol_wrap=0; -if (typeof ol_followmouse=='undefined') var ol_followmouse=1; -if (typeof ol_mouseoff=='undefined') var ol_mouseoff=0; -if (typeof ol_closetitle=='undefined') var ol_closetitle='Close'; -if (typeof ol_compatmode=='undefined') var ol_compatmode=0; -if (typeof ol_css=='undefined') var ol_css=CSSOFF; -if (typeof ol_fgclass=='undefined') var ol_fgclass=""; -if (typeof ol_bgclass=='undefined') var ol_bgclass=""; -if (typeof ol_textfontclass=='undefined') var ol_textfontclass=""; -if (typeof ol_captionfontclass=='undefined') var ol_captionfontclass=""; -if (typeof ol_closefontclass=='undefined') var ol_closefontclass=""; - -//////// -// ARRAY CONFIGURATION -//////// - -// You can use these arrays to store popup text here instead of in the html. -if (typeof ol_texts=='undefined') var ol_texts = new Array("Text 0", "Text 1"); -if (typeof ol_caps=='undefined') var ol_caps = new Array("Caption 0", "Caption 1"); - -//////// -// END OF CONFIGURATION -// Don't change anything below this line, all configuration is above. -//////// - - - - - -//////// -// INIT -//////// -// Runtime variables init. Don't change for config! -var o3_text=""; -var o3_cap=""; -var o3_sticky=0; -var o3_background=""; -var o3_close="Close"; -var o3_hpos=RIGHT; -var o3_offsetx=2; -var o3_offsety=2; -var o3_fgcolor=""; -var o3_bgcolor=""; -var o3_textcolor=""; -var o3_capcolor=""; -var o3_closecolor=""; -var o3_width=100; -var o3_border=1; -var o3_cellpad=2; -var o3_status=""; -var o3_autostatus=0; -var o3_height=-1; -var o3_snapx=0; -var o3_snapy=0; -var o3_fixx=-1; -var o3_fixy=-1; -var o3_relx=null; -var o3_rely=null; -var o3_fgbackground=""; -var o3_bgbackground=""; -var o3_padxl=0; -var o3_padxr=0; -var o3_padyt=0; -var o3_padyb=0; -var o3_fullhtml=0; -var o3_vpos=BELOW; -var o3_aboveheight=0; -var o3_capicon=""; -var o3_textfont="Verdana,Arial,Helvetica"; -var o3_captionfont="Verdana,Arial,Helvetica"; -var o3_closefont="Verdana,Arial,Helvetica"; -var o3_textsize="1"; -var o3_captionsize="1"; -var o3_closesize="1"; -var o3_frame=self; -var o3_timeout=0; -var o3_timerid=0; -var o3_allowmove=0; -var o3_function=null; -var o3_delay=0; -var o3_delayid=0; -var o3_hauto=0; -var o3_vauto=0; -var o3_closeclick=0; -var o3_wrap=0; -var o3_followmouse=1; -var o3_mouseoff=0; -var o3_closetitle=''; -var o3_compatmode=0; -var o3_css=CSSOFF; -var o3_fgclass=""; -var o3_bgclass=""; -var o3_textfontclass=""; -var o3_captionfontclass=""; -var o3_closefontclass=""; - -// Display state variables -var o3_x = 0; -var o3_y = 0; -var o3_showingsticky = 0; -var o3_removecounter = 0; - -// Our layer -var over = null; -var fnRef, hoveringSwitch = false; -var olHideDelay; - -// Decide browser version -var isMac = (navigator.userAgent.indexOf("Mac") != -1); -var olOp = (navigator.userAgent.toLowerCase().indexOf('opera') > -1 && document.createTextNode); // Opera 7 -var olNs4 = (navigator.appName=='Netscape' && parseInt(navigator.appVersion) == 4); -var olNs6 = (document.getElementById) ? true : false; -var olKq = (olNs6 && /konqueror/i.test(navigator.userAgent)); -var olIe4 = (document.all) ? true : false; -var olIe5 = false; -var olIe55 = false; // Added additional variable to identify IE5.5+ -var docRoot = 'document.body'; - -// Resize fix for NS4.x to keep track of layer -if (olNs4) { - var oW = window.innerWidth; - var oH = window.innerHeight; - window.onresize = function() { if (oW != window.innerWidth || oH != window.innerHeight) location.reload(); } -} - -// Microsoft Stupidity Check(tm). -if (olIe4) { - var agent = navigator.userAgent; - if (/MSIE/.test(agent)) { - var versNum = parseFloat(agent.match(/MSIE[ ](\d\.\d+)\.*/i)[1]); - if (versNum >= 5){ - olIe5=true; - olIe55=(versNum>=5.5&&!olOp) ? true : false; - if (olNs6) olNs6=false; - } - } - if (olNs6) olIe4 = false; -} - -// Check for compatability mode. -if (document.compatMode && document.compatMode == 'CSS1Compat') { - docRoot= ((olIe4 && !olOp) ? 'document.documentElement' : docRoot); -} - -// Add window onload handlers to indicate when all modules have been loaded -// For Netscape 6+ and Mozilla, uses addEventListener method on the window object -// For IE it uses the attachEvent method of the window object and for Netscape 4.x -// it sets the window.onload handler to the OLonload_handler function for Bubbling -if(window.addEventListener) window.addEventListener("load",OLonLoad_handler,false); -else if (window.attachEvent) window.attachEvent("onload",OLonLoad_handler); - -var capExtent; - -//////// -// PUBLIC FUNCTIONS -//////// - -// overlib(arg0,...,argN) -// Loads parameters into global runtime variables. -function overlib() { - if (!olLoaded || isExclusive(overlib.arguments)) return true; - if (olCheckMouseCapture) olMouseCapture(); - if (over) { - over = (typeof over.id != 'string') ? o3_frame.document.all['overDiv'] : over; - cClick(); - } - - // Load defaults to runtime. - olHideDelay=0; - o3_text=ol_text; - o3_cap=ol_cap; - o3_sticky=ol_sticky; - o3_background=ol_background; - o3_close=ol_close; - o3_hpos=ol_hpos; - o3_offsetx=ol_offsetx; - o3_offsety=ol_offsety; - o3_fgcolor=ol_fgcolor; - o3_bgcolor=ol_bgcolor; - o3_textcolor=ol_textcolor; - o3_capcolor=ol_capcolor; - o3_closecolor=ol_closecolor; - o3_width=ol_width; - o3_border=ol_border; - o3_cellpad=ol_cellpad; - o3_status=ol_status; - o3_autostatus=ol_autostatus; - o3_height=ol_height; - o3_snapx=ol_snapx; - o3_snapy=ol_snapy; - o3_fixx=ol_fixx; - o3_fixy=ol_fixy; - o3_relx=ol_relx; - o3_rely=ol_rely; - o3_fgbackground=ol_fgbackground; - o3_bgbackground=ol_bgbackground; - o3_padxl=ol_padxl; - o3_padxr=ol_padxr; - o3_padyt=ol_padyt; - o3_padyb=ol_padyb; - o3_fullhtml=ol_fullhtml; - o3_vpos=ol_vpos; - o3_aboveheight=ol_aboveheight; - o3_capicon=ol_capicon; - o3_textfont=ol_textfont; - o3_captionfont=ol_captionfont; - o3_closefont=ol_closefont; - o3_textsize=ol_textsize; - o3_captionsize=ol_captionsize; - o3_closesize=ol_closesize; - o3_timeout=ol_timeout; - o3_function=ol_function; - o3_delay=ol_delay; - o3_hauto=ol_hauto; - o3_vauto=ol_vauto; - o3_closeclick=ol_closeclick; - o3_wrap=ol_wrap; - o3_followmouse=ol_followmouse; - o3_mouseoff=ol_mouseoff; - o3_closetitle=ol_closetitle; - o3_css=ol_css; - o3_compatmode=ol_compatmode; - o3_fgclass=ol_fgclass; - o3_bgclass=ol_bgclass; - o3_textfontclass=ol_textfontclass; - o3_captionfontclass=ol_captionfontclass; - o3_closefontclass=ol_closefontclass; - - setRunTimeVariables(); - - fnRef = ''; - - // Special for frame support, over must be reset... - o3_frame = ol_frame; - - if(!(over=createDivContainer())) return false; - - parseTokens('o3_', overlib.arguments); - if (!postParseChecks()) return false; - - if (o3_delay == 0) { - return runHook("olMain", FREPLACE); - } else { - o3_delayid = setTimeout("runHook('olMain', FREPLACE)", o3_delay); - return false; - } -} - -// Clears popups if appropriate -function nd(time) { - if (olLoaded && !isExclusive()) { - hideDelay(time); // delay popup close if time specified - - if (o3_removecounter >= 1) { o3_showingsticky = 0 }; - - if (o3_showingsticky == 0) { - o3_allowmove = 0; - if (over != null && o3_timerid == 0) runHook("hideObject", FREPLACE, over); - } else { - o3_removecounter++; - } - } - - return true; -} - -// The Close onMouseOver function for stickies -function cClick() { - if (olLoaded) { - runHook("hideObject", FREPLACE, over); - o3_showingsticky = 0; - } - return false; -} - -// Method for setting page specific defaults. -function overlib_pagedefaults() { - parseTokens('ol_', overlib_pagedefaults.arguments); -} - - -//////// -// OVERLIB MAIN FUNCTION -//////// - -// This function decides what it is we want to display and how we want it done. -function olMain() { - var layerhtml, styleType; - runHook("olMain", FBEFORE); - - if (o3_background!="" || o3_fullhtml) { - // Use background instead of box. - layerhtml = runHook('ol_content_background', FALTERNATE, o3_css, o3_text, o3_background, o3_fullhtml); - } else { - // They want a popup box. - styleType = (pms[o3_css-1-pmStart] == "cssoff" || pms[o3_css-1-pmStart] == "cssclass"); - - // Prepare popup background - if (o3_fgbackground != "") o3_fgbackground = "background=\""+o3_fgbackground+"\""; - if (o3_bgbackground != "") o3_bgbackground = (styleType ? "background=\""+o3_bgbackground+"\"" : o3_bgbackground); - - // Prepare popup colors - if (o3_fgcolor != "") o3_fgcolor = (styleType ? "bgcolor=\""+o3_fgcolor+"\"" : o3_fgcolor); - if (o3_bgcolor != "") o3_bgcolor = (styleType ? "bgcolor=\""+o3_bgcolor+"\"" : o3_bgcolor); - - // Prepare popup height - if (o3_height > 0) o3_height = (styleType ? "height=\""+o3_height+"\"" : o3_height); - else o3_height = ""; - - // Decide which kinda box. - if (o3_cap=="") { - // Plain - layerhtml = runHook('ol_content_simple', FALTERNATE, o3_css, o3_text); - } else { - // With caption - if (o3_sticky) { - // Show close text - layerhtml = runHook('ol_content_caption', FALTERNATE, o3_css, o3_text, o3_cap, o3_close); - } else { - // No close text - layerhtml = runHook('ol_content_caption', FALTERNATE, o3_css, o3_text, o3_cap, ""); - } - } - } - - // We want it to stick! - if (o3_sticky) { - if (o3_timerid > 0) { - clearTimeout(o3_timerid); - o3_timerid = 0; - } - o3_showingsticky = 1; - o3_removecounter = 0; - } - - // Created a separate routine to generate the popup to make it easier - // to implement a plugin capability - if (!runHook("createPopup", FREPLACE, layerhtml)) return false; - - // Prepare status bar - if (o3_autostatus > 0) { - o3_status = o3_text; - if (o3_autostatus > 1) o3_status = o3_cap; - } - - // When placing the layer the first time, even stickies may be moved. - o3_allowmove = 0; - - // Initiate a timer for timeout - if (o3_timeout > 0) { - if (o3_timerid > 0) clearTimeout(o3_timerid); - o3_timerid = setTimeout("cClick()", o3_timeout); - } - - // Show layer - runHook("disp", FREPLACE, o3_status); - runHook("olMain", FAFTER); - - return (olOp && event && event.type == 'mouseover' && !o3_status) ? '' : (o3_status != ''); -} - -//////// -// LAYER GENERATION FUNCTIONS -//////// -// These functions just handle popup content with tags that should adhere to the W3C standards specification. - -// Makes simple table without caption -function ol_content_simple(text) { - var cpIsMultiple = /,/.test(o3_cellpad); - var txt = '
' : ((!olNs4&&cpIsMultiple) ? ' style="'+setCellPadStr(o3_cellpad)+'">' : '>'))+(o3_textfontclass ? '' : wrapStr(0,o3_textsize,'text'))+text+(o3_textfontclass ? '' : wrapStr(1,o3_textsize))+'
'; - - set_background(""); - return txt; -} - -// Makes table with caption and optional close link -function ol_content_caption(text,title,close) { - var nameId, txt, cpIsMultiple = /,/.test(o3_cellpad); - var closing, closeevent; - - closing = ""; - closeevent = "onmouseover"; - if (o3_closeclick == 1) closeevent = (o3_closetitle ? "title='" + o3_closetitle +"'" : "") + " onclick"; - if (o3_capicon != "") { - nameId = ' hspace = \"5\"'+' align = \"middle\" alt = \"\"'; - if (typeof o3_dragimg != 'undefined' && o3_dragimg) nameId =' hspace=\"5\"'+' name=\"'+o3_dragimg+'\" id=\"'+o3_dragimg+'\" align=\"middle\" alt=\"Drag Enabled\" title=\"Drag Enabled\"'; - o3_capicon = ''; - } - - if (close != "") - closing = ''+(o3_closefontclass ? '' : wrapStr(0,o3_closesize,'close'))+close+(o3_closefontclass ? '' : wrapStr(1,o3_closesize,'close'))+''; - txt = '
' : '>')+(o3_captionfontclass ? '' : ''+wrapStr(0,o3_captionsize,'caption'))+o3_capicon+title+(o3_captionfontclass ? '' : wrapStr(1,o3_captionsize)+'')+''+closing+'
' :((!olNs4&&cpIsMultiple) ? ' style="'+setCellPadStr(o3_cellpad)+'">' : '>'))+(o3_textfontclass ? '' : wrapStr(0,o3_textsize,'text'))+text+(o3_textfontclass ? '' : wrapStr(1,o3_textsize)) + '
'; - - set_background(""); - return txt; -} - -// Sets the background picture,padding and lots more. :) -function ol_content_background(text,picture,hasfullhtml) { - if (hasfullhtml) { - txt=text; - } else { - txt='
'+(o3_textfontclass ? '' : wrapStr(0,o3_textsize,'text'))+text+(o3_textfontclass ? '' : wrapStr(1,o3_textsize))+'
'; - } - - set_background(picture); - return txt; -} - -// Loads a picture into the div. -function set_background(pic) { - if (pic == "") { - if (olNs4) { - over.background.src = null; - } else if (over.style) { - over.style.backgroundImage = "none"; - } - } else { - if (olNs4) { - over.background.src = pic; - } else if (over.style) { - over.style.width=o3_width + 'px'; - over.style.backgroundImage = "url("+pic+")"; - } - } -} - -//////// -// HANDLING FUNCTIONS -//////// -var olShowId=-1; - -// Displays the popup -function disp(statustext) { - runHook("disp", FBEFORE); - - if (o3_allowmove == 0) { - runHook("placeLayer", FREPLACE); - (olNs6&&olShowId<0) ? olShowId=setTimeout("runHook('showObject', FREPLACE, over)", 1) : runHook("showObject", FREPLACE, over); - o3_allowmove = (o3_sticky || o3_followmouse==0) ? 0 : 1; - } - - runHook("disp", FAFTER); - - if (statustext != "") self.status = statustext; -} - -// Creates the actual popup structure -function createPopup(lyrContent){ - runHook("createPopup", FBEFORE); - - if (o3_wrap) { - var wd,ww,theObj = (olNs4 ? over : over.style); - theObj.top = theObj.left = ((olIe4&&!olOp) ? 0 : -10000) + (!olNs4 ? 'px' : 0); - layerWrite(lyrContent); - wd = (olNs4 ? over.clip.width : over.offsetWidth); - if (wd > (ww=windowWidth())) { - lyrContent=lyrContent.replace(/\ /g, ' '); - o3_width=ww; - o3_wrap=0; - } - } - - layerWrite(lyrContent); - - // Have to set o3_width for placeLayer() routine if o3_wrap is turned on - if (o3_wrap) o3_width=(olNs4 ? over.clip.width : over.offsetWidth); - - runHook("createPopup", FAFTER, lyrContent); - - return true; -} - -// Decides where we want the popup. -function placeLayer() { - var placeX, placeY, widthFix = 0; - - // HORIZONTAL PLACEMENT, re-arranged to work in Safari - if (o3_frame.innerWidth) widthFix=18; - iwidth = windowWidth(); - - // Horizontal scroll offset - winoffset=(olIe4) ? eval('o3_frame.'+docRoot+'.scrollLeft') : o3_frame.pageXOffset; - - placeX = runHook('horizontalPlacement',FCHAIN,iwidth,winoffset,widthFix); - - // VERTICAL PLACEMENT, re-arranged to work in Safari - if (o3_frame.innerHeight) { - iheight=o3_frame.innerHeight; - } else if (eval('o3_frame.'+docRoot)&&eval("typeof o3_frame."+docRoot+".clientHeight=='number'")&&eval('o3_frame.'+docRoot+'.clientHeight')) { - iheight=eval('o3_frame.'+docRoot+'.clientHeight'); - } - - // Vertical scroll offset - scrolloffset=(olIe4) ? eval('o3_frame.'+docRoot+'.scrollTop') : o3_frame.pageYOffset; - placeY = runHook('verticalPlacement',FCHAIN,iheight,scrolloffset); - - // Actually move the object. - repositionTo(over, placeX, placeY); -} - -// Moves the layer -function olMouseMove(e) { - var e = (e) ? e : event; - - if (e.pageX) { - o3_x = e.pageX; - o3_y = e.pageY; - } else if (e.clientX) { - o3_x = eval('e.clientX+o3_frame.'+docRoot+'.scrollLeft'); - o3_y = eval('e.clientY+o3_frame.'+docRoot+'.scrollTop'); - } - - if (o3_allowmove == 1) runHook("placeLayer", FREPLACE); - - // MouseOut handler - if (hoveringSwitch && !olNs4 && runHook("cursorOff", FREPLACE)) { - (olHideDelay ? hideDelay(olHideDelay) : cClick()); - hoveringSwitch = !hoveringSwitch; - } -} - -// Fake function for 3.0 users. -function no_overlib() { return ver3fix; } - -// Capture the mouse and chain other scripts. -function olMouseCapture() { - capExtent = document; - var fN, str = '', l, k, f, wMv, sS, mseHandler = olMouseMove; - var re = /function[ ]*(\w*)\(/; - - wMv = (!olIe4 && window.onmousemove); - if (document.onmousemove || wMv) { - if (wMv) capExtent = window; - f = capExtent.onmousemove.toString(); - fN = f.match(re); - if (fN == null) { - str = f+'(e); '; - } else if (fN[1] == 'anonymous' || fN[1] == 'olMouseMove' || (wMv && fN[1] == 'onmousemove')) { - if (!olOp && wMv) { - l = f.indexOf('{')+1; - k = f.lastIndexOf('}'); - sS = f.substring(l,k); - if ((l = sS.indexOf('(')) != -1) { - sS = sS.substring(0,l).replace(/^\s+/,'').replace(/\s+$/,''); - if (eval("typeof " + sS + " == 'undefined'")) window.onmousemove = null; - else str = sS + '(e);'; - } - } - if (!str) { - olCheckMouseCapture = false; - return; - } - } else { - if (fN[1]) str = fN[1]+'(e); '; - else { - l = f.indexOf('{')+1; - k = f.lastIndexOf('}'); - str = f.substring(l,k) + '\n'; - } - } - str += 'olMouseMove(e); '; - mseHandler = new Function('e', str); - } - - capExtent.onmousemove = mseHandler; - if (olNs4) capExtent.captureEvents(Event.MOUSEMOVE); -} - -//////// -// PARSING FUNCTIONS -//////// - -// Does the actual command parsing. -function parseTokens(pf, ar) { - // What the next argument is expected to be. - var v, i, mode=-1, par = (pf != 'ol_'); - var fnMark = (par && !ar.length ? 1 : 0); - - for (i = 0; i < ar.length; i++) { - if (mode < 0) { - // Arg is maintext,unless its a number between pmStart and pmUpper - // then its a command. - if (typeof ar[i] == 'number' && ar[i] > pmStart && ar[i] < pmUpper) { - fnMark = (par ? 1 : 0); - i--; // backup one so that the next block can parse it - } else { - switch(pf) { - case 'ol_': - ol_text = ar[i].toString(); - break; - default: - o3_text=ar[i].toString(); - } - } - mode = 0; - } else { - // Note: NS4 doesn't like switch cases with vars. - if (ar[i] >= pmCount || ar[i]==DONOTHING) { continue; } - if (ar[i]==INARRAY) { fnMark = 0; eval(pf+'text=ol_texts['+ar[++i]+'].toString()'); continue; } - if (ar[i]==CAPARRAY) { eval(pf+'cap=ol_caps['+ar[++i]+'].toString()'); continue; } - if (ar[i]==STICKY) { if (pf!='ol_') eval(pf+'sticky=1'); continue; } - if (ar[i]==BACKGROUND) { eval(pf+'background="'+ar[++i]+'"'); continue; } - if (ar[i]==NOCLOSE) { if (pf!='ol_') opt_NOCLOSE(); continue; } - if (ar[i]==CAPTION) { eval(pf+"cap='"+escSglQuote(ar[++i])+"'"); continue; } - if (ar[i]==CENTER || ar[i]==LEFT || ar[i]==RIGHT) { eval(pf+'hpos='+ar[i]); if(pf!='ol_') olHautoFlag=1; continue; } - if (ar[i]==OFFSETX) { eval(pf+'offsetx='+ar[++i]); continue; } - if (ar[i]==OFFSETY) { eval(pf+'offsety='+ar[++i]); continue; } - if (ar[i]==FGCOLOR) { eval(pf+'fgcolor="'+ar[++i]+'"'); continue; } - if (ar[i]==BGCOLOR) { eval(pf+'bgcolor="'+ar[++i]+'"'); continue; } - if (ar[i]==TEXTCOLOR) { eval(pf+'textcolor="'+ar[++i]+'"'); continue; } - if (ar[i]==CAPCOLOR) { eval(pf+'capcolor="'+ar[++i]+'"'); continue; } - if (ar[i]==CLOSECOLOR) { eval(pf+'closecolor="'+ar[++i]+'"'); continue; } - if (ar[i]==WIDTH) { eval(pf+'width='+ar[++i]); continue; } - if (ar[i]==BORDER) { eval(pf+'border='+ar[++i]); continue; } - if (ar[i]==CELLPAD) { i=opt_MULTIPLEARGS(++i,ar,(pf+'cellpad')); continue; } - if (ar[i]==STATUS) { eval(pf+"status='"+escSglQuote(ar[++i])+"'"); continue; } - if (ar[i]==AUTOSTATUS) { eval(pf +'autostatus=('+pf+'autostatus == 1) ? 0 : 1'); continue; } - if (ar[i]==AUTOSTATUSCAP) { eval(pf +'autostatus=('+pf+'autostatus == 2) ? 0 : 2'); continue; } - if (ar[i]==HEIGHT) { eval(pf+'height='+pf+'aboveheight='+ar[++i]); continue; } // Same param again. - if (ar[i]==CLOSETEXT) { eval(pf+"close='"+escSglQuote(ar[++i])+"'"); continue; } - if (ar[i]==SNAPX) { eval(pf+'snapx='+ar[++i]); continue; } - if (ar[i]==SNAPY) { eval(pf+'snapy='+ar[++i]); continue; } - if (ar[i]==FIXX) { eval(pf+'fixx='+ar[++i]); continue; } - if (ar[i]==FIXY) { eval(pf+'fixy='+ar[++i]); continue; } - if (ar[i]==RELX) { eval(pf+'relx='+ar[++i]); continue; } - if (ar[i]==RELY) { eval(pf+'rely='+ar[++i]); continue; } - if (ar[i]==FGBACKGROUND) { eval(pf+'fgbackground="'+ar[++i]+'"'); continue; } - if (ar[i]==BGBACKGROUND) { eval(pf+'bgbackground="'+ar[++i]+'"'); continue; } - if (ar[i]==PADX) { eval(pf+'padxl='+ar[++i]); eval(pf+'padxr='+ar[++i]); continue; } - if (ar[i]==PADY) { eval(pf+'padyt='+ar[++i]); eval(pf+'padyb='+ar[++i]); continue; } - if (ar[i]==FULLHTML) { if (pf!='ol_') eval(pf+'fullhtml=1'); continue; } - if (ar[i]==BELOW || ar[i]==ABOVE) { eval(pf+'vpos='+ar[i]); if (pf!='ol_') olVautoFlag=1; continue; } - if (ar[i]==CAPICON) { eval(pf+'capicon="'+ar[++i]+'"'); continue; } - if (ar[i]==TEXTFONT) { eval(pf+"textfont='"+escSglQuote(ar[++i])+"'"); continue; } - if (ar[i]==CAPTIONFONT) { eval(pf+"captionfont='"+escSglQuote(ar[++i])+"'"); continue; } - if (ar[i]==CLOSEFONT) { eval(pf+"closefont='"+escSglQuote(ar[++i])+"'"); continue; } - if (ar[i]==TEXTSIZE) { eval(pf+'textsize="'+ar[++i]+'"'); continue; } - if (ar[i]==CAPTIONSIZE) { eval(pf+'captionsize="'+ar[++i]+'"'); continue; } - if (ar[i]==CLOSESIZE) { eval(pf+'closesize="'+ar[++i]+'"'); continue; } - if (ar[i]==TIMEOUT) { eval(pf+'timeout='+ar[++i]); continue; } - if (ar[i]==FUNCTION) { if (pf=='ol_') { if (typeof ar[i+1]!='number') { v=ar[++i]; ol_function=(typeof v=='function' ? v : null); }} else {fnMark = 0; v = null; if (typeof ar[i+1]!='number') v = ar[++i]; opt_FUNCTION(v); } continue; } - if (ar[i]==DELAY) { eval(pf+'delay='+ar[++i]); continue; } - if (ar[i]==HAUTO) { eval(pf+'hauto=('+pf+'hauto == 0) ? 1 : 0'); continue; } - if (ar[i]==VAUTO) { eval(pf+'vauto=('+pf+'vauto == 0) ? 1 : 0'); continue; } - if (ar[i]==CLOSECLICK) { eval(pf +'closeclick=('+pf+'closeclick == 0) ? 1 : 0'); continue; } - if (ar[i]==WRAP) { eval(pf +'wrap=('+pf+'wrap == 0) ? 1 : 0'); continue; } - if (ar[i]==FOLLOWMOUSE) { eval(pf +'followmouse=('+pf+'followmouse == 1) ? 0 : 1'); continue; } - if (ar[i]==MOUSEOFF) { eval(pf +'mouseoff=('+pf+'mouseoff==0) ? 1 : 0'); v=ar[i+1]; if (pf != 'ol_' && eval(pf+'mouseoff') && typeof v == 'number' && (v < pmStart || v > pmUpper)) olHideDelay=ar[++i]; continue; } - if (ar[i]==CLOSETITLE) { eval(pf+"closetitle='"+escSglQuote(ar[++i])+"'"); continue; } - if (ar[i]==CSSOFF||ar[i]==CSSCLASS) { eval(pf+'css='+ar[i]); continue; } - if (ar[i]==COMPATMODE) { eval(pf+'compatmode=('+pf+'compatmode==0) ? 1 : 0'); continue; } - if (ar[i]==FGCLASS) { eval(pf+'fgclass="'+ar[++i]+'"'); continue; } - if (ar[i]==BGCLASS) { eval(pf+'bgclass="'+ar[++i]+'"'); continue; } - if (ar[i]==TEXTFONTCLASS) { eval(pf+'textfontclass="'+ar[++i]+'"'); continue; } - if (ar[i]==CAPTIONFONTCLASS) { eval(pf+'captionfontclass="'+ar[++i]+'"'); continue; } - if (ar[i]==CLOSEFONTCLASS) { eval(pf+'closefontclass="'+ar[++i]+'"'); continue; } - i = parseCmdLine(pf, i, ar); - } - } - - if (fnMark && o3_function) o3_text = o3_function(); - - if ((pf == 'o3_') && o3_wrap) { - o3_width = 0; - - var tReg=/<.*\n*>/ig; - if (!tReg.test(o3_text)) o3_text = o3_text.replace(/[ ]+/g, ' '); - if (!tReg.test(o3_cap))o3_cap = o3_cap.replace(/[ ]+/g, ' '); - } - if ((pf == 'o3_') && o3_sticky) { - if (!o3_close && (o3_frame != ol_frame)) o3_close = ol_close; - if (o3_mouseoff && (o3_frame == ol_frame)) opt_NOCLOSE(' '); - } -} - - -//////// -// LAYER FUNCTIONS -//////// - -// Writes to a layer -function layerWrite(txt) { - txt += "\n"; - if (olNs4) { - var lyr = o3_frame.document.layers['overDiv'].document - lyr.write(txt) - lyr.close() - } else if (typeof over.innerHTML != 'undefined') { - if (olIe5 && isMac) over.innerHTML = ''; - over.innerHTML = txt; - } else { - range = o3_frame.document.createRange(); - range.setStartAfter(over); - domfrag = range.createContextualFragment(txt); - - while (over.hasChildNodes()) { - over.removeChild(over.lastChild); - } - - over.appendChild(domfrag); - } -} - -// Make an object visible -function showObject(obj) { - runHook("showObject", FBEFORE); - - var theObj=(olNs4 ? obj : obj.style); - theObj.visibility = 'visible'; - - runHook("showObject", FAFTER); -} - -// Hides an object -function hideObject(obj) { - runHook("hideObject", FBEFORE); - - var theObj=(olNs4 ? obj : obj.style); - if (olNs6 && olShowId>0) { clearTimeout(olShowId); olShowId=0; } - theObj.visibility = 'hidden'; - theObj.top = theObj.left = ((olIe4&&!olOp) ? 0 : -10000) + (!olNs4 ? 'px' : 0); - - if (o3_timerid > 0) clearTimeout(o3_timerid); - if (o3_delayid > 0) clearTimeout(o3_delayid); - - o3_timerid = 0; - o3_delayid = 0; - self.status = ""; - - if (obj.onmouseout||obj.onmouseover) { - if (olNs4) obj.releaseEvents(Event.MOUSEOUT || Event.MOUSEOVER); - obj.onmouseout = obj.onmouseover = null; - } - - runHook("hideObject", FAFTER); -} - -// Move a layer -function repositionTo(obj, xL, yL) { - var theObj=(olNs4 ? obj : obj.style); - theObj.left = xL + (!olNs4 ? 'px' : 0); - theObj.top = yL + (!olNs4 ? 'px' : 0); -} - -// Check position of cursor relative to overDiv DIVision; mouseOut function -function cursorOff() { - var left = parseInt(over.style.left); - var top = parseInt(over.style.top); - var right = left + (over.offsetWidth >= parseInt(o3_width) ? over.offsetWidth : parseInt(o3_width)); - var bottom = top + (over.offsetHeight >= o3_aboveheight ? over.offsetHeight : o3_aboveheight); - - if (o3_x < left || o3_x > right || o3_y < top || o3_y > bottom) return true; - - return false; -} - - -//////// -// COMMAND FUNCTIONS -//////// - -// Calls callme or the default function. -function opt_FUNCTION(callme) { - o3_text = (callme ? (typeof callme=='string' ? (/.+\(.*\)/.test(callme) ? eval(callme) : callme) : callme()) : (o3_function ? o3_function() : 'No Function')); - - return 0; -} - -// Handle hovering -function opt_NOCLOSE(unused) { - if (!unused) o3_close = ""; - - if (olNs4) { - over.captureEvents(Event.MOUSEOUT || Event.MOUSEOVER); - over.onmouseover = function () { if (o3_timerid > 0) { clearTimeout(o3_timerid); o3_timerid = 0; } } - over.onmouseout = function (e) { if (olHideDelay) hideDelay(olHideDelay); else cClick(e); } - } else { - over.onmouseover = function () {hoveringSwitch = true; if (o3_timerid > 0) { clearTimeout(o3_timerid); o3_timerid =0; } } - } - - return 0; -} - -// Function to scan command line arguments for multiples -function opt_MULTIPLEARGS(i, args, parameter) { - var k=i, re, pV, str=''; - - for(k=i; kpmStart) break; - str += args[k] + ','; - } - if (str) str = str.substring(0,--str.length); - - k--; // reduce by one so the for loop this is in works correctly - pV=(olNs4 && /cellpad/i.test(parameter)) ? str.split(',')[0] : str; - eval(parameter + '="' + pV + '"'); - - return k; -} - -// Remove   in texts when done. -function nbspCleanup() { - if (o3_wrap) { - o3_text = o3_text.replace(/\ /g, ' '); - o3_cap = o3_cap.replace(/\ /g, ' '); - } -} - -// Escape embedded single quotes in text strings -function escSglQuote(str) { - return str.toString().replace(/'/g,"\\'"); -} - -// Onload handler for window onload event -function OLonLoad_handler(e) { - var re = /\w+\(.*\)[;\s]+/g, olre = /overlib\(|nd\(|cClick\(/, fn, l, i; - - if(!olLoaded) olLoaded=1; - - // Remove it for Gecko based browsers - if(window.removeEventListener && e.eventPhase == 3) window.removeEventListener("load",OLonLoad_handler,false); - else if(window.detachEvent) { // and for IE and Opera 4.x but execute calls to overlib, nd, or cClick() - window.detachEvent("onload",OLonLoad_handler); - var fN = document.body.getAttribute('onload'); - if (fN) { - fN=fN.toString().match(re); - if (fN && fN.length) { - for (i=0; i' : '') : ''; - else { - fontStr='o3_'+whichString+'font'; - fontColor='o3_'+((whichString=='caption')? 'cap' : whichString)+'color'; - return (hasDims&&!olNs4) ? (isClose ? '' : '
') : ''; - } -} - -// Quotes Multi word font names; needed for CSS Standards adherence in font-family -function quoteMultiNameFonts(theFont) { - var v, pM=theFont.split(','); - for (var i=0; i 0) clearTimeout(o3_timerid); - - o3_timerid=setTimeout("cClick()",(o3_timeout=time)); - } -} - -// Was originally in the placeLayer() routine; separated out for future ease -function horizontalPlacement(browserWidth, horizontalScrollAmount, widthFix) { - var placeX, iwidth=browserWidth, winoffset=horizontalScrollAmount; - var parsedWidth = parseInt(o3_width); - - if (o3_fixx > -1 || o3_relx != null) { - // Fixed position - placeX=(o3_relx != null ? ( o3_relx < 0 ? winoffset +o3_relx+ iwidth - parsedWidth - widthFix : winoffset+o3_relx) : o3_fixx); - } else { - // If HAUTO, decide what to use. - if (o3_hauto == 1) { - if ((o3_x - winoffset) > (iwidth / 2)) { - o3_hpos = LEFT; - } else { - o3_hpos = RIGHT; - } - } - - // From mouse - if (o3_hpos == CENTER) { // Center - placeX = o3_x+o3_offsetx-(parsedWidth/2); - - if (placeX < winoffset) placeX = winoffset; - } - - if (o3_hpos == RIGHT) { // Right - placeX = o3_x+o3_offsetx; - - if ((placeX+parsedWidth) > (winoffset+iwidth - widthFix)) { - placeX = iwidth+winoffset - parsedWidth - widthFix; - if (placeX < 0) placeX = 0; - } - } - if (o3_hpos == LEFT) { // Left - placeX = o3_x-o3_offsetx-parsedWidth; - if (placeX < winoffset) placeX = winoffset; - } - - // Snapping! - if (o3_snapx > 1) { - var snapping = placeX % o3_snapx; - - if (o3_hpos == LEFT) { - placeX = placeX - (o3_snapx+snapping); - } else { - // CENTER and RIGHT - placeX = placeX+(o3_snapx - snapping); - } - - if (placeX < winoffset) placeX = winoffset; - } - } - - return placeX; -} - -// was originally in the placeLayer() routine; separated out for future ease -function verticalPlacement(browserHeight,verticalScrollAmount) { - var placeY, iheight=browserHeight, scrolloffset=verticalScrollAmount; - var parsedHeight=(o3_aboveheight ? parseInt(o3_aboveheight) : (olNs4 ? over.clip.height : over.offsetHeight)); - - if (o3_fixy > -1 || o3_rely != null) { - // Fixed position - placeY=(o3_rely != null ? (o3_rely < 0 ? scrolloffset+o3_rely+iheight - parsedHeight : scrolloffset+o3_rely) : o3_fixy); - } else { - // If VAUTO, decide what to use. - if (o3_vauto == 1) { - if ((o3_y - scrolloffset) > (iheight / 2) && o3_vpos == BELOW && (o3_y + parsedHeight + o3_offsety - (scrolloffset + iheight) > 0)) { - o3_vpos = ABOVE; - } else if (o3_vpos == ABOVE && (o3_y - (parsedHeight + o3_offsety) - scrolloffset < 0)) { - o3_vpos = BELOW; - } - } - - // From mouse - if (o3_vpos == ABOVE) { - if (o3_aboveheight == 0) o3_aboveheight = parsedHeight; - - placeY = o3_y - (o3_aboveheight+o3_offsety); - if (placeY < scrolloffset) placeY = scrolloffset; - } else { - // BELOW - placeY = o3_y+o3_offsety; - } - - // Snapping! - if (o3_snapy > 1) { - var snapping = placeY % o3_snapy; - - if (o3_aboveheight > 0 && o3_vpos == ABOVE) { - placeY = placeY - (o3_snapy+snapping); - } else { - placeY = placeY+(o3_snapy - snapping); - } - - if (placeY < scrolloffset) placeY = scrolloffset; - } - } - - return placeY; -} - -// checks positioning flags -function checkPositionFlags() { - if (olHautoFlag) olHautoFlag = o3_hauto=0; - if (olVautoFlag) olVautoFlag = o3_vauto=0; - return true; -} - -// get Browser window width -function windowWidth() { - var w; - if (o3_frame.innerWidth) w=o3_frame.innerWidth; - else if (eval('o3_frame.'+docRoot)&&eval("typeof o3_frame."+docRoot+".clientWidth=='number'")&&eval('o3_frame.'+docRoot+'.clientWidth')) - w=eval('o3_frame.'+docRoot+'.clientWidth'); - return w; -} - -// create the div container for popup content if it doesn't exist -function createDivContainer(id,frm,zValue) { - id = (id || 'overDiv'), frm = (frm || o3_frame), zValue = (zValue || 1000); - var objRef, divContainer = layerReference(id); - - if (divContainer == null) { - if (olNs4) { - divContainer = frm.document.layers[id] = new Layer(window.innerWidth, frm); - objRef = divContainer; - } else { - var body = (olIe4 ? frm.document.all.tags('BODY')[0] : frm.document.getElementsByTagName("BODY")[0]); - if (olIe4&&!document.getElementById) { - body.insertAdjacentHTML("beforeEnd",'
'); - divContainer=layerReference(id); - } else { - divContainer = frm.document.createElement("DIV"); - divContainer.id = id; - body.appendChild(divContainer); - } - objRef = divContainer.style; - } - - objRef.position = 'absolute'; - objRef.visibility = 'hidden'; - objRef.zIndex = zValue; - if (olIe4&&!olOp) objRef.left = objRef.top = '0px'; - else objRef.left = objRef.top = -10000 + (!olNs4 ? 'px' : 0); - } - - return divContainer; -} - -// get reference to a layer with ID=id -function layerReference(id) { - return (olNs4 ? o3_frame.document.layers[id] : (document.all ? o3_frame.document.all[id] : o3_frame.document.getElementById(id))); -} -//////// -// UTILITY FUNCTIONS -//////// - -// Checks if something is a function. -function isFunction(fnRef) { - var rtn = true; - - if (typeof fnRef == 'object') { - for (var i = 0; i < fnRef.length; i++) { - if (typeof fnRef[i]=='function') continue; - rtn = false; - break; - } - } else if (typeof fnRef != 'function') { - rtn = false; - } - - return rtn; -} - -// Converts an array into an argument string for use in eval. -function argToString(array, strtInd, argName) { - var jS = strtInd, aS = '', ar = array; - argName=(argName ? argName : 'ar'); - - if (ar.length > jS) { - for (var k = jS; k < ar.length; k++) aS += argName+'['+k+'], '; - aS = aS.substring(0, aS.length-2); - } - - return aS; -} - -// Places a hook in the correct position in a hook point. -function reOrder(hookPt, fnRef, order) { - var newPt = new Array(), match, i, j; - - if (!order || typeof order == 'undefined' || typeof order == 'number') return hookPt; - - if (typeof order=='function') { - if (typeof fnRef=='object') { - newPt = newPt.concat(fnRef); - } else { - newPt[newPt.length++]=fnRef; - } - - for (i = 0; i < hookPt.length; i++) { - match = false; - if (typeof fnRef == 'function' && hookPt[i] == fnRef) { - continue; - } else { - for(j = 0; j < fnRef.length; j++) if (hookPt[i] == fnRef[j]) { - match = true; - break; - } - } - if (!match) newPt[newPt.length++] = hookPt[i]; - } - - newPt[newPt.length++] = order; - - } else if (typeof order == 'object') { - if (typeof fnRef == 'object') { - newPt = newPt.concat(fnRef); - } else { - newPt[newPt.length++] = fnRef; - } - - for (j = 0; j < hookPt.length; j++) { - match = false; - if (typeof fnRef == 'function' && hookPt[j] == fnRef) { - continue; - } else { - for (i = 0; i < fnRef.length; i++) if (hookPt[j] == fnRef[i]) { - match = true; - break; - } - } - if (!match) newPt[newPt.length++]=hookPt[j]; - } - - for (i = 0; i < newPt.length; i++) hookPt[i] = newPt[i]; - newPt.length = 0; - - for (j = 0; j < hookPt.length; j++) { - match = false; - for (i = 0; i < order.length; i++) { - if (hookPt[j] == order[i]) { - match = true; - break; - } - } - if (!match) newPt[newPt.length++] = hookPt[j]; - } - newPt = newPt.concat(order); - } - - hookPt = newPt; - - return hookPt; -} - -//////// -// PLUGIN ACTIVATION FUNCTIONS -//////// - -// Runs plugin functions to set runtime variables. -function setRunTimeVariables(){ - if (typeof runTime != 'undefined' && runTime.length) { - for (var k = 0; k < runTime.length; k++) { - runTime[k](); - } - } -} - -// Runs plugin functions to parse commands. -function parseCmdLine(pf, i, args) { - if (typeof cmdLine != 'undefined' && cmdLine.length) { - for (var k = 0; k < cmdLine.length; k++) { - var j = cmdLine[k](pf, i, args); - if (j >- 1) { - i = j; - break; - } - } - } - - return i; -} - -// Runs plugin functions to do things after parse. -function postParseChecks(pf,args){ - if (typeof postParse != 'undefined' && postParse.length) { - for (var k = 0; k < postParse.length; k++) { - if (postParse[k](pf,args)) continue; - return false; // end now since have an error - } - } - return true; -} - - -//////// -// PLUGIN REGISTRATION FUNCTIONS -//////// - -// Registers commands and creates constants. -function registerCommands(cmdStr) { - if (typeof cmdStr!='string') return; - - var pM = cmdStr.split(','); - pms = pms.concat(pM); - - for (var i = 0; i< pM.length; i++) { - eval(pM[i].toUpperCase()+'='+pmCount++); - } -} - -// Registers no-parameter commands -function registerNoParameterCommands(cmdStr) { - if (!cmdStr && typeof cmdStr != 'string') return; - pmt=(!pmt) ? cmdStr : pmt + ',' + cmdStr; -} - -// Register a function to hook at a certain point. -function registerHook(fnHookTo, fnRef, hookType, optPm) { - var hookPt, last = typeof optPm; - - if (fnHookTo == 'plgIn'||fnHookTo == 'postParse') return; - if (typeof hookPts[fnHookTo] == 'undefined') hookPts[fnHookTo] = new FunctionReference(); - - hookPt = hookPts[fnHookTo]; - - if (hookType != null) { - if (hookType == FREPLACE) { - hookPt.ovload = fnRef; // replace normal overlib routine - if (fnHookTo.indexOf('ol_content_') > -1) hookPt.alt[pms[CSSOFF-1-pmStart]]=fnRef; - - } else if (hookType == FBEFORE || hookType == FAFTER) { - var hookPt=(hookType == 1 ? hookPt.before : hookPt.after); - - if (typeof fnRef == 'object') { - hookPt = hookPt.concat(fnRef); - } else { - hookPt[hookPt.length++] = fnRef; - } - - if (optPm) hookPt = reOrder(hookPt, fnRef, optPm); - - } else if (hookType == FALTERNATE) { - if (last=='number') hookPt.alt[pms[optPm-1-pmStart]] = fnRef; - } else if (hookType == FCHAIN) { - hookPt = hookPt.chain; - if (typeof fnRef=='object') hookPt=hookPt.concat(fnRef); // add other functions - else hookPt[hookPt.length++]=fnRef; - } - - return; - } -} - -// Register a function that will set runtime variables. -function registerRunTimeFunction(fn) { - if (isFunction(fn)) { - if (typeof fn == 'object') { - runTime = runTime.concat(fn); - } else { - runTime[runTime.length++] = fn; - } - } -} - -// Register a function that will handle command parsing. -function registerCmdLineFunction(fn){ - if (isFunction(fn)) { - if (typeof fn == 'object') { - cmdLine = cmdLine.concat(fn); - } else { - cmdLine[cmdLine.length++] = fn; - } - } -} - -// Register a function that does things after command parsing. -function registerPostParseFunction(fn){ - if (isFunction(fn)) { - if (typeof fn == 'object') { - postParse = postParse.concat(fn); - } else { - postParse[postParse.length++] = fn; - } - } -} - -//////// -// PLUGIN REGISTRATION FUNCTIONS -//////// - -// Runs any hooks registered. -function runHook(fnHookTo, hookType) { - var l = hookPts[fnHookTo], k, rtnVal = null, optPm, arS, ar = runHook.arguments; - - if (hookType == FREPLACE) { - arS = argToString(ar, 2); - - if (typeof l == 'undefined' || !(l = l.ovload)) rtnVal = eval(fnHookTo+'('+arS+')'); - else rtnVal = eval('l('+arS+')'); - - } else if (hookType == FBEFORE || hookType == FAFTER) { - if (typeof l != 'undefined') { - l=(hookType == 1 ? l.before : l.after); - - if (l.length) { - arS = argToString(ar, 2); - for (var k = 0; k < l.length; k++) eval('l[k]('+arS+')'); - } - } - } else if (hookType == FALTERNATE) { - optPm = ar[2]; - arS = argToString(ar, 3); - - if (typeof l == 'undefined' || (l = l.alt[pms[optPm-1-pmStart]]) == 'undefined') { - rtnVal = eval(fnHookTo+'('+arS+')'); - } else { - rtnVal = eval('l('+arS+')'); - } - } else if (hookType == FCHAIN) { - arS=argToString(ar,2); - l=l.chain; - - for (k=l.length; k > 0; k--) if((rtnVal=eval('l[k-1]('+arS+')'))!=void(0)) break; - } - - return rtnVal; -} - -//////// -// OBJECT CONSTRUCTORS -//////// - -// Object for handling hooks. -function FunctionReference() { - this.ovload = null; - this.before = new Array(); - this.after = new Array(); - this.alt = new Array(); - this.chain = new Array(); -} - -// Object for simple access to the overLIB version used. -// Examples: simpleversion:351 major:3 minor:5 revision:1 -function Info(version, prerelease) { - this.version = version; - this.prerelease = prerelease; - - this.simpleversion = Math.round(this.version*100); - this.major = parseInt(this.simpleversion / 100); - this.minor = parseInt(this.simpleversion / 10) - this.major * 10; - this.revision = parseInt(this.simpleversion) - this.major * 100 - this.minor * 10; - this.meets = meets; -} - -// checks for Core Version required -function meets(reqdVersion) { - return (!reqdVersion) ? false : this.simpleversion >= Math.round(100*parseFloat(reqdVersion)); -} - - -//////// -// STANDARD REGISTRATIONS -//////// -registerHook("ol_content_simple", ol_content_simple, FALTERNATE, CSSOFF); -registerHook("ol_content_caption", ol_content_caption, FALTERNATE, CSSOFF); -registerHook("ol_content_background", ol_content_background, FALTERNATE, CSSOFF); -registerHook("ol_content_simple", ol_content_simple, FALTERNATE, CSSCLASS); -registerHook("ol_content_caption", ol_content_caption, FALTERNATE, CSSCLASS); -registerHook("ol_content_background", ol_content_background, FALTERNATE, CSSCLASS); -registerPostParseFunction(checkPositionFlags); -registerHook("hideObject", nbspCleanup, FAFTER); -registerHook("horizontalPlacement", horizontalPlacement, FCHAIN); -registerHook("verticalPlacement", verticalPlacement, FCHAIN); -if (olNs4||(olIe5&&isMac)||olKq) olLoaded=1; -registerNoParameterCommands('sticky,autostatus,autostatuscap,fullhtml,hauto,vauto,closeclick,wrap,followmouse,mouseoff,compatmode'); -/////// -// ESTABLISH MOUSECAPTURING -/////// - -// Capture events, alt. diffuses the overlib function. -var olCheckMouseCapture=true; -if ((olNs4 || olNs6 || olIe4)) { - olMouseCapture(); -} else { - overlib = no_overlib; - nd = no_overlib; - ver3fix = true; -} +//\///// +//\ overLIB 4.21 - You may not remove or change this notice. +//\ Copyright Erik Bosrup 1998-2004. All rights reserved. +//\ +//\ Contributors are listed on the homepage. +//\ This file might be old, always check for the latest version at: +//\ http://www.bosrup.com/web/overlib/ +//\ +//\ Please read the license agreement (available through the link above) +//\ before using overLIB. Direct any licensing questions to erik@bosrup.com. +//\ +//\ Do not sell this as your own work or remove this copyright notice. +//\ For full details on copying or changing this script please read the +//\ license agreement at the link above. Please give credit on sites that +//\ use overLIB and submit changes of the script so other people can use +//\ them as well. +// $Revision: 1.1 $ $Date: 2006/05/29 16:38:21 $ +//\///// +//\mini + +//////// +// PRE-INIT +// Ignore these lines, configuration is below. +//////// +var olLoaded = 0;var pmStart = 10000000; var pmUpper = 10001000; var pmCount = pmStart+1; var pmt=''; var pms = new Array(); var olInfo = new Info('4.21', 1); +var FREPLACE = 0; var FBEFORE = 1; var FAFTER = 2; var FALTERNATE = 3; var FCHAIN=4; +var olHideForm=0; // parameter for hiding SELECT and ActiveX elements in IE5.5+ +var olHautoFlag = 0; // flags for over-riding VAUTO and HAUTO if corresponding +var olVautoFlag = 0; // positioning commands are used on the command line +var hookPts = new Array(), postParse = new Array(), cmdLine = new Array(), runTime = new Array(); +// for plugins +registerCommands('donothing,inarray,caparray,sticky,background,noclose,caption,left,right,center,offsetx,offsety,fgcolor,bgcolor,textcolor,capcolor,closecolor,width,border,cellpad,status,autostatus,autostatuscap,height,closetext,snapx,snapy,fixx,fixy,relx,rely,fgbackground,bgbackground,padx,pady,fullhtml,above,below,capicon,textfont,captionfont,closefont,textsize,captionsize,closesize,timeout,function,delay,hauto,vauto,closeclick,wrap,followmouse,mouseoff,closetitle,cssoff,compatmode,cssclass,fgclass,bgclass,textfontclass,captionfontclass,closefontclass'); + +//////// +// DEFAULT CONFIGURATION +// Settings you want everywhere are set here. All of this can also be +// changed on your html page or through an overLIB call. +//////// +if (typeof ol_fgcolor=='undefined') var ol_fgcolor="#99BBDD"; +if (typeof ol_bgcolor=='undefined') var ol_bgcolor="#7799BB"; +if (typeof ol_textcolor=='undefined') var ol_textcolor="#000000"; +if (typeof ol_capcolor=='undefined') var ol_capcolor="#000033"; +if (typeof ol_closecolor=='undefined') var ol_closecolor="#000000"; +if (typeof ol_textfont=='undefined') var ol_textfont="Verdana,Arial,Helvetica"; +if (typeof ol_captionfont=='undefined') var ol_captionfont="Verdana,Arial,Helvetica"; +if (typeof ol_closefont=='undefined') var ol_closefont="Verdana,Arial,Helvetica"; +if (typeof ol_textsize=='undefined') var ol_textsize="1"; +if (typeof ol_captionsize=='undefined') var ol_captionsize="1"; +if (typeof ol_closesize=='undefined') var ol_closesize="1"; +if (typeof ol_width=='undefined') var ol_width="200"; +if (typeof ol_border=='undefined') var ol_border="1"; +if (typeof ol_cellpad=='undefined') var ol_cellpad=2; +if (typeof ol_offsetx=='undefined') var ol_offsetx=10; +if (typeof ol_offsety=='undefined') var ol_offsety=10; +if (typeof ol_text=='undefined') var ol_text="Default Text"; +if (typeof ol_cap=='undefined') var ol_cap=""; +if (typeof ol_sticky=='undefined') var ol_sticky=0; +if (typeof ol_background=='undefined') var ol_background=""; +if (typeof ol_close=='undefined') var ol_close="Close"; +if (typeof ol_hpos=='undefined') var ol_hpos=RIGHT; +if (typeof ol_status=='undefined') var ol_status=""; +if (typeof ol_autostatus=='undefined') var ol_autostatus=0; +if (typeof ol_height=='undefined') var ol_height=-1; +if (typeof ol_snapx=='undefined') var ol_snapx=0; +if (typeof ol_snapy=='undefined') var ol_snapy=0; +if (typeof ol_fixx=='undefined') var ol_fixx=-1; +if (typeof ol_fixy=='undefined') var ol_fixy=-1; +if (typeof ol_relx=='undefined') var ol_relx=null; +if (typeof ol_rely=='undefined') var ol_rely=null; +if (typeof ol_fgbackground=='undefined') var ol_fgbackground=""; +if (typeof ol_bgbackground=='undefined') var ol_bgbackground=""; +if (typeof ol_padxl=='undefined') var ol_padxl=1; +if (typeof ol_padxr=='undefined') var ol_padxr=1; +if (typeof ol_padyt=='undefined') var ol_padyt=1; +if (typeof ol_padyb=='undefined') var ol_padyb=1; +if (typeof ol_fullhtml=='undefined') var ol_fullhtml=0; +if (typeof ol_vpos=='undefined') var ol_vpos=BELOW; +if (typeof ol_aboveheight=='undefined') var ol_aboveheight=0; +if (typeof ol_capicon=='undefined') var ol_capicon=""; +if (typeof ol_frame=='undefined') var ol_frame=self; +if (typeof ol_timeout=='undefined') var ol_timeout=0; +if (typeof ol_function=='undefined') var ol_function=null; +if (typeof ol_delay=='undefined') var ol_delay=0; +if (typeof ol_hauto=='undefined') var ol_hauto=0; +if (typeof ol_vauto=='undefined') var ol_vauto=0; +if (typeof ol_closeclick=='undefined') var ol_closeclick=0; +if (typeof ol_wrap=='undefined') var ol_wrap=0; +if (typeof ol_followmouse=='undefined') var ol_followmouse=1; +if (typeof ol_mouseoff=='undefined') var ol_mouseoff=0; +if (typeof ol_closetitle=='undefined') var ol_closetitle='Close'; +if (typeof ol_compatmode=='undefined') var ol_compatmode=0; +if (typeof ol_css=='undefined') var ol_css=CSSOFF; +if (typeof ol_fgclass=='undefined') var ol_fgclass=""; +if (typeof ol_bgclass=='undefined') var ol_bgclass=""; +if (typeof ol_textfontclass=='undefined') var ol_textfontclass=""; +if (typeof ol_captionfontclass=='undefined') var ol_captionfontclass=""; +if (typeof ol_closefontclass=='undefined') var ol_closefontclass=""; + +//////// +// ARRAY CONFIGURATION +//////// + +// You can use these arrays to store popup text here instead of in the html. +if (typeof ol_texts=='undefined') var ol_texts = new Array("Text 0", "Text 1"); +if (typeof ol_caps=='undefined') var ol_caps = new Array("Caption 0", "Caption 1"); + +//////// +// END OF CONFIGURATION +// Don't change anything below this line, all configuration is above. +//////// + + + + + +//////// +// INIT +//////// +// Runtime variables init. Don't change for config! +var o3_text=""; +var o3_cap=""; +var o3_sticky=0; +var o3_background=""; +var o3_close="Close"; +var o3_hpos=RIGHT; +var o3_offsetx=2; +var o3_offsety=2; +var o3_fgcolor=""; +var o3_bgcolor=""; +var o3_textcolor=""; +var o3_capcolor=""; +var o3_closecolor=""; +var o3_width=100; +var o3_border=1; +var o3_cellpad=2; +var o3_status=""; +var o3_autostatus=0; +var o3_height=-1; +var o3_snapx=0; +var o3_snapy=0; +var o3_fixx=-1; +var o3_fixy=-1; +var o3_relx=null; +var o3_rely=null; +var o3_fgbackground=""; +var o3_bgbackground=""; +var o3_padxl=0; +var o3_padxr=0; +var o3_padyt=0; +var o3_padyb=0; +var o3_fullhtml=0; +var o3_vpos=BELOW; +var o3_aboveheight=0; +var o3_capicon=""; +var o3_textfont="Verdana,Arial,Helvetica"; +var o3_captionfont="Verdana,Arial,Helvetica"; +var o3_closefont="Verdana,Arial,Helvetica"; +var o3_textsize="1"; +var o3_captionsize="1"; +var o3_closesize="1"; +var o3_frame=self; +var o3_timeout=0; +var o3_timerid=0; +var o3_allowmove=0; +var o3_function=null; +var o3_delay=0; +var o3_delayid=0; +var o3_hauto=0; +var o3_vauto=0; +var o3_closeclick=0; +var o3_wrap=0; +var o3_followmouse=1; +var o3_mouseoff=0; +var o3_closetitle=''; +var o3_compatmode=0; +var o3_css=CSSOFF; +var o3_fgclass=""; +var o3_bgclass=""; +var o3_textfontclass=""; +var o3_captionfontclass=""; +var o3_closefontclass=""; + +// Display state variables +var o3_x = 0; +var o3_y = 0; +var o3_showingsticky = 0; +var o3_removecounter = 0; + +// Our layer +var over = null; +var fnRef, hoveringSwitch = false; +var olHideDelay; + +// Decide browser version +var isMac = (navigator.userAgent.indexOf("Mac") != -1); +var olOp = (navigator.userAgent.toLowerCase().indexOf('opera') > -1 && document.createTextNode); // Opera 7 +var olNs4 = (navigator.appName=='Netscape' && parseInt(navigator.appVersion) == 4); +var olNs6 = (document.getElementById) ? true : false; +var olKq = (olNs6 && /konqueror/i.test(navigator.userAgent)); +var olIe4 = (document.all) ? true : false; +var olIe5 = false; +var olIe55 = false; // Added additional variable to identify IE5.5+ +var docRoot = 'document.body'; + +// Resize fix for NS4.x to keep track of layer +if (olNs4) { + var oW = window.innerWidth; + var oH = window.innerHeight; + window.onresize = function() { if (oW != window.innerWidth || oH != window.innerHeight) location.reload(); } +} + +// Microsoft Stupidity Check(tm). +if (olIe4) { + var agent = navigator.userAgent; + if (/MSIE/.test(agent)) { + var versNum = parseFloat(agent.match(/MSIE[ ](\d\.\d+)\.*/i)[1]); + if (versNum >= 5){ + olIe5=true; + olIe55=(versNum>=5.5&&!olOp) ? true : false; + if (olNs6) olNs6=false; + } + } + if (olNs6) olIe4 = false; +} + +// Check for compatability mode. +if (document.compatMode && document.compatMode == 'CSS1Compat') { + docRoot= ((olIe4 && !olOp) ? 'document.documentElement' : docRoot); +} + +// Add window onload handlers to indicate when all modules have been loaded +// For Netscape 6+ and Mozilla, uses addEventListener method on the window object +// For IE it uses the attachEvent method of the window object and for Netscape 4.x +// it sets the window.onload handler to the OLonload_handler function for Bubbling +if(window.addEventListener) window.addEventListener("load",OLonLoad_handler,false); +else if (window.attachEvent) window.attachEvent("onload",OLonLoad_handler); + +var capExtent; + +//////// +// PUBLIC FUNCTIONS +//////// + +// overlib(arg0,...,argN) +// Loads parameters into global runtime variables. +function overlib() { + if (!olLoaded || isExclusive(overlib.arguments)) return true; + if (olCheckMouseCapture) olMouseCapture(); + if (over) { + over = (typeof over.id != 'string') ? o3_frame.document.all['overDiv'] : over; + cClick(); + } + + // Load defaults to runtime. + olHideDelay=0; + o3_text=ol_text; + o3_cap=ol_cap; + o3_sticky=ol_sticky; + o3_background=ol_background; + o3_close=ol_close; + o3_hpos=ol_hpos; + o3_offsetx=ol_offsetx; + o3_offsety=ol_offsety; + o3_fgcolor=ol_fgcolor; + o3_bgcolor=ol_bgcolor; + o3_textcolor=ol_textcolor; + o3_capcolor=ol_capcolor; + o3_closecolor=ol_closecolor; + o3_width=ol_width; + o3_border=ol_border; + o3_cellpad=ol_cellpad; + o3_status=ol_status; + o3_autostatus=ol_autostatus; + o3_height=ol_height; + o3_snapx=ol_snapx; + o3_snapy=ol_snapy; + o3_fixx=ol_fixx; + o3_fixy=ol_fixy; + o3_relx=ol_relx; + o3_rely=ol_rely; + o3_fgbackground=ol_fgbackground; + o3_bgbackground=ol_bgbackground; + o3_padxl=ol_padxl; + o3_padxr=ol_padxr; + o3_padyt=ol_padyt; + o3_padyb=ol_padyb; + o3_fullhtml=ol_fullhtml; + o3_vpos=ol_vpos; + o3_aboveheight=ol_aboveheight; + o3_capicon=ol_capicon; + o3_textfont=ol_textfont; + o3_captionfont=ol_captionfont; + o3_closefont=ol_closefont; + o3_textsize=ol_textsize; + o3_captionsize=ol_captionsize; + o3_closesize=ol_closesize; + o3_timeout=ol_timeout; + o3_function=ol_function; + o3_delay=ol_delay; + o3_hauto=ol_hauto; + o3_vauto=ol_vauto; + o3_closeclick=ol_closeclick; + o3_wrap=ol_wrap; + o3_followmouse=ol_followmouse; + o3_mouseoff=ol_mouseoff; + o3_closetitle=ol_closetitle; + o3_css=ol_css; + o3_compatmode=ol_compatmode; + o3_fgclass=ol_fgclass; + o3_bgclass=ol_bgclass; + o3_textfontclass=ol_textfontclass; + o3_captionfontclass=ol_captionfontclass; + o3_closefontclass=ol_closefontclass; + + setRunTimeVariables(); + + fnRef = ''; + + // Special for frame support, over must be reset... + o3_frame = ol_frame; + + if(!(over=createDivContainer())) return false; + + parseTokens('o3_', overlib.arguments); + if (!postParseChecks()) return false; + + if (o3_delay == 0) { + return runHook("olMain", FREPLACE); + } else { + o3_delayid = setTimeout("runHook('olMain', FREPLACE)", o3_delay); + return false; + } +} + +// Clears popups if appropriate +function nd(time) { + if (olLoaded && !isExclusive()) { + hideDelay(time); // delay popup close if time specified + + if (o3_removecounter >= 1) { o3_showingsticky = 0 }; + + if (o3_showingsticky == 0) { + o3_allowmove = 0; + if (over != null && o3_timerid == 0) runHook("hideObject", FREPLACE, over); + } else { + o3_removecounter++; + } + } + + return true; +} + +// The Close onMouseOver function for stickies +function cClick() { + if (olLoaded) { + runHook("hideObject", FREPLACE, over); + o3_showingsticky = 0; + } + return false; +} + +// Method for setting page specific defaults. +function overlib_pagedefaults() { + parseTokens('ol_', overlib_pagedefaults.arguments); +} + + +//////// +// OVERLIB MAIN FUNCTION +//////// + +// This function decides what it is we want to display and how we want it done. +function olMain() { + var layerhtml, styleType; + runHook("olMain", FBEFORE); + + if (o3_background!="" || o3_fullhtml) { + // Use background instead of box. + layerhtml = runHook('ol_content_background', FALTERNATE, o3_css, o3_text, o3_background, o3_fullhtml); + } else { + // They want a popup box. + styleType = (pms[o3_css-1-pmStart] == "cssoff" || pms[o3_css-1-pmStart] == "cssclass"); + + // Prepare popup background + if (o3_fgbackground != "") o3_fgbackground = "background=\""+o3_fgbackground+"\""; + if (o3_bgbackground != "") o3_bgbackground = (styleType ? "background=\""+o3_bgbackground+"\"" : o3_bgbackground); + + // Prepare popup colors + if (o3_fgcolor != "") o3_fgcolor = (styleType ? "bgcolor=\""+o3_fgcolor+"\"" : o3_fgcolor); + if (o3_bgcolor != "") o3_bgcolor = (styleType ? "bgcolor=\""+o3_bgcolor+"\"" : o3_bgcolor); + + // Prepare popup height + if (o3_height > 0) o3_height = (styleType ? "height=\""+o3_height+"\"" : o3_height); + else o3_height = ""; + + // Decide which kinda box. + if (o3_cap=="") { + // Plain + layerhtml = runHook('ol_content_simple', FALTERNATE, o3_css, o3_text); + } else { + // With caption + if (o3_sticky) { + // Show close text + layerhtml = runHook('ol_content_caption', FALTERNATE, o3_css, o3_text, o3_cap, o3_close); + } else { + // No close text + layerhtml = runHook('ol_content_caption', FALTERNATE, o3_css, o3_text, o3_cap, ""); + } + } + } + + // We want it to stick! + if (o3_sticky) { + if (o3_timerid > 0) { + clearTimeout(o3_timerid); + o3_timerid = 0; + } + o3_showingsticky = 1; + o3_removecounter = 0; + } + + // Created a separate routine to generate the popup to make it easier + // to implement a plugin capability + if (!runHook("createPopup", FREPLACE, layerhtml)) return false; + + // Prepare status bar + if (o3_autostatus > 0) { + o3_status = o3_text; + if (o3_autostatus > 1) o3_status = o3_cap; + } + + // When placing the layer the first time, even stickies may be moved. + o3_allowmove = 0; + + // Initiate a timer for timeout + if (o3_timeout > 0) { + if (o3_timerid > 0) clearTimeout(o3_timerid); + o3_timerid = setTimeout("cClick()", o3_timeout); + } + + // Show layer + runHook("disp", FREPLACE, o3_status); + runHook("olMain", FAFTER); + + return (olOp && event && event.type == 'mouseover' && !o3_status) ? '' : (o3_status != ''); +} + +//////// +// LAYER GENERATION FUNCTIONS +//////// +// These functions just handle popup content with tags that should adhere to the W3C standards specification. + +// Makes simple table without caption +function ol_content_simple(text) { + var cpIsMultiple = /,/.test(o3_cellpad); + var txt = '
' : ((!olNs4&&cpIsMultiple) ? ' style="'+setCellPadStr(o3_cellpad)+'">' : '>'))+(o3_textfontclass ? '' : wrapStr(0,o3_textsize,'text'))+text+(o3_textfontclass ? '' : wrapStr(1,o3_textsize))+'
'; + + set_background(""); + return txt; +} + +// Makes table with caption and optional close link +function ol_content_caption(text,title,close) { + var nameId, txt, cpIsMultiple = /,/.test(o3_cellpad); + var closing, closeevent; + + closing = ""; + closeevent = "onmouseover"; + if (o3_closeclick == 1) closeevent = (o3_closetitle ? "title='" + o3_closetitle +"'" : "") + " onclick"; + if (o3_capicon != "") { + nameId = ' hspace = \"5\"'+' align = \"middle\" alt = \"\"'; + if (typeof o3_dragimg != 'undefined' && o3_dragimg) nameId =' hspace=\"5\"'+' name=\"'+o3_dragimg+'\" id=\"'+o3_dragimg+'\" align=\"middle\" alt=\"Drag Enabled\" title=\"Drag Enabled\"'; + o3_capicon = ''; + } + + if (close != "") + closing = ''+(o3_closefontclass ? '' : wrapStr(0,o3_closesize,'close'))+close+(o3_closefontclass ? '' : wrapStr(1,o3_closesize,'close'))+''; + txt = '
' : '>')+(o3_captionfontclass ? '' : ''+wrapStr(0,o3_captionsize,'caption'))+o3_capicon+title+(o3_captionfontclass ? '' : wrapStr(1,o3_captionsize)+'')+''+closing+'
' :((!olNs4&&cpIsMultiple) ? ' style="'+setCellPadStr(o3_cellpad)+'">' : '>'))+(o3_textfontclass ? '' : wrapStr(0,o3_textsize,'text'))+text+(o3_textfontclass ? '' : wrapStr(1,o3_textsize)) + '
'; + + set_background(""); + return txt; +} + +// Sets the background picture,padding and lots more. :) +function ol_content_background(text,picture,hasfullhtml) { + if (hasfullhtml) { + txt=text; + } else { + txt='
'+(o3_textfontclass ? '' : wrapStr(0,o3_textsize,'text'))+text+(o3_textfontclass ? '' : wrapStr(1,o3_textsize))+'
'; + } + + set_background(picture); + return txt; +} + +// Loads a picture into the div. +function set_background(pic) { + if (pic == "") { + if (olNs4) { + over.background.src = null; + } else if (over.style) { + over.style.backgroundImage = "none"; + } + } else { + if (olNs4) { + over.background.src = pic; + } else if (over.style) { + over.style.width=o3_width + 'px'; + over.style.backgroundImage = "url("+pic+")"; + } + } +} + +//////// +// HANDLING FUNCTIONS +//////// +var olShowId=-1; + +// Displays the popup +function disp(statustext) { + runHook("disp", FBEFORE); + + if (o3_allowmove == 0) { + runHook("placeLayer", FREPLACE); + (olNs6&&olShowId<0) ? olShowId=setTimeout("runHook('showObject', FREPLACE, over)", 1) : runHook("showObject", FREPLACE, over); + o3_allowmove = (o3_sticky || o3_followmouse==0) ? 0 : 1; + } + + runHook("disp", FAFTER); + + if (statustext != "") self.status = statustext; +} + +// Creates the actual popup structure +function createPopup(lyrContent){ + runHook("createPopup", FBEFORE); + + if (o3_wrap) { + var wd,ww,theObj = (olNs4 ? over : over.style); + theObj.top = theObj.left = ((olIe4&&!olOp) ? 0 : -10000) + (!olNs4 ? 'px' : 0); + layerWrite(lyrContent); + wd = (olNs4 ? over.clip.width : over.offsetWidth); + if (wd > (ww=windowWidth())) { + lyrContent=lyrContent.replace(/\ /g, ' '); + o3_width=ww; + o3_wrap=0; + } + } + + layerWrite(lyrContent); + + // Have to set o3_width for placeLayer() routine if o3_wrap is turned on + if (o3_wrap) o3_width=(olNs4 ? over.clip.width : over.offsetWidth); + + runHook("createPopup", FAFTER, lyrContent); + + return true; +} + +// Decides where we want the popup. +function placeLayer() { + var placeX, placeY, widthFix = 0; + + // HORIZONTAL PLACEMENT, re-arranged to work in Safari + if (o3_frame.innerWidth) widthFix=18; + iwidth = windowWidth(); + + // Horizontal scroll offset + winoffset=(olIe4) ? eval('o3_frame.'+docRoot+'.scrollLeft') : o3_frame.pageXOffset; + + placeX = runHook('horizontalPlacement',FCHAIN,iwidth,winoffset,widthFix); + + // VERTICAL PLACEMENT, re-arranged to work in Safari + if (o3_frame.innerHeight) { + iheight=o3_frame.innerHeight; + } else if (eval('o3_frame.'+docRoot)&&eval("typeof o3_frame."+docRoot+".clientHeight=='number'")&&eval('o3_frame.'+docRoot+'.clientHeight')) { + iheight=eval('o3_frame.'+docRoot+'.clientHeight'); + } + + // Vertical scroll offset + scrolloffset=(olIe4) ? eval('o3_frame.'+docRoot+'.scrollTop') : o3_frame.pageYOffset; + placeY = runHook('verticalPlacement',FCHAIN,iheight,scrolloffset); + + // Actually move the object. + repositionTo(over, placeX, placeY); +} + +// Moves the layer +function olMouseMove(e) { + var e = (e) ? e : event; + + if (e.pageX) { + o3_x = e.pageX; + o3_y = e.pageY; + } else if (e.clientX) { + o3_x = eval('e.clientX+o3_frame.'+docRoot+'.scrollLeft'); + o3_y = eval('e.clientY+o3_frame.'+docRoot+'.scrollTop'); + } + + if (o3_allowmove == 1) runHook("placeLayer", FREPLACE); + + // MouseOut handler + if (hoveringSwitch && !olNs4 && runHook("cursorOff", FREPLACE)) { + (olHideDelay ? hideDelay(olHideDelay) : cClick()); + hoveringSwitch = !hoveringSwitch; + } +} + +// Fake function for 3.0 users. +function no_overlib() { return ver3fix; } + +// Capture the mouse and chain other scripts. +function olMouseCapture() { + capExtent = document; + var fN, str = '', l, k, f, wMv, sS, mseHandler = olMouseMove; + var re = /function[ ]*(\w*)\(/; + + wMv = (!olIe4 && window.onmousemove); + if (document.onmousemove || wMv) { + if (wMv) capExtent = window; + f = capExtent.onmousemove.toString(); + fN = f.match(re); + if (fN == null) { + str = f+'(e); '; + } else if (fN[1] == 'anonymous' || fN[1] == 'olMouseMove' || (wMv && fN[1] == 'onmousemove')) { + if (!olOp && wMv) { + l = f.indexOf('{')+1; + k = f.lastIndexOf('}'); + sS = f.substring(l,k); + if ((l = sS.indexOf('(')) != -1) { + sS = sS.substring(0,l).replace(/^\s+/,'').replace(/\s+$/,''); + if (eval("typeof " + sS + " == 'undefined'")) window.onmousemove = null; + else str = sS + '(e);'; + } + } + if (!str) { + olCheckMouseCapture = false; + return; + } + } else { + if (fN[1]) str = fN[1]+'(e); '; + else { + l = f.indexOf('{')+1; + k = f.lastIndexOf('}'); + str = f.substring(l,k) + '\n'; + } + } + str += 'olMouseMove(e); '; + mseHandler = new Function('e', str); + } + + capExtent.onmousemove = mseHandler; + if (olNs4) capExtent.captureEvents(Event.MOUSEMOVE); +} + +//////// +// PARSING FUNCTIONS +//////// + +// Does the actual command parsing. +function parseTokens(pf, ar) { + // What the next argument is expected to be. + var v, i, mode=-1, par = (pf != 'ol_'); + var fnMark = (par && !ar.length ? 1 : 0); + + for (i = 0; i < ar.length; i++) { + if (mode < 0) { + // Arg is maintext,unless its a number between pmStart and pmUpper + // then its a command. + if (typeof ar[i] == 'number' && ar[i] > pmStart && ar[i] < pmUpper) { + fnMark = (par ? 1 : 0); + i--; // backup one so that the next block can parse it + } else { + switch(pf) { + case 'ol_': + ol_text = ar[i].toString(); + break; + default: + o3_text=ar[i].toString(); + } + } + mode = 0; + } else { + // Note: NS4 doesn't like switch cases with vars. + if (ar[i] >= pmCount || ar[i]==DONOTHING) { continue; } + if (ar[i]==INARRAY) { fnMark = 0; eval(pf+'text=ol_texts['+ar[++i]+'].toString()'); continue; } + if (ar[i]==CAPARRAY) { eval(pf+'cap=ol_caps['+ar[++i]+'].toString()'); continue; } + if (ar[i]==STICKY) { if (pf!='ol_') eval(pf+'sticky=1'); continue; } + if (ar[i]==BACKGROUND) { eval(pf+'background="'+ar[++i]+'"'); continue; } + if (ar[i]==NOCLOSE) { if (pf!='ol_') opt_NOCLOSE(); continue; } + if (ar[i]==CAPTION) { eval(pf+"cap='"+escSglQuote(ar[++i])+"'"); continue; } + if (ar[i]==CENTER || ar[i]==LEFT || ar[i]==RIGHT) { eval(pf+'hpos='+ar[i]); if(pf!='ol_') olHautoFlag=1; continue; } + if (ar[i]==OFFSETX) { eval(pf+'offsetx='+ar[++i]); continue; } + if (ar[i]==OFFSETY) { eval(pf+'offsety='+ar[++i]); continue; } + if (ar[i]==FGCOLOR) { eval(pf+'fgcolor="'+ar[++i]+'"'); continue; } + if (ar[i]==BGCOLOR) { eval(pf+'bgcolor="'+ar[++i]+'"'); continue; } + if (ar[i]==TEXTCOLOR) { eval(pf+'textcolor="'+ar[++i]+'"'); continue; } + if (ar[i]==CAPCOLOR) { eval(pf+'capcolor="'+ar[++i]+'"'); continue; } + if (ar[i]==CLOSECOLOR) { eval(pf+'closecolor="'+ar[++i]+'"'); continue; } + if (ar[i]==WIDTH) { eval(pf+'width='+ar[++i]); continue; } + if (ar[i]==BORDER) { eval(pf+'border='+ar[++i]); continue; } + if (ar[i]==CELLPAD) { i=opt_MULTIPLEARGS(++i,ar,(pf+'cellpad')); continue; } + if (ar[i]==STATUS) { eval(pf+"status='"+escSglQuote(ar[++i])+"'"); continue; } + if (ar[i]==AUTOSTATUS) { eval(pf +'autostatus=('+pf+'autostatus == 1) ? 0 : 1'); continue; } + if (ar[i]==AUTOSTATUSCAP) { eval(pf +'autostatus=('+pf+'autostatus == 2) ? 0 : 2'); continue; } + if (ar[i]==HEIGHT) { eval(pf+'height='+pf+'aboveheight='+ar[++i]); continue; } // Same param again. + if (ar[i]==CLOSETEXT) { eval(pf+"close='"+escSglQuote(ar[++i])+"'"); continue; } + if (ar[i]==SNAPX) { eval(pf+'snapx='+ar[++i]); continue; } + if (ar[i]==SNAPY) { eval(pf+'snapy='+ar[++i]); continue; } + if (ar[i]==FIXX) { eval(pf+'fixx='+ar[++i]); continue; } + if (ar[i]==FIXY) { eval(pf+'fixy='+ar[++i]); continue; } + if (ar[i]==RELX) { eval(pf+'relx='+ar[++i]); continue; } + if (ar[i]==RELY) { eval(pf+'rely='+ar[++i]); continue; } + if (ar[i]==FGBACKGROUND) { eval(pf+'fgbackground="'+ar[++i]+'"'); continue; } + if (ar[i]==BGBACKGROUND) { eval(pf+'bgbackground="'+ar[++i]+'"'); continue; } + if (ar[i]==PADX) { eval(pf+'padxl='+ar[++i]); eval(pf+'padxr='+ar[++i]); continue; } + if (ar[i]==PADY) { eval(pf+'padyt='+ar[++i]); eval(pf+'padyb='+ar[++i]); continue; } + if (ar[i]==FULLHTML) { if (pf!='ol_') eval(pf+'fullhtml=1'); continue; } + if (ar[i]==BELOW || ar[i]==ABOVE) { eval(pf+'vpos='+ar[i]); if (pf!='ol_') olVautoFlag=1; continue; } + if (ar[i]==CAPICON) { eval(pf+'capicon="'+ar[++i]+'"'); continue; } + if (ar[i]==TEXTFONT) { eval(pf+"textfont='"+escSglQuote(ar[++i])+"'"); continue; } + if (ar[i]==CAPTIONFONT) { eval(pf+"captionfont='"+escSglQuote(ar[++i])+"'"); continue; } + if (ar[i]==CLOSEFONT) { eval(pf+"closefont='"+escSglQuote(ar[++i])+"'"); continue; } + if (ar[i]==TEXTSIZE) { eval(pf+'textsize="'+ar[++i]+'"'); continue; } + if (ar[i]==CAPTIONSIZE) { eval(pf+'captionsize="'+ar[++i]+'"'); continue; } + if (ar[i]==CLOSESIZE) { eval(pf+'closesize="'+ar[++i]+'"'); continue; } + if (ar[i]==TIMEOUT) { eval(pf+'timeout='+ar[++i]); continue; } + if (ar[i]==FUNCTION) { if (pf=='ol_') { if (typeof ar[i+1]!='number') { v=ar[++i]; ol_function=(typeof v=='function' ? v : null); }} else {fnMark = 0; v = null; if (typeof ar[i+1]!='number') v = ar[++i]; opt_FUNCTION(v); } continue; } + if (ar[i]==DELAY) { eval(pf+'delay='+ar[++i]); continue; } + if (ar[i]==HAUTO) { eval(pf+'hauto=('+pf+'hauto == 0) ? 1 : 0'); continue; } + if (ar[i]==VAUTO) { eval(pf+'vauto=('+pf+'vauto == 0) ? 1 : 0'); continue; } + if (ar[i]==CLOSECLICK) { eval(pf +'closeclick=('+pf+'closeclick == 0) ? 1 : 0'); continue; } + if (ar[i]==WRAP) { eval(pf +'wrap=('+pf+'wrap == 0) ? 1 : 0'); continue; } + if (ar[i]==FOLLOWMOUSE) { eval(pf +'followmouse=('+pf+'followmouse == 1) ? 0 : 1'); continue; } + if (ar[i]==MOUSEOFF) { eval(pf +'mouseoff=('+pf+'mouseoff==0) ? 1 : 0'); v=ar[i+1]; if (pf != 'ol_' && eval(pf+'mouseoff') && typeof v == 'number' && (v < pmStart || v > pmUpper)) olHideDelay=ar[++i]; continue; } + if (ar[i]==CLOSETITLE) { eval(pf+"closetitle='"+escSglQuote(ar[++i])+"'"); continue; } + if (ar[i]==CSSOFF||ar[i]==CSSCLASS) { eval(pf+'css='+ar[i]); continue; } + if (ar[i]==COMPATMODE) { eval(pf+'compatmode=('+pf+'compatmode==0) ? 1 : 0'); continue; } + if (ar[i]==FGCLASS) { eval(pf+'fgclass="'+ar[++i]+'"'); continue; } + if (ar[i]==BGCLASS) { eval(pf+'bgclass="'+ar[++i]+'"'); continue; } + if (ar[i]==TEXTFONTCLASS) { eval(pf+'textfontclass="'+ar[++i]+'"'); continue; } + if (ar[i]==CAPTIONFONTCLASS) { eval(pf+'captionfontclass="'+ar[++i]+'"'); continue; } + if (ar[i]==CLOSEFONTCLASS) { eval(pf+'closefontclass="'+ar[++i]+'"'); continue; } + i = parseCmdLine(pf, i, ar); + } + } + + if (fnMark && o3_function) o3_text = o3_function(); + + if ((pf == 'o3_') && o3_wrap) { + o3_width = 0; + + var tReg=/<.*\n*>/ig; + if (!tReg.test(o3_text)) o3_text = o3_text.replace(/[ ]+/g, ' '); + if (!tReg.test(o3_cap))o3_cap = o3_cap.replace(/[ ]+/g, ' '); + } + if ((pf == 'o3_') && o3_sticky) { + if (!o3_close && (o3_frame != ol_frame)) o3_close = ol_close; + if (o3_mouseoff && (o3_frame == ol_frame)) opt_NOCLOSE(' '); + } +} + + +//////// +// LAYER FUNCTIONS +//////// + +// Writes to a layer +function layerWrite(txt) { + txt += "\n"; + if (olNs4) { + var lyr = o3_frame.document.layers['overDiv'].document + lyr.write(txt) + lyr.close() + } else if (typeof over.innerHTML != 'undefined') { + if (olIe5 && isMac) over.innerHTML = ''; + over.innerHTML = txt; + } else { + range = o3_frame.document.createRange(); + range.setStartAfter(over); + domfrag = range.createContextualFragment(txt); + + while (over.hasChildNodes()) { + over.removeChild(over.lastChild); + } + + over.appendChild(domfrag); + } +} + +// Make an object visible +function showObject(obj) { + runHook("showObject", FBEFORE); + + var theObj=(olNs4 ? obj : obj.style); + theObj.visibility = 'visible'; + + runHook("showObject", FAFTER); +} + +// Hides an object +function hideObject(obj) { + runHook("hideObject", FBEFORE); + + var theObj=(olNs4 ? obj : obj.style); + if (olNs6 && olShowId>0) { clearTimeout(olShowId); olShowId=0; } + theObj.visibility = 'hidden'; + theObj.top = theObj.left = ((olIe4&&!olOp) ? 0 : -10000) + (!olNs4 ? 'px' : 0); + + if (o3_timerid > 0) clearTimeout(o3_timerid); + if (o3_delayid > 0) clearTimeout(o3_delayid); + + o3_timerid = 0; + o3_delayid = 0; + self.status = ""; + + if (obj.onmouseout||obj.onmouseover) { + if (olNs4) obj.releaseEvents(Event.MOUSEOUT || Event.MOUSEOVER); + obj.onmouseout = obj.onmouseover = null; + } + + runHook("hideObject", FAFTER); +} + +// Move a layer +function repositionTo(obj, xL, yL) { + var theObj=(olNs4 ? obj : obj.style); + theObj.left = xL + (!olNs4 ? 'px' : 0); + theObj.top = yL + (!olNs4 ? 'px' : 0); +} + +// Check position of cursor relative to overDiv DIVision; mouseOut function +function cursorOff() { + var left = parseInt(over.style.left); + var top = parseInt(over.style.top); + var right = left + (over.offsetWidth >= parseInt(o3_width) ? over.offsetWidth : parseInt(o3_width)); + var bottom = top + (over.offsetHeight >= o3_aboveheight ? over.offsetHeight : o3_aboveheight); + + if (o3_x < left || o3_x > right || o3_y < top || o3_y > bottom) return true; + + return false; +} + + +//////// +// COMMAND FUNCTIONS +//////// + +// Calls callme or the default function. +function opt_FUNCTION(callme) { + o3_text = (callme ? (typeof callme=='string' ? (/.+\(.*\)/.test(callme) ? eval(callme) : callme) : callme()) : (o3_function ? o3_function() : 'No Function')); + + return 0; +} + +// Handle hovering +function opt_NOCLOSE(unused) { + if (!unused) o3_close = ""; + + if (olNs4) { + over.captureEvents(Event.MOUSEOUT || Event.MOUSEOVER); + over.onmouseover = function () { if (o3_timerid > 0) { clearTimeout(o3_timerid); o3_timerid = 0; } } + over.onmouseout = function (e) { if (olHideDelay) hideDelay(olHideDelay); else cClick(e); } + } else { + over.onmouseover = function () {hoveringSwitch = true; if (o3_timerid > 0) { clearTimeout(o3_timerid); o3_timerid =0; } } + } + + return 0; +} + +// Function to scan command line arguments for multiples +function opt_MULTIPLEARGS(i, args, parameter) { + var k=i, re, pV, str=''; + + for(k=i; kpmStart) break; + str += args[k] + ','; + } + if (str) str = str.substring(0,--str.length); + + k--; // reduce by one so the for loop this is in works correctly + pV=(olNs4 && /cellpad/i.test(parameter)) ? str.split(',')[0] : str; + eval(parameter + '="' + pV + '"'); + + return k; +} + +// Remove   in texts when done. +function nbspCleanup() { + if (o3_wrap) { + o3_text = o3_text.replace(/\ /g, ' '); + o3_cap = o3_cap.replace(/\ /g, ' '); + } +} + +// Escape embedded single quotes in text strings +function escSglQuote(str) { + return str.toString().replace(/'/g,"\\'"); +} + +// Onload handler for window onload event +function OLonLoad_handler(e) { + var re = /\w+\(.*\)[;\s]+/g, olre = /overlib\(|nd\(|cClick\(/, fn, l, i; + + if(!olLoaded) olLoaded=1; + + // Remove it for Gecko based browsers + if(window.removeEventListener && e.eventPhase == 3) window.removeEventListener("load",OLonLoad_handler,false); + else if(window.detachEvent) { // and for IE and Opera 4.x but execute calls to overlib, nd, or cClick() + window.detachEvent("onload",OLonLoad_handler); + var fN = document.body.getAttribute('onload'); + if (fN) { + fN=fN.toString().match(re); + if (fN && fN.length) { + for (i=0; i' : '
') : ''; + else { + fontStr='o3_'+whichString+'font'; + fontColor='o3_'+((whichString=='caption')? 'cap' : whichString)+'color'; + return (hasDims&&!olNs4) ? (isClose ? '' : '
') : ''; + } +} + +// Quotes Multi word font names; needed for CSS Standards adherence in font-family +function quoteMultiNameFonts(theFont) { + var v, pM=theFont.split(','); + for (var i=0; i 0) clearTimeout(o3_timerid); + + o3_timerid=setTimeout("cClick()",(o3_timeout=time)); + } +} + +// Was originally in the placeLayer() routine; separated out for future ease +function horizontalPlacement(browserWidth, horizontalScrollAmount, widthFix) { + var placeX, iwidth=browserWidth, winoffset=horizontalScrollAmount; + var parsedWidth = parseInt(o3_width); + + if (o3_fixx > -1 || o3_relx != null) { + // Fixed position + placeX=(o3_relx != null ? ( o3_relx < 0 ? winoffset +o3_relx+ iwidth - parsedWidth - widthFix : winoffset+o3_relx) : o3_fixx); + } else { + // If HAUTO, decide what to use. + if (o3_hauto == 1) { + if ((o3_x - winoffset) > (iwidth / 2)) { + o3_hpos = LEFT; + } else { + o3_hpos = RIGHT; + } + } + + // From mouse + if (o3_hpos == CENTER) { // Center + placeX = o3_x+o3_offsetx-(parsedWidth/2); + + if (placeX < winoffset) placeX = winoffset; + } + + if (o3_hpos == RIGHT) { // Right + placeX = o3_x+o3_offsetx; + + if ((placeX+parsedWidth) > (winoffset+iwidth - widthFix)) { + placeX = iwidth+winoffset - parsedWidth - widthFix; + if (placeX < 0) placeX = 0; + } + } + if (o3_hpos == LEFT) { // Left + placeX = o3_x-o3_offsetx-parsedWidth; + if (placeX < winoffset) placeX = winoffset; + } + + // Snapping! + if (o3_snapx > 1) { + var snapping = placeX % o3_snapx; + + if (o3_hpos == LEFT) { + placeX = placeX - (o3_snapx+snapping); + } else { + // CENTER and RIGHT + placeX = placeX+(o3_snapx - snapping); + } + + if (placeX < winoffset) placeX = winoffset; + } + } + + return placeX; +} + +// was originally in the placeLayer() routine; separated out for future ease +function verticalPlacement(browserHeight,verticalScrollAmount) { + var placeY, iheight=browserHeight, scrolloffset=verticalScrollAmount; + var parsedHeight=(o3_aboveheight ? parseInt(o3_aboveheight) : (olNs4 ? over.clip.height : over.offsetHeight)); + + if (o3_fixy > -1 || o3_rely != null) { + // Fixed position + placeY=(o3_rely != null ? (o3_rely < 0 ? scrolloffset+o3_rely+iheight - parsedHeight : scrolloffset+o3_rely) : o3_fixy); + } else { + // If VAUTO, decide what to use. + if (o3_vauto == 1) { + if ((o3_y - scrolloffset) > (iheight / 2) && o3_vpos == BELOW && (o3_y + parsedHeight + o3_offsety - (scrolloffset + iheight) > 0)) { + o3_vpos = ABOVE; + } else if (o3_vpos == ABOVE && (o3_y - (parsedHeight + o3_offsety) - scrolloffset < 0)) { + o3_vpos = BELOW; + } + } + + // From mouse + if (o3_vpos == ABOVE) { + if (o3_aboveheight == 0) o3_aboveheight = parsedHeight; + + placeY = o3_y - (o3_aboveheight+o3_offsety); + if (placeY < scrolloffset) placeY = scrolloffset; + } else { + // BELOW + placeY = o3_y+o3_offsety; + } + + // Snapping! + if (o3_snapy > 1) { + var snapping = placeY % o3_snapy; + + if (o3_aboveheight > 0 && o3_vpos == ABOVE) { + placeY = placeY - (o3_snapy+snapping); + } else { + placeY = placeY+(o3_snapy - snapping); + } + + if (placeY < scrolloffset) placeY = scrolloffset; + } + } + + return placeY; +} + +// checks positioning flags +function checkPositionFlags() { + if (olHautoFlag) olHautoFlag = o3_hauto=0; + if (olVautoFlag) olVautoFlag = o3_vauto=0; + return true; +} + +// get Browser window width +function windowWidth() { + var w; + if (o3_frame.innerWidth) w=o3_frame.innerWidth; + else if (eval('o3_frame.'+docRoot)&&eval("typeof o3_frame."+docRoot+".clientWidth=='number'")&&eval('o3_frame.'+docRoot+'.clientWidth')) + w=eval('o3_frame.'+docRoot+'.clientWidth'); + return w; +} + +// create the div container for popup content if it doesn't exist +function createDivContainer(id,frm,zValue) { + id = (id || 'overDiv'), frm = (frm || o3_frame), zValue = (zValue || 1000); + var objRef, divContainer = layerReference(id); + + if (divContainer == null) { + if (olNs4) { + divContainer = frm.document.layers[id] = new Layer(window.innerWidth, frm); + objRef = divContainer; + } else { + var body = (olIe4 ? frm.document.all.tags('BODY')[0] : frm.document.getElementsByTagName("BODY")[0]); + if (olIe4&&!document.getElementById) { + body.insertAdjacentHTML("beforeEnd",'
'); + divContainer=layerReference(id); + } else { + divContainer = frm.document.createElement("DIV"); + divContainer.id = id; + body.appendChild(divContainer); + } + objRef = divContainer.style; + } + + objRef.position = 'absolute'; + objRef.visibility = 'hidden'; + objRef.zIndex = zValue; + if (olIe4&&!olOp) objRef.left = objRef.top = '0px'; + else objRef.left = objRef.top = -10000 + (!olNs4 ? 'px' : 0); + } + + return divContainer; +} + +// get reference to a layer with ID=id +function layerReference(id) { + return (olNs4 ? o3_frame.document.layers[id] : (document.all ? o3_frame.document.all[id] : o3_frame.document.getElementById(id))); +} +//////// +// UTILITY FUNCTIONS +//////// + +// Checks if something is a function. +function isFunction(fnRef) { + var rtn = true; + + if (typeof fnRef == 'object') { + for (var i = 0; i < fnRef.length; i++) { + if (typeof fnRef[i]=='function') continue; + rtn = false; + break; + } + } else if (typeof fnRef != 'function') { + rtn = false; + } + + return rtn; +} + +// Converts an array into an argument string for use in eval. +function argToString(array, strtInd, argName) { + var jS = strtInd, aS = '', ar = array; + argName=(argName ? argName : 'ar'); + + if (ar.length > jS) { + for (var k = jS; k < ar.length; k++) aS += argName+'['+k+'], '; + aS = aS.substring(0, aS.length-2); + } + + return aS; +} + +// Places a hook in the correct position in a hook point. +function reOrder(hookPt, fnRef, order) { + var newPt = new Array(), match, i, j; + + if (!order || typeof order == 'undefined' || typeof order == 'number') return hookPt; + + if (typeof order=='function') { + if (typeof fnRef=='object') { + newPt = newPt.concat(fnRef); + } else { + newPt[newPt.length++]=fnRef; + } + + for (i = 0; i < hookPt.length; i++) { + match = false; + if (typeof fnRef == 'function' && hookPt[i] == fnRef) { + continue; + } else { + for(j = 0; j < fnRef.length; j++) if (hookPt[i] == fnRef[j]) { + match = true; + break; + } + } + if (!match) newPt[newPt.length++] = hookPt[i]; + } + + newPt[newPt.length++] = order; + + } else if (typeof order == 'object') { + if (typeof fnRef == 'object') { + newPt = newPt.concat(fnRef); + } else { + newPt[newPt.length++] = fnRef; + } + + for (j = 0; j < hookPt.length; j++) { + match = false; + if (typeof fnRef == 'function' && hookPt[j] == fnRef) { + continue; + } else { + for (i = 0; i < fnRef.length; i++) if (hookPt[j] == fnRef[i]) { + match = true; + break; + } + } + if (!match) newPt[newPt.length++]=hookPt[j]; + } + + for (i = 0; i < newPt.length; i++) hookPt[i] = newPt[i]; + newPt.length = 0; + + for (j = 0; j < hookPt.length; j++) { + match = false; + for (i = 0; i < order.length; i++) { + if (hookPt[j] == order[i]) { + match = true; + break; + } + } + if (!match) newPt[newPt.length++] = hookPt[j]; + } + newPt = newPt.concat(order); + } + + hookPt = newPt; + + return hookPt; +} + +//////// +// PLUGIN ACTIVATION FUNCTIONS +//////// + +// Runs plugin functions to set runtime variables. +function setRunTimeVariables(){ + if (typeof runTime != 'undefined' && runTime.length) { + for (var k = 0; k < runTime.length; k++) { + runTime[k](); + } + } +} + +// Runs plugin functions to parse commands. +function parseCmdLine(pf, i, args) { + if (typeof cmdLine != 'undefined' && cmdLine.length) { + for (var k = 0; k < cmdLine.length; k++) { + var j = cmdLine[k](pf, i, args); + if (j >- 1) { + i = j; + break; + } + } + } + + return i; +} + +// Runs plugin functions to do things after parse. +function postParseChecks(pf,args){ + if (typeof postParse != 'undefined' && postParse.length) { + for (var k = 0; k < postParse.length; k++) { + if (postParse[k](pf,args)) continue; + return false; // end now since have an error + } + } + return true; +} + + +//////// +// PLUGIN REGISTRATION FUNCTIONS +//////// + +// Registers commands and creates constants. +function registerCommands(cmdStr) { + if (typeof cmdStr!='string') return; + + var pM = cmdStr.split(','); + pms = pms.concat(pM); + + for (var i = 0; i< pM.length; i++) { + eval(pM[i].toUpperCase()+'='+pmCount++); + } +} + +// Registers no-parameter commands +function registerNoParameterCommands(cmdStr) { + if (!cmdStr && typeof cmdStr != 'string') return; + pmt=(!pmt) ? cmdStr : pmt + ',' + cmdStr; +} + +// Register a function to hook at a certain point. +function registerHook(fnHookTo, fnRef, hookType, optPm) { + var hookPt, last = typeof optPm; + + if (fnHookTo == 'plgIn'||fnHookTo == 'postParse') return; + if (typeof hookPts[fnHookTo] == 'undefined') hookPts[fnHookTo] = new FunctionReference(); + + hookPt = hookPts[fnHookTo]; + + if (hookType != null) { + if (hookType == FREPLACE) { + hookPt.ovload = fnRef; // replace normal overlib routine + if (fnHookTo.indexOf('ol_content_') > -1) hookPt.alt[pms[CSSOFF-1-pmStart]]=fnRef; + + } else if (hookType == FBEFORE || hookType == FAFTER) { + var hookPt=(hookType == 1 ? hookPt.before : hookPt.after); + + if (typeof fnRef == 'object') { + hookPt = hookPt.concat(fnRef); + } else { + hookPt[hookPt.length++] = fnRef; + } + + if (optPm) hookPt = reOrder(hookPt, fnRef, optPm); + + } else if (hookType == FALTERNATE) { + if (last=='number') hookPt.alt[pms[optPm-1-pmStart]] = fnRef; + } else if (hookType == FCHAIN) { + hookPt = hookPt.chain; + if (typeof fnRef=='object') hookPt=hookPt.concat(fnRef); // add other functions + else hookPt[hookPt.length++]=fnRef; + } + + return; + } +} + +// Register a function that will set runtime variables. +function registerRunTimeFunction(fn) { + if (isFunction(fn)) { + if (typeof fn == 'object') { + runTime = runTime.concat(fn); + } else { + runTime[runTime.length++] = fn; + } + } +} + +// Register a function that will handle command parsing. +function registerCmdLineFunction(fn){ + if (isFunction(fn)) { + if (typeof fn == 'object') { + cmdLine = cmdLine.concat(fn); + } else { + cmdLine[cmdLine.length++] = fn; + } + } +} + +// Register a function that does things after command parsing. +function registerPostParseFunction(fn){ + if (isFunction(fn)) { + if (typeof fn == 'object') { + postParse = postParse.concat(fn); + } else { + postParse[postParse.length++] = fn; + } + } +} + +//////// +// PLUGIN REGISTRATION FUNCTIONS +//////// + +// Runs any hooks registered. +function runHook(fnHookTo, hookType) { + var l = hookPts[fnHookTo], k, rtnVal = null, optPm, arS, ar = runHook.arguments; + + if (hookType == FREPLACE) { + arS = argToString(ar, 2); + + if (typeof l == 'undefined' || !(l = l.ovload)) rtnVal = eval(fnHookTo+'('+arS+')'); + else rtnVal = eval('l('+arS+')'); + + } else if (hookType == FBEFORE || hookType == FAFTER) { + if (typeof l != 'undefined') { + l=(hookType == 1 ? l.before : l.after); + + if (l.length) { + arS = argToString(ar, 2); + for (var k = 0; k < l.length; k++) eval('l[k]('+arS+')'); + } + } + } else if (hookType == FALTERNATE) { + optPm = ar[2]; + arS = argToString(ar, 3); + + if (typeof l == 'undefined' || (l = l.alt[pms[optPm-1-pmStart]]) == 'undefined') { + rtnVal = eval(fnHookTo+'('+arS+')'); + } else { + rtnVal = eval('l('+arS+')'); + } + } else if (hookType == FCHAIN) { + arS=argToString(ar,2); + l=l.chain; + + for (k=l.length; k > 0; k--) if((rtnVal=eval('l[k-1]('+arS+')'))!=void(0)) break; + } + + return rtnVal; +} + +//////// +// OBJECT CONSTRUCTORS +//////// + +// Object for handling hooks. +function FunctionReference() { + this.ovload = null; + this.before = new Array(); + this.after = new Array(); + this.alt = new Array(); + this.chain = new Array(); +} + +// Object for simple access to the overLIB version used. +// Examples: simpleversion:351 major:3 minor:5 revision:1 +function Info(version, prerelease) { + this.version = version; + this.prerelease = prerelease; + + this.simpleversion = Math.round(this.version*100); + this.major = parseInt(this.simpleversion / 100); + this.minor = parseInt(this.simpleversion / 10) - this.major * 10; + this.revision = parseInt(this.simpleversion) - this.major * 100 - this.minor * 10; + this.meets = meets; +} + +// checks for Core Version required +function meets(reqdVersion) { + return (!reqdVersion) ? false : this.simpleversion >= Math.round(100*parseFloat(reqdVersion)); +} + + +//////// +// STANDARD REGISTRATIONS +//////// +registerHook("ol_content_simple", ol_content_simple, FALTERNATE, CSSOFF); +registerHook("ol_content_caption", ol_content_caption, FALTERNATE, CSSOFF); +registerHook("ol_content_background", ol_content_background, FALTERNATE, CSSOFF); +registerHook("ol_content_simple", ol_content_simple, FALTERNATE, CSSCLASS); +registerHook("ol_content_caption", ol_content_caption, FALTERNATE, CSSCLASS); +registerHook("ol_content_background", ol_content_background, FALTERNATE, CSSCLASS); +registerPostParseFunction(checkPositionFlags); +registerHook("hideObject", nbspCleanup, FAFTER); +registerHook("horizontalPlacement", horizontalPlacement, FCHAIN); +registerHook("verticalPlacement", verticalPlacement, FCHAIN); +if (olNs4||(olIe5&&isMac)||olKq) olLoaded=1; +registerNoParameterCommands('sticky,autostatus,autostatuscap,fullhtml,hauto,vauto,closeclick,wrap,followmouse,mouseoff,compatmode'); +/////// +// ESTABLISH MOUSECAPTURING +/////// + +// Capture events, alt. diffuses the overlib function. +var olCheckMouseCapture=true; +if ((olNs4 || olNs6 || olIe4)) { + olMouseCapture(); +} else { + overlib = no_overlib; + nd = no_overlib; + ver3fix = true; +} diff --git a/web/public_php/admin/overlib/overlib_anchor.js b/web/public_php/admin/overlib/overlib_anchor.js index c97b58c783..2dd75cf90d 100644 --- a/web/public_php/admin/overlib/overlib_anchor.js +++ b/web/public_php/admin/overlib/overlib_anchor.js @@ -1,333 +1,333 @@ -//\///// -//\ overLIB Anchor Plugin -//\ This file requires overLIB 4.10 or later. -//\ -//\ overLIB 4.10 - You may not remove or change this notice. -//\ Copyright Erik Bosrup 1998-2004. All rights reserved. -//\ Contributors are listed on the homepage. -//\ See http://www.bosrup.com/web/overlib/ for details. -// $Revision: 1.1 $ $Date: 2006/05/29 16:38:21 $ -//\///// -//\mini - - -//////// -// PRE-INIT -// Ignore these lines, configuration is below. -//////// -if (typeof olInfo == 'undefined' || typeof olInfo.meets == 'undefined' || !olInfo.meets(4.10)) alert('overLIB 4.10 or later is required for the Anchor Plugin.'); -else { -registerCommands('anchor,anchorx,anchory,noanchorwarn,anchoralign'); - - - -//////// -// DEFAULT CONFIGURATION -// Settings you want everywhere are set here. All of this can also be -// changed on your html page or through an overLIB call. -//////// -if (typeof ol_anchor == 'undefined') var ol_anchor = ''; -if (typeof ol_anchorx == 'undefined') var ol_anchorx = 0; -if (typeof ol_anchory == 'undefined') var ol_anchory = 0; -if (typeof ol_noanchorwarn == 'undefined') var ol_noanchorwarn = 1; -if (typeof ol_anchoralign == 'undefined') var ol_anchoralign = 'UL'; - -//////// -// END OF CONFIGURATION -// Don't change anything below this line, all configuration is above. -//////// - - - - - -//////// -// INIT -//////// -// Runtime variables init. Don't change for config! -var o3_anchor = ""; -var o3_anchorx = 0; -var o3_anchory = 0; -var o3_noanchorwarn = 1; -var o3_anchoralign = 'UL'; -var mrkObj, rmrkPosition; //reference mark object, reference mark position, an array; - - -//////// -// PLUGIN FUNCTIONS -//////// -function setAnchorVariables() { - o3_anchor = ol_anchor; - o3_anchorx = ol_anchorx; - o3_anchory = ol_anchory; - o3_noanchorwarn = ol_noanchorwarn; - o3_anchoralign = ol_anchoralign; - mrkObj = null; // initialize this variable -} - -// Parses Reference Mark commands -function parseAnchorExtras(pf,i,ar) { - var v, k=i; - - if (k < ar.length) { - if (ar[k] == ANCHOR) { eval(pf + "anchor = '" + escSglQuote(ar[++k]) + "'"); return k; } - if (ar[k] == ANCHORX) { eval(pf + 'anchorx = ' + ar[++k]); return k; } - if (ar[k] == ANCHORY) { eval(pf + 'anchory = ' + ar[++k]); return k; } - if (ar[k] == NOANCHORWARN) { eval(pf + 'noanchorwarn = (' + pf + 'noanchorwarn==1) ? 0 : 1'); return k; } - if (ar[k] == ANCHORALIGN) { k = opt_MULTIPLEARGS(++k, ar, (pf + 'anchoralign')); return k; } - } - - return -1; -} - - -/////// -// FUNCTION WHICH CHECKS FOR THE EXISTENCE OF A REFERENCE MARKER -/////// -function checkAnchorObject() { - var w = o3_anchor; - - if (w) { - if (!(mrkObj = getAnchorObjectRef(w))) { - if (o3_noanchorwarn) { - alert('WARNING! Reference mark "' + w + '" not found.'); - return false; - } else w = ''; - } - } - - return true; -} - -/////// -// EXTERNAL SUPPORT FUNCTIONS TO HANDLE ANCHOR PROPERTIES -/////// - -// Horizontal placement routine with anchors -function anchorHorizontal(browserWidth, horizontalScrollAmount, widthFix) { - var hasAnchor = (typeof o3_anchor != 'undefined' && o3_anchor); - if (!hasAnchor) return void(0); - - // set o3_relx for follow scroll if defined - if (typeof o3_followscroll != 'undefined' && o3_followscroll && o3_sticky) o3_relx = rmrkPosition[0]; - - return rmrkPosition[0]; -} - -// Vertical placement routine with anchors -function anchorVertical(browserHeight,verticalScrollAmount) { - var hasAnchor = (typeof o3_anchor != 'undefined' && o3_anchor); - if (!hasAnchor) return void(0); - - // set o3_rely for follow scroll if defined - if (typeof o3_followscroll != 'undefined' && o3_followscroll && o3_sticky) o3_rely = rmrkPosition[1]; - - return rmrkPosition[1]; -} - -// Stub function for the runHook routine -function anchorPreface() { - if (!mrkObj) return; - rmrkPosition = getAnchorLocation(mrkObj); -} - -// Get Reference Mark object -function getAnchorObjectRef(aObj) { - return getRefById(aObj, o3_frame.document) || getRefByName(aObj, o3_frame.document) -} - -// Adapted to overlib from jwin by Jason Anderson -- http://www.jwinlib.com -function getAnchorLocation(objRef){ - var mkObj, of, offsets, mlyr - - mkObj = mlyr = objRef - offsets = [o3_anchorx, o3_anchory] - - if (document.layers){ - if (typeof mlyr.length != 'undefined' && mlyr.length > 1) { - mkObj = mlyr[0] - offsets[0] += mlyr[0].x + mlyr[1].pageX - offsets[1] += mlyr[0].y + mlyr[1].pageY - } else { - if(mlyr.toString().indexOf('Image') != -1 || mlyr.toString().indexOf('Anchor') != -1){ - offsets[0] += mlyr.x - offsets[1] += mlyr.y - } else { - offsets[0] += mlyr.pageX - offsets[1] += mlyr.pageY - } - } - } else { - offsets[0] += pageLocation(mlyr, 'Left') - offsets[1] += pageLocation(mlyr, 'Top') - } - - of = getAnchorOffsets(mkObj) - - if (typeof o3_dragimg != 'undefined' && o3_dragimg) { - olImgLeft = offsets[0]; - olImgTop = offsets[1]; - } - - offsets[0] += of[0] - offsets[1] += of[1] - - if (typeof o3_dragimg != 'undefined' && o3_dragimg) { - olImgRight = offsets[0]; - olImgBottom = offsets[1]; - return; - } - - return offsets; -} - -// Adapted to overlib from jwin by Jason Anderson -- http://www.jwinlib.com -function getAnchorOffsets(mkObj){ - var fx = fy = 0, mp, puc, mkAry, sx = sy = 0, w = o3_anchoralign - var mW = mH = pW = pH = 0 - var off = [0, 0] - - mkAry = w.split(','); - - if (mkAry.length < 3) { - mp = mkAry[0].toUpperCase(); - puc = (mkAry.length == 1) ? mp : mkAry[1].toUpperCase(); - } else if (mkAry.length == 3) { - if (!isNaN(mkAry[0])) { - mp = mkAry.slice(0, 2); - puc = mkAry[2].toUpperCase(); - } else { - mp = mkAry[0].toUpperCase(); - puc = mkAry.slice(1); - } - } else { - mp = mkAry.slice(0, 2); - puc = mkAry.slice(2); - } - - var shdwPresent = typeof o3_shadow != 'undefined' && o3_shadow - - if (shdwPresent) { - sx = Math.abs(o3_shadowx); - sy = Math.abs(o3_shadowy); - } - - pW = (shdwPresent ? parseInt(o3_width) : (olNs4 ? over.clip.width : over.offsetWidth)) - pH = (shdwPresent ? parseInt(o3_aboveheight) : (olNs4 ? over.clip.height : over.offsetHeight)) - - if (olOp && o3_wrap) { - pW = (shdwPresent ? parseInt(o3_width) : (olNs4 ? over.clip.width : over.offsetWidth)) - pH = (shdwPresent ? parseInt(o3_aboveheight) : (olNs4 ? over.clip.height : over.offsetHeight)) - } - - if (!olOp && mkObj.toString().indexOf('Image') != -1){ - mW = mkObj.width - mH = mkObj.height - } else if (!olOp && mkObj.toString().indexOf('Anchor') != -1) { // enforced only for NS4 - mp = 'UL' - } else { - mW = (olNs4) ? mkObj.clip.width : mkObj.offsetWidth - mH = (olNs4) ? mkObj.clip.height : mkObj.offsetHeight - } - - if (!isNaN(mp) || typeof mp == 'object') { - if (typeof mp == 'object') { - fx = parseFloat(mp[0]); - fy = parseFloat(mp[1]); - } else - fx = fy = parseFloat(mp); - off = [Math.round(fx*mW), Math.round(fy*mH)]; - } else { - if (mp == 'UR') off = [mW, 0] - else if (mp == 'LL') off = [0, mH] - else if (mp == 'LR') off = [mW, mH] - } - - if (typeof o3_dragimg != 'undefined' && o3_dragimg) return off; - else { - if (!isNaN(puc) || typeof puc == 'object' ) { - if (typeof puc == 'object') { - fx = parseFloat(puc[0]); - fy = parseFloat(puc[1]); - } else - fx = fy = parseFloat(puc); - off[0] -= Math.round(fx*(pW - sx)); - off[1] -= Math.round(fy*(pH - sy)); - } else { - if (puc == 'UR') { - off[0] -= (pW - sx); - off[1] -= sy - } else if (puc == 'LL') { - off[0] -= sx; - off[1] -= (pH - sy) - } else if (puc == 'LR') { - off[0] -= (pW-sx); - off[1] -= (pH - sy) - } - } - return off - } -} - -// Adapted to overlib from jwin by Jason Anderson -- http://www.jwinlib.com -function pageLocation(o, t){ - var x = 0 - - while(o.offsetParent){ - x += o['offset' + t] - o = o.offsetParent - } - x += o['offset' + t] - - return x -} - -// Adapted to overlib from jwin by Jason Anderson -- http://www.jwinlib.com -function getRefById(l, d){ - var r = "", j - - d = (d || document) - if (d.all) return d.all[l] - else if (d.getElementById) return d.getElementById(l) - else if (d.layers && d.layers.length > 0) { - if (d.layers[l]) return d.layers[l] - - for (j=0; j < d.layers.length; j++) { - r = getRefById(l, d.layers[j].document) - if(r) return r - } - } - - return false -} - -// Adapted to overlib from jwin by Jason Anderson -- http://www.jwinlib.com -function getRefByName(l, d) { - var r = null, j - - d = (d || document) - - if (d.images[l]) return d.images[l] - else if (d.anchors[l]) return d.anchors[l]; - else if (d.layers && d.layers.length > 0) { - for (j=0; j < d.layers.length; j++) { - r = getRefByName(l, d.layers[j].document) - if (r && r.length > 0) return r - else if (r) return [r, d.layers[j]] - } - } - - return null -} - -//////// -// PLUGIN REGISTRATIONS -//////// -registerRunTimeFunction(setAnchorVariables); -registerCmdLineFunction(parseAnchorExtras); -registerPostParseFunction(checkAnchorObject); -registerHook("createPopup", anchorPreface, FAFTER); -registerHook("horizontalPlacement", anchorHorizontal, FCHAIN); -registerHook("verticalPlacement", anchorVertical, FCHAIN); -if(olInfo.meets(4.10)) registerNoParameterCommands('noanchorwarn'); +//\///// +//\ overLIB Anchor Plugin +//\ This file requires overLIB 4.10 or later. +//\ +//\ overLIB 4.10 - You may not remove or change this notice. +//\ Copyright Erik Bosrup 1998-2004. All rights reserved. +//\ Contributors are listed on the homepage. +//\ See http://www.bosrup.com/web/overlib/ for details. +// $Revision: 1.1 $ $Date: 2006/05/29 16:38:21 $ +//\///// +//\mini + + +//////// +// PRE-INIT +// Ignore these lines, configuration is below. +//////// +if (typeof olInfo == 'undefined' || typeof olInfo.meets == 'undefined' || !olInfo.meets(4.10)) alert('overLIB 4.10 or later is required for the Anchor Plugin.'); +else { +registerCommands('anchor,anchorx,anchory,noanchorwarn,anchoralign'); + + + +//////// +// DEFAULT CONFIGURATION +// Settings you want everywhere are set here. All of this can also be +// changed on your html page or through an overLIB call. +//////// +if (typeof ol_anchor == 'undefined') var ol_anchor = ''; +if (typeof ol_anchorx == 'undefined') var ol_anchorx = 0; +if (typeof ol_anchory == 'undefined') var ol_anchory = 0; +if (typeof ol_noanchorwarn == 'undefined') var ol_noanchorwarn = 1; +if (typeof ol_anchoralign == 'undefined') var ol_anchoralign = 'UL'; + +//////// +// END OF CONFIGURATION +// Don't change anything below this line, all configuration is above. +//////// + + + + + +//////// +// INIT +//////// +// Runtime variables init. Don't change for config! +var o3_anchor = ""; +var o3_anchorx = 0; +var o3_anchory = 0; +var o3_noanchorwarn = 1; +var o3_anchoralign = 'UL'; +var mrkObj, rmrkPosition; //reference mark object, reference mark position, an array; + + +//////// +// PLUGIN FUNCTIONS +//////// +function setAnchorVariables() { + o3_anchor = ol_anchor; + o3_anchorx = ol_anchorx; + o3_anchory = ol_anchory; + o3_noanchorwarn = ol_noanchorwarn; + o3_anchoralign = ol_anchoralign; + mrkObj = null; // initialize this variable +} + +// Parses Reference Mark commands +function parseAnchorExtras(pf,i,ar) { + var v, k=i; + + if (k < ar.length) { + if (ar[k] == ANCHOR) { eval(pf + "anchor = '" + escSglQuote(ar[++k]) + "'"); return k; } + if (ar[k] == ANCHORX) { eval(pf + 'anchorx = ' + ar[++k]); return k; } + if (ar[k] == ANCHORY) { eval(pf + 'anchory = ' + ar[++k]); return k; } + if (ar[k] == NOANCHORWARN) { eval(pf + 'noanchorwarn = (' + pf + 'noanchorwarn==1) ? 0 : 1'); return k; } + if (ar[k] == ANCHORALIGN) { k = opt_MULTIPLEARGS(++k, ar, (pf + 'anchoralign')); return k; } + } + + return -1; +} + + +/////// +// FUNCTION WHICH CHECKS FOR THE EXISTENCE OF A REFERENCE MARKER +/////// +function checkAnchorObject() { + var w = o3_anchor; + + if (w) { + if (!(mrkObj = getAnchorObjectRef(w))) { + if (o3_noanchorwarn) { + alert('WARNING! Reference mark "' + w + '" not found.'); + return false; + } else w = ''; + } + } + + return true; +} + +/////// +// EXTERNAL SUPPORT FUNCTIONS TO HANDLE ANCHOR PROPERTIES +/////// + +// Horizontal placement routine with anchors +function anchorHorizontal(browserWidth, horizontalScrollAmount, widthFix) { + var hasAnchor = (typeof o3_anchor != 'undefined' && o3_anchor); + if (!hasAnchor) return void(0); + + // set o3_relx for follow scroll if defined + if (typeof o3_followscroll != 'undefined' && o3_followscroll && o3_sticky) o3_relx = rmrkPosition[0]; + + return rmrkPosition[0]; +} + +// Vertical placement routine with anchors +function anchorVertical(browserHeight,verticalScrollAmount) { + var hasAnchor = (typeof o3_anchor != 'undefined' && o3_anchor); + if (!hasAnchor) return void(0); + + // set o3_rely for follow scroll if defined + if (typeof o3_followscroll != 'undefined' && o3_followscroll && o3_sticky) o3_rely = rmrkPosition[1]; + + return rmrkPosition[1]; +} + +// Stub function for the runHook routine +function anchorPreface() { + if (!mrkObj) return; + rmrkPosition = getAnchorLocation(mrkObj); +} + +// Get Reference Mark object +function getAnchorObjectRef(aObj) { + return getRefById(aObj, o3_frame.document) || getRefByName(aObj, o3_frame.document) +} + +// Adapted to overlib from jwin by Jason Anderson -- http://www.jwinlib.com +function getAnchorLocation(objRef){ + var mkObj, of, offsets, mlyr + + mkObj = mlyr = objRef + offsets = [o3_anchorx, o3_anchory] + + if (document.layers){ + if (typeof mlyr.length != 'undefined' && mlyr.length > 1) { + mkObj = mlyr[0] + offsets[0] += mlyr[0].x + mlyr[1].pageX + offsets[1] += mlyr[0].y + mlyr[1].pageY + } else { + if(mlyr.toString().indexOf('Image') != -1 || mlyr.toString().indexOf('Anchor') != -1){ + offsets[0] += mlyr.x + offsets[1] += mlyr.y + } else { + offsets[0] += mlyr.pageX + offsets[1] += mlyr.pageY + } + } + } else { + offsets[0] += pageLocation(mlyr, 'Left') + offsets[1] += pageLocation(mlyr, 'Top') + } + + of = getAnchorOffsets(mkObj) + + if (typeof o3_dragimg != 'undefined' && o3_dragimg) { + olImgLeft = offsets[0]; + olImgTop = offsets[1]; + } + + offsets[0] += of[0] + offsets[1] += of[1] + + if (typeof o3_dragimg != 'undefined' && o3_dragimg) { + olImgRight = offsets[0]; + olImgBottom = offsets[1]; + return; + } + + return offsets; +} + +// Adapted to overlib from jwin by Jason Anderson -- http://www.jwinlib.com +function getAnchorOffsets(mkObj){ + var fx = fy = 0, mp, puc, mkAry, sx = sy = 0, w = o3_anchoralign + var mW = mH = pW = pH = 0 + var off = [0, 0] + + mkAry = w.split(','); + + if (mkAry.length < 3) { + mp = mkAry[0].toUpperCase(); + puc = (mkAry.length == 1) ? mp : mkAry[1].toUpperCase(); + } else if (mkAry.length == 3) { + if (!isNaN(mkAry[0])) { + mp = mkAry.slice(0, 2); + puc = mkAry[2].toUpperCase(); + } else { + mp = mkAry[0].toUpperCase(); + puc = mkAry.slice(1); + } + } else { + mp = mkAry.slice(0, 2); + puc = mkAry.slice(2); + } + + var shdwPresent = typeof o3_shadow != 'undefined' && o3_shadow + + if (shdwPresent) { + sx = Math.abs(o3_shadowx); + sy = Math.abs(o3_shadowy); + } + + pW = (shdwPresent ? parseInt(o3_width) : (olNs4 ? over.clip.width : over.offsetWidth)) + pH = (shdwPresent ? parseInt(o3_aboveheight) : (olNs4 ? over.clip.height : over.offsetHeight)) + + if (olOp && o3_wrap) { + pW = (shdwPresent ? parseInt(o3_width) : (olNs4 ? over.clip.width : over.offsetWidth)) + pH = (shdwPresent ? parseInt(o3_aboveheight) : (olNs4 ? over.clip.height : over.offsetHeight)) + } + + if (!olOp && mkObj.toString().indexOf('Image') != -1){ + mW = mkObj.width + mH = mkObj.height + } else if (!olOp && mkObj.toString().indexOf('Anchor') != -1) { // enforced only for NS4 + mp = 'UL' + } else { + mW = (olNs4) ? mkObj.clip.width : mkObj.offsetWidth + mH = (olNs4) ? mkObj.clip.height : mkObj.offsetHeight + } + + if (!isNaN(mp) || typeof mp == 'object') { + if (typeof mp == 'object') { + fx = parseFloat(mp[0]); + fy = parseFloat(mp[1]); + } else + fx = fy = parseFloat(mp); + off = [Math.round(fx*mW), Math.round(fy*mH)]; + } else { + if (mp == 'UR') off = [mW, 0] + else if (mp == 'LL') off = [0, mH] + else if (mp == 'LR') off = [mW, mH] + } + + if (typeof o3_dragimg != 'undefined' && o3_dragimg) return off; + else { + if (!isNaN(puc) || typeof puc == 'object' ) { + if (typeof puc == 'object') { + fx = parseFloat(puc[0]); + fy = parseFloat(puc[1]); + } else + fx = fy = parseFloat(puc); + off[0] -= Math.round(fx*(pW - sx)); + off[1] -= Math.round(fy*(pH - sy)); + } else { + if (puc == 'UR') { + off[0] -= (pW - sx); + off[1] -= sy + } else if (puc == 'LL') { + off[0] -= sx; + off[1] -= (pH - sy) + } else if (puc == 'LR') { + off[0] -= (pW-sx); + off[1] -= (pH - sy) + } + } + return off + } +} + +// Adapted to overlib from jwin by Jason Anderson -- http://www.jwinlib.com +function pageLocation(o, t){ + var x = 0 + + while(o.offsetParent){ + x += o['offset' + t] + o = o.offsetParent + } + x += o['offset' + t] + + return x +} + +// Adapted to overlib from jwin by Jason Anderson -- http://www.jwinlib.com +function getRefById(l, d){ + var r = "", j + + d = (d || document) + if (d.all) return d.all[l] + else if (d.getElementById) return d.getElementById(l) + else if (d.layers && d.layers.length > 0) { + if (d.layers[l]) return d.layers[l] + + for (j=0; j < d.layers.length; j++) { + r = getRefById(l, d.layers[j].document) + if(r) return r + } + } + + return false +} + +// Adapted to overlib from jwin by Jason Anderson -- http://www.jwinlib.com +function getRefByName(l, d) { + var r = null, j + + d = (d || document) + + if (d.images[l]) return d.images[l] + else if (d.anchors[l]) return d.anchors[l]; + else if (d.layers && d.layers.length > 0) { + for (j=0; j < d.layers.length; j++) { + r = getRefByName(l, d.layers[j].document) + if (r && r.length > 0) return r + else if (r) return [r, d.layers[j]] + } + } + + return null +} + +//////// +// PLUGIN REGISTRATIONS +//////// +registerRunTimeFunction(setAnchorVariables); +registerCmdLineFunction(parseAnchorExtras); +registerPostParseFunction(checkAnchorObject); +registerHook("createPopup", anchorPreface, FAFTER); +registerHook("horizontalPlacement", anchorHorizontal, FCHAIN); +registerHook("verticalPlacement", anchorVertical, FCHAIN); +if(olInfo.meets(4.10)) registerNoParameterCommands('noanchorwarn'); } \ No newline at end of file diff --git a/web/public_php/admin/overlib/overlib_anchor_mini.js b/web/public_php/admin/overlib/overlib_anchor_mini.js index c12a034dfc..e1e952e418 100644 --- a/web/public_php/admin/overlib/overlib_anchor_mini.js +++ b/web/public_php/admin/overlib/overlib_anchor_mini.js @@ -1,98 +1,98 @@ -//\///// -//\ overLIB Anchor Plugin -//\ This file requires overLIB 4.10 or later. -//\ -//\ overLIB 4.10 - You may not remove or change this notice. -//\ Copyright Erik Bosrup 1998-2004. All rights reserved. -//\ Contributors are listed on the homepage. -//\ See http://www.bosrup.com/web/overlib/ for details. -//\///// -//\ THIS IS A VERY MODIFIED VERSION. DO NOT EDIT OR PUBLISH. GET THE ORIGINAL! -if(typeof olInfo=='undefined'||typeof olInfo.meets=='undefined'||!olInfo.meets(4.10))alert('overLIB 4.10 or later is required for the Anchor Plugin.');else{registerCommands('anchor,anchorx,anchory,noanchorwarn,anchoralign'); -if(typeof ol_anchor=='undefined')var ol_anchor='';if(typeof ol_anchorx=='undefined')var ol_anchorx=0;if(typeof ol_anchory=='undefined')var ol_anchory=0;if(typeof ol_noanchorwarn=='undefined')var ol_noanchorwarn=1;if(typeof ol_anchoralign=='undefined')var ol_anchoralign='UL'; -var o3_anchor="",o3_anchorx=0,o3_anchory=0,o3_noanchorwarn=1,o3_anchoralign='UL',mrkObj,rmrkPosition; -function setAnchorVariables(){o3_anchor=ol_anchor;o3_anchorx=ol_anchorx;o3_anchory=ol_anchory;o3_noanchorwarn=ol_noanchorwarn;o3_anchoralign=ol_anchoralign;mrkObj=null;} -function parseAnchorExtras(pf,i,ar){var v,k=i; -if(k1){mkObj=mlyr[0] -offsets[0]+=mlyr[0].x+mlyr[1].pageX -offsets[1]+=mlyr[0].y+mlyr[1].pageY -}else{if(mlyr.toString().indexOf('Image')!=-1||mlyr.toString().indexOf('Anchor')!=-1){offsets[0]+=mlyr.x -offsets[1]+=mlyr.y -}else{offsets[0]+=mlyr.pageX -offsets[1]+=mlyr.pageY}} -}else{offsets[0]+=pageLocation(mlyr,'Left') -offsets[1]+=pageLocation(mlyr,'Top')} -of=getAnchorOffsets(mkObj) -if(typeof o3_dragimg!='undefined'&& o3_dragimg){olImgLeft=offsets[0];olImgTop=offsets[1];} -offsets[0]+=of[0] -offsets[1]+=of[1] -if(typeof o3_dragimg!='undefined'&& o3_dragimg){olImgRight=offsets[0];olImgBottom=offsets[1];return;} -return offsets;} -function getAnchorOffsets(mkObj){var fx=fy=0, mp,puc,mkAry,sx=sy=0,w=o3_anchoralign -var mW=mH=pW=pH=0 -var off=[0,0] -mkAry=w.split(','); -if(mkAry.length<3){mp=mkAry[0].toUpperCase();puc=(mkAry.length==1)?mp:mkAry[1].toUpperCase();}else if(mkAry.length==3){if(!isNaN(mkAry[0])){mp=mkAry.slice(0,2);puc=mkAry[2].toUpperCase();}else{mp=mkAry[0].toUpperCase();puc=mkAry.slice(1);} -}else{mp=mkAry.slice(0,2);puc=mkAry.slice(2);} -var shdwPresent=typeof o3_shadow!='undefined'&& o3_shadow -if(shdwPresent){sx=Math.abs(o3_shadowx);sy=Math.abs(o3_shadowy);} -pW=(shdwPresent?parseInt(o3_width):(olNs4?over.clip.width:over.offsetWidth)) -pH=(shdwPresent?parseInt(o3_aboveheight):(olNs4?over.clip.height:over.offsetHeight)) -if(olOp&& o3_wrap){pW=(shdwPresent?parseInt(o3_width):(olNs4?over.clip.width:over.offsetWidth)) -pH=(shdwPresent?parseInt(o3_aboveheight):(olNs4?over.clip.height:over.offsetHeight))} -if(!olOp&& mkObj.toString().indexOf('Image')!=-1){mW=mkObj.width -mH=mkObj.height -}else if(!olOp&& mkObj.toString().indexOf('Anchor')!=-1){mp='UL' -}else{mW=(olNs4)?mkObj.clip.width:mkObj.offsetWidth -mH=(olNs4)?mkObj.clip.height:mkObj.offsetHeight} -if(!isNaN(mp)||typeof mp=='object'){if(typeof mp=='object'){fx=parseFloat(mp[0]);fy=parseFloat(mp[1]);}else -fx=fy=parseFloat(mp);off=[Math.round(fx*mW),Math.round(fy*mH)];}else{if(mp=='UR')off=[mW,0] -else if(mp=='LL')off=[0,mH] -else if(mp=='LR')off=[mW,mH]} -if(typeof o3_dragimg!='undefined'&& o3_dragimg)return off;else{if(!isNaN(puc)||typeof puc=='object' ){if(typeof puc=='object'){fx=parseFloat(puc[0]);fy=parseFloat(puc[1]);}else -fx=fy=parseFloat(puc);off[0]-=Math.round(fx*(pW-sx));off[1]-=Math.round(fy*(pH-sy));}else{if(puc=='UR'){off[0]-=(pW-sx);off[1]-=sy -}else if(puc=='LL'){off[0]-=sx;off[1]-=(pH-sy) -}else if(puc=='LR'){off[0]-=(pW-sx);off[1]-=(pH-sy)}} -return off}} -function pageLocation(o,t){var x=0 -while(o.offsetParent){x+=o['offset'+t] -o=o.offsetParent} -x+=o['offset'+t] -return x} -function getRefById(l,d){var r="",j -d=(d||document) -if(d.all)return d.all[l] -else if(d.getElementById)return d.getElementById(l) -else if(d.layers&& d.layers.length>0){if(d.layers[l])return d.layers[l] -for(j=0;j0){for(j=0;j0)return r -else if(r)return [r,d.layers[j]]}} -return null} -registerRunTimeFunction(setAnchorVariables);registerCmdLineFunction(parseAnchorExtras);registerPostParseFunction(checkAnchorObject);registerHook("createPopup",anchorPreface,FAFTER);registerHook("horizontalPlacement",anchorHorizontal,FCHAIN);registerHook("verticalPlacement",anchorVertical,FCHAIN);if(olInfo.meets(4.10))registerNoParameterCommands('noanchorwarn'); -} +//\///// +//\ overLIB Anchor Plugin +//\ This file requires overLIB 4.10 or later. +//\ +//\ overLIB 4.10 - You may not remove or change this notice. +//\ Copyright Erik Bosrup 1998-2004. All rights reserved. +//\ Contributors are listed on the homepage. +//\ See http://www.bosrup.com/web/overlib/ for details. +//\///// +//\ THIS IS A VERY MODIFIED VERSION. DO NOT EDIT OR PUBLISH. GET THE ORIGINAL! +if(typeof olInfo=='undefined'||typeof olInfo.meets=='undefined'||!olInfo.meets(4.10))alert('overLIB 4.10 or later is required for the Anchor Plugin.');else{registerCommands('anchor,anchorx,anchory,noanchorwarn,anchoralign'); +if(typeof ol_anchor=='undefined')var ol_anchor='';if(typeof ol_anchorx=='undefined')var ol_anchorx=0;if(typeof ol_anchory=='undefined')var ol_anchory=0;if(typeof ol_noanchorwarn=='undefined')var ol_noanchorwarn=1;if(typeof ol_anchoralign=='undefined')var ol_anchoralign='UL'; +var o3_anchor="",o3_anchorx=0,o3_anchory=0,o3_noanchorwarn=1,o3_anchoralign='UL',mrkObj,rmrkPosition; +function setAnchorVariables(){o3_anchor=ol_anchor;o3_anchorx=ol_anchorx;o3_anchory=ol_anchory;o3_noanchorwarn=ol_noanchorwarn;o3_anchoralign=ol_anchoralign;mrkObj=null;} +function parseAnchorExtras(pf,i,ar){var v,k=i; +if(k1){mkObj=mlyr[0] +offsets[0]+=mlyr[0].x+mlyr[1].pageX +offsets[1]+=mlyr[0].y+mlyr[1].pageY +}else{if(mlyr.toString().indexOf('Image')!=-1||mlyr.toString().indexOf('Anchor')!=-1){offsets[0]+=mlyr.x +offsets[1]+=mlyr.y +}else{offsets[0]+=mlyr.pageX +offsets[1]+=mlyr.pageY}} +}else{offsets[0]+=pageLocation(mlyr,'Left') +offsets[1]+=pageLocation(mlyr,'Top')} +of=getAnchorOffsets(mkObj) +if(typeof o3_dragimg!='undefined'&& o3_dragimg){olImgLeft=offsets[0];olImgTop=offsets[1];} +offsets[0]+=of[0] +offsets[1]+=of[1] +if(typeof o3_dragimg!='undefined'&& o3_dragimg){olImgRight=offsets[0];olImgBottom=offsets[1];return;} +return offsets;} +function getAnchorOffsets(mkObj){var fx=fy=0, mp,puc,mkAry,sx=sy=0,w=o3_anchoralign +var mW=mH=pW=pH=0 +var off=[0,0] +mkAry=w.split(','); +if(mkAry.length<3){mp=mkAry[0].toUpperCase();puc=(mkAry.length==1)?mp:mkAry[1].toUpperCase();}else if(mkAry.length==3){if(!isNaN(mkAry[0])){mp=mkAry.slice(0,2);puc=mkAry[2].toUpperCase();}else{mp=mkAry[0].toUpperCase();puc=mkAry.slice(1);} +}else{mp=mkAry.slice(0,2);puc=mkAry.slice(2);} +var shdwPresent=typeof o3_shadow!='undefined'&& o3_shadow +if(shdwPresent){sx=Math.abs(o3_shadowx);sy=Math.abs(o3_shadowy);} +pW=(shdwPresent?parseInt(o3_width):(olNs4?over.clip.width:over.offsetWidth)) +pH=(shdwPresent?parseInt(o3_aboveheight):(olNs4?over.clip.height:over.offsetHeight)) +if(olOp&& o3_wrap){pW=(shdwPresent?parseInt(o3_width):(olNs4?over.clip.width:over.offsetWidth)) +pH=(shdwPresent?parseInt(o3_aboveheight):(olNs4?over.clip.height:over.offsetHeight))} +if(!olOp&& mkObj.toString().indexOf('Image')!=-1){mW=mkObj.width +mH=mkObj.height +}else if(!olOp&& mkObj.toString().indexOf('Anchor')!=-1){mp='UL' +}else{mW=(olNs4)?mkObj.clip.width:mkObj.offsetWidth +mH=(olNs4)?mkObj.clip.height:mkObj.offsetHeight} +if(!isNaN(mp)||typeof mp=='object'){if(typeof mp=='object'){fx=parseFloat(mp[0]);fy=parseFloat(mp[1]);}else +fx=fy=parseFloat(mp);off=[Math.round(fx*mW),Math.round(fy*mH)];}else{if(mp=='UR')off=[mW,0] +else if(mp=='LL')off=[0,mH] +else if(mp=='LR')off=[mW,mH]} +if(typeof o3_dragimg!='undefined'&& o3_dragimg)return off;else{if(!isNaN(puc)||typeof puc=='object' ){if(typeof puc=='object'){fx=parseFloat(puc[0]);fy=parseFloat(puc[1]);}else +fx=fy=parseFloat(puc);off[0]-=Math.round(fx*(pW-sx));off[1]-=Math.round(fy*(pH-sy));}else{if(puc=='UR'){off[0]-=(pW-sx);off[1]-=sy +}else if(puc=='LL'){off[0]-=sx;off[1]-=(pH-sy) +}else if(puc=='LR'){off[0]-=(pW-sx);off[1]-=(pH-sy)}} +return off}} +function pageLocation(o,t){var x=0 +while(o.offsetParent){x+=o['offset'+t] +o=o.offsetParent} +x+=o['offset'+t] +return x} +function getRefById(l,d){var r="",j +d=(d||document) +if(d.all)return d.all[l] +else if(d.getElementById)return d.getElementById(l) +else if(d.layers&& d.layers.length>0){if(d.layers[l])return d.layers[l] +for(j=0;j0){for(j=0;j0)return r +else if(r)return [r,d.layers[j]]}} +return null} +registerRunTimeFunction(setAnchorVariables);registerCmdLineFunction(parseAnchorExtras);registerPostParseFunction(checkAnchorObject);registerHook("createPopup",anchorPreface,FAFTER);registerHook("horizontalPlacement",anchorHorizontal,FCHAIN);registerHook("verticalPlacement",anchorVertical,FCHAIN);if(olInfo.meets(4.10))registerNoParameterCommands('noanchorwarn'); +} diff --git a/web/public_php/admin/overlib/overlib_draggable.js b/web/public_php/admin/overlib/overlib_draggable.js index d6797982c1..ab06c992b2 100644 --- a/web/public_php/admin/overlib/overlib_draggable.js +++ b/web/public_php/admin/overlib/overlib_draggable.js @@ -1,174 +1,174 @@ -//\///// -//\ overLIB Draggable Plugin -//\ -//\ You may not remove or change this notice. -//\ Copyright Erik Bosrup 1998-2003. All rights reserved. -//\ Contributors are listed on the homepage. -//\ See http://www.bosrup.com/web/overlib/ for details. -//\///// -//////// -// PRE-INIT -// Ignore these lines, configuration is below. -//////// -if (typeof olInfo == 'undefined' || typeof olInfo.meets == 'undefined' || !olInfo.meets(4.14)) alert('overLIB 4.14 or later is required for the Draggable Plugin.'); -else { -registerCommands('draggable,altcut,dragimg'); -//////// -// DEFAULT CONFIGURATION -// Settings you want everywhere are set here. All of this can also be -// changed on your html page or through an overLIB call. -//////// -if (typeof ol_draggable=='undefined') var ol_draggable=0; -if (typeof ol_altcut=='undefined') var ol_altcut=0; -if (typeof ol_dragimg=='undefined') var ol_dragimg=''; -//////// -// END OF CONFIGURATION -// Don't change anything below this line, all configuration is above. -//////// -//////// -// INIT -//////// -// Runtime variables init. Don't change for config! -var o3_draggable=0; -var o3_altcut=0; -var o3_dragimg=''; -var olImgLeft,olImgTop; -var olImgObj; -var olMseMv; // hold old mouseMove routine -//////// -// PLUGIN FUNCTIONS -//////// -function setDragVariables() { - o3_draggable=ol_draggable; - o3_altcut=ol_altcut; - o3_dragimg=ol_dragimg; - olImgObj=null; -} -// Parses Draggable commands -function parseDragExtras(pf,i,ar) { - var k=i; - if (k < ar.length) { - if (ar[k]==DRAGGABLE) { eval(pf+'draggable=('+pf+'draggable==0) ? 1 : 0'); return k; } - if (ar[k]==ALTCUT) { eval(pf+'altcut=('+pf+'altcut==0) ? 1 : 0'); return k; } - if (ar[k]==DRAGIMG) { eval(pf+'dragimg="'+ar[++k]+'"'); return k; } - } - return -1; -} -////// -// PRESHOW PROCESSING FOR DRAGGABLE POPUPS -////// -function startDrag() { - // Initiate dragging if in same frame and its a sticky - if (o3_draggable) { - if (o3_sticky&&(o3_frame==ol_frame)) initDrag(); - else o3_draggable=0; - } -} -////// -// POSTHIDE PROCESSING FOR DRAGGABLE POPUPS -////// -function stopDrag() { - if (o3_draggable) endDrag(); -} -////// -// DRAGGABLE FUNCTIONS -////// -function initDrag() { - olMseMv=capExtent.onmousemove; - if(olNs4) { - document.captureEvents(Event.MOUSEDOWN | Event.CLICK); - document.onmousedown=grabEl; - document.onclick=function(e) {return routeEvent(e);} - } else { - over.onmousedown=grabEl; - } - if (o3_dragimg) chkForImgSupport(o3_dragimg); - return true; -} -// Checks for image for dragging -function chkForImgSupport(dragImg) { - if (dragImg) { - if (typeof getAnchorObjRef!='undefined') olImgObj=getAnchorObjRef(dragImg); - if (olImgObj==null) o3_dragimg=''; - } -} -// Sets cursor symbol -function setCursor(on) { - if (olNs4) return; - over.style.cursor=(on ? 'move' : 'auto'); -} -// Checks cursor position relative to image -function chkCursorPosition(Obj,XPos,YPos) { - if (Obj) { - o3_anchorx=o3_anchory=0; - o3_anchoralign='UL'; - getAnchorLocation(Obj); - if (XPos < olImgLeft||XPos > (olImgLeft+Obj.width)||YPos < olImgTop||YPos > (olImgTop+Obj.height)) return false; - } - return true; -} -// Sets up mouse grab for moving -function grabEl(e) { - var e=(e) ? e : event; - var X,Y; - var cKy=(olNs4 ? e.modifiers & Event.ALT_MASK : (!olOp ? e.altKey : e.ctrlKey)); - if ((o3_altcut ? !cKy : cKy)) { - // get mouse's current x,y location - X=(e.pageX || eval('e.clientX+o3_frame.'+docRoot+'.scrollLeft')); - Y=(e.pageY || eval('e.clientY+o3_frame.'+docRoot+'.scrollTop')); - if (chkCursorPosition(olImgObj,X,Y)) { - if (olNs4) document.captureEvents(Event.MOUSEUP); - capExtent.onmousemove=moveEl; - document.onmouseup=function() {setCursor(0); if (olIe4) over.onselectstart=null; capExtent.onmousemove=olMseMv;} - setCursor(1); - if (olIe4) over.onselectstart=function() {return false;} - if (olNs4) { - cX=X - cY=Y - } else { - // get offsets from upper left hand corner of popup to keep popup from jummping - // when first starting to drag - cX=X-(olNs4 ? over.left : parseInt(over.style.left)); - cY=Y-(olNs4 ? over.top : parseInt(over.style.top)); - } - return (olNs4 ? routeEvent(e) : false); - } - } else setCursor(0); -} -// Moves popup to follow mouse -function moveEl(e) { - var e=(e) ? e : event; - var dX,dY,X,Y; - // get new mouse location - X=(e.pageX || eval('e.clientX+o3_frame.'+docRoot+'.scrollLeft')); - Y=(e.pageY || eval('e.clientY+o3_frame.'+docRoot+'.scrollTop')); - if (chkCursorPosition(olImgObj,X,Y)){ - if (olNs4) { - dX=X-cX; cX=X; - dY=Y-cY; cY=Y; - over.moveBy(dX,dY); - } else - repositionTo(over,X-cX,Y-cY); // move popup to that position - } -} -// Cleanup for Drag end -function endDrag(obj) { - if (olNs4) { - document.releaseEvents(Event.MOUSEDOWN | Event.MOUSEUP | Event.CLICK); - document.onmousedown=document.onclick=null; - } else { - if(!obj) obj=over; - obj.onmousedown=null; - } - document.onmouseup= null; -} -//////// -// PLUGIN REGISTRATIONS -//////// -registerRunTimeFunction(setDragVariables); -registerCmdLineFunction(parseDragExtras); -registerHook("disp",startDrag,FBEFORE); -registerHook("hideObject",stopDrag,FAFTER); -if (olInfo.meets(4.14)) registerNoParameterCommands('draggable,altcut'); -} -//end +//\///// +//\ overLIB Draggable Plugin +//\ +//\ You may not remove or change this notice. +//\ Copyright Erik Bosrup 1998-2003. All rights reserved. +//\ Contributors are listed on the homepage. +//\ See http://www.bosrup.com/web/overlib/ for details. +//\///// +//////// +// PRE-INIT +// Ignore these lines, configuration is below. +//////// +if (typeof olInfo == 'undefined' || typeof olInfo.meets == 'undefined' || !olInfo.meets(4.14)) alert('overLIB 4.14 or later is required for the Draggable Plugin.'); +else { +registerCommands('draggable,altcut,dragimg'); +//////// +// DEFAULT CONFIGURATION +// Settings you want everywhere are set here. All of this can also be +// changed on your html page or through an overLIB call. +//////// +if (typeof ol_draggable=='undefined') var ol_draggable=0; +if (typeof ol_altcut=='undefined') var ol_altcut=0; +if (typeof ol_dragimg=='undefined') var ol_dragimg=''; +//////// +// END OF CONFIGURATION +// Don't change anything below this line, all configuration is above. +//////// +//////// +// INIT +//////// +// Runtime variables init. Don't change for config! +var o3_draggable=0; +var o3_altcut=0; +var o3_dragimg=''; +var olImgLeft,olImgTop; +var olImgObj; +var olMseMv; // hold old mouseMove routine +//////// +// PLUGIN FUNCTIONS +//////// +function setDragVariables() { + o3_draggable=ol_draggable; + o3_altcut=ol_altcut; + o3_dragimg=ol_dragimg; + olImgObj=null; +} +// Parses Draggable commands +function parseDragExtras(pf,i,ar) { + var k=i; + if (k < ar.length) { + if (ar[k]==DRAGGABLE) { eval(pf+'draggable=('+pf+'draggable==0) ? 1 : 0'); return k; } + if (ar[k]==ALTCUT) { eval(pf+'altcut=('+pf+'altcut==0) ? 1 : 0'); return k; } + if (ar[k]==DRAGIMG) { eval(pf+'dragimg="'+ar[++k]+'"'); return k; } + } + return -1; +} +////// +// PRESHOW PROCESSING FOR DRAGGABLE POPUPS +////// +function startDrag() { + // Initiate dragging if in same frame and its a sticky + if (o3_draggable) { + if (o3_sticky&&(o3_frame==ol_frame)) initDrag(); + else o3_draggable=0; + } +} +////// +// POSTHIDE PROCESSING FOR DRAGGABLE POPUPS +////// +function stopDrag() { + if (o3_draggable) endDrag(); +} +////// +// DRAGGABLE FUNCTIONS +////// +function initDrag() { + olMseMv=capExtent.onmousemove; + if(olNs4) { + document.captureEvents(Event.MOUSEDOWN | Event.CLICK); + document.onmousedown=grabEl; + document.onclick=function(e) {return routeEvent(e);} + } else { + over.onmousedown=grabEl; + } + if (o3_dragimg) chkForImgSupport(o3_dragimg); + return true; +} +// Checks for image for dragging +function chkForImgSupport(dragImg) { + if (dragImg) { + if (typeof getAnchorObjRef!='undefined') olImgObj=getAnchorObjRef(dragImg); + if (olImgObj==null) o3_dragimg=''; + } +} +// Sets cursor symbol +function setCursor(on) { + if (olNs4) return; + over.style.cursor=(on ? 'move' : 'auto'); +} +// Checks cursor position relative to image +function chkCursorPosition(Obj,XPos,YPos) { + if (Obj) { + o3_anchorx=o3_anchory=0; + o3_anchoralign='UL'; + getAnchorLocation(Obj); + if (XPos < olImgLeft||XPos > (olImgLeft+Obj.width)||YPos < olImgTop||YPos > (olImgTop+Obj.height)) return false; + } + return true; +} +// Sets up mouse grab for moving +function grabEl(e) { + var e=(e) ? e : event; + var X,Y; + var cKy=(olNs4 ? e.modifiers & Event.ALT_MASK : (!olOp ? e.altKey : e.ctrlKey)); + if ((o3_altcut ? !cKy : cKy)) { + // get mouse's current x,y location + X=(e.pageX || eval('e.clientX+o3_frame.'+docRoot+'.scrollLeft')); + Y=(e.pageY || eval('e.clientY+o3_frame.'+docRoot+'.scrollTop')); + if (chkCursorPosition(olImgObj,X,Y)) { + if (olNs4) document.captureEvents(Event.MOUSEUP); + capExtent.onmousemove=moveEl; + document.onmouseup=function() {setCursor(0); if (olIe4) over.onselectstart=null; capExtent.onmousemove=olMseMv;} + setCursor(1); + if (olIe4) over.onselectstart=function() {return false;} + if (olNs4) { + cX=X + cY=Y + } else { + // get offsets from upper left hand corner of popup to keep popup from jummping + // when first starting to drag + cX=X-(olNs4 ? over.left : parseInt(over.style.left)); + cY=Y-(olNs4 ? over.top : parseInt(over.style.top)); + } + return (olNs4 ? routeEvent(e) : false); + } + } else setCursor(0); +} +// Moves popup to follow mouse +function moveEl(e) { + var e=(e) ? e : event; + var dX,dY,X,Y; + // get new mouse location + X=(e.pageX || eval('e.clientX+o3_frame.'+docRoot+'.scrollLeft')); + Y=(e.pageY || eval('e.clientY+o3_frame.'+docRoot+'.scrollTop')); + if (chkCursorPosition(olImgObj,X,Y)){ + if (olNs4) { + dX=X-cX; cX=X; + dY=Y-cY; cY=Y; + over.moveBy(dX,dY); + } else + repositionTo(over,X-cX,Y-cY); // move popup to that position + } +} +// Cleanup for Drag end +function endDrag(obj) { + if (olNs4) { + document.releaseEvents(Event.MOUSEDOWN | Event.MOUSEUP | Event.CLICK); + document.onmousedown=document.onclick=null; + } else { + if(!obj) obj=over; + obj.onmousedown=null; + } + document.onmouseup= null; +} +//////// +// PLUGIN REGISTRATIONS +//////// +registerRunTimeFunction(setDragVariables); +registerCmdLineFunction(parseDragExtras); +registerHook("disp",startDrag,FBEFORE); +registerHook("hideObject",stopDrag,FAFTER); +if (olInfo.meets(4.14)) registerNoParameterCommands('draggable,altcut'); +} +//end diff --git a/web/public_php/admin/overlib/overlib_draggable_mini.js b/web/public_php/admin/overlib/overlib_draggable_mini.js index d956eda1c7..59f8aafeb1 100644 --- a/web/public_php/admin/overlib/overlib_draggable_mini.js +++ b/web/public_php/admin/overlib/overlib_draggable_mini.js @@ -1,11 +1,11 @@ -//\///// -//\ overLIB Draggable Plugin -//\ -//\ You may not remove or change this notice. -//\ Copyright Erik Bosrup 1998-2003. All rights reserved. -//\ Contributors are listed on the homepage. -//\ See http://www.bosrup.com/web/overlib/ for details. -//\///// +//\///// +//\ overLIB Draggable Plugin +//\ +//\ You may not remove or change this notice. +//\ Copyright Erik Bosrup 1998-2003. All rights reserved. +//\ Contributors are listed on the homepage. +//\ See http://www.bosrup.com/web/overlib/ for details. +//\///// if(typeof olInfo=='undefined'||typeof olInfo.meets=='undefined'||!olInfo.meets(4.14))alert('overLIB 4.14 or later is required for the Draggable Plugin.');else{registerCommands('draggable,altcut,dragimg'); if(typeof ol_draggable=='undefined')var ol_draggable=0;if(typeof ol_altcut=='undefined')var ol_altcut=0;if(typeof ol_dragimg=='undefined')var ol_dragimg=''; var o3_draggable=0,o3_altcut=0,o3_dragimg='',olImgLeft,olImgTop,olImgObj,olMseMv; diff --git a/web/public_php/admin/overlib/overlib_mini.js b/web/public_php/admin/overlib/overlib_mini.js index a2df535b22..6262e3ee5b 100644 --- a/web/public_php/admin/overlib/overlib_mini.js +++ b/web/public_php/admin/overlib/overlib_mini.js @@ -1,20 +1,20 @@ -//\///// -//\ overLIB 4.21 - You may not remove or change this notice. -//\ Copyright Erik Bosrup 1998-2004. All rights reserved. -//\ -//\ Contributors are listed on the homepage. -//\ This file might be old, always check for the latest version at: -//\ http://www.bosrup.com/web/overlib/ -//\ -//\ Please read the license agreement (available through the link above) -//\ before using overLIB. Direct any licensing questions to erik@bosrup.com. -//\ -//\ Do not sell this as your own work or remove this copyright notice. -//\ For full details on copying or changing this script please read the -//\ license agreement at the link above. Please give credit on sites that -//\ use overLIB and submit changes of the script so other people can use -//\ them as well. -//\///// +//\///// +//\ overLIB 4.21 - You may not remove or change this notice. +//\ Copyright Erik Bosrup 1998-2004. All rights reserved. +//\ +//\ Contributors are listed on the homepage. +//\ This file might be old, always check for the latest version at: +//\ http://www.bosrup.com/web/overlib/ +//\ +//\ Please read the license agreement (available through the link above) +//\ before using overLIB. Direct any licensing questions to erik@bosrup.com. +//\ +//\ Do not sell this as your own work or remove this copyright notice. +//\ For full details on copying or changing this script please read the +//\ license agreement at the link above. Please give credit on sites that +//\ use overLIB and submit changes of the script so other people can use +//\ them as well. +//\///// //\ THIS IS A VERY MODIFIED VERSION. DO NOT EDIT OR PUBLISH. GET THE ORIGINAL! var olLoaded=0,pmStart=10000000,pmUpper=10001000,pmCount=pmStart+1,pmt='',pms=new Array(),olInfo=new Info('4.21',1),FREPLACE=0,FBEFORE=1,FAFTER=2,FALTERNATE=3,FCHAIN=4,olHideForm=0,olHautoFlag=0,olVautoFlag=0,hookPts=new Array(),postParse=new Array(),cmdLine=new Array(),runTime=new Array(); registerCommands('donothing,inarray,caparray,sticky,background,noclose,caption,left,right,center,offsetx,offsety,fgcolor,bgcolor,textcolor,capcolor,closecolor,width,border,cellpad,status,autostatus,autostatuscap,height,closetext,snapx,snapy,fixx,fixy,relx,rely,fgbackground,bgbackground,padx,pady,fullhtml,above,below,capicon,textfont,captionfont,closefont,textsize,captionsize,closesize,timeout,function,delay,hauto,vauto,closeclick,wrap,followmouse,mouseoff,closetitle,cssoff,compatmode,cssclass,fgclass,bgclass,textfontclass,captionfontclass,closefontclass'); diff --git a/web/public_php/ams/css/custom.css b/web/public_php/ams/css/custom.css index 7a36a67992..ec7b90139d 100644 --- a/web/public_php/ams/css/custom.css +++ b/web/public_php/ams/css/custom.css @@ -1,139 +1,139 @@ -.box-content { - background: white; -} - -.box-header { - background-color: white; -} - -.top-block { - background-color: white; - border-radius: 5px; -} - -.row-fluid [class*="span"] { - min-height: 28px; -} - -.login-header -{ - height:190px; -} - -.brand img -{ - height:100%; - margin-bottom:-18px; - margin-top:-15px; - width:auto; -} - -#for-is-ajax -{ - display:none; -} - -.navbar { - border-bottom: 0px; -} - -.flags { - display: block; - position:relative; - left:290px; - top:28px; -} - -.flags_no_visible_elements{ - display: block; - position:relative; - left:67%; - top:210px; -} - -.input-prepend .add-on, -.input-append .add-on { - height: auto; -} - -select, -textarea, -input[type="text"], -input[type="password"], -input[type="datetime"], -input[type="datetime-local"], -input[type="date"], -input[type="month"], -input[type="time"], -input[type="week"], -input[type="number"], -input[type="email"], -input[type="url"], -input[type="search"], -input[type="tel"], -input[type="color"], -.uneditable-input { - height: auto; -} - -.btn .caret { - margin: 10px; -} - -.btn .caret { - border-top-color: #333; -} - -.table-bordered { - border-collapse: collapse; -} - -.table { -margin-top: 10px; -} - -.nav { - margin-bottom: 22px; -} - -.radio, .checkbox { - display: table-row-group; -} - -.gender-list { - margin-left: 22px; -} - -.lg-icon { - font-size: 20px; - margin: 5px; -} - -.sidebar-nav { - padding-top: 5px; -} - -.sidebar-nav .nav-header{ - color:#666; -} - -.flags_logged_in{ - display: inline; - position:absolute; - margin:7px; -} - -.setup-width { - width:75%; -} - -.js-masonry { - padding-left: -1; - padding-right: -1; - margin-left: -1; - margin-right: -1; -} - -.col-sm-4 { - width: 33.333%; +.box-content { + background: white; +} + +.box-header { + background-color: white; +} + +.top-block { + background-color: white; + border-radius: 5px; +} + +.row-fluid [class*="span"] { + min-height: 28px; +} + +.login-header +{ + height:190px; +} + +.brand img +{ + height:100%; + margin-bottom:-18px; + margin-top:-15px; + width:auto; +} + +#for-is-ajax +{ + display:none; +} + +.navbar { + border-bottom: 0px; +} + +.flags { + display: block; + position:relative; + left:290px; + top:28px; +} + +.flags_no_visible_elements{ + display: block; + position:relative; + left:67%; + top:210px; +} + +.input-prepend .add-on, +.input-append .add-on { + height: auto; +} + +select, +textarea, +input[type="text"], +input[type="password"], +input[type="datetime"], +input[type="datetime-local"], +input[type="date"], +input[type="month"], +input[type="time"], +input[type="week"], +input[type="number"], +input[type="email"], +input[type="url"], +input[type="search"], +input[type="tel"], +input[type="color"], +.uneditable-input { + height: auto; +} + +.btn .caret { + margin: 10px; +} + +.btn .caret { + border-top-color: #333; +} + +.table-bordered { + border-collapse: collapse; +} + +.table { +margin-top: 10px; +} + +.nav { + margin-bottom: 22px; +} + +.radio, .checkbox { + display: table-row-group; +} + +.gender-list { + margin-left: 22px; +} + +.lg-icon { + font-size: 20px; + margin: 5px; +} + +.sidebar-nav { + padding-top: 5px; +} + +.sidebar-nav .nav-header{ + color:#666; +} + +.flags_logged_in{ + display: inline; + position:absolute; + margin:7px; +} + +.setup-width { + width:75%; +} + +.js-masonry { + padding-left: -1; + padding-right: -1; + margin-left: -1; + margin-right: -1; +} + +.col-sm-4 { + width: 33.333%; } \ No newline at end of file diff --git a/web/public_php/ams/css/uploadify.css b/web/public_php/ams/css/uploadify.css index 1df3e3e9dd..89e1932602 100644 --- a/web/public_php/ams/css/uploadify.css +++ b/web/public_php/ams/css/uploadify.css @@ -1,92 +1,92 @@ -/* -Uploadify -Copyright (c) 2012 Reactive Apps, Ronnie Garcia -Released under the MIT License -*/ - -.uploadify { - position: relative; - margin-bottom: 1em; -} -.uploadify-button { - background-color: #505050; - background-image: linear-gradient(bottom, #505050 0%, #707070 100%); - background-image: -o-linear-gradient(bottom, #505050 0%, #707070 100%); - background-image: -moz-linear-gradient(bottom, #505050 0%, #707070 100%); - background-image: -webkit-linear-gradient(bottom, #505050 0%, #707070 100%); - background-image: -ms-linear-gradient(bottom, #505050 0%, #707070 100%); - background-image: -webkit-gradient( - linear, - left bottom, - left top, - color-stop(0, #505050), - color-stop(1, #707070) - ); - background-position: center top; - background-repeat: no-repeat; - -webkit-border-radius: 30px; - -moz-border-radius: 30px; - border-radius: 30px; - border: 2px solid #808080; - color: #FFF; - font: bold 12px Arial, Helvetica, sans-serif; - text-align: center; - text-shadow: 0 -1px 0 rgba(0,0,0,0.25); - width: 100%; -} -.uploadify:hover .uploadify-button { - background-color: #606060; - background-image: linear-gradient(top, #606060 0%, #808080 100%); - background-image: -o-linear-gradient(top, #606060 0%, #808080 100%); - background-image: -moz-linear-gradient(top, #606060 0%, #808080 100%); - background-image: -webkit-linear-gradient(top, #606060 0%, #808080 100%); - background-image: -ms-linear-gradient(top, #606060 0%, #808080 100%); - background-image: -webkit-gradient( - linear, - left bottom, - left top, - color-stop(0, #606060), - color-stop(1, #808080) - ); - background-position: center bottom; -} -.uploadify-button.disabled { - background-color: #D0D0D0; - color: #808080; -} -.uploadify-queue { - margin-bottom: 1em; -} -.uploadify-queue-item { - background-color: #F5F5F5; - -webkit-border-radius: 3px; - -moz-border-radius: 3px; - border-radius: 3px; - font: 11px Verdana, Geneva, sans-serif; - margin-top: 5px; - max-width: 350px; - padding: 10px; -} -.uploadify-error { - background-color: #FDE5DD !important; -} -.uploadify-queue-item .cancel a { - background: url('../img/uploadify-cancel.png') 0 0 no-repeat; - float: right; - height: 16px; - text-indent: -9999px; - width: 16px; -} -.uploadify-queue-item.completed { - background-color: #E5E5E5; -} -.uploadify-progress { - background-color: #E5E5E5; - margin-top: 10px; - width: 100%; -} -.uploadify-progress-bar { - background-color: #0099FF; - height: 3px; - width: 1px; +/* +Uploadify +Copyright (c) 2012 Reactive Apps, Ronnie Garcia +Released under the MIT License +*/ + +.uploadify { + position: relative; + margin-bottom: 1em; +} +.uploadify-button { + background-color: #505050; + background-image: linear-gradient(bottom, #505050 0%, #707070 100%); + background-image: -o-linear-gradient(bottom, #505050 0%, #707070 100%); + background-image: -moz-linear-gradient(bottom, #505050 0%, #707070 100%); + background-image: -webkit-linear-gradient(bottom, #505050 0%, #707070 100%); + background-image: -ms-linear-gradient(bottom, #505050 0%, #707070 100%); + background-image: -webkit-gradient( + linear, + left bottom, + left top, + color-stop(0, #505050), + color-stop(1, #707070) + ); + background-position: center top; + background-repeat: no-repeat; + -webkit-border-radius: 30px; + -moz-border-radius: 30px; + border-radius: 30px; + border: 2px solid #808080; + color: #FFF; + font: bold 12px Arial, Helvetica, sans-serif; + text-align: center; + text-shadow: 0 -1px 0 rgba(0,0,0,0.25); + width: 100%; +} +.uploadify:hover .uploadify-button { + background-color: #606060; + background-image: linear-gradient(top, #606060 0%, #808080 100%); + background-image: -o-linear-gradient(top, #606060 0%, #808080 100%); + background-image: -moz-linear-gradient(top, #606060 0%, #808080 100%); + background-image: -webkit-linear-gradient(top, #606060 0%, #808080 100%); + background-image: -ms-linear-gradient(top, #606060 0%, #808080 100%); + background-image: -webkit-gradient( + linear, + left bottom, + left top, + color-stop(0, #606060), + color-stop(1, #808080) + ); + background-position: center bottom; +} +.uploadify-button.disabled { + background-color: #D0D0D0; + color: #808080; +} +.uploadify-queue { + margin-bottom: 1em; +} +.uploadify-queue-item { + background-color: #F5F5F5; + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + border-radius: 3px; + font: 11px Verdana, Geneva, sans-serif; + margin-top: 5px; + max-width: 350px; + padding: 10px; +} +.uploadify-error { + background-color: #FDE5DD !important; +} +.uploadify-queue-item .cancel a { + background: url('../img/uploadify-cancel.png') 0 0 no-repeat; + float: right; + height: 16px; + text-indent: -9999px; + width: 16px; +} +.uploadify-queue-item.completed { + background-color: #E5E5E5; +} +.uploadify-progress { + background-color: #E5E5E5; + margin-top: 10px; + width: 100%; +} +.uploadify-progress-bar { + background-color: #0099FF; + height: 3px; + width: 1px; } \ No newline at end of file diff --git a/web/public_php/ams/js/jquery.uploadify-3.1.js b/web/public_php/ams/js/jquery.uploadify-3.1.js index 9590681506..a4c6409e3d 100644 --- a/web/public_php/ams/js/jquery.uploadify-3.1.js +++ b/web/public_php/ams/js/jquery.uploadify-3.1.js @@ -1,1971 +1,1971 @@ -/* -Uploadify v3.1.1 -Copyright (c) 2012 Reactive Apps, Ronnie Garcia -Released under the MIT License - -SWFUpload: http://www.swfupload.org, http://swfupload.googlecode.com -mmSWFUpload 1.0: Flash upload dialog - http://profandesign.se/swfupload/, http://www.vinterwebb.se/ -SWFUpload is (c) 2006-2007 Lars Huring, Olov Nilzén and Mammon Media and is released under the MIT License: -http://www.opensource.org/licenses/mit-license.php -SWFUpload 2 is (c) 2007-2008 Jake Roberts and is released under the MIT License: -http://www.opensource.org/licenses/mit-license.php - -SWFObject v2.2 -is released under the MIT License -*/ -; -var swfobject = function () { - var aq = "undefined", - aD = "object", - ab = "Shockwave Flash", - X = "ShockwaveFlash.ShockwaveFlash", - aE = "application/x-shockwave-flash", - ac = "SWFObjectExprInst", - ax = "onreadystatechange", - af = window, - aL = document, - aB = navigator, - aa = false, - Z = [aN], - aG = [], - ag = [], - al = [], - aJ, ad, ap, at, ak = false, - aU = false, - aH, an, aI = true, - ah = function () { - var a = typeof aL.getElementById != aq && typeof aL.getElementsByTagName != aq && typeof aL.createElement != aq, - e = aB.userAgent.toLowerCase(), - c = aB.platform.toLowerCase(), - h = c ? /win/.test(c) : /win/.test(e), - j = c ? /mac/.test(c) : /mac/.test(e), - g = /webkit/.test(e) ? parseFloat(e.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, - d = !+"\v1", - f = [0, 0, 0], - k = null; - if (typeof aB.plugins != aq && typeof aB.plugins[ab] == aD) { - k = aB.plugins[ab].description; - if (k && !(typeof aB.mimeTypes != aq && aB.mimeTypes[aE] && !aB.mimeTypes[aE].enabledPlugin)) { - aa = true; - d = false; - k = k.replace(/^.*\s+(\S+\s+\S+$)/, "$1"); - f[0] = parseInt(k.replace(/^(.*)\..*$/, "$1"), 10); - f[1] = parseInt(k.replace(/^.*\.(.*)\s.*$/, "$1"), 10); - f[2] = /[a-zA-Z]/.test(k) ? parseInt(k.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0; - } - } else { - if (typeof af.ActiveXObject != aq) { - try { - var i = new ActiveXObject(X); - if (i) { - k = i.GetVariable("$version"); - if (k) { - d = true; - k = k.split(" ")[1].split(","); - f = [parseInt(k[0], 10), parseInt(k[1], 10), parseInt(k[2], 10)]; - } - } - } catch (b) {} - } - } - return { - w3: a, - pv: f, - wk: g, - ie: d, - win: h, - mac: j - }; - }(), - aK = function () { - if (!ah.w3) { - return; - } - if ((typeof aL.readyState != aq && aL.readyState == "complete") || (typeof aL.readyState == aq && (aL.getElementsByTagName("body")[0] || aL.body))) { - aP(); - } - if (!ak) { - if (typeof aL.addEventListener != aq) { - aL.addEventListener("DOMContentLoaded", aP, false); - } - if (ah.ie && ah.win) { - aL.attachEvent(ax, function () { - if (aL.readyState == "complete") { - aL.detachEvent(ax, arguments.callee); - aP(); - } - }); - if (af == top) { - (function () { - if (ak) { - return; - } - try { - aL.documentElement.doScroll("left"); - } catch (a) { - setTimeout(arguments.callee, 0); - return; - } - aP(); - })(); - } - } - if (ah.wk) { - (function () { - if (ak) { - return; - } - if (!/loaded|complete/.test(aL.readyState)) { - setTimeout(arguments.callee, 0); - return; - } - aP(); - })(); - } - aC(aP); - } - }(); - - function aP() { - if (ak) { - return; - } - try { - var b = aL.getElementsByTagName("body")[0].appendChild(ar("span")); - b.parentNode.removeChild(b); - } catch (a) { - return; - } - ak = true; - var d = Z.length; - for (var c = 0; c < d; c++) { - Z[c](); - } - } - function aj(a) { - if (ak) { - a(); - } else { - Z[Z.length] = a; - } - } - function aC(a) { - if (typeof af.addEventListener != aq) { - af.addEventListener("load", a, false); - } else { - if (typeof aL.addEventListener != aq) { - aL.addEventListener("load", a, false); - } else { - if (typeof af.attachEvent != aq) { - aM(af, "onload", a); - } else { - if (typeof af.onload == "function") { - var b = af.onload; - af.onload = function () { - b(); - a(); - }; - } else { - af.onload = a; - } - } - } - } - } - function aN() { - if (aa) { - Y(); - } else { - am(); - } - } - function Y() { - var d = aL.getElementsByTagName("body")[0]; - var b = ar(aD); - b.setAttribute("type", aE); - var a = d.appendChild(b); - if (a) { - var c = 0; - (function () { - if (typeof a.GetVariable != aq) { - var e = a.GetVariable("$version"); - if (e) { - e = e.split(" ")[1].split(","); - ah.pv = [parseInt(e[0], 10), parseInt(e[1], 10), parseInt(e[2], 10)]; - } - } else { - if (c < 10) { - c++; - setTimeout(arguments.callee, 10); - return; - } - } - d.removeChild(b); - a = null; - am(); - })(); - } else { - am(); - } - } - function am() { - var g = aG.length; - if (g > 0) { - for (var h = 0; h < g; h++) { - var c = aG[h].id; - var l = aG[h].callbackFn; - var a = { - success: false, - id: c - }; - if (ah.pv[0] > 0) { - var i = aS(c); - if (i) { - if (ao(aG[h].swfVersion) && !(ah.wk && ah.wk < 312)) { - ay(c, true); - if (l) { - a.success = true; - a.ref = av(c); - l(a); - } - } else { - if (aG[h].expressInstall && au()) { - var e = {}; - e.data = aG[h].expressInstall; - e.width = i.getAttribute("width") || "0"; - e.height = i.getAttribute("height") || "0"; - if (i.getAttribute("class")) { - e.styleclass = i.getAttribute("class"); - } - if (i.getAttribute("align")) { - e.align = i.getAttribute("align"); - } - var f = {}; - var d = i.getElementsByTagName("param"); - var k = d.length; - for (var j = 0; j < k; j++) { - if (d[j].getAttribute("name").toLowerCase() != "movie") { - f[d[j].getAttribute("name")] = d[j].getAttribute("value"); - } - } - ae(e, f, c, l); - } else { - aF(i); - if (l) { - l(a); - } - } - } - } - } else { - ay(c, true); - if (l) { - var b = av(c); - if (b && typeof b.SetVariable != aq) { - a.success = true; - a.ref = b; - } - l(a); - } - } - } - } - } - function av(b) { - var d = null; - var c = aS(b); - if (c && c.nodeName == "OBJECT") { - if (typeof c.SetVariable != aq) { - d = c; - } else { - var a = c.getElementsByTagName(aD)[0]; - if (a) { - d = a; - } - } - } - return d; - } - function au() { - return !aU && ao("6.0.65") && (ah.win || ah.mac) && !(ah.wk && ah.wk < 312); - } - function ae(f, d, h, e) { - aU = true; - ap = e || null; - at = { - success: false, - id: h - }; - var a = aS(h); - if (a) { - if (a.nodeName == "OBJECT") { - aJ = aO(a); - ad = null; - } else { - aJ = a; - ad = h; - } - f.id = ac; - if (typeof f.width == aq || (!/%$/.test(f.width) && parseInt(f.width, 10) < 310)) { - f.width = "310"; - } - if (typeof f.height == aq || (!/%$/.test(f.height) && parseInt(f.height, 10) < 137)) { - f.height = "137"; - } - aL.title = aL.title.slice(0, 47) + " - Flash Player Installation"; - var b = ah.ie && ah.win ? "ActiveX" : "PlugIn", - c = "MMredirectURL=" + af.location.toString().replace(/&/g, "%26") + "&MMplayerType=" + b + "&MMdoctitle=" + aL.title; - if (typeof d.flashvars != aq) { - d.flashvars += "&" + c; - } else { - d.flashvars = c; - } - if (ah.ie && ah.win && a.readyState != 4) { - var g = ar("div"); - h += "SWFObjectNew"; - g.setAttribute("id", h); - a.parentNode.insertBefore(g, a); - a.style.display = "none"; - (function () { - if (a.readyState == 4) { - a.parentNode.removeChild(a); - } else { - setTimeout(arguments.callee, 10); - } - })(); - } - aA(f, d, h); - } - } - function aF(a) { - if (ah.ie && ah.win && a.readyState != 4) { - var b = ar("div"); - a.parentNode.insertBefore(b, a); - b.parentNode.replaceChild(aO(a), b); - a.style.display = "none"; - (function () { - if (a.readyState == 4) { - a.parentNode.removeChild(a); - } else { - setTimeout(arguments.callee, 10); - } - })(); - } else { - a.parentNode.replaceChild(aO(a), a); - } - } - function aO(b) { - var d = ar("div"); - if (ah.win && ah.ie) { - d.innerHTML = b.innerHTML; - } else { - var e = b.getElementsByTagName(aD)[0]; - if (e) { - var a = e.childNodes; - if (a) { - var f = a.length; - for (var c = 0; c < f; c++) { - if (!(a[c].nodeType == 1 && a[c].nodeName == "PARAM") && !(a[c].nodeType == 8)) { - d.appendChild(a[c].cloneNode(true)); - } - } - } - } - } - return d; - } - function aA(e, g, c) { - var d, a = aS(c); - if (ah.wk && ah.wk < 312) { - return d; - } - if (a) { - if (typeof e.id == aq) { - e.id = c; - } - if (ah.ie && ah.win) { - var f = ""; - for (var i in e) { - if (e[i] != Object.prototype[i]) { - if (i.toLowerCase() == "data") { - g.movie = e[i]; - } else { - if (i.toLowerCase() == "styleclass") { - f += ' class="' + e[i] + '"'; - } else { - if (i.toLowerCase() != "classid") { - f += " " + i + '="' + e[i] + '"'; - } - } - } - } - } - var h = ""; - for (var j in g) { - if (g[j] != Object.prototype[j]) { - h += ''; - } - } - a.outerHTML = '" + h + ""; - ag[ag.length] = e.id; - d = aS(e.id); - } else { - var b = ar(aD); - b.setAttribute("type", aE); - for (var k in e) { - if (e[k] != Object.prototype[k]) { - if (k.toLowerCase() == "styleclass") { - b.setAttribute("class", e[k]); - } else { - if (k.toLowerCase() != "classid") { - b.setAttribute(k, e[k]); - } - } - } - } - for (var l in g) { - if (g[l] != Object.prototype[l] && l.toLowerCase() != "movie") { - aQ(b, l, g[l]); - } - } - a.parentNode.replaceChild(b, a); - d = b; - } - } - return d; - } - function aQ(b, d, c) { - var a = ar("param"); - a.setAttribute("name", d); - a.setAttribute("value", c); - b.appendChild(a); - } - function aw(a) { - var b = aS(a); - if (b && b.nodeName == "OBJECT") { - if (ah.ie && ah.win) { - b.style.display = "none"; - (function () { - if (b.readyState == 4) { - aT(a); - } else { - setTimeout(arguments.callee, 10); - } - })(); - } else { - b.parentNode.removeChild(b); - } - } - } - function aT(a) { - var b = aS(a); - if (b) { - for (var c in b) { - if (typeof b[c] == "function") { - b[c] = null; - } - } - b.parentNode.removeChild(b); - } - } - function aS(a) { - var c = null; - try { - c = aL.getElementById(a); - } catch (b) {} - return c; - } - function ar(a) { - return aL.createElement(a); - } - function aM(a, c, b) { - a.attachEvent(c, b); - al[al.length] = [a, c, b]; - } - function ao(a) { - var b = ah.pv, - c = a.split("."); - c[0] = parseInt(c[0], 10); - c[1] = parseInt(c[1], 10) || 0; - c[2] = parseInt(c[2], 10) || 0; - return (b[0] > c[0] || (b[0] == c[0] && b[1] > c[1]) || (b[0] == c[0] && b[1] == c[1] && b[2] >= c[2])) ? true : false; - } - function az(b, f, a, c) { - if (ah.ie && ah.mac) { - return; - } - var e = aL.getElementsByTagName("head")[0]; - if (!e) { - return; - } - var g = (a && typeof a == "string") ? a : "screen"; - if (c) { - aH = null; - an = null; - } - if (!aH || an != g) { - var d = ar("style"); - d.setAttribute("type", "text/css"); - d.setAttribute("media", g); - aH = e.appendChild(d); - if (ah.ie && ah.win && typeof aL.styleSheets != aq && aL.styleSheets.length > 0) { - aH = aL.styleSheets[aL.styleSheets.length - 1]; - } - an = g; - } - if (ah.ie && ah.win) { - if (aH && typeof aH.addRule == aD) { - aH.addRule(b, f); - } - } else { - if (aH && typeof aL.createTextNode != aq) { - aH.appendChild(aL.createTextNode(b + " {" + f + "}")); - } - } - } - function ay(a, c) { - if (!aI) { - return; - } - var b = c ? "visible" : "hidden"; - if (ak && aS(a)) { - aS(a).style.visibility = b; - } else { - az("#" + a, "visibility:" + b); - } - } - function ai(b) { - var a = /[\\\"<>\.;]/; - var c = a.exec(b) != null; - return c && typeof encodeURIComponent != aq ? encodeURIComponent(b) : b; - } - var aR = function () { - if (ah.ie && ah.win) { - window.attachEvent("onunload", function () { - var a = al.length; - for (var b = 0; b < a; b++) { - al[b][0].detachEvent(al[b][1], al[b][2]); - } - var d = ag.length; - for (var c = 0; c < d; c++) { - aw(ag[c]); - } - for (var e in ah) { - ah[e] = null; - } - ah = null; - for (var f in swfobject) { - swfobject[f] = null; - } - swfobject = null; - }); - } - }(); - return { - registerObject: function (a, e, c, b) { - if (ah.w3 && a && e) { - var d = {}; - d.id = a; - d.swfVersion = e; - d.expressInstall = c; - d.callbackFn = b; - aG[aG.length] = d; - ay(a, false); - } else { - if (b) { - b({ - success: false, - id: a - }); - } - } - }, - getObjectById: function (a) { - if (ah.w3) { - return av(a); - } - }, - embedSWF: function (k, e, h, f, c, a, b, i, g, j) { - var d = { - success: false, - id: e - }; - if (ah.w3 && !(ah.wk && ah.wk < 312) && k && e && h && f && c) { - ay(e, false); - aj(function () { - h += ""; - f += ""; - var q = {}; - if (g && typeof g === aD) { - for (var o in g) { - q[o] = g[o]; - } - } - q.data = k; - q.width = h; - q.height = f; - var n = {}; - if (i && typeof i === aD) { - for (var p in i) { - n[p] = i[p]; - } - } - if (b && typeof b === aD) { - for (var l in b) { - if (typeof n.flashvars != aq) { - n.flashvars += "&" + l + "=" + b[l]; - } else { - n.flashvars = l + "=" + b[l]; - } - } - } - if (ao(c)) { - var m = aA(q, n, e); - if (q.id == e) { - ay(e, true); - } - d.success = true; - d.ref = m; - } else { - if (a && au()) { - q.data = a; - ae(q, n, e, j); - return; - } else { - ay(e, true); - } - } - if (j) { - j(d); - } - }); - } else { - if (j) { - j(d); - } - } - }, - switchOffAutoHideShow: function () { - aI = false; - }, - ua: ah, - getFlashPlayerVersion: function () { - return { - major: ah.pv[0], - minor: ah.pv[1], - release: ah.pv[2] - }; - }, - hasFlashPlayerVersion: ao, - createSWF: function (a, b, c) { - if (ah.w3) { - return aA(a, b, c); - } else { - return undefined; - } - }, - showExpressInstall: function (b, a, d, c) { - if (ah.w3 && au()) { - ae(b, a, d, c); - } - }, - removeSWF: function (a) { - if (ah.w3) { - aw(a); - } - }, - createCSS: function (b, a, c, d) { - if (ah.w3) { - az(b, a, c, d); - } - }, - addDomLoadEvent: aj, - addLoadEvent: aC, - getQueryParamValue: function (b) { - var a = aL.location.search || aL.location.hash; - if (a) { - if (/\?/.test(a)) { - a = a.split("?")[1]; - } - if (b == null) { - return ai(a); - } - var c = a.split("&"); - for (var d = 0; d < c.length; d++) { - if (c[d].substring(0, c[d].indexOf("=")) == b) { - return ai(c[d].substring((c[d].indexOf("=") + 1))); - } - } - } - return ""; - }, - expressInstallCallback: function () { - if (aU) { - var a = aS(ac); - if (a && aJ) { - a.parentNode.replaceChild(aJ, a); - if (ad) { - ay(ad, true); - if (ah.ie && ah.win) { - aJ.style.display = "block"; - } - } - if (ap) { - ap(at); - } - } - aU = false; - } - } - }; -}(); -var SWFUpload; -if (SWFUpload == undefined) { - SWFUpload = function (b) { - this.initSWFUpload(b); - }; -} -SWFUpload.prototype.initSWFUpload = function (c) { - try { - this.customSettings = {}; - this.settings = c; - this.eventQueue = []; - this.movieName = "SWFUpload_" + SWFUpload.movieCount++; - this.movieElement = null; - SWFUpload.instances[this.movieName] = this; - this.initSettings(); - this.loadFlash(); - this.displayDebugInfo(); - } catch (d) { - delete SWFUpload.instances[this.movieName]; - throw d; - } -}; -SWFUpload.instances = {}; -SWFUpload.movieCount = 0; -SWFUpload.version = "2.2.0 2009-03-25"; -SWFUpload.QUEUE_ERROR = { - QUEUE_LIMIT_EXCEEDED: -100, - FILE_EXCEEDS_SIZE_LIMIT: -110, - ZERO_BYTE_FILE: -120, - INVALID_FILETYPE: -130 -}; -SWFUpload.UPLOAD_ERROR = { - HTTP_ERROR: -200, - MISSING_UPLOAD_URL: -210, - IO_ERROR: -220, - SECURITY_ERROR: -230, - UPLOAD_LIMIT_EXCEEDED: -240, - UPLOAD_FAILED: -250, - SPECIFIED_FILE_ID_NOT_FOUND: -260, - FILE_VALIDATION_FAILED: -270, - FILE_CANCELLED: -280, - UPLOAD_STOPPED: -290 -}; -SWFUpload.FILE_STATUS = { - QUEUED: -1, - IN_PROGRESS: -2, - ERROR: -3, - COMPLETE: -4, - CANCELLED: -5 -}; -SWFUpload.BUTTON_ACTION = { - SELECT_FILE: -100, - SELECT_FILES: -110, - START_UPLOAD: -120 -}; -SWFUpload.CURSOR = { - ARROW: -1, - HAND: -2 -}; -SWFUpload.WINDOW_MODE = { - WINDOW: "window", - TRANSPARENT: "transparent", - OPAQUE: "opaque" -}; -SWFUpload.completeURL = function (e) { - if (typeof(e) !== "string" || e.match(/^https?:\/\//i) || e.match(/^\//)) { - return e; - } - var f = window.location.protocol + "//" + window.location.hostname + (window.location.port ? ":" + window.location.port : ""); - var d = window.location.pathname.lastIndexOf("/"); - if (d <= 0) { - path = "/"; - } else { - path = window.location.pathname.substr(0, d) + "/"; - } - return path + e; -}; -SWFUpload.prototype.initSettings = function () { - this.ensureDefault = function (c, d) { - this.settings[c] = (this.settings[c] == undefined) ? d : this.settings[c]; - }; - this.ensureDefault("upload_url", ""); - this.ensureDefault("preserve_relative_urls", false); - this.ensureDefault("file_post_name", "Filedata"); - this.ensureDefault("post_params", {}); - this.ensureDefault("use_query_string", false); - this.ensureDefault("requeue_on_error", false); - this.ensureDefault("http_success", []); - this.ensureDefault("assume_success_timeout", 0); - this.ensureDefault("file_types", "*.*"); - this.ensureDefault("file_types_description", "All Files"); - this.ensureDefault("file_size_limit", 0); - this.ensureDefault("file_upload_limit", 0); - this.ensureDefault("file_queue_limit", 0); - this.ensureDefault("flash_url", "swfupload.swf"); - this.ensureDefault("prevent_swf_caching", true); - this.ensureDefault("button_image_url", ""); - this.ensureDefault("button_width", 1); - this.ensureDefault("button_height", 1); - this.ensureDefault("button_text", ""); - this.ensureDefault("button_text_style", "color: #000000; font-size: 16pt;"); - this.ensureDefault("button_text_top_padding", 0); - this.ensureDefault("button_text_left_padding", 0); - this.ensureDefault("button_action", SWFUpload.BUTTON_ACTION.SELECT_FILES); - this.ensureDefault("button_disabled", false); - this.ensureDefault("button_placeholder_id", ""); - this.ensureDefault("button_placeholder", null); - this.ensureDefault("button_cursor", SWFUpload.CURSOR.ARROW); - this.ensureDefault("button_window_mode", SWFUpload.WINDOW_MODE.WINDOW); - this.ensureDefault("debug", false); - this.settings.debug_enabled = this.settings.debug; - this.settings.return_upload_start_handler = this.returnUploadStart; - this.ensureDefault("swfupload_loaded_handler", null); - this.ensureDefault("file_dialog_start_handler", null); - this.ensureDefault("file_queued_handler", null); - this.ensureDefault("file_queue_error_handler", null); - this.ensureDefault("file_dialog_complete_handler", null); - this.ensureDefault("upload_start_handler", null); - this.ensureDefault("upload_progress_handler", null); - this.ensureDefault("upload_error_handler", null); - this.ensureDefault("upload_success_handler", null); - this.ensureDefault("upload_complete_handler", null); - this.ensureDefault("debug_handler", this.debugMessage); - this.ensureDefault("custom_settings", {}); - this.customSettings = this.settings.custom_settings; - if ( !! this.settings.prevent_swf_caching) { - this.settings.flash_url = this.settings.flash_url + (this.settings.flash_url.indexOf("?") < 0 ? "?" : "&") + "preventswfcaching=" + new Date().getTime(); - } - if (!this.settings.preserve_relative_urls) { - this.settings.upload_url = SWFUpload.completeURL(this.settings.upload_url); - this.settings.button_image_url = SWFUpload.completeURL(this.settings.button_image_url); - } - delete this.ensureDefault; -}; -SWFUpload.prototype.loadFlash = function () { - var d, c; - if (document.getElementById(this.movieName) !== null) { - throw "ID " + this.movieName + " is already in use. The Flash Object could not be added"; - } - d = document.getElementById(this.settings.button_placeholder_id) || this.settings.button_placeholder; - if (d == undefined) { - throw "Could not find the placeholder element: " + this.settings.button_placeholder_id; - } - c = document.createElement("div"); - c.innerHTML = this.getFlashHTML(); - d.parentNode.replaceChild(c.firstChild, d); - if (window[this.movieName] == undefined) { - window[this.movieName] = this.getMovieElement(); - } -}; -SWFUpload.prototype.getFlashHTML = function () { - return ['', '', '', '', '', '', '', ""].join(""); -}; -SWFUpload.prototype.getFlashVars = function () { - var c = this.buildParamString(); - var d = this.settings.http_success.join(","); - return ["movieName=", encodeURIComponent(this.movieName), "&uploadURL=", encodeURIComponent(this.settings.upload_url), "&useQueryString=", encodeURIComponent(this.settings.use_query_string), "&requeueOnError=", encodeURIComponent(this.settings.requeue_on_error), "&httpSuccess=", encodeURIComponent(d), "&assumeSuccessTimeout=", encodeURIComponent(this.settings.assume_success_timeout), "&params=", encodeURIComponent(c), "&filePostName=", encodeURIComponent(this.settings.file_post_name), "&fileTypes=", encodeURIComponent(this.settings.file_types), "&fileTypesDescription=", encodeURIComponent(this.settings.file_types_description), "&fileSizeLimit=", encodeURIComponent(this.settings.file_size_limit), "&fileUploadLimit=", encodeURIComponent(this.settings.file_upload_limit), "&fileQueueLimit=", encodeURIComponent(this.settings.file_queue_limit), "&debugEnabled=", encodeURIComponent(this.settings.debug_enabled), "&buttonImageURL=", encodeURIComponent(this.settings.button_image_url), "&buttonWidth=", encodeURIComponent(this.settings.button_width), "&buttonHeight=", encodeURIComponent(this.settings.button_height), "&buttonText=", encodeURIComponent(this.settings.button_text), "&buttonTextTopPadding=", encodeURIComponent(this.settings.button_text_top_padding), "&buttonTextLeftPadding=", encodeURIComponent(this.settings.button_text_left_padding), "&buttonTextStyle=", encodeURIComponent(this.settings.button_text_style), "&buttonAction=", encodeURIComponent(this.settings.button_action), "&buttonDisabled=", encodeURIComponent(this.settings.button_disabled), "&buttonCursor=", encodeURIComponent(this.settings.button_cursor)].join(""); -}; -SWFUpload.prototype.getMovieElement = function () { - if (this.movieElement == undefined) { - this.movieElement = document.getElementById(this.movieName); - } - if (this.movieElement === null) { - throw "Could not find Flash element"; - } - return this.movieElement; -}; -SWFUpload.prototype.buildParamString = function () { - var f = this.settings.post_params; - var d = []; - if (typeof(f) === "object") { - for (var e in f) { - if (f.hasOwnProperty(e)) { - d.push(encodeURIComponent(e.toString()) + "=" + encodeURIComponent(f[e].toString())); - } - } - } - return d.join("&"); -}; -SWFUpload.prototype.destroy = function () { - try { - this.cancelUpload(null, false); - var g = null; - g = this.getMovieElement(); - if (g && typeof(g.CallFunction) === "unknown") { - for (var j in g) { - try { - if (typeof(g[j]) === "function") { - g[j] = null; - } - } catch (h) {} - } - try { - g.parentNode.removeChild(g); - } catch (f) {} - } - window[this.movieName] = null; - SWFUpload.instances[this.movieName] = null; - delete SWFUpload.instances[this.movieName]; - this.movieElement = null; - this.settings = null; - this.customSettings = null; - this.eventQueue = null; - this.movieName = null; - return true; - } catch (i) { - return false; - } -}; -SWFUpload.prototype.displayDebugInfo = function () { - this.debug(["---SWFUpload Instance Info---\n", "Version: ", SWFUpload.version, "\n", "Movie Name: ", this.movieName, "\n", "Settings:\n", "\t", "upload_url: ", this.settings.upload_url, "\n", "\t", "flash_url: ", this.settings.flash_url, "\n", "\t", "use_query_string: ", this.settings.use_query_string.toString(), "\n", "\t", "requeue_on_error: ", this.settings.requeue_on_error.toString(), "\n", "\t", "http_success: ", this.settings.http_success.join(", "), "\n", "\t", "assume_success_timeout: ", this.settings.assume_success_timeout, "\n", "\t", "file_post_name: ", this.settings.file_post_name, "\n", "\t", "post_params: ", this.settings.post_params.toString(), "\n", "\t", "file_types: ", this.settings.file_types, "\n", "\t", "file_types_description: ", this.settings.file_types_description, "\n", "\t", "file_size_limit: ", this.settings.file_size_limit, "\n", "\t", "file_upload_limit: ", this.settings.file_upload_limit, "\n", "\t", "file_queue_limit: ", this.settings.file_queue_limit, "\n", "\t", "debug: ", this.settings.debug.toString(), "\n", "\t", "prevent_swf_caching: ", this.settings.prevent_swf_caching.toString(), "\n", "\t", "button_placeholder_id: ", this.settings.button_placeholder_id.toString(), "\n", "\t", "button_placeholder: ", (this.settings.button_placeholder ? "Set" : "Not Set"), "\n", "\t", "button_image_url: ", this.settings.button_image_url.toString(), "\n", "\t", "button_width: ", this.settings.button_width.toString(), "\n", "\t", "button_height: ", this.settings.button_height.toString(), "\n", "\t", "button_text: ", this.settings.button_text.toString(), "\n", "\t", "button_text_style: ", this.settings.button_text_style.toString(), "\n", "\t", "button_text_top_padding: ", this.settings.button_text_top_padding.toString(), "\n", "\t", "button_text_left_padding: ", this.settings.button_text_left_padding.toString(), "\n", "\t", "button_action: ", this.settings.button_action.toString(), "\n", "\t", "button_disabled: ", this.settings.button_disabled.toString(), "\n", "\t", "custom_settings: ", this.settings.custom_settings.toString(), "\n", "Event Handlers:\n", "\t", "swfupload_loaded_handler assigned: ", (typeof this.settings.swfupload_loaded_handler === "function").toString(), "\n", "\t", "file_dialog_start_handler assigned: ", (typeof this.settings.file_dialog_start_handler === "function").toString(), "\n", "\t", "file_queued_handler assigned: ", (typeof this.settings.file_queued_handler === "function").toString(), "\n", "\t", "file_queue_error_handler assigned: ", (typeof this.settings.file_queue_error_handler === "function").toString(), "\n", "\t", "upload_start_handler assigned: ", (typeof this.settings.upload_start_handler === "function").toString(), "\n", "\t", "upload_progress_handler assigned: ", (typeof this.settings.upload_progress_handler === "function").toString(), "\n", "\t", "upload_error_handler assigned: ", (typeof this.settings.upload_error_handler === "function").toString(), "\n", "\t", "upload_success_handler assigned: ", (typeof this.settings.upload_success_handler === "function").toString(), "\n", "\t", "upload_complete_handler assigned: ", (typeof this.settings.upload_complete_handler === "function").toString(), "\n", "\t", "debug_handler assigned: ", (typeof this.settings.debug_handler === "function").toString(), "\n"].join("")); -}; -SWFUpload.prototype.addSetting = function (d, f, e) { - if (f == undefined) { - return (this.settings[d] = e); - } else { - return (this.settings[d] = f); - } -}; -SWFUpload.prototype.getSetting = function (b) { - if (this.settings[b] != undefined) { - return this.settings[b]; - } - return ""; -}; -SWFUpload.prototype.callFlash = function (functionName, argumentArray) { - argumentArray = argumentArray || []; - var movieElement = this.getMovieElement(); - var returnValue, returnString; - try { - returnString = movieElement.CallFunction('' + __flash__argumentsToXML(argumentArray, 0) + ""); - returnValue = eval(returnString); - } catch (ex) { - throw "Call to " + functionName + " failed"; - } - if (returnValue != undefined && typeof returnValue.post === "object") { - returnValue = this.unescapeFilePostParams(returnValue); - } - return returnValue; -}; -SWFUpload.prototype.selectFile = function () { - this.callFlash("SelectFile"); -}; -SWFUpload.prototype.selectFiles = function () { - this.callFlash("SelectFiles"); -}; -SWFUpload.prototype.startUpload = function (b) { - this.callFlash("StartUpload", [b]); -}; -SWFUpload.prototype.cancelUpload = function (d, c) { - if (c !== false) { - c = true; - } - this.callFlash("CancelUpload", [d, c]); -}; -SWFUpload.prototype.stopUpload = function () { - this.callFlash("StopUpload"); -}; -SWFUpload.prototype.getStats = function () { - return this.callFlash("GetStats"); -}; -SWFUpload.prototype.setStats = function (b) { - this.callFlash("SetStats", [b]); -}; -SWFUpload.prototype.getFile = function (b) { - if (typeof(b) === "number") { - return this.callFlash("GetFileByIndex", [b]); - } else { - return this.callFlash("GetFile", [b]); - } -}; -SWFUpload.prototype.addFileParam = function (e, d, f) { - return this.callFlash("AddFileParam", [e, d, f]); -}; -SWFUpload.prototype.removeFileParam = function (d, c) { - this.callFlash("RemoveFileParam", [d, c]); -}; -SWFUpload.prototype.setUploadURL = function (b) { - this.settings.upload_url = b.toString(); - this.callFlash("SetUploadURL", [b]); -}; -SWFUpload.prototype.setPostParams = function (b) { - this.settings.post_params = b; - this.callFlash("SetPostParams", [b]); -}; -SWFUpload.prototype.addPostParam = function (d, c) { - this.settings.post_params[d] = c; - this.callFlash("SetPostParams", [this.settings.post_params]); -}; -SWFUpload.prototype.removePostParam = function (b) { - delete this.settings.post_params[b]; - this.callFlash("SetPostParams", [this.settings.post_params]); -}; -SWFUpload.prototype.setFileTypes = function (d, c) { - this.settings.file_types = d; - this.settings.file_types_description = c; - this.callFlash("SetFileTypes", [d, c]); -}; -SWFUpload.prototype.setFileSizeLimit = function (b) { - this.settings.file_size_limit = b; - this.callFlash("SetFileSizeLimit", [b]); -}; -SWFUpload.prototype.setFileUploadLimit = function (b) { - this.settings.file_upload_limit = b; - this.callFlash("SetFileUploadLimit", [b]); -}; -SWFUpload.prototype.setFileQueueLimit = function (b) { - this.settings.file_queue_limit = b; - this.callFlash("SetFileQueueLimit", [b]); -}; -SWFUpload.prototype.setFilePostName = function (b) { - this.settings.file_post_name = b; - this.callFlash("SetFilePostName", [b]); -}; -SWFUpload.prototype.setUseQueryString = function (b) { - this.settings.use_query_string = b; - this.callFlash("SetUseQueryString", [b]); -}; -SWFUpload.prototype.setRequeueOnError = function (b) { - this.settings.requeue_on_error = b; - this.callFlash("SetRequeueOnError", [b]); -}; -SWFUpload.prototype.setHTTPSuccess = function (b) { - if (typeof b === "string") { - b = b.replace(" ", "").split(","); - } - this.settings.http_success = b; - this.callFlash("SetHTTPSuccess", [b]); -}; -SWFUpload.prototype.setAssumeSuccessTimeout = function (b) { - this.settings.assume_success_timeout = b; - this.callFlash("SetAssumeSuccessTimeout", [b]); -}; -SWFUpload.prototype.setDebugEnabled = function (b) { - this.settings.debug_enabled = b; - this.callFlash("SetDebugEnabled", [b]); -}; -SWFUpload.prototype.setButtonImageURL = function (b) { - if (b == undefined) { - b = ""; - } - this.settings.button_image_url = b; - this.callFlash("SetButtonImageURL", [b]); -}; -SWFUpload.prototype.setButtonDimensions = function (f, e) { - this.settings.button_width = f; - this.settings.button_height = e; - var d = this.getMovieElement(); - if (d != undefined) { - d.style.width = f + "px"; - d.style.height = e + "px"; - } - this.callFlash("SetButtonDimensions", [f, e]); -}; -SWFUpload.prototype.setButtonText = function (b) { - this.settings.button_text = b; - this.callFlash("SetButtonText", [b]); -}; -SWFUpload.prototype.setButtonTextPadding = function (c, d) { - this.settings.button_text_top_padding = d; - this.settings.button_text_left_padding = c; - this.callFlash("SetButtonTextPadding", [c, d]); -}; -SWFUpload.prototype.setButtonTextStyle = function (b) { - this.settings.button_text_style = b; - this.callFlash("SetButtonTextStyle", [b]); -}; -SWFUpload.prototype.setButtonDisabled = function (b) { - this.settings.button_disabled = b; - this.callFlash("SetButtonDisabled", [b]); -}; -SWFUpload.prototype.setButtonAction = function (b) { - this.settings.button_action = b; - this.callFlash("SetButtonAction", [b]); -}; -SWFUpload.prototype.setButtonCursor = function (b) { - this.settings.button_cursor = b; - this.callFlash("SetButtonCursor", [b]); -}; -SWFUpload.prototype.queueEvent = function (d, f) { - if (f == undefined) { - f = []; - } else { - if (!(f instanceof Array)) { - f = [f]; - } - } - var e = this; - if (typeof this.settings[d] === "function") { - this.eventQueue.push(function () { - this.settings[d].apply(this, f); - }); - setTimeout(function () { - e.executeNextEvent(); - }, 0); - } else { - if (this.settings[d] !== null) { - throw "Event handler " + d + " is unknown or is not a function"; - } - } -}; -SWFUpload.prototype.executeNextEvent = function () { - var b = this.eventQueue ? this.eventQueue.shift() : null; - if (typeof(b) === "function") { - b.apply(this); - } -}; -SWFUpload.prototype.unescapeFilePostParams = function (l) { - var j = /[$]([0-9a-f]{4})/i; - var i = {}; - var k; - if (l != undefined) { - for (var h in l.post) { - if (l.post.hasOwnProperty(h)) { - k = h; - var g; - while ((g = j.exec(k)) !== null) { - k = k.replace(g[0], String.fromCharCode(parseInt("0x" + g[1], 16))); - } - i[k] = l.post[h]; - } - } - l.post = i; - } - return l; -}; -SWFUpload.prototype.testExternalInterface = function () { - try { - return this.callFlash("TestExternalInterface"); - } catch (b) { - return false; - } -}; -SWFUpload.prototype.flashReady = function () { - var b = this.getMovieElement(); - if (!b) { - this.debug("Flash called back ready but the flash movie can't be found."); - return; - } - this.cleanUp(b); - this.queueEvent("swfupload_loaded_handler"); -}; -SWFUpload.prototype.cleanUp = function (f) { - try { - if (this.movieElement && typeof(f.CallFunction) === "unknown") { - this.debug("Removing Flash functions hooks (this should only run in IE and should prevent memory leaks)"); - for (var h in f) { - try { - if (typeof(f[h]) === "function") { - f[h] = null; - } - } catch (e) {} - } - } - } catch (g) {} - window.__flash__removeCallback = function (c, b) { - try { - if (c) { - c[b] = null; - } - } catch (a) {} - }; -}; -SWFUpload.prototype.fileDialogStart = function () { - this.queueEvent("file_dialog_start_handler"); -}; -SWFUpload.prototype.fileQueued = function (b) { - b = this.unescapeFilePostParams(b); - this.queueEvent("file_queued_handler", b); -}; -SWFUpload.prototype.fileQueueError = function (e, f, d) { - e = this.unescapeFilePostParams(e); - this.queueEvent("file_queue_error_handler", [e, f, d]); -}; -SWFUpload.prototype.fileDialogComplete = function (d, f, e) { - this.queueEvent("file_dialog_complete_handler", [d, f, e]); -}; -SWFUpload.prototype.uploadStart = function (b) { - b = this.unescapeFilePostParams(b); - this.queueEvent("return_upload_start_handler", b); -}; -SWFUpload.prototype.returnUploadStart = function (d) { - var c; - if (typeof this.settings.upload_start_handler === "function") { - d = this.unescapeFilePostParams(d); - c = this.settings.upload_start_handler.call(this, d); - } else { - if (this.settings.upload_start_handler != undefined) { - throw "upload_start_handler must be a function"; - } - } - if (c === undefined) { - c = true; - } - c = !! c; - this.callFlash("ReturnUploadStart", [c]); -}; -SWFUpload.prototype.uploadProgress = function (e, f, d) { - e = this.unescapeFilePostParams(e); - this.queueEvent("upload_progress_handler", [e, f, d]); -}; -SWFUpload.prototype.uploadError = function (e, f, d) { - e = this.unescapeFilePostParams(e); - this.queueEvent("upload_error_handler", [e, f, d]); -}; -SWFUpload.prototype.uploadSuccess = function (d, e, f) { - d = this.unescapeFilePostParams(d); - this.queueEvent("upload_success_handler", [d, e, f]); -}; -SWFUpload.prototype.uploadComplete = function (b) { - b = this.unescapeFilePostParams(b); - this.queueEvent("upload_complete_handler", b); -}; -SWFUpload.prototype.debug = function (b) { - this.queueEvent("debug_handler", b); -}; -SWFUpload.prototype.debugMessage = function (h) { - if (this.settings.debug) { - var f, g = []; - if (typeof h === "object" && typeof h.name === "string" && typeof h.message === "string") { - for (var e in h) { - if (h.hasOwnProperty(e)) { - g.push(e + ": " + h[e]); - } - } - f = g.join("\n") || ""; - g = f.split("\n"); - f = "EXCEPTION: " + g.join("\nEXCEPTION: "); - SWFUpload.Console.writeLine(f); - } else { - SWFUpload.Console.writeLine(h); - } - } -}; -SWFUpload.Console = {}; -SWFUpload.Console.writeLine = function (g) { - var e, f; - try { - e = document.getElementById("SWFUpload_Console"); - if (!e) { - f = document.createElement("form"); - document.getElementsByTagName("body")[0].appendChild(f); - e = document.createElement("textarea"); - e.id = "SWFUpload_Console"; - e.style.fontFamily = "monospace"; - e.setAttribute("wrap", "off"); - e.wrap = "off"; - e.style.overflow = "auto"; - e.style.width = "700px"; - e.style.height = "350px"; - e.style.margin = "5px"; - f.appendChild(e); - } - e.value += g + "\n"; - e.scrollTop = e.scrollHeight - e.clientHeight; - } catch (h) { - alert("Exception: " + h.name + " Message: " + h.message); - } -}; -(function (c) { - var b = { - init: function (d, e) { - return this.each(function () { - var n = c(this); - var m = n.clone(); - var j = c.extend({ - id: n.attr("id"), - swf: "uploadify.swf", - uploader: "uploadify.php", - auto: true, - buttonClass: "", - buttonCursor: "hand", - buttonImage: null, - buttonText: "SELECT FILES", - checkExisting: false, - debug: false, - fileObjName: "Filedata", - fileSizeLimit: 0, - fileTypeDesc: "All Files", - fileTypeExts: "*.*", - height: 30, - method: "post", - multi: true, - formData: {}, - preventCaching: true, - progressData: "percentage", - queueID: false, - queueSizeLimit: 999, - removeCompleted: true, - removeTimeout: 3, - requeueErrors: false, - successTimeout: 30, - uploadLimit: 0, - width: 120, - overrideEvents: [] - }, d); - var g = { - assume_success_timeout: j.successTimeout, - button_placeholder_id: j.id, - button_width: j.width, - button_height: j.height, - button_text: null, - button_text_style: null, - button_text_top_padding: 0, - button_text_left_padding: 0, - button_action: (j.multi ? SWFUpload.BUTTON_ACTION.SELECT_FILES : SWFUpload.BUTTON_ACTION.SELECT_FILE), - button_disabled: false, - button_cursor: (j.buttonCursor == "arrow" ? SWFUpload.CURSOR.ARROW : SWFUpload.CURSOR.HAND), - button_window_mode: SWFUpload.WINDOW_MODE.TRANSPARENT, - debug: j.debug, - requeue_on_error: j.requeueErrors, - file_post_name: j.fileObjName, - file_size_limit: j.fileSizeLimit, - file_types: j.fileTypeExts, - file_types_description: j.fileTypeDesc, - file_queue_limit: j.queueSizeLimit, - file_upload_limit: j.uploadLimit, - flash_url: j.swf, - prevent_swf_caching: j.preventCaching, - post_params: j.formData, - upload_url: j.uploader, - use_query_string: (j.method == "get"), - file_dialog_complete_handler: a.onDialogClose, - file_dialog_start_handler: a.onDialogOpen, - file_queued_handler: a.onSelect, - file_queue_error_handler: a.onSelectError, - swfupload_loaded_handler: j.onSWFReady, - upload_complete_handler: a.onUploadComplete, - upload_error_handler: a.onUploadError, - upload_progress_handler: a.onUploadProgress, - upload_start_handler: a.onUploadStart, - upload_success_handler: a.onUploadSuccess - }; - if (e) { - g = c.extend(g, e); - } - g = c.extend(g, j); - var o = swfobject.getFlashPlayerVersion(); - var h = (o.major >= 9); - if (h) { - window["uploadify_" + j.id] = new SWFUpload(g); - var i = window["uploadify_" + j.id]; - n.data("uploadify", i); - var l = c("
", { - id: j.id, - "class": "uploadify", - css: { - height: j.height + "px", - width: j.width + "px" - } - }); - c("#" + i.movieName).wrap(l); - l = c("#" + j.id); - l.data("uploadify", i); - var f = c("
", { - id: j.id + "-button", - "class": "uploadify-button " + j.buttonClass - }); - if (j.buttonImage) { - f.css({ - "background-image": "url('" + j.buttonImage + "')", - "text-indent": "-9999px" - }); - } - f.html('' + j.buttonText + "").css({ - height: j.height + "px", - "line-height": j.height + "px", - width: j.width + "px" - }); - l.append(f); - c("#" + i.movieName).css({ - position: "absolute", - "z-index": 1 - }); - if (!j.queueID) { - var k = c("
", { - id: j.id + "-queue", - "class": "uploadify-queue" - }); - l.after(k); - i.settings.queueID = j.id + "-queue"; - i.settings.defaultQueue = true; - } - i.queueData = { - files: {}, - filesSelected: 0, - filesQueued: 0, - filesReplaced: 0, - filesCancelled: 0, - filesErrored: 0, - uploadsSuccessful: 0, - uploadsErrored: 0, - averageSpeed: 0, - queueLength: 0, - queueSize: 0, - uploadSize: 0, - queueBytesUploaded: 0, - uploadQueue: [], - errorMsg: "Some files were not added to the queue:" - }; - i.original = m; - i.wrapper = l; - i.button = f; - i.queue = k; - if (j.onInit) { - j.onInit.call(n, i); - } - } else { - if (j.onFallback) { - j.onFallback.call(n); - } - } - }); - }, - cancel: function (d, f) { - var e = arguments; - this.each(function () { - var l = c(this), - i = l.data("uploadify"), - j = i.settings, - h = -1; - if (e[0]) { - if (e[0] == "*") { - var g = i.queueData.queueLength; - c("#" + j.queueID).find(".uploadify-queue-item").each(function () { - h++; - if (e[1] === true) { - i.cancelUpload(c(this).attr("id"), false); - } else { - i.cancelUpload(c(this).attr("id")); - } - c(this).find(".data").removeClass("data").html(" - Cancelled"); - c(this).find(".uploadify-progress-bar").remove(); - c(this).delay(1000 + 100 * h).fadeOut(500, function () { - c(this).remove(); - }); - }); - i.queueData.queueSize = 0; - i.queueData.queueLength = 0; - if (j.onClearQueue) { - j.onClearQueue.call(l, g); - } - } else { - for (var m = 0; m < e.length; m++) { - i.cancelUpload(e[m]); - c("#" + e[m]).find(".data").removeClass("data").html(" - Cancelled"); - c("#" + e[m]).find(".uploadify-progress-bar").remove(); - c("#" + e[m]).delay(1000 + 100 * m).fadeOut(500, function () { - c(this).remove(); - }); - } - } - } else { - var k = c("#" + j.queueID).find(".uploadify-queue-item").get(0); - $item = c(k); - i.cancelUpload($item.attr("id")); - $item.find(".data").removeClass("data").html(" - Cancelled"); - $item.find(".uploadify-progress-bar").remove(); - $item.delay(1000).fadeOut(500, function () { - c(this).remove(); - }); - } - }); - }, - destroy: function () { - this.each(function () { - var f = c(this), - d = f.data("uploadify"), - e = d.settings; - d.destroy(); - if (e.defaultQueue) { - c("#" + e.queueID).remove(); - } - c("#" + e.id).replaceWith(d.original); - if (e.onDestroy) { - e.onDestroy.call(this); - } - delete d; - }); - }, - disable: function (d) { - this.each(function () { - var g = c(this), - e = g.data("uploadify"), - f = e.settings; - if (d) { - e.button.addClass("disabled"); - if (f.onDisable) { - f.onDisable.call(this); - } - } else { - e.button.removeClass("disabled"); - if (f.onEnable) { - f.onEnable.call(this); - } - } - e.setButtonDisabled(d); - }); - }, - settings: function (e, g, h) { - var d = arguments; - var f = g; - this.each(function () { - var k = c(this), - i = k.data("uploadify"), - j = i.settings; - if (typeof(d[0]) == "object") { - for (var l in g) { - setData(l, g[l]); - } - } - if (d.length === 1) { - f = j[e]; - } else { - switch (e) { - case "uploader": - i.setUploadURL(g); - break; - case "formData": - if (!h) { - g = c.extend(j.formData, g); - } - i.setPostParams(j.formData); - break; - case "method": - if (g == "get") { - i.setUseQueryString(true); - } else { - i.setUseQueryString(false); - } - break; - case "fileObjName": - i.setFilePostName(g); - break; - case "fileTypeExts": - i.setFileTypes(g, j.fileTypeDesc); - break; - case "fileTypeDesc": - i.setFileTypes(j.fileTypeExts, g); - break; - case "fileSizeLimit": - i.setFileSizeLimit(g); - break; - case "uploadLimit": - i.setFileUploadLimit(g); - break; - case "queueSizeLimit": - i.setFileQueueLimit(g); - break; - case "buttonImage": - i.button.css("background-image", settingValue); - break; - case "buttonCursor": - if (g == "arrow") { - i.setButtonCursor(SWFUpload.CURSOR.ARROW); - } else { - i.setButtonCursor(SWFUpload.CURSOR.HAND); - } - break; - case "buttonText": - c("#" + j.id + "-button").find(".uploadify-button-text").html(g); - break; - case "width": - i.setButtonDimensions(g, j.height); - break; - case "height": - i.setButtonDimensions(j.width, g); - break; - case "multi": - if (g) { - i.setButtonAction(SWFUpload.BUTTON_ACTION.SELECT_FILES); - } else { - i.setButtonAction(SWFUpload.BUTTON_ACTION.SELECT_FILE); - } - break; - } - j[e] = g; - } - }); - if (d.length === 1) { - return f; - } - }, - stop: function () { - this.each(function () { - var e = c(this), - d = e.data("uploadify"); - d.queueData.averageSpeed = 0; - d.queueData.uploadSize = 0; - d.queueData.bytesUploaded = 0; - d.queueData.uploadQueue = []; - d.stopUpload(); - }); - }, - upload: function () { - var d = arguments; - this.each(function () { - var f = c(this), - e = f.data("uploadify"); - e.queueData.averageSpeed = 0; - e.queueData.uploadSize = 0; - e.queueData.bytesUploaded = 0; - e.queueData.uploadQueue = []; - if (d[0]) { - if (d[0] == "*") { - e.queueData.uploadSize = e.queueData.queueSize; - e.queueData.uploadQueue.push("*"); - e.startUpload(); - } else { - for (var g = 0; g < d.length; g++) { - e.queueData.uploadSize += e.queueData.files[d[g]].size; - e.queueData.uploadQueue.push(d[g]); - } - e.startUpload(e.queueData.uploadQueue.shift()); - } - } else { - e.startUpload(); - } - }); - } - }; - var a = { - onDialogOpen: function () { - var d = this.settings; - this.queueData.errorMsg = "Some files were not added to the queue:"; - this.queueData.filesReplaced = 0; - this.queueData.filesCancelled = 0; - if (d.onDialogOpen) { - d.onDialogOpen.call(this); - } - }, - onDialogClose: function (d, f, g) { - var e = this.settings; - this.queueData.filesErrored = d - f; - this.queueData.filesSelected = d; - this.queueData.filesQueued = f - this.queueData.filesCancelled; - this.queueData.queueLength = g; - if (c.inArray("onDialogClose", e.overrideEvents) < 0) { - if (this.queueData.filesErrored > 0) { - alert(this.queueData.errorMsg); - } - } - if (e.onDialogClose) { - e.onDialogClose.call(this, this.queueData); - } - if (e.auto) { - c("#" + e.id).uploadify("upload", "*"); - } - }, - onSelect: function (g) { - var h = this.settings; - var e = {}; - for (var f in this.queueData.files) { - e = this.queueData.files[f]; - if (e.uploaded != true && e.name == g.name) { - var d = confirm('The file named "' + g.name + '" is already in the queue.\nDo you want to replace the existing item in the queue?'); - if (!d) { - this.cancelUpload(g.id); - this.queueData.filesCancelled++; - return false; - } else { - c("#" + e.id).remove(); - this.cancelUpload(e.id); - this.queueData.filesReplaced++; - } - } - } - var i = Math.round(g.size / 1024); - var l = "KB"; - if (i > 1000) { - i = Math.round(i / 1000); - l = "MB"; - } - var k = i.toString().split("."); - i = k[0]; - if (k.length > 1) { - i += "." + k[1].substr(0, 2); - } - i += l; - var j = g.name; - if (j.length > 25) { - j = j.substr(0, 25) + "..."; - } - if (c.inArray("onSelect", h.overrideEvents) < 0) { - c("#" + h.queueID).append('
X
' + j + " (" + i + ')
'); - } - this.queueData.queueSize += g.size; - this.queueData.files[g.id] = g; - if (h.onSelect) { - h.onSelect.apply(this, arguments); - } - }, - onSelectError: function (d, g, f) { - var e = this.settings; - if (c.inArray("onSelectError", e.overrideEvents) < 0) { - switch (g) { - case SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED: - if (e.queueSizeLimit > f) { - this.queueData.errorMsg += "\nThe number of files selected exceeds the remaining upload limit (" + f + ")."; - } else { - this.queueData.errorMsg += "\nThe number of files selected exceeds the queue size limit (" + e.queueSizeLimit + ")."; - } - break; - case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT: - this.queueData.errorMsg += '\nThe file "' + d.name + '" exceeds the size limit (' + e.fileSizeLimit + ")."; - break; - case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE: - this.queueData.errorMsg += '\nThe file "' + d.name + '" is empty.'; - break; - case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT: - this.queueData.errorMsg += '\nThe file "' + d.name + '" is not an accepted file type (' + e.fileTypeDesc + ")."; - break; - } - } - if (g != SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED) { - delete this.queueData.files[d.id]; - } - if (e.onSelectError) { - e.onSelectError.apply(this, arguments); - } - }, - onQueueComplete: function () { - if (this.settings.onQueueComplete) { - this.settings.onQueueComplete.call(this, this.settings.queueData); - } - }, - onUploadComplete: function (f) { - var g = this.settings, - d = this; - var e = this.getStats(); - this.queueData.queueLength = e.files_queued; - if (this.queueData.uploadQueue[0] == "*") { - if (this.queueData.queueLength > 0) { - this.startUpload(); - } else { - this.queueData.uploadQueue = []; - if (g.onQueueComplete) { - g.onQueueComplete.call(this, this.queueData); - } - } - } else { - if (this.queueData.uploadQueue.length > 0) { - this.startUpload(this.queueData.uploadQueue.shift()); - } else { - this.queueData.uploadQueue = []; - if (g.onQueueComplete) { - g.onQueueComplete.call(this, this.queueData); - } - } - } - if (c.inArray("onUploadComplete", g.overrideEvents) < 0) { - if (g.removeCompleted) { - switch (f.filestatus) { - case SWFUpload.FILE_STATUS.COMPLETE: - setTimeout(function () { - if (c("#" + f.id)) { - d.queueData.queueSize -= f.size; - d.queueData.queueLength -= 1; - delete d.queueData.files[f.id]; - c("#" + f.id).fadeOut(500, function () { - c(this).remove(); - }); - } - }, g.removeTimeout * 1000); - break; - case SWFUpload.FILE_STATUS.ERROR: - if (!g.requeueErrors) { - setTimeout(function () { - if (c("#" + f.id)) { - d.queueData.queueSize -= f.size; - d.queueData.queueLength -= 1; - delete d.queueData.files[f.id]; - c("#" + f.id).fadeOut(500, function () { - c(this).remove(); - }); - } - }, g.removeTimeout * 1000); - } - break; - } - } else { - f.uploaded = true; - } - } - if (g.onUploadComplete) { - g.onUploadComplete.call(this, f); - } - }, - onUploadError: function (e, i, h) { - var f = this.settings; - var g = "Error"; - switch (i) { - case SWFUpload.UPLOAD_ERROR.HTTP_ERROR: - g = "HTTP Error (" + h + ")"; - break; - case SWFUpload.UPLOAD_ERROR.MISSING_UPLOAD_URL: - g = "Missing Upload URL"; - break; - case SWFUpload.UPLOAD_ERROR.IO_ERROR: - g = "IO Error"; - break; - case SWFUpload.UPLOAD_ERROR.SECURITY_ERROR: - g = "Security Error"; - break; - case SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED: - alert("The upload limit has been reached (" + h + ")."); - g = "Exceeds Upload Limit"; - break; - case SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED: - g = "Failed"; - break; - case SWFUpload.UPLOAD_ERROR.SPECIFIED_FILE_ID_NOT_FOUND: - break; - case SWFUpload.UPLOAD_ERROR.FILE_VALIDATION_FAILED: - g = "Validation Error"; - break; - case SWFUpload.UPLOAD_ERROR.FILE_CANCELLED: - g = "Cancelled"; - this.queueData.queueSize -= e.size; - this.queueData.queueLength -= 1; - if (e.status == SWFUpload.FILE_STATUS.IN_PROGRESS || c.inArray(e.id, this.queueData.uploadQueue) >= 0) { - this.queueData.uploadSize -= e.size; - } - if (f.onCancel) { - f.onCancel.call(this, e); - } - delete this.queueData.files[e.id]; - break; - case SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED: - g = "Stopped"; - break; - } - if (c.inArray("onUploadError", f.overrideEvents) < 0) { - if (i != SWFUpload.UPLOAD_ERROR.FILE_CANCELLED && i != SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED) { - c("#" + e.id).addClass("uploadify-error"); - } - c("#" + e.id).find(".uploadify-progress-bar").css("width", "1px"); - if (i != SWFUpload.UPLOAD_ERROR.SPECIFIED_FILE_ID_NOT_FOUND && e.status != SWFUpload.FILE_STATUS.COMPLETE) { - c("#" + e.id).find(".data").html(" - " + g); - } - } - var d = this.getStats(); - this.queueData.uploadsErrored = d.upload_errors; - if (f.onUploadError) { - f.onUploadError.call(this, e, i, h, g); - } - }, - onUploadProgress: function (g, m, j) { - var h = this.settings; - var e = new Date(); - var n = e.getTime(); - var k = n - this.timer; - if (k > 500) { - this.timer = n; - } - var i = m - this.bytesLoaded; - this.bytesLoaded = m; - var d = this.queueData.queueBytesUploaded + m; - var p = Math.round(m / j * 100); - var o = "KB/s"; - var l = 0; - var f = (i / 1024) / (k / 1000); - f = Math.floor(f * 10) / 10; - if (this.queueData.averageSpeed > 0) { - this.queueData.averageSpeed = Math.floor((this.queueData.averageSpeed + f) / 2); - } else { - this.queueData.averageSpeed = Math.floor(f); - } - if (f > 1000) { - l = (f * 0.001); - this.queueData.averageSpeed = Math.floor(l); - o = "MB/s"; - } - if (c.inArray("onUploadProgress", h.overrideEvents) < 0) { - if (h.progressData == "percentage") { - c("#" + g.id).find(".data").html(" - " + p + "%"); - } else { - if (h.progressData == "speed" && k > 500) { - c("#" + g.id).find(".data").html(" - " + this.queueData.averageSpeed + o); - } - } - c("#" + g.id).find(".uploadify-progress-bar").css("width", p + "%"); - } - if (h.onUploadProgress) { - h.onUploadProgress.call(this, g, m, j, d, this.queueData.uploadSize); - } - }, - onUploadStart: function (d) { - var e = this.settings; - var f = new Date(); - this.timer = f.getTime(); - this.bytesLoaded = 0; - if (this.queueData.uploadQueue.length == 0) { - this.queueData.uploadSize = d.size; - } - if (e.checkExisting) { - c.ajax({ - type: "POST", - async: false, - url: e.checkExisting, - data: { - filename: d.name - }, - success: function (h) { - if (h == 1) { - var g = confirm('A file with the name "' + d.name + '" already exists on the server.\nWould you like to replace the existing file?'); - if (!g) { - this.cancelUpload(d.id); - c("#" + d.id).remove(); - if (this.queueData.uploadQueue.length > 0 && this.queueData.queueLength > 0) { - if (this.queueData.uploadQueue[0] == "*") { - this.startUpload(); - } else { - this.startUpload(this.queueData.uploadQueue.shift()); - } - } - } - } - } - }); - } - if (e.onUploadStart) { - e.onUploadStart.call(this, d); - } - }, - onUploadSuccess: function (f, h, d) { - var g = this.settings; - var e = this.getStats(); - this.queueData.uploadsSuccessful = e.successful_uploads; - this.queueData.queueBytesUploaded += f.size; - if (c.inArray("onUploadSuccess", g.overrideEvents) < 0) { - c("#" + f.id).find(".data").html(" - Complete"); - } - if (g.onUploadSuccess) { - g.onUploadSuccess.call(this, f, h, d); - } - } - }; - c.fn.uploadify = function (d) { - if (b[d]) { - return b[d].apply(this, Array.prototype.slice.call(arguments, 1)); - } else { - if (typeof d === "object" || !d) { - return b.init.apply(this, arguments); - } else { - c.error("The method " + d + " does not exist in $.uploadify"); - } - } - }; +/* +Uploadify v3.1.1 +Copyright (c) 2012 Reactive Apps, Ronnie Garcia +Released under the MIT License + +SWFUpload: http://www.swfupload.org, http://swfupload.googlecode.com +mmSWFUpload 1.0: Flash upload dialog - http://profandesign.se/swfupload/, http://www.vinterwebb.se/ +SWFUpload is (c) 2006-2007 Lars Huring, Olov Nilzén and Mammon Media and is released under the MIT License: +http://www.opensource.org/licenses/mit-license.php +SWFUpload 2 is (c) 2007-2008 Jake Roberts and is released under the MIT License: +http://www.opensource.org/licenses/mit-license.php + +SWFObject v2.2 +is released under the MIT License +*/ +; +var swfobject = function () { + var aq = "undefined", + aD = "object", + ab = "Shockwave Flash", + X = "ShockwaveFlash.ShockwaveFlash", + aE = "application/x-shockwave-flash", + ac = "SWFObjectExprInst", + ax = "onreadystatechange", + af = window, + aL = document, + aB = navigator, + aa = false, + Z = [aN], + aG = [], + ag = [], + al = [], + aJ, ad, ap, at, ak = false, + aU = false, + aH, an, aI = true, + ah = function () { + var a = typeof aL.getElementById != aq && typeof aL.getElementsByTagName != aq && typeof aL.createElement != aq, + e = aB.userAgent.toLowerCase(), + c = aB.platform.toLowerCase(), + h = c ? /win/.test(c) : /win/.test(e), + j = c ? /mac/.test(c) : /mac/.test(e), + g = /webkit/.test(e) ? parseFloat(e.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, + d = !+"\v1", + f = [0, 0, 0], + k = null; + if (typeof aB.plugins != aq && typeof aB.plugins[ab] == aD) { + k = aB.plugins[ab].description; + if (k && !(typeof aB.mimeTypes != aq && aB.mimeTypes[aE] && !aB.mimeTypes[aE].enabledPlugin)) { + aa = true; + d = false; + k = k.replace(/^.*\s+(\S+\s+\S+$)/, "$1"); + f[0] = parseInt(k.replace(/^(.*)\..*$/, "$1"), 10); + f[1] = parseInt(k.replace(/^.*\.(.*)\s.*$/, "$1"), 10); + f[2] = /[a-zA-Z]/.test(k) ? parseInt(k.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0; + } + } else { + if (typeof af.ActiveXObject != aq) { + try { + var i = new ActiveXObject(X); + if (i) { + k = i.GetVariable("$version"); + if (k) { + d = true; + k = k.split(" ")[1].split(","); + f = [parseInt(k[0], 10), parseInt(k[1], 10), parseInt(k[2], 10)]; + } + } + } catch (b) {} + } + } + return { + w3: a, + pv: f, + wk: g, + ie: d, + win: h, + mac: j + }; + }(), + aK = function () { + if (!ah.w3) { + return; + } + if ((typeof aL.readyState != aq && aL.readyState == "complete") || (typeof aL.readyState == aq && (aL.getElementsByTagName("body")[0] || aL.body))) { + aP(); + } + if (!ak) { + if (typeof aL.addEventListener != aq) { + aL.addEventListener("DOMContentLoaded", aP, false); + } + if (ah.ie && ah.win) { + aL.attachEvent(ax, function () { + if (aL.readyState == "complete") { + aL.detachEvent(ax, arguments.callee); + aP(); + } + }); + if (af == top) { + (function () { + if (ak) { + return; + } + try { + aL.documentElement.doScroll("left"); + } catch (a) { + setTimeout(arguments.callee, 0); + return; + } + aP(); + })(); + } + } + if (ah.wk) { + (function () { + if (ak) { + return; + } + if (!/loaded|complete/.test(aL.readyState)) { + setTimeout(arguments.callee, 0); + return; + } + aP(); + })(); + } + aC(aP); + } + }(); + + function aP() { + if (ak) { + return; + } + try { + var b = aL.getElementsByTagName("body")[0].appendChild(ar("span")); + b.parentNode.removeChild(b); + } catch (a) { + return; + } + ak = true; + var d = Z.length; + for (var c = 0; c < d; c++) { + Z[c](); + } + } + function aj(a) { + if (ak) { + a(); + } else { + Z[Z.length] = a; + } + } + function aC(a) { + if (typeof af.addEventListener != aq) { + af.addEventListener("load", a, false); + } else { + if (typeof aL.addEventListener != aq) { + aL.addEventListener("load", a, false); + } else { + if (typeof af.attachEvent != aq) { + aM(af, "onload", a); + } else { + if (typeof af.onload == "function") { + var b = af.onload; + af.onload = function () { + b(); + a(); + }; + } else { + af.onload = a; + } + } + } + } + } + function aN() { + if (aa) { + Y(); + } else { + am(); + } + } + function Y() { + var d = aL.getElementsByTagName("body")[0]; + var b = ar(aD); + b.setAttribute("type", aE); + var a = d.appendChild(b); + if (a) { + var c = 0; + (function () { + if (typeof a.GetVariable != aq) { + var e = a.GetVariable("$version"); + if (e) { + e = e.split(" ")[1].split(","); + ah.pv = [parseInt(e[0], 10), parseInt(e[1], 10), parseInt(e[2], 10)]; + } + } else { + if (c < 10) { + c++; + setTimeout(arguments.callee, 10); + return; + } + } + d.removeChild(b); + a = null; + am(); + })(); + } else { + am(); + } + } + function am() { + var g = aG.length; + if (g > 0) { + for (var h = 0; h < g; h++) { + var c = aG[h].id; + var l = aG[h].callbackFn; + var a = { + success: false, + id: c + }; + if (ah.pv[0] > 0) { + var i = aS(c); + if (i) { + if (ao(aG[h].swfVersion) && !(ah.wk && ah.wk < 312)) { + ay(c, true); + if (l) { + a.success = true; + a.ref = av(c); + l(a); + } + } else { + if (aG[h].expressInstall && au()) { + var e = {}; + e.data = aG[h].expressInstall; + e.width = i.getAttribute("width") || "0"; + e.height = i.getAttribute("height") || "0"; + if (i.getAttribute("class")) { + e.styleclass = i.getAttribute("class"); + } + if (i.getAttribute("align")) { + e.align = i.getAttribute("align"); + } + var f = {}; + var d = i.getElementsByTagName("param"); + var k = d.length; + for (var j = 0; j < k; j++) { + if (d[j].getAttribute("name").toLowerCase() != "movie") { + f[d[j].getAttribute("name")] = d[j].getAttribute("value"); + } + } + ae(e, f, c, l); + } else { + aF(i); + if (l) { + l(a); + } + } + } + } + } else { + ay(c, true); + if (l) { + var b = av(c); + if (b && typeof b.SetVariable != aq) { + a.success = true; + a.ref = b; + } + l(a); + } + } + } + } + } + function av(b) { + var d = null; + var c = aS(b); + if (c && c.nodeName == "OBJECT") { + if (typeof c.SetVariable != aq) { + d = c; + } else { + var a = c.getElementsByTagName(aD)[0]; + if (a) { + d = a; + } + } + } + return d; + } + function au() { + return !aU && ao("6.0.65") && (ah.win || ah.mac) && !(ah.wk && ah.wk < 312); + } + function ae(f, d, h, e) { + aU = true; + ap = e || null; + at = { + success: false, + id: h + }; + var a = aS(h); + if (a) { + if (a.nodeName == "OBJECT") { + aJ = aO(a); + ad = null; + } else { + aJ = a; + ad = h; + } + f.id = ac; + if (typeof f.width == aq || (!/%$/.test(f.width) && parseInt(f.width, 10) < 310)) { + f.width = "310"; + } + if (typeof f.height == aq || (!/%$/.test(f.height) && parseInt(f.height, 10) < 137)) { + f.height = "137"; + } + aL.title = aL.title.slice(0, 47) + " - Flash Player Installation"; + var b = ah.ie && ah.win ? "ActiveX" : "PlugIn", + c = "MMredirectURL=" + af.location.toString().replace(/&/g, "%26") + "&MMplayerType=" + b + "&MMdoctitle=" + aL.title; + if (typeof d.flashvars != aq) { + d.flashvars += "&" + c; + } else { + d.flashvars = c; + } + if (ah.ie && ah.win && a.readyState != 4) { + var g = ar("div"); + h += "SWFObjectNew"; + g.setAttribute("id", h); + a.parentNode.insertBefore(g, a); + a.style.display = "none"; + (function () { + if (a.readyState == 4) { + a.parentNode.removeChild(a); + } else { + setTimeout(arguments.callee, 10); + } + })(); + } + aA(f, d, h); + } + } + function aF(a) { + if (ah.ie && ah.win && a.readyState != 4) { + var b = ar("div"); + a.parentNode.insertBefore(b, a); + b.parentNode.replaceChild(aO(a), b); + a.style.display = "none"; + (function () { + if (a.readyState == 4) { + a.parentNode.removeChild(a); + } else { + setTimeout(arguments.callee, 10); + } + })(); + } else { + a.parentNode.replaceChild(aO(a), a); + } + } + function aO(b) { + var d = ar("div"); + if (ah.win && ah.ie) { + d.innerHTML = b.innerHTML; + } else { + var e = b.getElementsByTagName(aD)[0]; + if (e) { + var a = e.childNodes; + if (a) { + var f = a.length; + for (var c = 0; c < f; c++) { + if (!(a[c].nodeType == 1 && a[c].nodeName == "PARAM") && !(a[c].nodeType == 8)) { + d.appendChild(a[c].cloneNode(true)); + } + } + } + } + } + return d; + } + function aA(e, g, c) { + var d, a = aS(c); + if (ah.wk && ah.wk < 312) { + return d; + } + if (a) { + if (typeof e.id == aq) { + e.id = c; + } + if (ah.ie && ah.win) { + var f = ""; + for (var i in e) { + if (e[i] != Object.prototype[i]) { + if (i.toLowerCase() == "data") { + g.movie = e[i]; + } else { + if (i.toLowerCase() == "styleclass") { + f += ' class="' + e[i] + '"'; + } else { + if (i.toLowerCase() != "classid") { + f += " " + i + '="' + e[i] + '"'; + } + } + } + } + } + var h = ""; + for (var j in g) { + if (g[j] != Object.prototype[j]) { + h += ''; + } + } + a.outerHTML = '" + h + ""; + ag[ag.length] = e.id; + d = aS(e.id); + } else { + var b = ar(aD); + b.setAttribute("type", aE); + for (var k in e) { + if (e[k] != Object.prototype[k]) { + if (k.toLowerCase() == "styleclass") { + b.setAttribute("class", e[k]); + } else { + if (k.toLowerCase() != "classid") { + b.setAttribute(k, e[k]); + } + } + } + } + for (var l in g) { + if (g[l] != Object.prototype[l] && l.toLowerCase() != "movie") { + aQ(b, l, g[l]); + } + } + a.parentNode.replaceChild(b, a); + d = b; + } + } + return d; + } + function aQ(b, d, c) { + var a = ar("param"); + a.setAttribute("name", d); + a.setAttribute("value", c); + b.appendChild(a); + } + function aw(a) { + var b = aS(a); + if (b && b.nodeName == "OBJECT") { + if (ah.ie && ah.win) { + b.style.display = "none"; + (function () { + if (b.readyState == 4) { + aT(a); + } else { + setTimeout(arguments.callee, 10); + } + })(); + } else { + b.parentNode.removeChild(b); + } + } + } + function aT(a) { + var b = aS(a); + if (b) { + for (var c in b) { + if (typeof b[c] == "function") { + b[c] = null; + } + } + b.parentNode.removeChild(b); + } + } + function aS(a) { + var c = null; + try { + c = aL.getElementById(a); + } catch (b) {} + return c; + } + function ar(a) { + return aL.createElement(a); + } + function aM(a, c, b) { + a.attachEvent(c, b); + al[al.length] = [a, c, b]; + } + function ao(a) { + var b = ah.pv, + c = a.split("."); + c[0] = parseInt(c[0], 10); + c[1] = parseInt(c[1], 10) || 0; + c[2] = parseInt(c[2], 10) || 0; + return (b[0] > c[0] || (b[0] == c[0] && b[1] > c[1]) || (b[0] == c[0] && b[1] == c[1] && b[2] >= c[2])) ? true : false; + } + function az(b, f, a, c) { + if (ah.ie && ah.mac) { + return; + } + var e = aL.getElementsByTagName("head")[0]; + if (!e) { + return; + } + var g = (a && typeof a == "string") ? a : "screen"; + if (c) { + aH = null; + an = null; + } + if (!aH || an != g) { + var d = ar("style"); + d.setAttribute("type", "text/css"); + d.setAttribute("media", g); + aH = e.appendChild(d); + if (ah.ie && ah.win && typeof aL.styleSheets != aq && aL.styleSheets.length > 0) { + aH = aL.styleSheets[aL.styleSheets.length - 1]; + } + an = g; + } + if (ah.ie && ah.win) { + if (aH && typeof aH.addRule == aD) { + aH.addRule(b, f); + } + } else { + if (aH && typeof aL.createTextNode != aq) { + aH.appendChild(aL.createTextNode(b + " {" + f + "}")); + } + } + } + function ay(a, c) { + if (!aI) { + return; + } + var b = c ? "visible" : "hidden"; + if (ak && aS(a)) { + aS(a).style.visibility = b; + } else { + az("#" + a, "visibility:" + b); + } + } + function ai(b) { + var a = /[\\\"<>\.;]/; + var c = a.exec(b) != null; + return c && typeof encodeURIComponent != aq ? encodeURIComponent(b) : b; + } + var aR = function () { + if (ah.ie && ah.win) { + window.attachEvent("onunload", function () { + var a = al.length; + for (var b = 0; b < a; b++) { + al[b][0].detachEvent(al[b][1], al[b][2]); + } + var d = ag.length; + for (var c = 0; c < d; c++) { + aw(ag[c]); + } + for (var e in ah) { + ah[e] = null; + } + ah = null; + for (var f in swfobject) { + swfobject[f] = null; + } + swfobject = null; + }); + } + }(); + return { + registerObject: function (a, e, c, b) { + if (ah.w3 && a && e) { + var d = {}; + d.id = a; + d.swfVersion = e; + d.expressInstall = c; + d.callbackFn = b; + aG[aG.length] = d; + ay(a, false); + } else { + if (b) { + b({ + success: false, + id: a + }); + } + } + }, + getObjectById: function (a) { + if (ah.w3) { + return av(a); + } + }, + embedSWF: function (k, e, h, f, c, a, b, i, g, j) { + var d = { + success: false, + id: e + }; + if (ah.w3 && !(ah.wk && ah.wk < 312) && k && e && h && f && c) { + ay(e, false); + aj(function () { + h += ""; + f += ""; + var q = {}; + if (g && typeof g === aD) { + for (var o in g) { + q[o] = g[o]; + } + } + q.data = k; + q.width = h; + q.height = f; + var n = {}; + if (i && typeof i === aD) { + for (var p in i) { + n[p] = i[p]; + } + } + if (b && typeof b === aD) { + for (var l in b) { + if (typeof n.flashvars != aq) { + n.flashvars += "&" + l + "=" + b[l]; + } else { + n.flashvars = l + "=" + b[l]; + } + } + } + if (ao(c)) { + var m = aA(q, n, e); + if (q.id == e) { + ay(e, true); + } + d.success = true; + d.ref = m; + } else { + if (a && au()) { + q.data = a; + ae(q, n, e, j); + return; + } else { + ay(e, true); + } + } + if (j) { + j(d); + } + }); + } else { + if (j) { + j(d); + } + } + }, + switchOffAutoHideShow: function () { + aI = false; + }, + ua: ah, + getFlashPlayerVersion: function () { + return { + major: ah.pv[0], + minor: ah.pv[1], + release: ah.pv[2] + }; + }, + hasFlashPlayerVersion: ao, + createSWF: function (a, b, c) { + if (ah.w3) { + return aA(a, b, c); + } else { + return undefined; + } + }, + showExpressInstall: function (b, a, d, c) { + if (ah.w3 && au()) { + ae(b, a, d, c); + } + }, + removeSWF: function (a) { + if (ah.w3) { + aw(a); + } + }, + createCSS: function (b, a, c, d) { + if (ah.w3) { + az(b, a, c, d); + } + }, + addDomLoadEvent: aj, + addLoadEvent: aC, + getQueryParamValue: function (b) { + var a = aL.location.search || aL.location.hash; + if (a) { + if (/\?/.test(a)) { + a = a.split("?")[1]; + } + if (b == null) { + return ai(a); + } + var c = a.split("&"); + for (var d = 0; d < c.length; d++) { + if (c[d].substring(0, c[d].indexOf("=")) == b) { + return ai(c[d].substring((c[d].indexOf("=") + 1))); + } + } + } + return ""; + }, + expressInstallCallback: function () { + if (aU) { + var a = aS(ac); + if (a && aJ) { + a.parentNode.replaceChild(aJ, a); + if (ad) { + ay(ad, true); + if (ah.ie && ah.win) { + aJ.style.display = "block"; + } + } + if (ap) { + ap(at); + } + } + aU = false; + } + } + }; +}(); +var SWFUpload; +if (SWFUpload == undefined) { + SWFUpload = function (b) { + this.initSWFUpload(b); + }; +} +SWFUpload.prototype.initSWFUpload = function (c) { + try { + this.customSettings = {}; + this.settings = c; + this.eventQueue = []; + this.movieName = "SWFUpload_" + SWFUpload.movieCount++; + this.movieElement = null; + SWFUpload.instances[this.movieName] = this; + this.initSettings(); + this.loadFlash(); + this.displayDebugInfo(); + } catch (d) { + delete SWFUpload.instances[this.movieName]; + throw d; + } +}; +SWFUpload.instances = {}; +SWFUpload.movieCount = 0; +SWFUpload.version = "2.2.0 2009-03-25"; +SWFUpload.QUEUE_ERROR = { + QUEUE_LIMIT_EXCEEDED: -100, + FILE_EXCEEDS_SIZE_LIMIT: -110, + ZERO_BYTE_FILE: -120, + INVALID_FILETYPE: -130 +}; +SWFUpload.UPLOAD_ERROR = { + HTTP_ERROR: -200, + MISSING_UPLOAD_URL: -210, + IO_ERROR: -220, + SECURITY_ERROR: -230, + UPLOAD_LIMIT_EXCEEDED: -240, + UPLOAD_FAILED: -250, + SPECIFIED_FILE_ID_NOT_FOUND: -260, + FILE_VALIDATION_FAILED: -270, + FILE_CANCELLED: -280, + UPLOAD_STOPPED: -290 +}; +SWFUpload.FILE_STATUS = { + QUEUED: -1, + IN_PROGRESS: -2, + ERROR: -3, + COMPLETE: -4, + CANCELLED: -5 +}; +SWFUpload.BUTTON_ACTION = { + SELECT_FILE: -100, + SELECT_FILES: -110, + START_UPLOAD: -120 +}; +SWFUpload.CURSOR = { + ARROW: -1, + HAND: -2 +}; +SWFUpload.WINDOW_MODE = { + WINDOW: "window", + TRANSPARENT: "transparent", + OPAQUE: "opaque" +}; +SWFUpload.completeURL = function (e) { + if (typeof(e) !== "string" || e.match(/^https?:\/\//i) || e.match(/^\//)) { + return e; + } + var f = window.location.protocol + "//" + window.location.hostname + (window.location.port ? ":" + window.location.port : ""); + var d = window.location.pathname.lastIndexOf("/"); + if (d <= 0) { + path = "/"; + } else { + path = window.location.pathname.substr(0, d) + "/"; + } + return path + e; +}; +SWFUpload.prototype.initSettings = function () { + this.ensureDefault = function (c, d) { + this.settings[c] = (this.settings[c] == undefined) ? d : this.settings[c]; + }; + this.ensureDefault("upload_url", ""); + this.ensureDefault("preserve_relative_urls", false); + this.ensureDefault("file_post_name", "Filedata"); + this.ensureDefault("post_params", {}); + this.ensureDefault("use_query_string", false); + this.ensureDefault("requeue_on_error", false); + this.ensureDefault("http_success", []); + this.ensureDefault("assume_success_timeout", 0); + this.ensureDefault("file_types", "*.*"); + this.ensureDefault("file_types_description", "All Files"); + this.ensureDefault("file_size_limit", 0); + this.ensureDefault("file_upload_limit", 0); + this.ensureDefault("file_queue_limit", 0); + this.ensureDefault("flash_url", "swfupload.swf"); + this.ensureDefault("prevent_swf_caching", true); + this.ensureDefault("button_image_url", ""); + this.ensureDefault("button_width", 1); + this.ensureDefault("button_height", 1); + this.ensureDefault("button_text", ""); + this.ensureDefault("button_text_style", "color: #000000; font-size: 16pt;"); + this.ensureDefault("button_text_top_padding", 0); + this.ensureDefault("button_text_left_padding", 0); + this.ensureDefault("button_action", SWFUpload.BUTTON_ACTION.SELECT_FILES); + this.ensureDefault("button_disabled", false); + this.ensureDefault("button_placeholder_id", ""); + this.ensureDefault("button_placeholder", null); + this.ensureDefault("button_cursor", SWFUpload.CURSOR.ARROW); + this.ensureDefault("button_window_mode", SWFUpload.WINDOW_MODE.WINDOW); + this.ensureDefault("debug", false); + this.settings.debug_enabled = this.settings.debug; + this.settings.return_upload_start_handler = this.returnUploadStart; + this.ensureDefault("swfupload_loaded_handler", null); + this.ensureDefault("file_dialog_start_handler", null); + this.ensureDefault("file_queued_handler", null); + this.ensureDefault("file_queue_error_handler", null); + this.ensureDefault("file_dialog_complete_handler", null); + this.ensureDefault("upload_start_handler", null); + this.ensureDefault("upload_progress_handler", null); + this.ensureDefault("upload_error_handler", null); + this.ensureDefault("upload_success_handler", null); + this.ensureDefault("upload_complete_handler", null); + this.ensureDefault("debug_handler", this.debugMessage); + this.ensureDefault("custom_settings", {}); + this.customSettings = this.settings.custom_settings; + if ( !! this.settings.prevent_swf_caching) { + this.settings.flash_url = this.settings.flash_url + (this.settings.flash_url.indexOf("?") < 0 ? "?" : "&") + "preventswfcaching=" + new Date().getTime(); + } + if (!this.settings.preserve_relative_urls) { + this.settings.upload_url = SWFUpload.completeURL(this.settings.upload_url); + this.settings.button_image_url = SWFUpload.completeURL(this.settings.button_image_url); + } + delete this.ensureDefault; +}; +SWFUpload.prototype.loadFlash = function () { + var d, c; + if (document.getElementById(this.movieName) !== null) { + throw "ID " + this.movieName + " is already in use. The Flash Object could not be added"; + } + d = document.getElementById(this.settings.button_placeholder_id) || this.settings.button_placeholder; + if (d == undefined) { + throw "Could not find the placeholder element: " + this.settings.button_placeholder_id; + } + c = document.createElement("div"); + c.innerHTML = this.getFlashHTML(); + d.parentNode.replaceChild(c.firstChild, d); + if (window[this.movieName] == undefined) { + window[this.movieName] = this.getMovieElement(); + } +}; +SWFUpload.prototype.getFlashHTML = function () { + return ['', '', '', '', '', '', '', ""].join(""); +}; +SWFUpload.prototype.getFlashVars = function () { + var c = this.buildParamString(); + var d = this.settings.http_success.join(","); + return ["movieName=", encodeURIComponent(this.movieName), "&uploadURL=", encodeURIComponent(this.settings.upload_url), "&useQueryString=", encodeURIComponent(this.settings.use_query_string), "&requeueOnError=", encodeURIComponent(this.settings.requeue_on_error), "&httpSuccess=", encodeURIComponent(d), "&assumeSuccessTimeout=", encodeURIComponent(this.settings.assume_success_timeout), "&params=", encodeURIComponent(c), "&filePostName=", encodeURIComponent(this.settings.file_post_name), "&fileTypes=", encodeURIComponent(this.settings.file_types), "&fileTypesDescription=", encodeURIComponent(this.settings.file_types_description), "&fileSizeLimit=", encodeURIComponent(this.settings.file_size_limit), "&fileUploadLimit=", encodeURIComponent(this.settings.file_upload_limit), "&fileQueueLimit=", encodeURIComponent(this.settings.file_queue_limit), "&debugEnabled=", encodeURIComponent(this.settings.debug_enabled), "&buttonImageURL=", encodeURIComponent(this.settings.button_image_url), "&buttonWidth=", encodeURIComponent(this.settings.button_width), "&buttonHeight=", encodeURIComponent(this.settings.button_height), "&buttonText=", encodeURIComponent(this.settings.button_text), "&buttonTextTopPadding=", encodeURIComponent(this.settings.button_text_top_padding), "&buttonTextLeftPadding=", encodeURIComponent(this.settings.button_text_left_padding), "&buttonTextStyle=", encodeURIComponent(this.settings.button_text_style), "&buttonAction=", encodeURIComponent(this.settings.button_action), "&buttonDisabled=", encodeURIComponent(this.settings.button_disabled), "&buttonCursor=", encodeURIComponent(this.settings.button_cursor)].join(""); +}; +SWFUpload.prototype.getMovieElement = function () { + if (this.movieElement == undefined) { + this.movieElement = document.getElementById(this.movieName); + } + if (this.movieElement === null) { + throw "Could not find Flash element"; + } + return this.movieElement; +}; +SWFUpload.prototype.buildParamString = function () { + var f = this.settings.post_params; + var d = []; + if (typeof(f) === "object") { + for (var e in f) { + if (f.hasOwnProperty(e)) { + d.push(encodeURIComponent(e.toString()) + "=" + encodeURIComponent(f[e].toString())); + } + } + } + return d.join("&"); +}; +SWFUpload.prototype.destroy = function () { + try { + this.cancelUpload(null, false); + var g = null; + g = this.getMovieElement(); + if (g && typeof(g.CallFunction) === "unknown") { + for (var j in g) { + try { + if (typeof(g[j]) === "function") { + g[j] = null; + } + } catch (h) {} + } + try { + g.parentNode.removeChild(g); + } catch (f) {} + } + window[this.movieName] = null; + SWFUpload.instances[this.movieName] = null; + delete SWFUpload.instances[this.movieName]; + this.movieElement = null; + this.settings = null; + this.customSettings = null; + this.eventQueue = null; + this.movieName = null; + return true; + } catch (i) { + return false; + } +}; +SWFUpload.prototype.displayDebugInfo = function () { + this.debug(["---SWFUpload Instance Info---\n", "Version: ", SWFUpload.version, "\n", "Movie Name: ", this.movieName, "\n", "Settings:\n", "\t", "upload_url: ", this.settings.upload_url, "\n", "\t", "flash_url: ", this.settings.flash_url, "\n", "\t", "use_query_string: ", this.settings.use_query_string.toString(), "\n", "\t", "requeue_on_error: ", this.settings.requeue_on_error.toString(), "\n", "\t", "http_success: ", this.settings.http_success.join(", "), "\n", "\t", "assume_success_timeout: ", this.settings.assume_success_timeout, "\n", "\t", "file_post_name: ", this.settings.file_post_name, "\n", "\t", "post_params: ", this.settings.post_params.toString(), "\n", "\t", "file_types: ", this.settings.file_types, "\n", "\t", "file_types_description: ", this.settings.file_types_description, "\n", "\t", "file_size_limit: ", this.settings.file_size_limit, "\n", "\t", "file_upload_limit: ", this.settings.file_upload_limit, "\n", "\t", "file_queue_limit: ", this.settings.file_queue_limit, "\n", "\t", "debug: ", this.settings.debug.toString(), "\n", "\t", "prevent_swf_caching: ", this.settings.prevent_swf_caching.toString(), "\n", "\t", "button_placeholder_id: ", this.settings.button_placeholder_id.toString(), "\n", "\t", "button_placeholder: ", (this.settings.button_placeholder ? "Set" : "Not Set"), "\n", "\t", "button_image_url: ", this.settings.button_image_url.toString(), "\n", "\t", "button_width: ", this.settings.button_width.toString(), "\n", "\t", "button_height: ", this.settings.button_height.toString(), "\n", "\t", "button_text: ", this.settings.button_text.toString(), "\n", "\t", "button_text_style: ", this.settings.button_text_style.toString(), "\n", "\t", "button_text_top_padding: ", this.settings.button_text_top_padding.toString(), "\n", "\t", "button_text_left_padding: ", this.settings.button_text_left_padding.toString(), "\n", "\t", "button_action: ", this.settings.button_action.toString(), "\n", "\t", "button_disabled: ", this.settings.button_disabled.toString(), "\n", "\t", "custom_settings: ", this.settings.custom_settings.toString(), "\n", "Event Handlers:\n", "\t", "swfupload_loaded_handler assigned: ", (typeof this.settings.swfupload_loaded_handler === "function").toString(), "\n", "\t", "file_dialog_start_handler assigned: ", (typeof this.settings.file_dialog_start_handler === "function").toString(), "\n", "\t", "file_queued_handler assigned: ", (typeof this.settings.file_queued_handler === "function").toString(), "\n", "\t", "file_queue_error_handler assigned: ", (typeof this.settings.file_queue_error_handler === "function").toString(), "\n", "\t", "upload_start_handler assigned: ", (typeof this.settings.upload_start_handler === "function").toString(), "\n", "\t", "upload_progress_handler assigned: ", (typeof this.settings.upload_progress_handler === "function").toString(), "\n", "\t", "upload_error_handler assigned: ", (typeof this.settings.upload_error_handler === "function").toString(), "\n", "\t", "upload_success_handler assigned: ", (typeof this.settings.upload_success_handler === "function").toString(), "\n", "\t", "upload_complete_handler assigned: ", (typeof this.settings.upload_complete_handler === "function").toString(), "\n", "\t", "debug_handler assigned: ", (typeof this.settings.debug_handler === "function").toString(), "\n"].join("")); +}; +SWFUpload.prototype.addSetting = function (d, f, e) { + if (f == undefined) { + return (this.settings[d] = e); + } else { + return (this.settings[d] = f); + } +}; +SWFUpload.prototype.getSetting = function (b) { + if (this.settings[b] != undefined) { + return this.settings[b]; + } + return ""; +}; +SWFUpload.prototype.callFlash = function (functionName, argumentArray) { + argumentArray = argumentArray || []; + var movieElement = this.getMovieElement(); + var returnValue, returnString; + try { + returnString = movieElement.CallFunction('' + __flash__argumentsToXML(argumentArray, 0) + ""); + returnValue = eval(returnString); + } catch (ex) { + throw "Call to " + functionName + " failed"; + } + if (returnValue != undefined && typeof returnValue.post === "object") { + returnValue = this.unescapeFilePostParams(returnValue); + } + return returnValue; +}; +SWFUpload.prototype.selectFile = function () { + this.callFlash("SelectFile"); +}; +SWFUpload.prototype.selectFiles = function () { + this.callFlash("SelectFiles"); +}; +SWFUpload.prototype.startUpload = function (b) { + this.callFlash("StartUpload", [b]); +}; +SWFUpload.prototype.cancelUpload = function (d, c) { + if (c !== false) { + c = true; + } + this.callFlash("CancelUpload", [d, c]); +}; +SWFUpload.prototype.stopUpload = function () { + this.callFlash("StopUpload"); +}; +SWFUpload.prototype.getStats = function () { + return this.callFlash("GetStats"); +}; +SWFUpload.prototype.setStats = function (b) { + this.callFlash("SetStats", [b]); +}; +SWFUpload.prototype.getFile = function (b) { + if (typeof(b) === "number") { + return this.callFlash("GetFileByIndex", [b]); + } else { + return this.callFlash("GetFile", [b]); + } +}; +SWFUpload.prototype.addFileParam = function (e, d, f) { + return this.callFlash("AddFileParam", [e, d, f]); +}; +SWFUpload.prototype.removeFileParam = function (d, c) { + this.callFlash("RemoveFileParam", [d, c]); +}; +SWFUpload.prototype.setUploadURL = function (b) { + this.settings.upload_url = b.toString(); + this.callFlash("SetUploadURL", [b]); +}; +SWFUpload.prototype.setPostParams = function (b) { + this.settings.post_params = b; + this.callFlash("SetPostParams", [b]); +}; +SWFUpload.prototype.addPostParam = function (d, c) { + this.settings.post_params[d] = c; + this.callFlash("SetPostParams", [this.settings.post_params]); +}; +SWFUpload.prototype.removePostParam = function (b) { + delete this.settings.post_params[b]; + this.callFlash("SetPostParams", [this.settings.post_params]); +}; +SWFUpload.prototype.setFileTypes = function (d, c) { + this.settings.file_types = d; + this.settings.file_types_description = c; + this.callFlash("SetFileTypes", [d, c]); +}; +SWFUpload.prototype.setFileSizeLimit = function (b) { + this.settings.file_size_limit = b; + this.callFlash("SetFileSizeLimit", [b]); +}; +SWFUpload.prototype.setFileUploadLimit = function (b) { + this.settings.file_upload_limit = b; + this.callFlash("SetFileUploadLimit", [b]); +}; +SWFUpload.prototype.setFileQueueLimit = function (b) { + this.settings.file_queue_limit = b; + this.callFlash("SetFileQueueLimit", [b]); +}; +SWFUpload.prototype.setFilePostName = function (b) { + this.settings.file_post_name = b; + this.callFlash("SetFilePostName", [b]); +}; +SWFUpload.prototype.setUseQueryString = function (b) { + this.settings.use_query_string = b; + this.callFlash("SetUseQueryString", [b]); +}; +SWFUpload.prototype.setRequeueOnError = function (b) { + this.settings.requeue_on_error = b; + this.callFlash("SetRequeueOnError", [b]); +}; +SWFUpload.prototype.setHTTPSuccess = function (b) { + if (typeof b === "string") { + b = b.replace(" ", "").split(","); + } + this.settings.http_success = b; + this.callFlash("SetHTTPSuccess", [b]); +}; +SWFUpload.prototype.setAssumeSuccessTimeout = function (b) { + this.settings.assume_success_timeout = b; + this.callFlash("SetAssumeSuccessTimeout", [b]); +}; +SWFUpload.prototype.setDebugEnabled = function (b) { + this.settings.debug_enabled = b; + this.callFlash("SetDebugEnabled", [b]); +}; +SWFUpload.prototype.setButtonImageURL = function (b) { + if (b == undefined) { + b = ""; + } + this.settings.button_image_url = b; + this.callFlash("SetButtonImageURL", [b]); +}; +SWFUpload.prototype.setButtonDimensions = function (f, e) { + this.settings.button_width = f; + this.settings.button_height = e; + var d = this.getMovieElement(); + if (d != undefined) { + d.style.width = f + "px"; + d.style.height = e + "px"; + } + this.callFlash("SetButtonDimensions", [f, e]); +}; +SWFUpload.prototype.setButtonText = function (b) { + this.settings.button_text = b; + this.callFlash("SetButtonText", [b]); +}; +SWFUpload.prototype.setButtonTextPadding = function (c, d) { + this.settings.button_text_top_padding = d; + this.settings.button_text_left_padding = c; + this.callFlash("SetButtonTextPadding", [c, d]); +}; +SWFUpload.prototype.setButtonTextStyle = function (b) { + this.settings.button_text_style = b; + this.callFlash("SetButtonTextStyle", [b]); +}; +SWFUpload.prototype.setButtonDisabled = function (b) { + this.settings.button_disabled = b; + this.callFlash("SetButtonDisabled", [b]); +}; +SWFUpload.prototype.setButtonAction = function (b) { + this.settings.button_action = b; + this.callFlash("SetButtonAction", [b]); +}; +SWFUpload.prototype.setButtonCursor = function (b) { + this.settings.button_cursor = b; + this.callFlash("SetButtonCursor", [b]); +}; +SWFUpload.prototype.queueEvent = function (d, f) { + if (f == undefined) { + f = []; + } else { + if (!(f instanceof Array)) { + f = [f]; + } + } + var e = this; + if (typeof this.settings[d] === "function") { + this.eventQueue.push(function () { + this.settings[d].apply(this, f); + }); + setTimeout(function () { + e.executeNextEvent(); + }, 0); + } else { + if (this.settings[d] !== null) { + throw "Event handler " + d + " is unknown or is not a function"; + } + } +}; +SWFUpload.prototype.executeNextEvent = function () { + var b = this.eventQueue ? this.eventQueue.shift() : null; + if (typeof(b) === "function") { + b.apply(this); + } +}; +SWFUpload.prototype.unescapeFilePostParams = function (l) { + var j = /[$]([0-9a-f]{4})/i; + var i = {}; + var k; + if (l != undefined) { + for (var h in l.post) { + if (l.post.hasOwnProperty(h)) { + k = h; + var g; + while ((g = j.exec(k)) !== null) { + k = k.replace(g[0], String.fromCharCode(parseInt("0x" + g[1], 16))); + } + i[k] = l.post[h]; + } + } + l.post = i; + } + return l; +}; +SWFUpload.prototype.testExternalInterface = function () { + try { + return this.callFlash("TestExternalInterface"); + } catch (b) { + return false; + } +}; +SWFUpload.prototype.flashReady = function () { + var b = this.getMovieElement(); + if (!b) { + this.debug("Flash called back ready but the flash movie can't be found."); + return; + } + this.cleanUp(b); + this.queueEvent("swfupload_loaded_handler"); +}; +SWFUpload.prototype.cleanUp = function (f) { + try { + if (this.movieElement && typeof(f.CallFunction) === "unknown") { + this.debug("Removing Flash functions hooks (this should only run in IE and should prevent memory leaks)"); + for (var h in f) { + try { + if (typeof(f[h]) === "function") { + f[h] = null; + } + } catch (e) {} + } + } + } catch (g) {} + window.__flash__removeCallback = function (c, b) { + try { + if (c) { + c[b] = null; + } + } catch (a) {} + }; +}; +SWFUpload.prototype.fileDialogStart = function () { + this.queueEvent("file_dialog_start_handler"); +}; +SWFUpload.prototype.fileQueued = function (b) { + b = this.unescapeFilePostParams(b); + this.queueEvent("file_queued_handler", b); +}; +SWFUpload.prototype.fileQueueError = function (e, f, d) { + e = this.unescapeFilePostParams(e); + this.queueEvent("file_queue_error_handler", [e, f, d]); +}; +SWFUpload.prototype.fileDialogComplete = function (d, f, e) { + this.queueEvent("file_dialog_complete_handler", [d, f, e]); +}; +SWFUpload.prototype.uploadStart = function (b) { + b = this.unescapeFilePostParams(b); + this.queueEvent("return_upload_start_handler", b); +}; +SWFUpload.prototype.returnUploadStart = function (d) { + var c; + if (typeof this.settings.upload_start_handler === "function") { + d = this.unescapeFilePostParams(d); + c = this.settings.upload_start_handler.call(this, d); + } else { + if (this.settings.upload_start_handler != undefined) { + throw "upload_start_handler must be a function"; + } + } + if (c === undefined) { + c = true; + } + c = !! c; + this.callFlash("ReturnUploadStart", [c]); +}; +SWFUpload.prototype.uploadProgress = function (e, f, d) { + e = this.unescapeFilePostParams(e); + this.queueEvent("upload_progress_handler", [e, f, d]); +}; +SWFUpload.prototype.uploadError = function (e, f, d) { + e = this.unescapeFilePostParams(e); + this.queueEvent("upload_error_handler", [e, f, d]); +}; +SWFUpload.prototype.uploadSuccess = function (d, e, f) { + d = this.unescapeFilePostParams(d); + this.queueEvent("upload_success_handler", [d, e, f]); +}; +SWFUpload.prototype.uploadComplete = function (b) { + b = this.unescapeFilePostParams(b); + this.queueEvent("upload_complete_handler", b); +}; +SWFUpload.prototype.debug = function (b) { + this.queueEvent("debug_handler", b); +}; +SWFUpload.prototype.debugMessage = function (h) { + if (this.settings.debug) { + var f, g = []; + if (typeof h === "object" && typeof h.name === "string" && typeof h.message === "string") { + for (var e in h) { + if (h.hasOwnProperty(e)) { + g.push(e + ": " + h[e]); + } + } + f = g.join("\n") || ""; + g = f.split("\n"); + f = "EXCEPTION: " + g.join("\nEXCEPTION: "); + SWFUpload.Console.writeLine(f); + } else { + SWFUpload.Console.writeLine(h); + } + } +}; +SWFUpload.Console = {}; +SWFUpload.Console.writeLine = function (g) { + var e, f; + try { + e = document.getElementById("SWFUpload_Console"); + if (!e) { + f = document.createElement("form"); + document.getElementsByTagName("body")[0].appendChild(f); + e = document.createElement("textarea"); + e.id = "SWFUpload_Console"; + e.style.fontFamily = "monospace"; + e.setAttribute("wrap", "off"); + e.wrap = "off"; + e.style.overflow = "auto"; + e.style.width = "700px"; + e.style.height = "350px"; + e.style.margin = "5px"; + f.appendChild(e); + } + e.value += g + "\n"; + e.scrollTop = e.scrollHeight - e.clientHeight; + } catch (h) { + alert("Exception: " + h.name + " Message: " + h.message); + } +}; +(function (c) { + var b = { + init: function (d, e) { + return this.each(function () { + var n = c(this); + var m = n.clone(); + var j = c.extend({ + id: n.attr("id"), + swf: "uploadify.swf", + uploader: "uploadify.php", + auto: true, + buttonClass: "", + buttonCursor: "hand", + buttonImage: null, + buttonText: "SELECT FILES", + checkExisting: false, + debug: false, + fileObjName: "Filedata", + fileSizeLimit: 0, + fileTypeDesc: "All Files", + fileTypeExts: "*.*", + height: 30, + method: "post", + multi: true, + formData: {}, + preventCaching: true, + progressData: "percentage", + queueID: false, + queueSizeLimit: 999, + removeCompleted: true, + removeTimeout: 3, + requeueErrors: false, + successTimeout: 30, + uploadLimit: 0, + width: 120, + overrideEvents: [] + }, d); + var g = { + assume_success_timeout: j.successTimeout, + button_placeholder_id: j.id, + button_width: j.width, + button_height: j.height, + button_text: null, + button_text_style: null, + button_text_top_padding: 0, + button_text_left_padding: 0, + button_action: (j.multi ? SWFUpload.BUTTON_ACTION.SELECT_FILES : SWFUpload.BUTTON_ACTION.SELECT_FILE), + button_disabled: false, + button_cursor: (j.buttonCursor == "arrow" ? SWFUpload.CURSOR.ARROW : SWFUpload.CURSOR.HAND), + button_window_mode: SWFUpload.WINDOW_MODE.TRANSPARENT, + debug: j.debug, + requeue_on_error: j.requeueErrors, + file_post_name: j.fileObjName, + file_size_limit: j.fileSizeLimit, + file_types: j.fileTypeExts, + file_types_description: j.fileTypeDesc, + file_queue_limit: j.queueSizeLimit, + file_upload_limit: j.uploadLimit, + flash_url: j.swf, + prevent_swf_caching: j.preventCaching, + post_params: j.formData, + upload_url: j.uploader, + use_query_string: (j.method == "get"), + file_dialog_complete_handler: a.onDialogClose, + file_dialog_start_handler: a.onDialogOpen, + file_queued_handler: a.onSelect, + file_queue_error_handler: a.onSelectError, + swfupload_loaded_handler: j.onSWFReady, + upload_complete_handler: a.onUploadComplete, + upload_error_handler: a.onUploadError, + upload_progress_handler: a.onUploadProgress, + upload_start_handler: a.onUploadStart, + upload_success_handler: a.onUploadSuccess + }; + if (e) { + g = c.extend(g, e); + } + g = c.extend(g, j); + var o = swfobject.getFlashPlayerVersion(); + var h = (o.major >= 9); + if (h) { + window["uploadify_" + j.id] = new SWFUpload(g); + var i = window["uploadify_" + j.id]; + n.data("uploadify", i); + var l = c("
", { + id: j.id, + "class": "uploadify", + css: { + height: j.height + "px", + width: j.width + "px" + } + }); + c("#" + i.movieName).wrap(l); + l = c("#" + j.id); + l.data("uploadify", i); + var f = c("
", { + id: j.id + "-button", + "class": "uploadify-button " + j.buttonClass + }); + if (j.buttonImage) { + f.css({ + "background-image": "url('" + j.buttonImage + "')", + "text-indent": "-9999px" + }); + } + f.html('' + j.buttonText + "").css({ + height: j.height + "px", + "line-height": j.height + "px", + width: j.width + "px" + }); + l.append(f); + c("#" + i.movieName).css({ + position: "absolute", + "z-index": 1 + }); + if (!j.queueID) { + var k = c("
", { + id: j.id + "-queue", + "class": "uploadify-queue" + }); + l.after(k); + i.settings.queueID = j.id + "-queue"; + i.settings.defaultQueue = true; + } + i.queueData = { + files: {}, + filesSelected: 0, + filesQueued: 0, + filesReplaced: 0, + filesCancelled: 0, + filesErrored: 0, + uploadsSuccessful: 0, + uploadsErrored: 0, + averageSpeed: 0, + queueLength: 0, + queueSize: 0, + uploadSize: 0, + queueBytesUploaded: 0, + uploadQueue: [], + errorMsg: "Some files were not added to the queue:" + }; + i.original = m; + i.wrapper = l; + i.button = f; + i.queue = k; + if (j.onInit) { + j.onInit.call(n, i); + } + } else { + if (j.onFallback) { + j.onFallback.call(n); + } + } + }); + }, + cancel: function (d, f) { + var e = arguments; + this.each(function () { + var l = c(this), + i = l.data("uploadify"), + j = i.settings, + h = -1; + if (e[0]) { + if (e[0] == "*") { + var g = i.queueData.queueLength; + c("#" + j.queueID).find(".uploadify-queue-item").each(function () { + h++; + if (e[1] === true) { + i.cancelUpload(c(this).attr("id"), false); + } else { + i.cancelUpload(c(this).attr("id")); + } + c(this).find(".data").removeClass("data").html(" - Cancelled"); + c(this).find(".uploadify-progress-bar").remove(); + c(this).delay(1000 + 100 * h).fadeOut(500, function () { + c(this).remove(); + }); + }); + i.queueData.queueSize = 0; + i.queueData.queueLength = 0; + if (j.onClearQueue) { + j.onClearQueue.call(l, g); + } + } else { + for (var m = 0; m < e.length; m++) { + i.cancelUpload(e[m]); + c("#" + e[m]).find(".data").removeClass("data").html(" - Cancelled"); + c("#" + e[m]).find(".uploadify-progress-bar").remove(); + c("#" + e[m]).delay(1000 + 100 * m).fadeOut(500, function () { + c(this).remove(); + }); + } + } + } else { + var k = c("#" + j.queueID).find(".uploadify-queue-item").get(0); + $item = c(k); + i.cancelUpload($item.attr("id")); + $item.find(".data").removeClass("data").html(" - Cancelled"); + $item.find(".uploadify-progress-bar").remove(); + $item.delay(1000).fadeOut(500, function () { + c(this).remove(); + }); + } + }); + }, + destroy: function () { + this.each(function () { + var f = c(this), + d = f.data("uploadify"), + e = d.settings; + d.destroy(); + if (e.defaultQueue) { + c("#" + e.queueID).remove(); + } + c("#" + e.id).replaceWith(d.original); + if (e.onDestroy) { + e.onDestroy.call(this); + } + delete d; + }); + }, + disable: function (d) { + this.each(function () { + var g = c(this), + e = g.data("uploadify"), + f = e.settings; + if (d) { + e.button.addClass("disabled"); + if (f.onDisable) { + f.onDisable.call(this); + } + } else { + e.button.removeClass("disabled"); + if (f.onEnable) { + f.onEnable.call(this); + } + } + e.setButtonDisabled(d); + }); + }, + settings: function (e, g, h) { + var d = arguments; + var f = g; + this.each(function () { + var k = c(this), + i = k.data("uploadify"), + j = i.settings; + if (typeof(d[0]) == "object") { + for (var l in g) { + setData(l, g[l]); + } + } + if (d.length === 1) { + f = j[e]; + } else { + switch (e) { + case "uploader": + i.setUploadURL(g); + break; + case "formData": + if (!h) { + g = c.extend(j.formData, g); + } + i.setPostParams(j.formData); + break; + case "method": + if (g == "get") { + i.setUseQueryString(true); + } else { + i.setUseQueryString(false); + } + break; + case "fileObjName": + i.setFilePostName(g); + break; + case "fileTypeExts": + i.setFileTypes(g, j.fileTypeDesc); + break; + case "fileTypeDesc": + i.setFileTypes(j.fileTypeExts, g); + break; + case "fileSizeLimit": + i.setFileSizeLimit(g); + break; + case "uploadLimit": + i.setFileUploadLimit(g); + break; + case "queueSizeLimit": + i.setFileQueueLimit(g); + break; + case "buttonImage": + i.button.css("background-image", settingValue); + break; + case "buttonCursor": + if (g == "arrow") { + i.setButtonCursor(SWFUpload.CURSOR.ARROW); + } else { + i.setButtonCursor(SWFUpload.CURSOR.HAND); + } + break; + case "buttonText": + c("#" + j.id + "-button").find(".uploadify-button-text").html(g); + break; + case "width": + i.setButtonDimensions(g, j.height); + break; + case "height": + i.setButtonDimensions(j.width, g); + break; + case "multi": + if (g) { + i.setButtonAction(SWFUpload.BUTTON_ACTION.SELECT_FILES); + } else { + i.setButtonAction(SWFUpload.BUTTON_ACTION.SELECT_FILE); + } + break; + } + j[e] = g; + } + }); + if (d.length === 1) { + return f; + } + }, + stop: function () { + this.each(function () { + var e = c(this), + d = e.data("uploadify"); + d.queueData.averageSpeed = 0; + d.queueData.uploadSize = 0; + d.queueData.bytesUploaded = 0; + d.queueData.uploadQueue = []; + d.stopUpload(); + }); + }, + upload: function () { + var d = arguments; + this.each(function () { + var f = c(this), + e = f.data("uploadify"); + e.queueData.averageSpeed = 0; + e.queueData.uploadSize = 0; + e.queueData.bytesUploaded = 0; + e.queueData.uploadQueue = []; + if (d[0]) { + if (d[0] == "*") { + e.queueData.uploadSize = e.queueData.queueSize; + e.queueData.uploadQueue.push("*"); + e.startUpload(); + } else { + for (var g = 0; g < d.length; g++) { + e.queueData.uploadSize += e.queueData.files[d[g]].size; + e.queueData.uploadQueue.push(d[g]); + } + e.startUpload(e.queueData.uploadQueue.shift()); + } + } else { + e.startUpload(); + } + }); + } + }; + var a = { + onDialogOpen: function () { + var d = this.settings; + this.queueData.errorMsg = "Some files were not added to the queue:"; + this.queueData.filesReplaced = 0; + this.queueData.filesCancelled = 0; + if (d.onDialogOpen) { + d.onDialogOpen.call(this); + } + }, + onDialogClose: function (d, f, g) { + var e = this.settings; + this.queueData.filesErrored = d - f; + this.queueData.filesSelected = d; + this.queueData.filesQueued = f - this.queueData.filesCancelled; + this.queueData.queueLength = g; + if (c.inArray("onDialogClose", e.overrideEvents) < 0) { + if (this.queueData.filesErrored > 0) { + alert(this.queueData.errorMsg); + } + } + if (e.onDialogClose) { + e.onDialogClose.call(this, this.queueData); + } + if (e.auto) { + c("#" + e.id).uploadify("upload", "*"); + } + }, + onSelect: function (g) { + var h = this.settings; + var e = {}; + for (var f in this.queueData.files) { + e = this.queueData.files[f]; + if (e.uploaded != true && e.name == g.name) { + var d = confirm('The file named "' + g.name + '" is already in the queue.\nDo you want to replace the existing item in the queue?'); + if (!d) { + this.cancelUpload(g.id); + this.queueData.filesCancelled++; + return false; + } else { + c("#" + e.id).remove(); + this.cancelUpload(e.id); + this.queueData.filesReplaced++; + } + } + } + var i = Math.round(g.size / 1024); + var l = "KB"; + if (i > 1000) { + i = Math.round(i / 1000); + l = "MB"; + } + var k = i.toString().split("."); + i = k[0]; + if (k.length > 1) { + i += "." + k[1].substr(0, 2); + } + i += l; + var j = g.name; + if (j.length > 25) { + j = j.substr(0, 25) + "..."; + } + if (c.inArray("onSelect", h.overrideEvents) < 0) { + c("#" + h.queueID).append('
X
' + j + " (" + i + ')
'); + } + this.queueData.queueSize += g.size; + this.queueData.files[g.id] = g; + if (h.onSelect) { + h.onSelect.apply(this, arguments); + } + }, + onSelectError: function (d, g, f) { + var e = this.settings; + if (c.inArray("onSelectError", e.overrideEvents) < 0) { + switch (g) { + case SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED: + if (e.queueSizeLimit > f) { + this.queueData.errorMsg += "\nThe number of files selected exceeds the remaining upload limit (" + f + ")."; + } else { + this.queueData.errorMsg += "\nThe number of files selected exceeds the queue size limit (" + e.queueSizeLimit + ")."; + } + break; + case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT: + this.queueData.errorMsg += '\nThe file "' + d.name + '" exceeds the size limit (' + e.fileSizeLimit + ")."; + break; + case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE: + this.queueData.errorMsg += '\nThe file "' + d.name + '" is empty.'; + break; + case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT: + this.queueData.errorMsg += '\nThe file "' + d.name + '" is not an accepted file type (' + e.fileTypeDesc + ")."; + break; + } + } + if (g != SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED) { + delete this.queueData.files[d.id]; + } + if (e.onSelectError) { + e.onSelectError.apply(this, arguments); + } + }, + onQueueComplete: function () { + if (this.settings.onQueueComplete) { + this.settings.onQueueComplete.call(this, this.settings.queueData); + } + }, + onUploadComplete: function (f) { + var g = this.settings, + d = this; + var e = this.getStats(); + this.queueData.queueLength = e.files_queued; + if (this.queueData.uploadQueue[0] == "*") { + if (this.queueData.queueLength > 0) { + this.startUpload(); + } else { + this.queueData.uploadQueue = []; + if (g.onQueueComplete) { + g.onQueueComplete.call(this, this.queueData); + } + } + } else { + if (this.queueData.uploadQueue.length > 0) { + this.startUpload(this.queueData.uploadQueue.shift()); + } else { + this.queueData.uploadQueue = []; + if (g.onQueueComplete) { + g.onQueueComplete.call(this, this.queueData); + } + } + } + if (c.inArray("onUploadComplete", g.overrideEvents) < 0) { + if (g.removeCompleted) { + switch (f.filestatus) { + case SWFUpload.FILE_STATUS.COMPLETE: + setTimeout(function () { + if (c("#" + f.id)) { + d.queueData.queueSize -= f.size; + d.queueData.queueLength -= 1; + delete d.queueData.files[f.id]; + c("#" + f.id).fadeOut(500, function () { + c(this).remove(); + }); + } + }, g.removeTimeout * 1000); + break; + case SWFUpload.FILE_STATUS.ERROR: + if (!g.requeueErrors) { + setTimeout(function () { + if (c("#" + f.id)) { + d.queueData.queueSize -= f.size; + d.queueData.queueLength -= 1; + delete d.queueData.files[f.id]; + c("#" + f.id).fadeOut(500, function () { + c(this).remove(); + }); + } + }, g.removeTimeout * 1000); + } + break; + } + } else { + f.uploaded = true; + } + } + if (g.onUploadComplete) { + g.onUploadComplete.call(this, f); + } + }, + onUploadError: function (e, i, h) { + var f = this.settings; + var g = "Error"; + switch (i) { + case SWFUpload.UPLOAD_ERROR.HTTP_ERROR: + g = "HTTP Error (" + h + ")"; + break; + case SWFUpload.UPLOAD_ERROR.MISSING_UPLOAD_URL: + g = "Missing Upload URL"; + break; + case SWFUpload.UPLOAD_ERROR.IO_ERROR: + g = "IO Error"; + break; + case SWFUpload.UPLOAD_ERROR.SECURITY_ERROR: + g = "Security Error"; + break; + case SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED: + alert("The upload limit has been reached (" + h + ")."); + g = "Exceeds Upload Limit"; + break; + case SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED: + g = "Failed"; + break; + case SWFUpload.UPLOAD_ERROR.SPECIFIED_FILE_ID_NOT_FOUND: + break; + case SWFUpload.UPLOAD_ERROR.FILE_VALIDATION_FAILED: + g = "Validation Error"; + break; + case SWFUpload.UPLOAD_ERROR.FILE_CANCELLED: + g = "Cancelled"; + this.queueData.queueSize -= e.size; + this.queueData.queueLength -= 1; + if (e.status == SWFUpload.FILE_STATUS.IN_PROGRESS || c.inArray(e.id, this.queueData.uploadQueue) >= 0) { + this.queueData.uploadSize -= e.size; + } + if (f.onCancel) { + f.onCancel.call(this, e); + } + delete this.queueData.files[e.id]; + break; + case SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED: + g = "Stopped"; + break; + } + if (c.inArray("onUploadError", f.overrideEvents) < 0) { + if (i != SWFUpload.UPLOAD_ERROR.FILE_CANCELLED && i != SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED) { + c("#" + e.id).addClass("uploadify-error"); + } + c("#" + e.id).find(".uploadify-progress-bar").css("width", "1px"); + if (i != SWFUpload.UPLOAD_ERROR.SPECIFIED_FILE_ID_NOT_FOUND && e.status != SWFUpload.FILE_STATUS.COMPLETE) { + c("#" + e.id).find(".data").html(" - " + g); + } + } + var d = this.getStats(); + this.queueData.uploadsErrored = d.upload_errors; + if (f.onUploadError) { + f.onUploadError.call(this, e, i, h, g); + } + }, + onUploadProgress: function (g, m, j) { + var h = this.settings; + var e = new Date(); + var n = e.getTime(); + var k = n - this.timer; + if (k > 500) { + this.timer = n; + } + var i = m - this.bytesLoaded; + this.bytesLoaded = m; + var d = this.queueData.queueBytesUploaded + m; + var p = Math.round(m / j * 100); + var o = "KB/s"; + var l = 0; + var f = (i / 1024) / (k / 1000); + f = Math.floor(f * 10) / 10; + if (this.queueData.averageSpeed > 0) { + this.queueData.averageSpeed = Math.floor((this.queueData.averageSpeed + f) / 2); + } else { + this.queueData.averageSpeed = Math.floor(f); + } + if (f > 1000) { + l = (f * 0.001); + this.queueData.averageSpeed = Math.floor(l); + o = "MB/s"; + } + if (c.inArray("onUploadProgress", h.overrideEvents) < 0) { + if (h.progressData == "percentage") { + c("#" + g.id).find(".data").html(" - " + p + "%"); + } else { + if (h.progressData == "speed" && k > 500) { + c("#" + g.id).find(".data").html(" - " + this.queueData.averageSpeed + o); + } + } + c("#" + g.id).find(".uploadify-progress-bar").css("width", p + "%"); + } + if (h.onUploadProgress) { + h.onUploadProgress.call(this, g, m, j, d, this.queueData.uploadSize); + } + }, + onUploadStart: function (d) { + var e = this.settings; + var f = new Date(); + this.timer = f.getTime(); + this.bytesLoaded = 0; + if (this.queueData.uploadQueue.length == 0) { + this.queueData.uploadSize = d.size; + } + if (e.checkExisting) { + c.ajax({ + type: "POST", + async: false, + url: e.checkExisting, + data: { + filename: d.name + }, + success: function (h) { + if (h == 1) { + var g = confirm('A file with the name "' + d.name + '" already exists on the server.\nWould you like to replace the existing file?'); + if (!g) { + this.cancelUpload(d.id); + c("#" + d.id).remove(); + if (this.queueData.uploadQueue.length > 0 && this.queueData.queueLength > 0) { + if (this.queueData.uploadQueue[0] == "*") { + this.startUpload(); + } else { + this.startUpload(this.queueData.uploadQueue.shift()); + } + } + } + } + } + }); + } + if (e.onUploadStart) { + e.onUploadStart.call(this, d); + } + }, + onUploadSuccess: function (f, h, d) { + var g = this.settings; + var e = this.getStats(); + this.queueData.uploadsSuccessful = e.successful_uploads; + this.queueData.queueBytesUploaded += f.size; + if (c.inArray("onUploadSuccess", g.overrideEvents) < 0) { + c("#" + f.id).find(".data").html(" - Complete"); + } + if (g.onUploadSuccess) { + g.onUploadSuccess.call(this, f, h, d); + } + } + }; + c.fn.uploadify = function (d) { + if (b[d]) { + return b[d].apply(this, Array.prototype.slice.call(arguments, 1)); + } else { + if (typeof d === "object" || !d) { + return b.init.apply(this, arguments); + } else { + c.error("The method " + d + " does not exist in $.uploadify"); + } + } + }; })($); \ No newline at end of file diff --git a/web/public_php/ams/js/jquery.uploadify-3.1.min.js b/web/public_php/ams/js/jquery.uploadify-3.1.min.js index f475d7c05d..2ecda85b02 100644 --- a/web/public_php/ams/js/jquery.uploadify-3.1.min.js +++ b/web/public_php/ams/js/jquery.uploadify-3.1.min.js @@ -1,16 +1,16 @@ -/* -Uploadify v3.1.1 -Copyright (c) 2012 Reactive Apps, Ronnie Garcia -Released under the MIT License - -SWFUpload: http://www.swfupload.org, http://swfupload.googlecode.com -mmSWFUpload 1.0: Flash upload dialog - http://profandesign.se/swfupload/, http://www.vinterwebb.se/ -SWFUpload is (c) 2006-2007 Lars Huring, Olov Nilzén and Mammon Media and is released under the MIT License: -http://www.opensource.org/licenses/mit-license.php -SWFUpload 2 is (c) 2007-2008 Jake Roberts and is released under the MIT License: -http://www.opensource.org/licenses/mit-license.php - -SWFObject v2.2 -is released under the MIT License -*/ +/* +Uploadify v3.1.1 +Copyright (c) 2012 Reactive Apps, Ronnie Garcia +Released under the MIT License + +SWFUpload: http://www.swfupload.org, http://swfupload.googlecode.com +mmSWFUpload 1.0: Flash upload dialog - http://profandesign.se/swfupload/, http://www.vinterwebb.se/ +SWFUpload is (c) 2006-2007 Lars Huring, Olov Nilzén and Mammon Media and is released under the MIT License: +http://www.opensource.org/licenses/mit-license.php +SWFUpload 2 is (c) 2007-2008 Jake Roberts and is released under the MIT License: +http://www.opensource.org/licenses/mit-license.php + +SWFObject v2.2 +is released under the MIT License +*/ ;var swfobject=function(){var aq="undefined",aD="object",ab="Shockwave Flash",X="ShockwaveFlash.ShockwaveFlash",aE="application/x-shockwave-flash",ac="SWFObjectExprInst",ax="onreadystatechange",af=window,aL=document,aB=navigator,aa=false,Z=[aN],aG=[],ag=[],al=[],aJ,ad,ap,at,ak=false,aU=false,aH,an,aI=true,ah=function(){var a=typeof aL.getElementById!=aq&&typeof aL.getElementsByTagName!=aq&&typeof aL.createElement!=aq,e=aB.userAgent.toLowerCase(),c=aB.platform.toLowerCase(),h=c?/win/.test(c):/win/.test(e),j=c?/mac/.test(c):/mac/.test(e),g=/webkit/.test(e)?parseFloat(e.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,d=!+"\v1",f=[0,0,0],k=null;if(typeof aB.plugins!=aq&&typeof aB.plugins[ab]==aD){k=aB.plugins[ab].description;if(k&&!(typeof aB.mimeTypes!=aq&&aB.mimeTypes[aE]&&!aB.mimeTypes[aE].enabledPlugin)){aa=true;d=false;k=k.replace(/^.*\s+(\S+\s+\S+$)/,"$1");f[0]=parseInt(k.replace(/^(.*)\..*$/,"$1"),10);f[1]=parseInt(k.replace(/^.*\.(.*)\s.*$/,"$1"),10);f[2]=/[a-zA-Z]/.test(k)?parseInt(k.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0;}}else{if(typeof af.ActiveXObject!=aq){try{var i=new ActiveXObject(X);if(i){k=i.GetVariable("$version");if(k){d=true;k=k.split(" ")[1].split(",");f=[parseInt(k[0],10),parseInt(k[1],10),parseInt(k[2],10)];}}}catch(b){}}}return{w3:a,pv:f,wk:g,ie:d,win:h,mac:j};}(),aK=function(){if(!ah.w3){return;}if((typeof aL.readyState!=aq&&aL.readyState=="complete")||(typeof aL.readyState==aq&&(aL.getElementsByTagName("body")[0]||aL.body))){aP();}if(!ak){if(typeof aL.addEventListener!=aq){aL.addEventListener("DOMContentLoaded",aP,false);}if(ah.ie&&ah.win){aL.attachEvent(ax,function(){if(aL.readyState=="complete"){aL.detachEvent(ax,arguments.callee);aP();}});if(af==top){(function(){if(ak){return;}try{aL.documentElement.doScroll("left");}catch(a){setTimeout(arguments.callee,0);return;}aP();})();}}if(ah.wk){(function(){if(ak){return;}if(!/loaded|complete/.test(aL.readyState)){setTimeout(arguments.callee,0);return;}aP();})();}aC(aP);}}();function aP(){if(ak){return;}try{var b=aL.getElementsByTagName("body")[0].appendChild(ar("span"));b.parentNode.removeChild(b);}catch(a){return;}ak=true;var d=Z.length;for(var c=0;c0){for(var h=0;h0){var i=aS(c);if(i){if(ao(aG[h].swfVersion)&&!(ah.wk&&ah.wk<312)){ay(c,true);if(l){a.success=true;a.ref=av(c);l(a);}}else{if(aG[h].expressInstall&&au()){var e={};e.data=aG[h].expressInstall;e.width=i.getAttribute("width")||"0";e.height=i.getAttribute("height")||"0";if(i.getAttribute("class")){e.styleclass=i.getAttribute("class");}if(i.getAttribute("align")){e.align=i.getAttribute("align");}var f={};var d=i.getElementsByTagName("param");var k=d.length;for(var j=0;j';}}a.outerHTML='"+h+"";ag[ag.length]=e.id;d=aS(e.id);}else{var b=ar(aD);b.setAttribute("type",aE);for(var k in e){if(e[k]!=Object.prototype[k]){if(k.toLowerCase()=="styleclass"){b.setAttribute("class",e[k]);}else{if(k.toLowerCase()!="classid"){b.setAttribute(k,e[k]);}}}}for(var l in g){if(g[l]!=Object.prototype[l]&&l.toLowerCase()!="movie"){aQ(b,l,g[l]);}}a.parentNode.replaceChild(b,a);d=b;}}return d;}function aQ(b,d,c){var a=ar("param");a.setAttribute("name",d);a.setAttribute("value",c);b.appendChild(a);}function aw(a){var b=aS(a);if(b&&b.nodeName=="OBJECT"){if(ah.ie&&ah.win){b.style.display="none";(function(){if(b.readyState==4){aT(a);}else{setTimeout(arguments.callee,10);}})();}else{b.parentNode.removeChild(b);}}}function aT(a){var b=aS(a);if(b){for(var c in b){if(typeof b[c]=="function"){b[c]=null;}}b.parentNode.removeChild(b);}}function aS(a){var c=null;try{c=aL.getElementById(a);}catch(b){}return c;}function ar(a){return aL.createElement(a);}function aM(a,c,b){a.attachEvent(c,b);al[al.length]=[a,c,b];}function ao(a){var b=ah.pv,c=a.split(".");c[0]=parseInt(c[0],10);c[1]=parseInt(c[1],10)||0;c[2]=parseInt(c[2],10)||0;return(b[0]>c[0]||(b[0]==c[0]&&b[1]>c[1])||(b[0]==c[0]&&b[1]==c[1]&&b[2]>=c[2]))?true:false;}function az(b,f,a,c){if(ah.ie&&ah.mac){return;}var e=aL.getElementsByTagName("head")[0];if(!e){return;}var g=(a&&typeof a=="string")?a:"screen";if(c){aH=null;an=null;}if(!aH||an!=g){var d=ar("style");d.setAttribute("type","text/css");d.setAttribute("media",g);aH=e.appendChild(d);if(ah.ie&&ah.win&&typeof aL.styleSheets!=aq&&aL.styleSheets.length>0){aH=aL.styleSheets[aL.styleSheets.length-1];}an=g;}if(ah.ie&&ah.win){if(aH&&typeof aH.addRule==aD){aH.addRule(b,f);}}else{if(aH&&typeof aL.createTextNode!=aq){aH.appendChild(aL.createTextNode(b+" {"+f+"}"));}}}function ay(a,c){if(!aI){return;}var b=c?"visible":"hidden";if(ak&&aS(a)){aS(a).style.visibility=b;}else{az("#"+a,"visibility:"+b);}}function ai(b){var a=/[\\\"<>\.;]/;var c=a.exec(b)!=null;return c&&typeof encodeURIComponent!=aq?encodeURIComponent(b):b;}var aR=function(){if(ah.ie&&ah.win){window.attachEvent("onunload",function(){var a=al.length;for(var b=0;b','','','','','','',""].join("");};SWFUpload.prototype.getFlashVars=function(){var c=this.buildParamString();var d=this.settings.http_success.join(",");return["movieName=",encodeURIComponent(this.movieName),"&uploadURL=",encodeURIComponent(this.settings.upload_url),"&useQueryString=",encodeURIComponent(this.settings.use_query_string),"&requeueOnError=",encodeURIComponent(this.settings.requeue_on_error),"&httpSuccess=",encodeURIComponent(d),"&assumeSuccessTimeout=",encodeURIComponent(this.settings.assume_success_timeout),"&params=",encodeURIComponent(c),"&filePostName=",encodeURIComponent(this.settings.file_post_name),"&fileTypes=",encodeURIComponent(this.settings.file_types),"&fileTypesDescription=",encodeURIComponent(this.settings.file_types_description),"&fileSizeLimit=",encodeURIComponent(this.settings.file_size_limit),"&fileUploadLimit=",encodeURIComponent(this.settings.file_upload_limit),"&fileQueueLimit=",encodeURIComponent(this.settings.file_queue_limit),"&debugEnabled=",encodeURIComponent(this.settings.debug_enabled),"&buttonImageURL=",encodeURIComponent(this.settings.button_image_url),"&buttonWidth=",encodeURIComponent(this.settings.button_width),"&buttonHeight=",encodeURIComponent(this.settings.button_height),"&buttonText=",encodeURIComponent(this.settings.button_text),"&buttonTextTopPadding=",encodeURIComponent(this.settings.button_text_top_padding),"&buttonTextLeftPadding=",encodeURIComponent(this.settings.button_text_left_padding),"&buttonTextStyle=",encodeURIComponent(this.settings.button_text_style),"&buttonAction=",encodeURIComponent(this.settings.button_action),"&buttonDisabled=",encodeURIComponent(this.settings.button_disabled),"&buttonCursor=",encodeURIComponent(this.settings.button_cursor)].join("");};SWFUpload.prototype.getMovieElement=function(){if(this.movieElement==undefined){this.movieElement=document.getElementById(this.movieName);}if(this.movieElement===null){throw"Could not find Flash element";}return this.movieElement;};SWFUpload.prototype.buildParamString=function(){var f=this.settings.post_params;var d=[];if(typeof(f)==="object"){for(var e in f){if(f.hasOwnProperty(e)){d.push(encodeURIComponent(e.toString())+"="+encodeURIComponent(f[e].toString()));}}}return d.join("&");};SWFUpload.prototype.destroy=function(){try{this.cancelUpload(null,false);var g=null;g=this.getMovieElement();if(g&&typeof(g.CallFunction)==="unknown"){for(var j in g){try{if(typeof(g[j])==="function"){g[j]=null;}}catch(h){}}try{g.parentNode.removeChild(g);}catch(f){}}window[this.movieName]=null;SWFUpload.instances[this.movieName]=null;delete SWFUpload.instances[this.movieName];this.movieElement=null;this.settings=null;this.customSettings=null;this.eventQueue=null;this.movieName=null;return true;}catch(i){return false;}};SWFUpload.prototype.displayDebugInfo=function(){this.debug(["---SWFUpload Instance Info---\n","Version: ",SWFUpload.version,"\n","Movie Name: ",this.movieName,"\n","Settings:\n","\t","upload_url: ",this.settings.upload_url,"\n","\t","flash_url: ",this.settings.flash_url,"\n","\t","use_query_string: ",this.settings.use_query_string.toString(),"\n","\t","requeue_on_error: ",this.settings.requeue_on_error.toString(),"\n","\t","http_success: ",this.settings.http_success.join(", "),"\n","\t","assume_success_timeout: ",this.settings.assume_success_timeout,"\n","\t","file_post_name: ",this.settings.file_post_name,"\n","\t","post_params: ",this.settings.post_params.toString(),"\n","\t","file_types: ",this.settings.file_types,"\n","\t","file_types_description: ",this.settings.file_types_description,"\n","\t","file_size_limit: ",this.settings.file_size_limit,"\n","\t","file_upload_limit: ",this.settings.file_upload_limit,"\n","\t","file_queue_limit: ",this.settings.file_queue_limit,"\n","\t","debug: ",this.settings.debug.toString(),"\n","\t","prevent_swf_caching: ",this.settings.prevent_swf_caching.toString(),"\n","\t","button_placeholder_id: ",this.settings.button_placeholder_id.toString(),"\n","\t","button_placeholder: ",(this.settings.button_placeholder?"Set":"Not Set"),"\n","\t","button_image_url: ",this.settings.button_image_url.toString(),"\n","\t","button_width: ",this.settings.button_width.toString(),"\n","\t","button_height: ",this.settings.button_height.toString(),"\n","\t","button_text: ",this.settings.button_text.toString(),"\n","\t","button_text_style: ",this.settings.button_text_style.toString(),"\n","\t","button_text_top_padding: ",this.settings.button_text_top_padding.toString(),"\n","\t","button_text_left_padding: ",this.settings.button_text_left_padding.toString(),"\n","\t","button_action: ",this.settings.button_action.toString(),"\n","\t","button_disabled: ",this.settings.button_disabled.toString(),"\n","\t","custom_settings: ",this.settings.custom_settings.toString(),"\n","Event Handlers:\n","\t","swfupload_loaded_handler assigned: ",(typeof this.settings.swfupload_loaded_handler==="function").toString(),"\n","\t","file_dialog_start_handler assigned: ",(typeof this.settings.file_dialog_start_handler==="function").toString(),"\n","\t","file_queued_handler assigned: ",(typeof this.settings.file_queued_handler==="function").toString(),"\n","\t","file_queue_error_handler assigned: ",(typeof this.settings.file_queue_error_handler==="function").toString(),"\n","\t","upload_start_handler assigned: ",(typeof this.settings.upload_start_handler==="function").toString(),"\n","\t","upload_progress_handler assigned: ",(typeof this.settings.upload_progress_handler==="function").toString(),"\n","\t","upload_error_handler assigned: ",(typeof this.settings.upload_error_handler==="function").toString(),"\n","\t","upload_success_handler assigned: ",(typeof this.settings.upload_success_handler==="function").toString(),"\n","\t","upload_complete_handler assigned: ",(typeof this.settings.upload_complete_handler==="function").toString(),"\n","\t","debug_handler assigned: ",(typeof this.settings.debug_handler==="function").toString(),"\n"].join(""));};SWFUpload.prototype.addSetting=function(d,f,e){if(f==undefined){return(this.settings[d]=e);}else{return(this.settings[d]=f);}};SWFUpload.prototype.getSetting=function(b){if(this.settings[b]!=undefined){return this.settings[b];}return"";};SWFUpload.prototype.callFlash=function(functionName,argumentArray){argumentArray=argumentArray||[];var movieElement=this.getMovieElement();var returnValue,returnString;try{returnString=movieElement.CallFunction(''+__flash__argumentsToXML(argumentArray,0)+"");returnValue=eval(returnString);}catch(ex){throw"Call to "+functionName+" failed";}if(returnValue!=undefined&&typeof returnValue.post==="object"){returnValue=this.unescapeFilePostParams(returnValue);}return returnValue;};SWFUpload.prototype.selectFile=function(){this.callFlash("SelectFile");};SWFUpload.prototype.selectFiles=function(){this.callFlash("SelectFiles");};SWFUpload.prototype.startUpload=function(b){this.callFlash("StartUpload",[b]);};SWFUpload.prototype.cancelUpload=function(d,c){if(c!==false){c=true;}this.callFlash("CancelUpload",[d,c]);};SWFUpload.prototype.stopUpload=function(){this.callFlash("StopUpload");};SWFUpload.prototype.getStats=function(){return this.callFlash("GetStats");};SWFUpload.prototype.setStats=function(b){this.callFlash("SetStats",[b]);};SWFUpload.prototype.getFile=function(b){if(typeof(b)==="number"){return this.callFlash("GetFileByIndex",[b]);}else{return this.callFlash("GetFile",[b]);}};SWFUpload.prototype.addFileParam=function(e,d,f){return this.callFlash("AddFileParam",[e,d,f]);};SWFUpload.prototype.removeFileParam=function(d,c){this.callFlash("RemoveFileParam",[d,c]);};SWFUpload.prototype.setUploadURL=function(b){this.settings.upload_url=b.toString();this.callFlash("SetUploadURL",[b]);};SWFUpload.prototype.setPostParams=function(b){this.settings.post_params=b;this.callFlash("SetPostParams",[b]);};SWFUpload.prototype.addPostParam=function(d,c){this.settings.post_params[d]=c;this.callFlash("SetPostParams",[this.settings.post_params]);};SWFUpload.prototype.removePostParam=function(b){delete this.settings.post_params[b];this.callFlash("SetPostParams",[this.settings.post_params]);};SWFUpload.prototype.setFileTypes=function(d,c){this.settings.file_types=d;this.settings.file_types_description=c;this.callFlash("SetFileTypes",[d,c]);};SWFUpload.prototype.setFileSizeLimit=function(b){this.settings.file_size_limit=b;this.callFlash("SetFileSizeLimit",[b]);};SWFUpload.prototype.setFileUploadLimit=function(b){this.settings.file_upload_limit=b;this.callFlash("SetFileUploadLimit",[b]);};SWFUpload.prototype.setFileQueueLimit=function(b){this.settings.file_queue_limit=b;this.callFlash("SetFileQueueLimit",[b]);};SWFUpload.prototype.setFilePostName=function(b){this.settings.file_post_name=b;this.callFlash("SetFilePostName",[b]);};SWFUpload.prototype.setUseQueryString=function(b){this.settings.use_query_string=b;this.callFlash("SetUseQueryString",[b]);};SWFUpload.prototype.setRequeueOnError=function(b){this.settings.requeue_on_error=b;this.callFlash("SetRequeueOnError",[b]);};SWFUpload.prototype.setHTTPSuccess=function(b){if(typeof b==="string"){b=b.replace(" ","").split(",");}this.settings.http_success=b;this.callFlash("SetHTTPSuccess",[b]);};SWFUpload.prototype.setAssumeSuccessTimeout=function(b){this.settings.assume_success_timeout=b;this.callFlash("SetAssumeSuccessTimeout",[b]);};SWFUpload.prototype.setDebugEnabled=function(b){this.settings.debug_enabled=b;this.callFlash("SetDebugEnabled",[b]);};SWFUpload.prototype.setButtonImageURL=function(b){if(b==undefined){b="";}this.settings.button_image_url=b;this.callFlash("SetButtonImageURL",[b]);};SWFUpload.prototype.setButtonDimensions=function(f,e){this.settings.button_width=f;this.settings.button_height=e;var d=this.getMovieElement();if(d!=undefined){d.style.width=f+"px";d.style.height=e+"px";}this.callFlash("SetButtonDimensions",[f,e]);};SWFUpload.prototype.setButtonText=function(b){this.settings.button_text=b;this.callFlash("SetButtonText",[b]);};SWFUpload.prototype.setButtonTextPadding=function(c,d){this.settings.button_text_top_padding=d;this.settings.button_text_left_padding=c;this.callFlash("SetButtonTextPadding",[c,d]);};SWFUpload.prototype.setButtonTextStyle=function(b){this.settings.button_text_style=b;this.callFlash("SetButtonTextStyle",[b]);};SWFUpload.prototype.setButtonDisabled=function(b){this.settings.button_disabled=b;this.callFlash("SetButtonDisabled",[b]);};SWFUpload.prototype.setButtonAction=function(b){this.settings.button_action=b;this.callFlash("SetButtonAction",[b]);};SWFUpload.prototype.setButtonCursor=function(b){this.settings.button_cursor=b;this.callFlash("SetButtonCursor",[b]);};SWFUpload.prototype.queueEvent=function(d,f){if(f==undefined){f=[];}else{if(!(f instanceof Array)){f=[f];}}var e=this;if(typeof this.settings[d]==="function"){this.eventQueue.push(function(){this.settings[d].apply(this,f);});setTimeout(function(){e.executeNextEvent();},0);}else{if(this.settings[d]!==null){throw"Event handler "+d+" is unknown or is not a function";}}};SWFUpload.prototype.executeNextEvent=function(){var b=this.eventQueue?this.eventQueue.shift():null;if(typeof(b)==="function"){b.apply(this);}};SWFUpload.prototype.unescapeFilePostParams=function(l){var j=/[$]([0-9a-f]{4})/i;var i={};var k;if(l!=undefined){for(var h in l.post){if(l.post.hasOwnProperty(h)){k=h;var g;while((g=j.exec(k))!==null){k=k.replace(g[0],String.fromCharCode(parseInt("0x"+g[1],16)));}i[k]=l.post[h];}}l.post=i;}return l;};SWFUpload.prototype.testExternalInterface=function(){try{return this.callFlash("TestExternalInterface");}catch(b){return false;}};SWFUpload.prototype.flashReady=function(){var b=this.getMovieElement();if(!b){this.debug("Flash called back ready but the flash movie can't be found.");return;}this.cleanUp(b);this.queueEvent("swfupload_loaded_handler");};SWFUpload.prototype.cleanUp=function(f){try{if(this.movieElement&&typeof(f.CallFunction)==="unknown"){this.debug("Removing Flash functions hooks (this should only run in IE and should prevent memory leaks)");for(var h in f){try{if(typeof(f[h])==="function"){f[h]=null;}}catch(e){}}}}catch(g){}window.__flash__removeCallback=function(c,b){try{if(c){c[b]=null;}}catch(a){}};};SWFUpload.prototype.fileDialogStart=function(){this.queueEvent("file_dialog_start_handler");};SWFUpload.prototype.fileQueued=function(b){b=this.unescapeFilePostParams(b);this.queueEvent("file_queued_handler",b);};SWFUpload.prototype.fileQueueError=function(e,f,d){e=this.unescapeFilePostParams(e);this.queueEvent("file_queue_error_handler",[e,f,d]);};SWFUpload.prototype.fileDialogComplete=function(d,f,e){this.queueEvent("file_dialog_complete_handler",[d,f,e]);};SWFUpload.prototype.uploadStart=function(b){b=this.unescapeFilePostParams(b);this.queueEvent("return_upload_start_handler",b);};SWFUpload.prototype.returnUploadStart=function(d){var c;if(typeof this.settings.upload_start_handler==="function"){d=this.unescapeFilePostParams(d);c=this.settings.upload_start_handler.call(this,d);}else{if(this.settings.upload_start_handler!=undefined){throw"upload_start_handler must be a function";}}if(c===undefined){c=true;}c=!!c;this.callFlash("ReturnUploadStart",[c]);};SWFUpload.prototype.uploadProgress=function(e,f,d){e=this.unescapeFilePostParams(e);this.queueEvent("upload_progress_handler",[e,f,d]);};SWFUpload.prototype.uploadError=function(e,f,d){e=this.unescapeFilePostParams(e);this.queueEvent("upload_error_handler",[e,f,d]);};SWFUpload.prototype.uploadSuccess=function(d,e,f){d=this.unescapeFilePostParams(d);this.queueEvent("upload_success_handler",[d,e,f]);};SWFUpload.prototype.uploadComplete=function(b){b=this.unescapeFilePostParams(b);this.queueEvent("upload_complete_handler",b);};SWFUpload.prototype.debug=function(b){this.queueEvent("debug_handler",b);};SWFUpload.prototype.debugMessage=function(h){if(this.settings.debug){var f,g=[];if(typeof h==="object"&&typeof h.name==="string"&&typeof h.message==="string"){for(var e in h){if(h.hasOwnProperty(e)){g.push(e+": "+h[e]);}}f=g.join("\n")||"";g=f.split("\n");f="EXCEPTION: "+g.join("\nEXCEPTION: ");SWFUpload.Console.writeLine(f);}else{SWFUpload.Console.writeLine(h);}}};SWFUpload.Console={};SWFUpload.Console.writeLine=function(g){var e,f;try{e=document.getElementById("SWFUpload_Console");if(!e){f=document.createElement("form");document.getElementsByTagName("body")[0].appendChild(f);e=document.createElement("textarea");e.id="SWFUpload_Console";e.style.fontFamily="monospace";e.setAttribute("wrap","off");e.wrap="off";e.style.overflow="auto";e.style.width="700px";e.style.height="350px";e.style.margin="5px";f.appendChild(e);}e.value+=g+"\n";e.scrollTop=e.scrollHeight-e.clientHeight;}catch(h){alert("Exception: "+h.name+" Message: "+h.message);}};(function(c){var b={init:function(d,e){return this.each(function(){var n=c(this);var m=n.clone();var j=c.extend({id:n.attr("id"),swf:"uploadify.swf",uploader:"uploadify.php",auto:true,buttonClass:"",buttonCursor:"hand",buttonImage:null,buttonText:"SELECT FILES",checkExisting:false,debug:false,fileObjName:"Filedata",fileSizeLimit:0,fileTypeDesc:"All Files",fileTypeExts:"*.*",height:30,method:"post",multi:true,formData:{},preventCaching:true,progressData:"percentage",queueID:false,queueSizeLimit:999,removeCompleted:true,removeTimeout:3,requeueErrors:false,successTimeout:30,uploadLimit:0,width:120,overrideEvents:[]},d);var g={assume_success_timeout:j.successTimeout,button_placeholder_id:j.id,button_width:j.width,button_height:j.height,button_text:null,button_text_style:null,button_text_top_padding:0,button_text_left_padding:0,button_action:(j.multi?SWFUpload.BUTTON_ACTION.SELECT_FILES:SWFUpload.BUTTON_ACTION.SELECT_FILE),button_disabled:false,button_cursor:(j.buttonCursor=="arrow"?SWFUpload.CURSOR.ARROW:SWFUpload.CURSOR.HAND),button_window_mode:SWFUpload.WINDOW_MODE.TRANSPARENT,debug:j.debug,requeue_on_error:j.requeueErrors,file_post_name:j.fileObjName,file_size_limit:j.fileSizeLimit,file_types:j.fileTypeExts,file_types_description:j.fileTypeDesc,file_queue_limit:j.queueSizeLimit,file_upload_limit:j.uploadLimit,flash_url:j.swf,prevent_swf_caching:j.preventCaching,post_params:j.formData,upload_url:j.uploader,use_query_string:(j.method=="get"),file_dialog_complete_handler:a.onDialogClose,file_dialog_start_handler:a.onDialogOpen,file_queued_handler:a.onSelect,file_queue_error_handler:a.onSelectError,swfupload_loaded_handler:j.onSWFReady,upload_complete_handler:a.onUploadComplete,upload_error_handler:a.onUploadError,upload_progress_handler:a.onUploadProgress,upload_start_handler:a.onUploadStart,upload_success_handler:a.onUploadSuccess};if(e){g=c.extend(g,e);}g=c.extend(g,j);var o=swfobject.getFlashPlayerVersion();var h=(o.major>=9);if(h){window["uploadify_"+j.id]=new SWFUpload(g);var i=window["uploadify_"+j.id];n.data("uploadify",i);var l=c("
",{id:j.id,"class":"uploadify",css:{height:j.height+"px",width:j.width+"px"}});c("#"+i.movieName).wrap(l);l=c("#"+j.id);l.data("uploadify",i);var f=c("
",{id:j.id+"-button","class":"uploadify-button "+j.buttonClass});if(j.buttonImage){f.css({"background-image":"url('"+j.buttonImage+"')","text-indent":"-9999px"});}f.html(''+j.buttonText+"").css({height:j.height+"px","line-height":j.height+"px",width:j.width+"px"});l.append(f);c("#"+i.movieName).css({position:"absolute","z-index":1});if(!j.queueID){var k=c("
",{id:j.id+"-queue","class":"uploadify-queue"});l.after(k);i.settings.queueID=j.id+"-queue";i.settings.defaultQueue=true;}i.queueData={files:{},filesSelected:0,filesQueued:0,filesReplaced:0,filesCancelled:0,filesErrored:0,uploadsSuccessful:0,uploadsErrored:0,averageSpeed:0,queueLength:0,queueSize:0,uploadSize:0,queueBytesUploaded:0,uploadQueue:[],errorMsg:"Some files were not added to the queue:"};i.original=m;i.wrapper=l;i.button=f;i.queue=k;if(j.onInit){j.onInit.call(n,i);}}else{if(j.onFallback){j.onFallback.call(n);}}});},cancel:function(d,f){var e=arguments;this.each(function(){var l=c(this),i=l.data("uploadify"),j=i.settings,h=-1;if(e[0]){if(e[0]=="*"){var g=i.queueData.queueLength;c("#"+j.queueID).find(".uploadify-queue-item").each(function(){h++;if(e[1]===true){i.cancelUpload(c(this).attr("id"),false);}else{i.cancelUpload(c(this).attr("id"));}c(this).find(".data").removeClass("data").html(" - Cancelled");c(this).find(".uploadify-progress-bar").remove();c(this).delay(1000+100*h).fadeOut(500,function(){c(this).remove();});});i.queueData.queueSize=0;i.queueData.queueLength=0;if(j.onClearQueue){j.onClearQueue.call(l,g);}}else{for(var m=0;m0){alert(this.queueData.errorMsg);}}if(e.onDialogClose){e.onDialogClose.call(this,this.queueData);}if(e.auto){c("#"+e.id).uploadify("upload","*");}},onSelect:function(g){var h=this.settings;var e={};for(var f in this.queueData.files){e=this.queueData.files[f];if(e.uploaded!=true&&e.name==g.name){var d=confirm('The file named "'+g.name+'" is already in the queue.\nDo you want to replace the existing item in the queue?');if(!d){this.cancelUpload(g.id);this.queueData.filesCancelled++;return false;}else{c("#"+e.id).remove();this.cancelUpload(e.id);this.queueData.filesReplaced++;}}}var i=Math.round(g.size/1024);var l="KB";if(i>1000){i=Math.round(i/1000);l="MB";}var k=i.toString().split(".");i=k[0];if(k.length>1){i+="."+k[1].substr(0,2);}i+=l;var j=g.name;if(j.length>25){j=j.substr(0,25)+"...";}if(c.inArray("onSelect",h.overrideEvents)<0){c("#"+h.queueID).append('
X
'+j+" ("+i+')
');}this.queueData.queueSize+=g.size;this.queueData.files[g.id]=g;if(h.onSelect){h.onSelect.apply(this,arguments);}},onSelectError:function(d,g,f){var e=this.settings;if(c.inArray("onSelectError",e.overrideEvents)<0){switch(g){case SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED:if(e.queueSizeLimit>f){this.queueData.errorMsg+="\nThe number of files selected exceeds the remaining upload limit ("+f+").";}else{this.queueData.errorMsg+="\nThe number of files selected exceeds the queue size limit ("+e.queueSizeLimit+").";}break;case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT:this.queueData.errorMsg+='\nThe file "'+d.name+'" exceeds the size limit ('+e.fileSizeLimit+").";break;case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE:this.queueData.errorMsg+='\nThe file "'+d.name+'" is empty.';break;case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT:this.queueData.errorMsg+='\nThe file "'+d.name+'" is not an accepted file type ('+e.fileTypeDesc+").";break;}}if(g!=SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED){delete this.queueData.files[d.id];}if(e.onSelectError){e.onSelectError.apply(this,arguments);}},onQueueComplete:function(){if(this.settings.onQueueComplete){this.settings.onQueueComplete.call(this,this.settings.queueData);}},onUploadComplete:function(f){var g=this.settings,d=this;var e=this.getStats();this.queueData.queueLength=e.files_queued;if(this.queueData.uploadQueue[0]=="*"){if(this.queueData.queueLength>0){this.startUpload();}else{this.queueData.uploadQueue=[];if(g.onQueueComplete){g.onQueueComplete.call(this,this.queueData);}}}else{if(this.queueData.uploadQueue.length>0){this.startUpload(this.queueData.uploadQueue.shift());}else{this.queueData.uploadQueue=[];if(g.onQueueComplete){g.onQueueComplete.call(this,this.queueData);}}}if(c.inArray("onUploadComplete",g.overrideEvents)<0){if(g.removeCompleted){switch(f.filestatus){case SWFUpload.FILE_STATUS.COMPLETE:setTimeout(function(){if(c("#"+f.id)){d.queueData.queueSize-=f.size;d.queueData.queueLength-=1;delete d.queueData.files[f.id];c("#"+f.id).fadeOut(500,function(){c(this).remove();});}},g.removeTimeout*1000);break;case SWFUpload.FILE_STATUS.ERROR:if(!g.requeueErrors){setTimeout(function(){if(c("#"+f.id)){d.queueData.queueSize-=f.size;d.queueData.queueLength-=1;delete d.queueData.files[f.id];c("#"+f.id).fadeOut(500,function(){c(this).remove();});}},g.removeTimeout*1000);}break;}}else{f.uploaded=true;}}if(g.onUploadComplete){g.onUploadComplete.call(this,f);}},onUploadError:function(e,i,h){var f=this.settings;var g="Error";switch(i){case SWFUpload.UPLOAD_ERROR.HTTP_ERROR:g="HTTP Error ("+h+")";break;case SWFUpload.UPLOAD_ERROR.MISSING_UPLOAD_URL:g="Missing Upload URL";break;case SWFUpload.UPLOAD_ERROR.IO_ERROR:g="IO Error";break;case SWFUpload.UPLOAD_ERROR.SECURITY_ERROR:g="Security Error";break;case SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED:alert("The upload limit has been reached ("+h+").");g="Exceeds Upload Limit";break;case SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED:g="Failed";break;case SWFUpload.UPLOAD_ERROR.SPECIFIED_FILE_ID_NOT_FOUND:break;case SWFUpload.UPLOAD_ERROR.FILE_VALIDATION_FAILED:g="Validation Error";break;case SWFUpload.UPLOAD_ERROR.FILE_CANCELLED:g="Cancelled";this.queueData.queueSize-=e.size;this.queueData.queueLength-=1;if(e.status==SWFUpload.FILE_STATUS.IN_PROGRESS||c.inArray(e.id,this.queueData.uploadQueue)>=0){this.queueData.uploadSize-=e.size;}if(f.onCancel){f.onCancel.call(this,e);}delete this.queueData.files[e.id];break;case SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED:g="Stopped";break;}if(c.inArray("onUploadError",f.overrideEvents)<0){if(i!=SWFUpload.UPLOAD_ERROR.FILE_CANCELLED&&i!=SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED){c("#"+e.id).addClass("uploadify-error");}c("#"+e.id).find(".uploadify-progress-bar").css("width","1px");if(i!=SWFUpload.UPLOAD_ERROR.SPECIFIED_FILE_ID_NOT_FOUND&&e.status!=SWFUpload.FILE_STATUS.COMPLETE){c("#"+e.id).find(".data").html(" - "+g);}}var d=this.getStats();this.queueData.uploadsErrored=d.upload_errors;if(f.onUploadError){f.onUploadError.call(this,e,i,h,g);}},onUploadProgress:function(g,m,j){var h=this.settings;var e=new Date();var n=e.getTime();var k=n-this.timer;if(k>500){this.timer=n;}var i=m-this.bytesLoaded;this.bytesLoaded=m;var d=this.queueData.queueBytesUploaded+m;var p=Math.round(m/j*100);var o="KB/s";var l=0;var f=(i/1024)/(k/1000);f=Math.floor(f*10)/10;if(this.queueData.averageSpeed>0){this.queueData.averageSpeed=Math.floor((this.queueData.averageSpeed+f)/2);}else{this.queueData.averageSpeed=Math.floor(f);}if(f>1000){l=(f*0.001);this.queueData.averageSpeed=Math.floor(l);o="MB/s";}if(c.inArray("onUploadProgress",h.overrideEvents)<0){if(h.progressData=="percentage"){c("#"+g.id).find(".data").html(" - "+p+"%");}else{if(h.progressData=="speed"&&k>500){c("#"+g.id).find(".data").html(" - "+this.queueData.averageSpeed+o);}}c("#"+g.id).find(".uploadify-progress-bar").css("width",p+"%");}if(h.onUploadProgress){h.onUploadProgress.call(this,g,m,j,d,this.queueData.uploadSize);}},onUploadStart:function(d){var e=this.settings;var f=new Date();this.timer=f.getTime();this.bytesLoaded=0;if(this.queueData.uploadQueue.length==0){this.queueData.uploadSize=d.size;}if(e.checkExisting){c.ajax({type:"POST",async:false,url:e.checkExisting,data:{filename:d.name},success:function(h){if(h==1){var g=confirm('A file with the name "'+d.name+'" already exists on the server.\nWould you like to replace the existing file?');if(!g){this.cancelUpload(d.id);c("#"+d.id).remove();if(this.queueData.uploadQueue.length>0&&this.queueData.queueLength>0){if(this.queueData.uploadQueue[0]=="*"){this.startUpload();}else{this.startUpload(this.queueData.uploadQueue.shift());}}}}}});}if(e.onUploadStart){e.onUploadStart.call(this,d);}},onUploadSuccess:function(f,h,d){var g=this.settings;var e=this.getStats();this.queueData.uploadsSuccessful=e.successful_uploads;this.queueData.queueBytesUploaded+=f.size;if(c.inArray("onUploadSuccess",g.overrideEvents)<0){c("#"+f.id).find(".data").html(" - Complete");}if(g.onUploadSuccess){g.onUploadSuccess.call(this,f,h,d);}}};c.fn.uploadify=function(d){if(b[d]){return b[d].apply(this,Array.prototype.slice.call(arguments,1));}else{if(typeof d==="object"||!d){return b.init.apply(this,arguments);}else{c.error("The method "+d+" does not exist in $.uploadify");}}};})($); \ No newline at end of file diff --git a/web/public_php/ams/js/masonry.pkgd.min.js b/web/public_php/ams/js/masonry.pkgd.min.js index 45642b6be6..f0da3709b1 100644 --- a/web/public_php/ams/js/masonry.pkgd.min.js +++ b/web/public_php/ams/js/masonry.pkgd.min.js @@ -1,9 +1,9 @@ -/*! - * Masonry PACKAGED v3.1.5 - * Cascading grid layout library - * http://masonry.desandro.com - * MIT License - * by David DeSandro - */ - +/*! + * Masonry PACKAGED v3.1.5 + * Cascading grid layout library + * http://masonry.desandro.com + * MIT License + * by David DeSandro + */ + !function(a){function b(){}function c(a){function c(b){b.prototype.option||(b.prototype.option=function(b){a.isPlainObject(b)&&(this.options=a.extend(!0,this.options,b))})}function e(b,c){a.fn[b]=function(e){if("string"==typeof e){for(var g=d.call(arguments,1),h=0,i=this.length;i>h;h++){var j=this[h],k=a.data(j,b);if(k)if(a.isFunction(k[e])&&"_"!==e.charAt(0)){var l=k[e].apply(k,g);if(void 0!==l)return l}else f("no such method '"+e+"' for "+b+" instance");else f("cannot call methods on "+b+" prior to initialization; attempted to call '"+e+"'")}return this}return this.each(function(){var d=a.data(this,b);d?(d.option(e),d._init()):(d=new c(this,e),a.data(this,b,d))})}}if(a){var f="undefined"==typeof console?b:function(a){console.error(a)};return a.bridget=function(a,b){c(b),e(a,b)},a.bridget}}var d=Array.prototype.slice;"function"==typeof define&&define.amd?define("jquery-bridget/jquery.bridget",["jquery"],c):c(a.jQuery)}(window),function(a){function b(b){var c=a.event;return c.target=c.target||c.srcElement||b,c}var c=document.documentElement,d=function(){};c.addEventListener?d=function(a,b,c){a.addEventListener(b,c,!1)}:c.attachEvent&&(d=function(a,c,d){a[c+d]=d.handleEvent?function(){var c=b(a);d.handleEvent.call(d,c)}:function(){var c=b(a);d.call(a,c)},a.attachEvent("on"+c,a[c+d])});var e=function(){};c.removeEventListener?e=function(a,b,c){a.removeEventListener(b,c,!1)}:c.detachEvent&&(e=function(a,b,c){a.detachEvent("on"+b,a[b+c]);try{delete a[b+c]}catch(d){a[b+c]=void 0}});var f={bind:d,unbind:e};"function"==typeof define&&define.amd?define("eventie/eventie",f):"object"==typeof exports?module.exports=f:a.eventie=f}(this),function(a){function b(a){"function"==typeof a&&(b.isReady?a():f.push(a))}function c(a){var c="readystatechange"===a.type&&"complete"!==e.readyState;if(!b.isReady&&!c){b.isReady=!0;for(var d=0,g=f.length;g>d;d++){var h=f[d];h()}}}function d(d){return d.bind(e,"DOMContentLoaded",c),d.bind(e,"readystatechange",c),d.bind(a,"load",c),b}var e=a.document,f=[];b.isReady=!1,"function"==typeof define&&define.amd?(b.isReady="function"==typeof requirejs,define("doc-ready/doc-ready",["eventie/eventie"],d)):a.docReady=d(a.eventie)}(this),function(){function a(){}function b(a,b){for(var c=a.length;c--;)if(a[c].listener===b)return c;return-1}function c(a){return function(){return this[a].apply(this,arguments)}}var d=a.prototype,e=this,f=e.EventEmitter;d.getListeners=function(a){var b,c,d=this._getEvents();if(a instanceof RegExp){b={};for(c in d)d.hasOwnProperty(c)&&a.test(c)&&(b[c]=d[c])}else b=d[a]||(d[a]=[]);return b},d.flattenListeners=function(a){var b,c=[];for(b=0;be;e++)if(b=c[e]+a,"string"==typeof d[b])return b}}var c="Webkit Moz ms Ms O".split(" "),d=document.documentElement.style;"function"==typeof define&&define.amd?define("get-style-property/get-style-property",[],function(){return b}):"object"==typeof exports?module.exports=b:a.getStyleProperty=b}(window),function(a){function b(a){var b=parseFloat(a),c=-1===a.indexOf("%")&&!isNaN(b);return c&&b}function c(){for(var a={width:0,height:0,innerWidth:0,innerHeight:0,outerWidth:0,outerHeight:0},b=0,c=g.length;c>b;b++){var d=g[b];a[d]=0}return a}function d(a){function d(a){if("string"==typeof a&&(a=document.querySelector(a)),a&&"object"==typeof a&&a.nodeType){var d=f(a);if("none"===d.display)return c();var e={};e.width=a.offsetWidth,e.height=a.offsetHeight;for(var k=e.isBorderBox=!(!j||!d[j]||"border-box"!==d[j]),l=0,m=g.length;m>l;l++){var n=g[l],o=d[n];o=h(a,o);var p=parseFloat(o);e[n]=isNaN(p)?0:p}var q=e.paddingLeft+e.paddingRight,r=e.paddingTop+e.paddingBottom,s=e.marginLeft+e.marginRight,t=e.marginTop+e.marginBottom,u=e.borderLeftWidth+e.borderRightWidth,v=e.borderTopWidth+e.borderBottomWidth,w=k&&i,x=b(d.width);x!==!1&&(e.width=x+(w?0:q+u));var y=b(d.height);return y!==!1&&(e.height=y+(w?0:r+v)),e.innerWidth=e.width-(q+u),e.innerHeight=e.height-(r+v),e.outerWidth=e.width+s,e.outerHeight=e.height+t,e}}function h(a,b){if(e||-1===b.indexOf("%"))return b;var c=a.style,d=c.left,f=a.runtimeStyle,g=f&&f.left;return g&&(f.left=a.currentStyle.left),c.left=b,b=c.pixelLeft,c.left=d,g&&(f.left=g),b}var i,j=a("boxSizing");return function(){if(j){var a=document.createElement("div");a.style.width="200px",a.style.padding="1px 2px 3px 4px",a.style.borderStyle="solid",a.style.borderWidth="1px 2px 3px 4px",a.style[j]="border-box";var c=document.body||document.documentElement;c.appendChild(a);var d=f(a);i=200===b(d.width),c.removeChild(a)}}(),d}var e=a.getComputedStyle,f=e?function(a){return e(a,null)}:function(a){return a.currentStyle},g=["paddingLeft","paddingRight","paddingTop","paddingBottom","marginLeft","marginRight","marginTop","marginBottom","borderLeftWidth","borderRightWidth","borderTopWidth","borderBottomWidth"];"function"==typeof define&&define.amd?define("get-size/get-size",["get-style-property/get-style-property"],d):"object"==typeof exports?module.exports=d(require("get-style-property")):a.getSize=d(a.getStyleProperty)}(window),function(a,b){function c(a,b){return a[h](b)}function d(a){if(!a.parentNode){var b=document.createDocumentFragment();b.appendChild(a)}}function e(a,b){d(a);for(var c=a.parentNode.querySelectorAll(b),e=0,f=c.length;f>e;e++)if(c[e]===a)return!0;return!1}function f(a,b){return d(a),c(a,b)}var g,h=function(){if(b.matchesSelector)return"matchesSelector";for(var a=["webkit","moz","ms","o"],c=0,d=a.length;d>c;c++){var e=a[c],f=e+"MatchesSelector";if(b[f])return f}}();if(h){var i=document.createElement("div"),j=c(i,"div");g=j?c:f}else g=e;"function"==typeof define&&define.amd?define("matches-selector/matches-selector",[],function(){return g}):window.matchesSelector=g}(this,Element.prototype),function(a){function b(a,b){for(var c in b)a[c]=b[c];return a}function c(a){for(var b in a)return!1;return b=null,!0}function d(a){return a.replace(/([A-Z])/g,function(a){return"-"+a.toLowerCase()})}function e(a,e,f){function h(a,b){a&&(this.element=a,this.layout=b,this.position={x:0,y:0},this._create())}var i=f("transition"),j=f("transform"),k=i&&j,l=!!f("perspective"),m={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"otransitionend",transition:"transitionend"}[i],n=["transform","transition","transitionDuration","transitionProperty"],o=function(){for(var a={},b=0,c=n.length;c>b;b++){var d=n[b],e=f(d);e&&e!==d&&(a[d]=e)}return a}();b(h.prototype,a.prototype),h.prototype._create=function(){this._transn={ingProperties:{},clean:{},onEnd:{}},this.css({position:"absolute"})},h.prototype.handleEvent=function(a){var b="on"+a.type;this[b]&&this[b](a)},h.prototype.getSize=function(){this.size=e(this.element)},h.prototype.css=function(a){var b=this.element.style;for(var c in a){var d=o[c]||c;b[d]=a[c]}},h.prototype.getPosition=function(){var a=g(this.element),b=this.layout.options,c=b.isOriginLeft,d=b.isOriginTop,e=parseInt(a[c?"left":"right"],10),f=parseInt(a[d?"top":"bottom"],10);e=isNaN(e)?0:e,f=isNaN(f)?0:f;var h=this.layout.size;e-=c?h.paddingLeft:h.paddingRight,f-=d?h.paddingTop:h.paddingBottom,this.position.x=e,this.position.y=f},h.prototype.layoutPosition=function(){var a=this.layout.size,b=this.layout.options,c={};b.isOriginLeft?(c.left=this.position.x+a.paddingLeft+"px",c.right=""):(c.right=this.position.x+a.paddingRight+"px",c.left=""),b.isOriginTop?(c.top=this.position.y+a.paddingTop+"px",c.bottom=""):(c.bottom=this.position.y+a.paddingBottom+"px",c.top=""),this.css(c),this.emitEvent("layout",[this])};var p=l?function(a,b){return"translate3d("+a+"px, "+b+"px, 0)"}:function(a,b){return"translate("+a+"px, "+b+"px)"};h.prototype._transitionTo=function(a,b){this.getPosition();var c=this.position.x,d=this.position.y,e=parseInt(a,10),f=parseInt(b,10),g=e===this.position.x&&f===this.position.y;if(this.setPosition(a,b),g&&!this.isTransitioning)return void this.layoutPosition();var h=a-c,i=b-d,j={},k=this.layout.options;h=k.isOriginLeft?h:-h,i=k.isOriginTop?i:-i,j.transform=p(h,i),this.transition({to:j,onTransitionEnd:{transform:this.layoutPosition},isCleaning:!0})},h.prototype.goTo=function(a,b){this.setPosition(a,b),this.layoutPosition()},h.prototype.moveTo=k?h.prototype._transitionTo:h.prototype.goTo,h.prototype.setPosition=function(a,b){this.position.x=parseInt(a,10),this.position.y=parseInt(b,10)},h.prototype._nonTransition=function(a){this.css(a.to),a.isCleaning&&this._removeStyles(a.to);for(var b in a.onTransitionEnd)a.onTransitionEnd[b].call(this)},h.prototype._transition=function(a){if(!parseFloat(this.layout.options.transitionDuration))return void this._nonTransition(a);var b=this._transn;for(var c in a.onTransitionEnd)b.onEnd[c]=a.onTransitionEnd[c];for(c in a.to)b.ingProperties[c]=!0,a.isCleaning&&(b.clean[c]=!0);if(a.from){this.css(a.from);var d=this.element.offsetHeight;d=null}this.enableTransition(a.to),this.css(a.to),this.isTransitioning=!0};var q=j&&d(j)+",opacity";h.prototype.enableTransition=function(){this.isTransitioning||(this.css({transitionProperty:q,transitionDuration:this.layout.options.transitionDuration}),this.element.addEventListener(m,this,!1))},h.prototype.transition=h.prototype[i?"_transition":"_nonTransition"],h.prototype.onwebkitTransitionEnd=function(a){this.ontransitionend(a)},h.prototype.onotransitionend=function(a){this.ontransitionend(a)};var r={"-webkit-transform":"transform","-moz-transform":"transform","-o-transform":"transform"};h.prototype.ontransitionend=function(a){if(a.target===this.element){var b=this._transn,d=r[a.propertyName]||a.propertyName;if(delete b.ingProperties[d],c(b.ingProperties)&&this.disableTransition(),d in b.clean&&(this.element.style[a.propertyName]="",delete b.clean[d]),d in b.onEnd){var e=b.onEnd[d];e.call(this),delete b.onEnd[d]}this.emitEvent("transitionEnd",[this])}},h.prototype.disableTransition=function(){this.removeTransitionStyles(),this.element.removeEventListener(m,this,!1),this.isTransitioning=!1},h.prototype._removeStyles=function(a){var b={};for(var c in a)b[c]="";this.css(b)};var s={transitionProperty:"",transitionDuration:""};return h.prototype.removeTransitionStyles=function(){this.css(s)},h.prototype.removeElem=function(){this.element.parentNode.removeChild(this.element),this.emitEvent("remove",[this])},h.prototype.remove=function(){if(!i||!parseFloat(this.layout.options.transitionDuration))return void this.removeElem();var a=this;this.on("transitionEnd",function(){return a.removeElem(),!0}),this.hide()},h.prototype.reveal=function(){delete this.isHidden,this.css({display:""});var a=this.layout.options;this.transition({from:a.hiddenStyle,to:a.visibleStyle,isCleaning:!0})},h.prototype.hide=function(){this.isHidden=!0,this.css({display:""});var a=this.layout.options;this.transition({from:a.visibleStyle,to:a.hiddenStyle,isCleaning:!0,onTransitionEnd:{opacity:function(){this.isHidden&&this.css({display:"none"})}}})},h.prototype.destroy=function(){this.css({position:"",left:"",right:"",top:"",bottom:"",transition:"",transform:""})},h}var f=a.getComputedStyle,g=f?function(a){return f(a,null)}:function(a){return a.currentStyle};"function"==typeof define&&define.amd?define("outlayer/item",["eventEmitter/EventEmitter","get-size/get-size","get-style-property/get-style-property"],e):(a.Outlayer={},a.Outlayer.Item=e(a.EventEmitter,a.getSize,a.getStyleProperty))}(window),function(a){function b(a,b){for(var c in b)a[c]=b[c];return a}function c(a){return"[object Array]"===l.call(a)}function d(a){var b=[];if(c(a))b=a;else if(a&&"number"==typeof a.length)for(var d=0,e=a.length;e>d;d++)b.push(a[d]);else b.push(a);return b}function e(a,b){var c=n(b,a);-1!==c&&b.splice(c,1)}function f(a){return a.replace(/(.)([A-Z])/g,function(a,b,c){return b+"-"+c}).toLowerCase()}function g(c,g,l,n,o,p){function q(a,c){if("string"==typeof a&&(a=h.querySelector(a)),!a||!m(a))return void(i&&i.error("Bad "+this.constructor.namespace+" element: "+a));this.element=a,this.options=b({},this.constructor.defaults),this.option(c);var d=++r;this.element.outlayerGUID=d,s[d]=this,this._create(),this.options.isInitLayout&&this.layout()}var r=0,s={};return q.namespace="outlayer",q.Item=p,q.defaults={containerStyle:{position:"relative"},isInitLayout:!0,isOriginLeft:!0,isOriginTop:!0,isResizeBound:!0,isResizingContainer:!0,transitionDuration:"0.4s",hiddenStyle:{opacity:0,transform:"scale(0.001)"},visibleStyle:{opacity:1,transform:"scale(1)"}},b(q.prototype,l.prototype),q.prototype.option=function(a){b(this.options,a)},q.prototype._create=function(){this.reloadItems(),this.stamps=[],this.stamp(this.options.stamp),b(this.element.style,this.options.containerStyle),this.options.isResizeBound&&this.bindResize()},q.prototype.reloadItems=function(){this.items=this._itemize(this.element.children)},q.prototype._itemize=function(a){for(var b=this._filterFindItemElements(a),c=this.constructor.Item,d=[],e=0,f=b.length;f>e;e++){var g=b[e],h=new c(g,this);d.push(h)}return d},q.prototype._filterFindItemElements=function(a){a=d(a);for(var b=this.options.itemSelector,c=[],e=0,f=a.length;f>e;e++){var g=a[e];if(m(g))if(b){o(g,b)&&c.push(g);for(var h=g.querySelectorAll(b),i=0,j=h.length;j>i;i++)c.push(h[i])}else c.push(g)}return c},q.prototype.getItemElements=function(){for(var a=[],b=0,c=this.items.length;c>b;b++)a.push(this.items[b].element);return a},q.prototype.layout=function(){this._resetLayout(),this._manageStamps();var a=void 0!==this.options.isLayoutInstant?this.options.isLayoutInstant:!this._isLayoutInited;this.layoutItems(this.items,a),this._isLayoutInited=!0},q.prototype._init=q.prototype.layout,q.prototype._resetLayout=function(){this.getSize()},q.prototype.getSize=function(){this.size=n(this.element)},q.prototype._getMeasurement=function(a,b){var c,d=this.options[a];d?("string"==typeof d?c=this.element.querySelector(d):m(d)&&(c=d),this[a]=c?n(c)[b]:d):this[a]=0},q.prototype.layoutItems=function(a,b){a=this._getItemsForLayout(a),this._layoutItems(a,b),this._postLayout()},q.prototype._getItemsForLayout=function(a){for(var b=[],c=0,d=a.length;d>c;c++){var e=a[c];e.isIgnored||b.push(e)}return b},q.prototype._layoutItems=function(a,b){function c(){d.emitEvent("layoutComplete",[d,a])}var d=this;if(!a||!a.length)return void c();this._itemsOn(a,"layout",c);for(var e=[],f=0,g=a.length;g>f;f++){var h=a[f],i=this._getItemLayoutPosition(h);i.item=h,i.isInstant=b||h.isLayoutInstant,e.push(i)}this._processLayoutQueue(e)},q.prototype._getItemLayoutPosition=function(){return{x:0,y:0}},q.prototype._processLayoutQueue=function(a){for(var b=0,c=a.length;c>b;b++){var d=a[b];this._positionItem(d.item,d.x,d.y,d.isInstant)}},q.prototype._positionItem=function(a,b,c,d){d?a.goTo(b,c):a.moveTo(b,c)},q.prototype._postLayout=function(){this.resizeContainer()},q.prototype.resizeContainer=function(){if(this.options.isResizingContainer){var a=this._getContainerSize();a&&(this._setContainerMeasure(a.width,!0),this._setContainerMeasure(a.height,!1))}},q.prototype._getContainerSize=k,q.prototype._setContainerMeasure=function(a,b){if(void 0!==a){var c=this.size;c.isBorderBox&&(a+=b?c.paddingLeft+c.paddingRight+c.borderLeftWidth+c.borderRightWidth:c.paddingBottom+c.paddingTop+c.borderTopWidth+c.borderBottomWidth),a=Math.max(a,0),this.element.style[b?"width":"height"]=a+"px"}},q.prototype._itemsOn=function(a,b,c){function d(){return e++,e===f&&c.call(g),!0}for(var e=0,f=a.length,g=this,h=0,i=a.length;i>h;h++){var j=a[h];j.on(b,d)}},q.prototype.ignore=function(a){var b=this.getItem(a);b&&(b.isIgnored=!0)},q.prototype.unignore=function(a){var b=this.getItem(a);b&&delete b.isIgnored},q.prototype.stamp=function(a){if(a=this._find(a)){this.stamps=this.stamps.concat(a);for(var b=0,c=a.length;c>b;b++){var d=a[b];this.ignore(d)}}},q.prototype.unstamp=function(a){if(a=this._find(a))for(var b=0,c=a.length;c>b;b++){var d=a[b];e(d,this.stamps),this.unignore(d)}},q.prototype._find=function(a){return a?("string"==typeof a&&(a=this.element.querySelectorAll(a)),a=d(a)):void 0},q.prototype._manageStamps=function(){if(this.stamps&&this.stamps.length){this._getBoundingRect();for(var a=0,b=this.stamps.length;b>a;a++){var c=this.stamps[a];this._manageStamp(c)}}},q.prototype._getBoundingRect=function(){var a=this.element.getBoundingClientRect(),b=this.size;this._boundingRect={left:a.left+b.paddingLeft+b.borderLeftWidth,top:a.top+b.paddingTop+b.borderTopWidth,right:a.right-(b.paddingRight+b.borderRightWidth),bottom:a.bottom-(b.paddingBottom+b.borderBottomWidth)}},q.prototype._manageStamp=k,q.prototype._getElementOffset=function(a){var b=a.getBoundingClientRect(),c=this._boundingRect,d=n(a),e={left:b.left-c.left-d.marginLeft,top:b.top-c.top-d.marginTop,right:c.right-b.right-d.marginRight,bottom:c.bottom-b.bottom-d.marginBottom};return e},q.prototype.handleEvent=function(a){var b="on"+a.type;this[b]&&this[b](a)},q.prototype.bindResize=function(){this.isResizeBound||(c.bind(a,"resize",this),this.isResizeBound=!0)},q.prototype.unbindResize=function(){this.isResizeBound&&c.unbind(a,"resize",this),this.isResizeBound=!1},q.prototype.onresize=function(){function a(){b.resize(),delete b.resizeTimeout}this.resizeTimeout&&clearTimeout(this.resizeTimeout);var b=this;this.resizeTimeout=setTimeout(a,100)},q.prototype.resize=function(){this.isResizeBound&&this.needsResizeLayout()&&this.layout()},q.prototype.needsResizeLayout=function(){var a=n(this.element),b=this.size&&a;return b&&a.innerWidth!==this.size.innerWidth},q.prototype.addItems=function(a){var b=this._itemize(a);return b.length&&(this.items=this.items.concat(b)),b},q.prototype.appended=function(a){var b=this.addItems(a);b.length&&(this.layoutItems(b,!0),this.reveal(b))},q.prototype.prepended=function(a){var b=this._itemize(a);if(b.length){var c=this.items.slice(0);this.items=b.concat(c),this._resetLayout(),this._manageStamps(),this.layoutItems(b,!0),this.reveal(b),this.layoutItems(c)}},q.prototype.reveal=function(a){var b=a&&a.length;if(b)for(var c=0;b>c;c++){var d=a[c];d.reveal()}},q.prototype.hide=function(a){var b=a&&a.length;if(b)for(var c=0;b>c;c++){var d=a[c];d.hide()}},q.prototype.getItem=function(a){for(var b=0,c=this.items.length;c>b;b++){var d=this.items[b];if(d.element===a)return d}},q.prototype.getItems=function(a){if(a&&a.length){for(var b=[],c=0,d=a.length;d>c;c++){var e=a[c],f=this.getItem(e);f&&b.push(f)}return b}},q.prototype.remove=function(a){a=d(a);var b=this.getItems(a);if(b&&b.length){this._itemsOn(b,"remove",function(){this.emitEvent("removeComplete",[this,b])});for(var c=0,f=b.length;f>c;c++){var g=b[c];g.remove(),e(g,this.items)}}},q.prototype.destroy=function(){var a=this.element.style;a.height="",a.position="",a.width="";for(var b=0,c=this.items.length;c>b;b++){var d=this.items[b];d.destroy()}this.unbindResize(),delete this.element.outlayerGUID,j&&j.removeData(this.element,this.constructor.namespace)},q.data=function(a){var b=a&&a.outlayerGUID;return b&&s[b]},q.create=function(a,c){function d(){q.apply(this,arguments)}return Object.create?d.prototype=Object.create(q.prototype):b(d.prototype,q.prototype),d.prototype.constructor=d,d.defaults=b({},q.defaults),b(d.defaults,c),d.prototype.settings={},d.namespace=a,d.data=q.data,d.Item=function(){p.apply(this,arguments)},d.Item.prototype=new p,g(function(){for(var b=f(a),c=h.querySelectorAll(".js-"+b),e="data-"+b+"-options",g=0,k=c.length;k>g;g++){var l,m=c[g],n=m.getAttribute(e);try{l=n&&JSON.parse(n)}catch(o){i&&i.error("Error parsing "+e+" on "+m.nodeName.toLowerCase()+(m.id?"#"+m.id:"")+": "+o);continue}var p=new d(m,l);j&&j.data(m,a,p)}}),j&&j.bridget&&j.bridget(a,d),d},q.Item=p,q}var h=a.document,i=a.console,j=a.jQuery,k=function(){},l=Object.prototype.toString,m="object"==typeof HTMLElement?function(a){return a instanceof HTMLElement}:function(a){return a&&"object"==typeof a&&1===a.nodeType&&"string"==typeof a.nodeName},n=Array.prototype.indexOf?function(a,b){return a.indexOf(b)}:function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1};"function"==typeof define&&define.amd?define("outlayer/outlayer",["eventie/eventie","doc-ready/doc-ready","eventEmitter/EventEmitter","get-size/get-size","matches-selector/matches-selector","./item"],g):a.Outlayer=g(a.eventie,a.docReady,a.EventEmitter,a.getSize,a.matchesSelector,a.Outlayer.Item)}(window),function(a){function b(a,b){var d=a.create("masonry");return d.prototype._resetLayout=function(){this.getSize(),this._getMeasurement("columnWidth","outerWidth"),this._getMeasurement("gutter","outerWidth"),this.measureColumns();var a=this.cols;for(this.colYs=[];a--;)this.colYs.push(0);this.maxY=0},d.prototype.measureColumns=function(){if(this.getContainerWidth(),!this.columnWidth){var a=this.items[0],c=a&&a.element;this.columnWidth=c&&b(c).outerWidth||this.containerWidth}this.columnWidth+=this.gutter,this.cols=Math.floor((this.containerWidth+this.gutter)/this.columnWidth),this.cols=Math.max(this.cols,1)},d.prototype.getContainerWidth=function(){var a=this.options.isFitWidth?this.element.parentNode:this.element,c=b(a);this.containerWidth=c&&c.innerWidth},d.prototype._getItemLayoutPosition=function(a){a.getSize();var b=a.size.outerWidth%this.columnWidth,d=b&&1>b?"round":"ceil",e=Math[d](a.size.outerWidth/this.columnWidth);e=Math.min(e,this.cols);for(var f=this._getColGroup(e),g=Math.min.apply(Math,f),h=c(f,g),i={x:this.columnWidth*h,y:g},j=g+a.size.outerHeight,k=this.cols+1-f.length,l=0;k>l;l++)this.colYs[h+l]=j;return i},d.prototype._getColGroup=function(a){if(2>a)return this.colYs;for(var b=[],c=this.cols+1-a,d=0;c>d;d++){var e=this.colYs.slice(d,d+a);b[d]=Math.max.apply(Math,e)}return b},d.prototype._manageStamp=function(a){var c=b(a),d=this._getElementOffset(a),e=this.options.isOriginLeft?d.left:d.right,f=e+c.outerWidth,g=Math.floor(e/this.columnWidth);g=Math.max(0,g);var h=Math.floor(f/this.columnWidth);h-=f%this.columnWidth?0:1,h=Math.min(this.cols-1,h);for(var i=(this.options.isOriginTop?d.top:d.bottom)+c.outerHeight,j=g;h>=j;j++)this.colYs[j]=Math.max(i,this.colYs[j])},d.prototype._getContainerSize=function(){this.maxY=Math.max.apply(Math,this.colYs);var a={height:this.maxY};return this.options.isFitWidth&&(a.width=this._getContainerFitWidth()),a},d.prototype._getContainerFitWidth=function(){for(var a=0,b=this.cols;--b&&0===this.colYs[b];)a++;return(this.cols-a)*this.columnWidth-this.gutter},d.prototype.needsResizeLayout=function(){var a=this.containerWidth;return this.getContainerWidth(),a!==this.containerWidth},d}var c=Array.prototype.indexOf?function(a,b){return a.indexOf(b)}:function(a,b){for(var c=0,d=a.length;d>c;c++){var e=a[c];if(e===b)return c}return-1};"function"==typeof define&&define.amd?define(["outlayer/outlayer","get-size/get-size"],b):a.Masonry=b(a.Outlayer,a.getSize)}(window); \ No newline at end of file From 03d2c793ec09ae5ec20ca0d8647b6dd3f648a6dd Mon Sep 17 00:00:00 2001 From: Josh Santos Date: Mon, 29 Jan 2024 09:49:27 +0000 Subject: [PATCH 120/126] Migrate from deprecated MAINTAINER command. --- tool/quick_start/docker/ryzombuild_focal_amd64/Dockerfile | 2 +- tool/quick_start/docker/ryzombuild_jammy_amd64/Dockerfile | 2 +- tool/quick_start/docker/ryzombuild_scout_amd64_gcc9/Dockerfile | 2 +- tool/quick_start/docker/ryzombuild_scout_i386_gcc9/Dockerfile | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tool/quick_start/docker/ryzombuild_focal_amd64/Dockerfile b/tool/quick_start/docker/ryzombuild_focal_amd64/Dockerfile index 38781bec60..3711ca1f1e 100644 --- a/tool/quick_start/docker/ryzombuild_focal_amd64/Dockerfile +++ b/tool/quick_start/docker/ryzombuild_focal_amd64/Dockerfile @@ -1,5 +1,5 @@ FROM --platform=linux/amd64 ubuntu:focal -MAINTAINER Ryzom Core +LABEL org.opencontainers.image.authors="Ryzom Core " RUN sed -i -e 's/archive\.ubuntu\.com/mirrors\.digitalocean\.com/' /etc/apt/sources.list diff --git a/tool/quick_start/docker/ryzombuild_jammy_amd64/Dockerfile b/tool/quick_start/docker/ryzombuild_jammy_amd64/Dockerfile index 9ec051bd41..4a2b846c95 100644 --- a/tool/quick_start/docker/ryzombuild_jammy_amd64/Dockerfile +++ b/tool/quick_start/docker/ryzombuild_jammy_amd64/Dockerfile @@ -1,5 +1,5 @@ FROM --platform=linux/amd64 ubuntu:jammy -MAINTAINER Ryzom Core +LABEL org.opencontainers.image.authors="Ryzom Core " RUN sed -i -e 's/archive\.ubuntu\.com/mirrors\.digitalocean\.com/' /etc/apt/sources.list diff --git a/tool/quick_start/docker/ryzombuild_scout_amd64_gcc9/Dockerfile b/tool/quick_start/docker/ryzombuild_scout_amd64_gcc9/Dockerfile index a0e2585835..16d4a6ad43 100644 --- a/tool/quick_start/docker/ryzombuild_scout_amd64_gcc9/Dockerfile +++ b/tool/quick_start/docker/ryzombuild_scout_amd64_gcc9/Dockerfile @@ -1,5 +1,5 @@ FROM --platform=linux/amd64 steamrt_scout_amd64:latest -MAINTAINER Ryzom Core +LABEL org.opencontainers.image.authors="Ryzom Core " RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 90 \ && update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-9 90 \ diff --git a/tool/quick_start/docker/ryzombuild_scout_i386_gcc9/Dockerfile b/tool/quick_start/docker/ryzombuild_scout_i386_gcc9/Dockerfile index 6895ad1f12..0d8bc74464 100644 --- a/tool/quick_start/docker/ryzombuild_scout_i386_gcc9/Dockerfile +++ b/tool/quick_start/docker/ryzombuild_scout_i386_gcc9/Dockerfile @@ -1,5 +1,5 @@ FROM --platform=linux/386 steamrt_scout_i386:latest -MAINTAINER Ryzom Core +LABEL org.opencontainers.image.authors="Ryzom Core " RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 90 \ && update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-9 90 \ From b9bee6035182254ac14f371cc7b238582e4d621c Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Sun, 14 Jul 2024 07:26:20 +0000 Subject: [PATCH 121/126] use built-in find icu module --- CMakeLists.txt | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 937faa4b0e..a2471986e5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -247,16 +247,15 @@ IF(WITH_STATIC) ENDIF() # under Linux and OS X, recent libxml2 versions are linked against libicu - # FIND_PACKAGE(Icu) - FIND_LIBRARY(ICU_LIBRARY icuuc) - IF(ICU_LIBRARY) - FIND_LIBRARY(ICU_DATA_LIBRARY icudata) - IF(ICU_LIBRARY) - MESSAGE(STATUS "ICU UC was found: ${ICU_LIBRARY}") - ELSE() - MESSAGE(STATUS "ICU UC was NOT found") - ENDIF() - SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${ICU_DATA_LIBRARY} ${ICU_LIBRARY}) + FIND_PACKAGE(ICU COMPONENTS data uc) + IF(ICU_FOUND) + IF(ICU_UC_FOUND) + MESSAGE(STATUS "ICU uc was found: ${ICU_LIBRARIES}") + ENDIF() + IF(ICU_DATA_FOUND) + MESSAGE(STATUS "ICU data was found: ${ICU_LIBRARIES}") + ENDIF() + SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ICU::data ICU::uc) ENDIF() ENDIF() From 61497f97fb3db04ef1e3b4606f5023dccd52d2cf Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Sun, 14 Jul 2024 09:49:21 +0000 Subject: [PATCH 122/126] use built-in FindFreetype module --- CMakeModules/FindFreeType.cmake | 110 -------------------------------- nel/CMakeLists.txt | 2 +- 2 files changed, 1 insertion(+), 111 deletions(-) delete mode 100644 CMakeModules/FindFreeType.cmake diff --git a/CMakeModules/FindFreeType.cmake b/CMakeModules/FindFreeType.cmake deleted file mode 100644 index d101607b48..0000000000 --- a/CMakeModules/FindFreeType.cmake +++ /dev/null @@ -1,110 +0,0 @@ -# - Locate FreeType library -# This module defines -# FREETYPE_LIBRARIES, libraries to link against -# FREETYPE_FOUND, if false, do not try to link to FREETYPE -# FREETYPE_INCLUDE_DIRS, where to find headers. - -IF(FREETYPE_LIBRARIES AND FREETYPE_INCLUDE_DIRS) - # in cache already - SET(Freetype_FIND_QUIETLY TRUE) -ENDIF() - -FIND_PATH(FREETYPE_INCLUDE_DIRS - freetype - PATHS - $ENV{FREETYPE_DIR}/include - /usr/local/include - /usr/include - /sw/include - /opt/local/include - /opt/csw/include - /opt/include - PATH_SUFFIXES freetype2 -) - -IF(NOT FREETYPE_INCLUDE_DIRS) - SET(FREETYPE_INCLUDE_DIRS "") -ENDIF() - -# ft2build.h does not reside in the freetype include dir -FIND_PATH(FREETYPE_ADDITIONAL_INCLUDE_DIR - ft2build.h - PATHS - /usr/local/include - /usr/include - /sw/include - /opt/local/include - /opt/csw/include - /opt/include - PATH_SUFFIXES freetype2 -) - -# combine both include directories into one variable -IF(FREETYPE_ADDITIONAL_INCLUDE_DIR) - SET(FREETYPE_INCLUDE_DIRS ${FREETYPE_INCLUDE_DIRS} ${FREETYPE_ADDITIONAL_INCLUDE_DIR}) -ENDIF() - -FIND_LIBRARY(FREETYPE_LIBRARY_RELEASE - NAMES freetype libfreetype freetype219 freetype246 - PATHS - $ENV{FREETYPE_DIR}/lib - /usr/local/lib - /usr/lib - /usr/local/X11R6/lib - /usr/X11R6/lib - /sw/lib - /opt/local/lib - /opt/csw/lib - /opt/lib - /usr/freeware/lib64 - /usr/lib/x86_64-linux-gnu -) - -FIND_LIBRARY(FREETYPE_LIBRARY_DEBUG - NAMES freetyped libfreetyped freetype219d freetype246d - PATHS - $ENV{FREETYPE_DIR}/lib - /usr/local/lib - /usr/lib - /usr/local/X11R6/lib - /usr/X11R6/lib - /sw/lib - /opt/local/lib - /opt/csw/lib - /opt/lib - /usr/freeware/lib64 - /usr/lib/x86_64-linux-gnu -) - -IF(FREETYPE_INCLUDE_DIRS) - IF(FREETYPE_LIBRARY_RELEASE AND FREETYPE_LIBRARY_DEBUG) - # Case where both Release and Debug versions are provided - SET(FREETYPE_FOUND ON) - SET(FREETYPE_LIBRARIES optimized ${FREETYPE_LIBRARY_RELEASE} debug ${FREETYPE_LIBRARY_DEBUG}) - ELSEIF(FREETYPE_LIBRARY_RELEASE) - # Normal case - SET(FREETYPE_FOUND ON) - SET(FREETYPE_LIBRARIES ${FREETYPE_LIBRARY_RELEASE}) - ELSEIF(FREETYPE_LIBRARY_DEBUG) - # Case where Freetype is compiled from sources (debug version is compiled by default) - SET(FREETYPE_FOUND ON) - SET(FREETYPE_LIBRARIES ${FREETYPE_LIBRARY_DEBUG}) - ENDIF() -ENDIF() - -IF(FREETYPE_FOUND) - IF(WITH_STATIC_EXTERNAL AND APPLE) - FIND_PACKAGE(BZip2) - IF(BZIP2_FOUND) - SET(FREETYPE_INCLUDE_DIRS ${FREETYPE_INCLUDE_DIRS} ${BZIP2_INCLUDE_DIR}) - SET(FREETYPE_LIBRARIES ${FREETYPE_LIBRARIES} ${BZIP2_LIBRARIES}) - ENDIF() - ENDIF() - IF(NOT Freetype_FIND_QUIETLY) - MESSAGE(STATUS "Found FreeType: ${FREETYPE_LIBRARIES}") - ENDIF() -ELSE() - IF(NOT Freetype_FIND_QUIETLY) - MESSAGE(STATUS "Warning: Unable to find FreeType!") - ENDIF() -ENDIF() diff --git a/nel/CMakeLists.txt b/nel/CMakeLists.txt index 1392c6dbd2..a41a96fbf2 100644 --- a/nel/CMakeLists.txt +++ b/nel/CMakeLists.txt @@ -23,7 +23,7 @@ IF(WITH_3D) FIND_PACKAGE(freetype CONFIG REQUIRED) SET(FREETYPE_LIBRARIES freetype::freetype) ELSE() - FIND_PACKAGE(FreeType) + FIND_PACKAGE(Freetype) ENDIF() #hunter IF(WITH_NEL_CEGUI) From 6bb26a7cef368f1bd605e410223186cbe58d9bfc Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Tue, 16 Jul 2024 17:26:39 +0000 Subject: [PATCH 123/126] remove test that was migrated to gtest --- nel/tools/nel_unit_test/ut_misc.h | 2 - nel/tools/nel_unit_test/ut_misc_config_file.h | 180 ------------------ 2 files changed, 182 deletions(-) delete mode 100644 nel/tools/nel_unit_test/ut_misc_config_file.h diff --git a/nel/tools/nel_unit_test/ut_misc.h b/nel/tools/nel_unit_test/ut_misc.h index 97bc0d4105..9913c9749f 100644 --- a/nel/tools/nel_unit_test/ut_misc.h +++ b/nel/tools/nel_unit_test/ut_misc.h @@ -20,7 +20,6 @@ #include "ut_misc_co_task.h" #include "ut_misc_command.h" #include "ut_misc_common.h" -#include "ut_misc_config_file.h" #include "ut_misc_debug.h" #include "ut_misc_dynlibload.h" #include "ut_misc_file.h" @@ -41,7 +40,6 @@ struct CUTMisc : public Test::Suite add(std::auto_ptr(new CUTMiscCoTask)); add(std::auto_ptr(new CUTMiscCommand)); add(std::auto_ptr(new CUTMiscCommon)); - add(std::auto_ptr(new CUTMiscConfigFile)); add(std::auto_ptr(new CUTMiscDebug)); add(std::auto_ptr(new CUTMiscDynLibLoad)); add(std::auto_ptr(new CUTMiscFile)); diff --git a/nel/tools/nel_unit_test/ut_misc_config_file.h b/nel/tools/nel_unit_test/ut_misc_config_file.h deleted file mode 100644 index 087343a2c0..0000000000 --- a/nel/tools/nel_unit_test/ut_misc_config_file.h +++ /dev/null @@ -1,180 +0,0 @@ -// NeL - MMORPG Framework -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -#ifndef UT_MISC_CONFIG_FILE -#define UT_MISC_CONFIG_FILE - -#include - -#ifndef NEL_UNIT_BASE -#define NEL_UNIT_BASE "" -#endif // NEL_UNIT_BASE - -// Test suite for CConfigFile class -class CUTMiscConfigFile : public Test::Suite -{ - string _WorkingPath; - string _OldPath; -public: - CUTMiscConfigFile () - { - TEST_ADD(CUTMiscConfigFile::configWithInclude); - TEST_ADD(CUTMiscConfigFile::configWithOptional); - TEST_ADD(CUTMiscConfigFile::configWithDefine); - TEST_ADD(CUTMiscConfigFile::configWithBadTest); - TEST_ADD(CUTMiscConfigFile::configIncludeAndOptional); - TEST_ADD(CUTMiscConfigFile::reportErrorInSubFiles); - } - - void setup() - { - _OldPath = NLMISC::CPath::getCurrentPath(); - NLMISC::CPath::setCurrentPath(_WorkingPath.c_str()); - } - - void tear_down() - { - NLMISC::CPath::setCurrentPath(_OldPath.c_str()); - } - - void configWithInclude() - { - NLMISC::CConfigFile configFile; - - TEST_THROWS_NOTHING(configFile.load(NEL_UNIT_BASE "ut_misc_files/cfg_with_include.cfg")); - - TEST_ASSERT(configFile.loaded()); - TEST_ASSERT(configFile.getVarPtr("CfgWithInclude") != NULL); - TEST_ASSERT(configFile.getVar("CfgWithInclude").asString(0) == "ok"); - TEST_ASSERT(configFile.getVarPtr("IncludedCfg") != NULL); - TEST_ASSERT(configFile.getVar("IncludedCfg").asString(0) == "ok"); - } - - void configWithOptional() - { - NLMISC::CConfigFile configFile; - - TEST_THROWS_NOTHING(configFile.load(NEL_UNIT_BASE "ut_misc_files/cfg_with_optional.cfg")); - - TEST_ASSERT(configFile.loaded()); - TEST_ASSERT(configFile.getVarPtr("CfgWithInclude") != NULL); - TEST_ASSERT(configFile.getVar("CfgWithInclude").asString(0) == "ok"); - TEST_ASSERT(configFile.getVarPtr("IncludedCfg") != NULL); - TEST_ASSERT(configFile.getVar("IncludedCfg").asString(0) == "ok"); - } - - - void configWithDefine() - { - NLMISC::CConfigFile configFile; - - TEST_THROWS_NOTHING(configFile.load(NEL_UNIT_BASE "ut_misc_files/cfg_with_define.cfg")); - - TEST_ASSERT(configFile.loaded()); - TEST_ASSERT(configFile.getVarPtr("CfgReadableVar") != NULL); - TEST_ASSERT(configFile.getVarPtr("CfgNotToBeFound") == NULL); - TEST_ASSERT(configFile.getVarPtr("CfgInvisible") == NULL); - TEST_ASSERT(configFile.getVarPtr("CfgMustExist") != NULL); - } - - class CMyDisplayer : public NLMISC::IDisplayer - { - public: - vector Lines; - - virtual void doDisplay( const NLMISC::CLog::TDisplayInfo& args, const char *message) - { - Lines.push_back(message); - } - }; - - void configWithBadTest() - { - // override the warning channel to get the error on unclosed if - CMyDisplayer warnings; - NLMISC::CLog logger; - logger.addDisplayer(&warnings); - NLMISC::CNLWarningOverride override(&logger); - - NLMISC::CConfigFile configFile; - - string fullName = NLMISC::CPath::getFullPath(NEL_UNIT_BASE "ut_misc_files/cfg_with_bad_test.cfg", false); - - TEST_THROWS_NOTHING(configFile.load(NEL_UNIT_BASE "ut_misc_files/cfg_with_bad_test.cfg")); - - TEST_ASSERT(configFile.getVarPtr("ASimpleVar") != NULL); - - // check that we have the warnings - TEST_ASSERT(warnings.Lines.size() == 13); - TEST_ASSERT(warnings.Lines[0].find(string("Preprocess: In file ")+fullName+"(6) : Error unrecognized preprocessor command") != string::npos); - TEST_ASSERT(warnings.Lines[1].find(string("Preprocess: In file ")+fullName+"(9) : Error found '#endif' without matching #if") != string::npos); - - // skip the I18N warning from parseMarkedString - TEST_ASSERT(warnings.Lines[3].find(string("Preprocess: In file ")+fullName+"(12) : Error parsing include file command") != string::npos); - // skip the I18N warning from parseMarkedString - TEST_ASSERT(warnings.Lines[5].find(string("Preprocess: In file ")+fullName+"(13) : Error parsing include file command") != string::npos); - // skip the I18N warning from parseMarkedString - TEST_ASSERT(warnings.Lines[7].find(string("Preprocess: In file ")+fullName+"(14) : Error parsing optional file command") != string::npos); - // skip the I18N warning from parseMarkedString - TEST_ASSERT(warnings.Lines[9].find(string("Preprocess: In file ")+fullName+"(15) : Error parsing optional file command") != string::npos); - TEST_ASSERT(warnings.Lines[10].find(string("Preprocess: In file ")+fullName+"(16) : Error parsing #define command") != string::npos); - TEST_ASSERT(warnings.Lines[11].find(string("Preprocess: In file ")+fullName+"(17) : Error parsing #ifdef command") != string::npos); - - TEST_ASSERT(warnings.Lines[12].find("Preprocess: Missing 1 closing #endif after parsing") != string::npos); - } - - void configIncludeAndOptional() - { - CMyDisplayer warnings; - NLMISC::CLog logger; - logger.addDisplayer(&warnings); - NLMISC::CNLWarningOverride override(&logger); - - NLMISC::CConfigFile configFile; - - string fullName = NLMISC::CPath::getFullPath(NEL_UNIT_BASE "ut_misc_files/cfg_with_include_and_optional.cfg", false); - - - TEST_THROWS_NOTHING(configFile.load(NEL_UNIT_BASE "ut_misc_files/cfg_with_include_and_optional.cfg")); - - // check that we have the warnings only for the 'include' command - TEST_ASSERT(warnings.Lines.size() == 1); - TEST_ASSERT(warnings.Lines[0].find(string("Preprocess: In file ")+fullName+"(2) : Cannot include file 'a_missing_file.cfg'") != string::npos); - } - - void reportErrorInSubFiles() - { - CMyDisplayer warnings; - NLMISC::CLog logger; - logger.addDisplayer(&warnings); - NLMISC::CNLWarningOverride override(&logger); - - NLMISC::CConfigFile configFile; - - string fullName = NLMISC::CPath::getFullPath(NEL_UNIT_BASE "ut_misc_files/cfg_with_error_main.cfg", false); - string subfullName = NLMISC::CPath::getFullPath(NEL_UNIT_BASE "ut_misc_files/cfg_with_error.cfg", false); - - - TEST_THROWS(configFile.load(NEL_UNIT_BASE "ut_misc_files/cfg_with_error_main.cfg"), NLMISC::EParseError); - - // check that we have error report with correct filename and line number - TEST_ASSERT(warnings.Lines.size() == 1); - // the first error is in the subfile - TEST_ASSERT(warnings.Lines[0].find(string("CF: Parsing error in file ")+subfullName+" line 18") != string::npos); - } -}; - -#endif From 08fa027f30d9db2be7cfaa8bf6ac648b0c49630b Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Wed, 17 Jul 2024 19:43:05 +0000 Subject: [PATCH 124/126] remove unused cmake code --- CMakeLists.txt | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a2471986e5..7d841d9f9f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -238,27 +238,6 @@ IF(WITH_STATIC) IF(WINSOCK2_LIB) SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${WINSOCK2_LIB}) ENDIF() - - IF(UNIX AND NOT HUNTER_ENABLED) - # under Linux and OS X, recent libxml2 versions are linked against liblzma - FIND_PACKAGE(LibLZMA) - IF(LIBLZMA_LIBRARIES) - SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${LIBLZMA_LIBRARIES}) - ENDIF() - - # under Linux and OS X, recent libxml2 versions are linked against libicu - FIND_PACKAGE(ICU COMPONENTS data uc) - IF(ICU_FOUND) - IF(ICU_UC_FOUND) - MESSAGE(STATUS "ICU uc was found: ${ICU_LIBRARIES}") - ENDIF() - IF(ICU_DATA_FOUND) - MESSAGE(STATUS "ICU data was found: ${ICU_LIBRARIES}") - ENDIF() - SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ICU::data ICU::uc) - ENDIF() - - ENDIF() ENDIF() IF(FINAL_VERSION) From 1a9887a7668158c88ac48d595b9d8222d08fa7dd Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Mon, 5 Aug 2024 14:46:05 +0000 Subject: [PATCH 125/126] build studio statically --- .github/workflows/build-studio.yml | 62 +++++++++++++++++++-- studio/CMakeLists.txt | 4 -- studio/src/plugins/CMakeLists.txt | 3 +- studio/src/plugins/gui_editor/link_list.cpp | 2 +- 4 files changed, 61 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build-studio.yml b/.github/workflows/build-studio.yml index 24a0449a52..5327f9528b 100644 --- a/.github/workflows/build-studio.yml +++ b/.github/workflows/build-studio.yml @@ -13,17 +13,70 @@ on: - '!.github/workflows/build-studio.yml' jobs: - build: + strings: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - name: Set reusable strings id: strings shell: bash run: | echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" + build: + needs: + - strings + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Dependencies + run: | + sudo apt update + sudo apt install --yes software-properties-common + sudo apt update + sudo apt install --yes \ + cmake build-essential ninja-build ccache \ + bison autoconf automake \ + libpng-dev \ + libjpeg-dev \ + libgif-dev libfreetype6-dev \ + freeglut3-dev \ + liblua5.2-dev libluabind-dev libcpptest-dev \ + libogg-dev libvorbis-dev libopenal-dev \ + libavcodec-dev libavformat-dev libavdevice-dev libswscale-dev libpostproc-dev \ + libmysqlclient-dev \ + libxml2-dev \ + libcurl4-openssl-dev libssl-dev \ + libsquish-dev \ + liblzma-dev \ + libgsf-1-dev \ + qtbase5-dev qttools5-dev qttools5-dev-tools libqtpropertybrowser-dev + + - name: Configure CMake + run: > + cmake -B ${{ needs.strings.outputs.build-output-dir }} + -G "Ninja" + -DWITH_QT5=ON + -DWITH_STUDIO=ON + -DWITH_RYZOM=OFF + -DWITH_NEL_TOOLS=OFF + -DWITH_NEL_SAMPLES=OFF + -DWITH_NEL_TESTS=OFF + -S ${{ github.workspace }} + + - name: Build + run: cmake --build ${{ needs.strings.outputs.build-output-dir }} --target studio + + build-static: + needs: + - strings + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Dependencies run: | sudo apt update @@ -49,10 +102,11 @@ jobs: - name: Configure CMake run: > - cmake -B ${{ steps.strings.outputs.build-output-dir }} + cmake -B ${{ needs.strings.outputs.build-output-dir }} -G "Ninja" -DWITH_QT5=ON -DWITH_STUDIO=ON + -DWITH_STATIC=ON -DWITH_RYZOM=OFF -DWITH_NEL_TOOLS=OFF -DWITH_NEL_SAMPLES=OFF @@ -60,4 +114,4 @@ jobs: -S ${{ github.workspace }} - name: Build - run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --target studio + run: cmake --build ${{ needs.strings.outputs.build-output-dir }} --target studio diff --git a/studio/CMakeLists.txt b/studio/CMakeLists.txt index b4f1a903f4..f3a2fd133c 100644 --- a/studio/CMakeLists.txt +++ b/studio/CMakeLists.txt @@ -29,10 +29,6 @@ ELSE() ADD_DEFINITIONS(-DHAVE_OVQT_CONFIG_H) ENDIF() -IF(UNIX AND WITH_STATIC) - MESSAGE(FATAL_ERROR "Studio does not work with static NeL builds on Unix atm.") -ENDIF() - ADD_SUBDIRECTORY(src) INSTALL(DIRECTORY data/ diff --git a/studio/src/plugins/CMakeLists.txt b/studio/src/plugins/CMakeLists.txt index 9fba47c6e3..5886fe4779 100644 --- a/studio/src/plugins/CMakeLists.txt +++ b/studio/src/plugins/CMakeLists.txt @@ -12,7 +12,8 @@ IF(WITH_GUI) ADD_SUBDIRECTORY(gui_editor) ENDIF() -ADD_SUBDIRECTORY(translation_manager) +# QFtp isn't available anymore only as a standalone module +#ADD_SUBDIRECTORY(translation_manager) ADD_SUBDIRECTORY(tile_editor) ADD_SUBDIRECTORY(bnp_manager) # Note: Temporarily disabled until development continues. diff --git a/studio/src/plugins/gui_editor/link_list.cpp b/studio/src/plugins/gui_editor/link_list.cpp index 9d9af182fc..b30163f406 100644 --- a/studio/src/plugins/gui_editor/link_list.cpp +++ b/studio/src/plugins/gui_editor/link_list.cpp @@ -76,7 +76,7 @@ namespace GUIEditor item->setData( 3, Qt::UserRole, itr->first ); linkTree->addTopLevelItem( item ); } - linkTree->sortByColumn( 0 ); + linkTree->sortByColumn( 0, Qt::AscendingOrder ); } void LinkList::onAddButtonClicked() From c5495f31a45ab18084292b148a1e4dacc26267fa Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Mon, 5 Aug 2024 15:02:04 +0000 Subject: [PATCH 126/126] add missing job output --- .github/workflows/build-studio.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-studio.yml b/.github/workflows/build-studio.yml index 5327f9528b..bf3557fe59 100644 --- a/.github/workflows/build-studio.yml +++ b/.github/workflows/build-studio.yml @@ -15,7 +15,8 @@ on: jobs: strings: runs-on: ubuntu-latest - + outputs: + build-output-dir: ${{ steps.strings.outputs.build-output-dir }} steps: - name: Set reusable strings id: strings