From c21199466d0159dbb9ae4ba2a54bef56b024568e Mon Sep 17 00:00:00 2001 From: kervala Date: Thu, 26 Aug 2010 14:49:11 +0200 Subject: [PATCH] Fixed: #1074 sheets_packer using default static relative paths --- code/ryzom/client/src/continent_manager.cpp | 12 ++++--- code/ryzom/client/src/continent_manager.h | 2 +- .../client/src/continent_manager_build.cpp | 10 +++--- .../client/src/continent_manager_build.h | 3 +- .../tools/sheets_packer/sheets_packer.cfg | 3 ++ .../tools/sheets_packer/sheets_packer.vcproj | 10 +++--- .../tools/sheets_packer/sheets_packer_cfg.cpp | 34 +++++-------------- .../tools/sheets_packer/sheets_packer_cfg.h | 20 ++++------- .../sheets_packer/sheets_packer_init.cpp | 2 +- 9 files changed, 38 insertions(+), 58 deletions(-) diff --git a/code/ryzom/client/src/continent_manager.cpp b/code/ryzom/client/src/continent_manager.cpp index 6e2f655f6..a9e8b3cb9 100644 --- a/code/ryzom/client/src/continent_manager.cpp +++ b/code/ryzom/client/src/continent_manager.cpp @@ -697,26 +697,28 @@ void CContinentManager::reloadSky() // *************************************************************************** void CContinentManager::loadContinentLandMarks() { + std::string dataPath = "../../client/data"; + if (ClientCfg.UpdatePackedSheet == false) { - readLMConts(); + readLMConts(dataPath); } else { - buildLMConts(); - readLMConts(); + buildLMConts("ryzom.world", "../../common/data_leveldesign/primitives", dataPath); + readLMConts(dataPath); } } // *************************************************************************** -void CContinentManager::readLMConts() +void CContinentManager::readLMConts(const std::string &dataPath) { CIFile f; string sPackedFileName = CPath::lookup(LM_PACKED_FILE, false); if (sPackedFileName.empty()) - sPackedFileName = LM_PACKED_FILE_SAVE; + sPackedFileName = CPath::standardizePath(dataPath) + LM_PACKED_FILE; if (f.open(sPackedFileName)) { diff --git a/code/ryzom/client/src/continent_manager.h b/code/ryzom/client/src/continent_manager.h index 062e2ec82..1d9326280 100644 --- a/code/ryzom/client/src/continent_manager.h +++ b/code/ryzom/client/src/continent_manager.h @@ -127,7 +127,7 @@ public: protected: void loadContinentLandMarks(); - void readLMConts(); + void readLMConts(const std::string &dataPath); protected: diff --git a/code/ryzom/client/src/continent_manager_build.cpp b/code/ryzom/client/src/continent_manager_build.cpp index 7e6999c0c..8d83de984 100644 --- a/code/ryzom/client/src/continent_manager_build.cpp +++ b/code/ryzom/client/src/continent_manager_build.cpp @@ -67,7 +67,7 @@ void primitiveToLM(CContLandMark &lm, IPrimitive *p) } // *************************************************************************** -bool buildLMConts() +bool buildLMConts(const std::string &worldSheet, const std::string &primitivesPath, const std::string &dataPath) { bool bRebuild = false; @@ -75,7 +75,7 @@ bool buildLMConts() map AllContinents; // Map with all continents. { - CEntitySheet *sheet = SheetMngr.get(CSheetId("ryzom.world")); + CEntitySheet *sheet = SheetMngr.get(CSheetId(worldSheet)); if (!sheet || sheet->type() != CEntitySheet::WORLD) { @@ -100,7 +100,7 @@ bool buildLMConts() vector vRegionFiles; { vector vTmp; - CPath::getPathContent("../../common/data_leveldesign/primitives", true, false, true, vTmp); + CPath::getPathContent(primitivesPath, true, false, true, vTmp); for (uint32 i = 0; i < vTmp.size(); ++i) { string filename = CFile::getFilename(vTmp[i]); @@ -115,7 +115,7 @@ bool buildLMConts() string sPackedFileName = CPath::lookup(LM_PACKED_FILE, false); if (sPackedFileName.empty()) { - sPackedFileName = LM_PACKED_FILE_SAVE; + sPackedFileName = NLMISC::CPath::standardizePath(dataPath) + LM_PACKED_FILE; bRebuild = true; } else @@ -253,7 +253,7 @@ bool buildLMConts() } else { - nlwarning("cannot find continent %s in ryzom.world", contName.c_str()); + nlwarning("cannot find continent %s in %s", contName.c_str(), worldSheet.c_str()); } } } diff --git a/code/ryzom/client/src/continent_manager_build.h b/code/ryzom/client/src/continent_manager_build.h index fdcd77c46..46361689f 100644 --- a/code/ryzom/client/src/continent_manager_build.h +++ b/code/ryzom/client/src/continent_manager_build.h @@ -83,10 +83,9 @@ public: } }; -extern bool buildLMConts(); +extern bool buildLMConts(const std::string &worldSheet, const std::string &primitivesPath, const std::string &dataPath); #define LM_PACKED_FILE "lmconts.packed" -#define LM_PACKED_FILE_SAVE "../../client/data/" LM_PACKED_FILE #define WORLD_MAP_FILE "global_world_map.primitive" #endif // CL_CONTINENT_MANAGER_BUILD_H diff --git a/code/ryzom/tools/sheets_packer/sheets_packer.cfg b/code/ryzom/tools/sheets_packer/sheets_packer.cfg index 9f2647ec5..ab175d829 100644 --- a/code/ryzom/tools/sheets_packer/sheets_packer.cfg +++ b/code/ryzom/tools/sheets_packer/sheets_packer.cfg @@ -4,4 +4,7 @@ ///////////////////////////////// ///////////////////////////////// DataPath = { "../../common/data_leveldesign", "../../common/data_common", "../../client/data" }; +WorldSheet = "ryzom.world"; +PrimitivesPath = "../../common/data_leveldesign/primitives"; +OutputDataPath = "../../client/data"; LigoPrimitiveClass = "world_editor_classes.xml"; diff --git a/code/ryzom/tools/sheets_packer/sheets_packer.vcproj b/code/ryzom/tools/sheets_packer/sheets_packer.vcproj index 9c5d6d60d..f43f88af4 100644 --- a/code/ryzom/tools/sheets_packer/sheets_packer.vcproj +++ b/code/ryzom/tools/sheets_packer/sheets_packer.vcproj @@ -52,7 +52,7 @@ Optimization="4" InlineFunctionExpansion="1" AdditionalIncludeDirectories="..\..\client\src;..\..\common\src" - PreprocessorDefinitions="_DEBUG;WIN32;_CONSOLE" + PreprocessorDefinitions="_DEBUG;WIN32;_CONSOLE;LIBXML_STATIC" BasicRuntimeChecks="3" SmallerTypeCheck="true" RuntimeLibrary="3" @@ -140,7 +140,7 @@ Optimization="4" InlineFunctionExpansion="1" AdditionalIncludeDirectories="..\..\client\src;..\..\common\src" - PreprocessorDefinitions="_DEBUG;WIN32;_CONSOLE" + PreprocessorDefinitions="_DEBUG;WIN32;_CONSOLE;LIBXML_STATIC" BasicRuntimeChecks="3" SmallerTypeCheck="true" RuntimeLibrary="3" @@ -148,6 +148,7 @@ PrecompiledHeaderThrough="stdpch.h" WarningLevel="3" DebugInformationFormat="3" + OmitDefaultLibName="true" /> @@ -232,7 +232,7 @@ OmitFramePointers="true" EnableFiberSafeOptimizations="true" AdditionalIncludeDirectories="..\..\client\src;..\..\common\src" - PreprocessorDefinitions="NDEBUG;WIN32;_CONSOLE" + PreprocessorDefinitions="NDEBUG;WIN32;_CONSOLE;LIBXML_STATIC" StringPooling="true" RuntimeLibrary="2" BufferSecurityCheck="false" @@ -325,7 +325,7 @@ OmitFramePointers="true" EnableFiberSafeOptimizations="true" AdditionalIncludeDirectories="..\..\client\src;..\..\common\src" - PreprocessorDefinitions="NDEBUG;WIN32;_CONSOLE" + PreprocessorDefinitions="NDEBUG;WIN32;_CONSOLE;LIBXML_STATIC" StringPooling="true" RuntimeLibrary="2" BufferSecurityCheck="false" diff --git a/code/ryzom/tools/sheets_packer/sheets_packer_cfg.cpp b/code/ryzom/tools/sheets_packer/sheets_packer_cfg.cpp index 340753f4a..77e05a7f7 100644 --- a/code/ryzom/tools/sheets_packer/sheets_packer_cfg.cpp +++ b/code/ryzom/tools/sheets_packer/sheets_packer_cfg.cpp @@ -147,12 +147,6 @@ const std::string ConfigFileName = "sheets_packer.cfg"; //--------------------------------------------------- CClientConfig::CClientConfig() { - SaveConfig = false; - UpdatePackedSheet = true; // Update packed sheet if needed - SceneName = ""; - IdFilePath = ""; - LanguageCode = "en"; // Default to english - FPExceptions = false; // Disable Floating Point Exceptions. }// CClientConfig // @@ -178,13 +172,14 @@ void setValues() } catch(EUnknownVar &) {nlwarning("Default value used for 'DataPath' !!!");} - // UpdatePackedSheet - READ_BOOL(UpdatePackedSheet) - - // SceneName - READ_STRING(SceneName) - // IdFile Path - READ_STRING(IdFilePath) + // World sheet name + READ_STRING(WorldSheet) + // Primitives path + READ_STRING(PrimitivesPath) + // Output data path + READ_STRING(OutputDataPath) + // Ligo primitive class + READ_STRING(LigoPrimitiveClass) ///////////// // FILTERS // @@ -216,13 +211,6 @@ void setValues() } } catch(EUnknownVar &) {} - - READ_STRING(LigoPrimitiveClass) - - // LanguageCode - READ_STRING(LanguageCode) - - READ_BOOL(FPExceptions) }// load // @@ -261,10 +249,4 @@ void CClientConfig::init(const std::string &configFileName) //----------------------------------------------- void CClientConfig::release () { - // Do we have to save the cfg file ? - if (AppCfg.SaveConfig) - { - // Save it - AppCfg.ConfigFile.save (); - } } diff --git a/code/ryzom/tools/sheets_packer/sheets_packer_cfg.h b/code/ryzom/tools/sheets_packer/sheets_packer_cfg.h index 169693af4..6c1f2e12a 100644 --- a/code/ryzom/tools/sheets_packer/sheets_packer_cfg.h +++ b/code/ryzom/tools/sheets_packer/sheets_packer_cfg.h @@ -41,24 +41,18 @@ struct CClientConfig void init (const std::string &configFileName); - /// Save the cfg file when exit the client ? - bool SaveConfig; - /// Data Path. std::vector DataPath; - /// True if we want the packed sheet to be updated if needed - bool UpdatePackedSheet; - /// Name of the scene to play. - std::string SceneName; - /// Path for the Id file. - std::string IdFilePath; - // Enable/disable Floating Point Exceptions - bool FPExceptions; + + /// World sheet name + std::string WorldSheet; + /// Path where to find .primitive files + std::string PrimitivesPath; + /// Path where to create lmconts.packed + std::string OutputDataPath; std::string LigoPrimitiveClass; -// TODO - std::string LanguageCode; public: /// Constructor. diff --git a/code/ryzom/tools/sheets_packer/sheets_packer_init.cpp b/code/ryzom/tools/sheets_packer/sheets_packer_init.cpp index f429aa634..9e1afe071 100644 --- a/code/ryzom/tools/sheets_packer/sheets_packer_init.cpp +++ b/code/ryzom/tools/sheets_packer/sheets_packer_init.cpp @@ -98,7 +98,7 @@ bool init() if (!LigoConfig.readPrimitiveClass (AppCfg.LigoPrimitiveClass.c_str(), false)) nlwarning ("Can't load primitive class file %s", AppCfg.LigoPrimitiveClass.c_str()); NLLIGO::CPrimitiveContext::instance().CurrentLigoConfig = &LigoConfig; - buildLMConts(); + buildLMConts(AppCfg.WorldSheet, AppCfg.PrimitivesPath, AppCfg.OutputDataPath); // The init is a success. return true;