diff --git a/code/ryzom/server/src/entities_game_service/egs_sheets/egs_sheets.cpp b/code/ryzom/server/src/entities_game_service/egs_sheets/egs_sheets.cpp index 10b59d03b..cdc50a9ac 100644 --- a/code/ryzom/server/src/entities_game_service/egs_sheets/egs_sheets.cpp +++ b/code/ryzom/server/src/entities_game_service/egs_sheets/egs_sheets.cpp @@ -56,6 +56,14 @@ CSheets CSheets::_StaticSheets; // the singleton instance bool CSheets::_Initialised=false; // - set true by constructor bool CSheets::_Destroyed=false; // - set true by destructor +#ifndef NO_EGS_VARS +static std::string writeDirectory() +{ + return IService::getInstance()->WriteFilesDirectory.toString(); +} +#else +extern std::string writeDirectory(); +#endif //--------------------------------------------------- // scanDirectoriesForFiles : utility routine for init() @@ -82,7 +90,7 @@ void scanGeorgePaths(bool forceFullRescan=false) NLMISC::CPath::clearMap(); // rescan 'Paths' directories - if ((var = IService::getInstance()->ConfigFile.getVarPtr ("Paths")) != NULL) + if (IService::isServiceInitialized() && ((var = IService::getInstance()->ConfigFile.getVarPtr ("Paths")) != NULL)) { for (uint i = 0; i < var->size(); i++) { @@ -91,7 +99,7 @@ void scanGeorgePaths(bool forceFullRescan=false) } // rescan 'PathsNoRecurse' directories - if ((var = IService::getInstance()->ConfigFile.getVarPtr ("PathsNoRecurse")) != NULL) + if (IService::isServiceInitialized() && ((var = IService::getInstance()->ConfigFile.getVarPtr ("PathsNoRecurse")) != NULL)) { for (uint i = 0; i < var->size(); i++) { @@ -101,7 +109,7 @@ void scanGeorgePaths(bool forceFullRescan=false) } // add any paths listed in the 'GeorgeFiles' config file variable - if ((var = IService::getInstance()->ConfigFile.getVarPtr ("GeorgePaths")) != NULL) + if (IService::isServiceInitialized() && ((var = IService::getInstance()->ConfigFile.getVarPtr ("GeorgePaths")) != NULL)) { for (uint i = 0; i < var->size(); i++) { @@ -123,9 +131,9 @@ template void loadSheetSet(const char *fileType,const char *sheetFile, sheetMap.clear(); // if the 'GeorgePaths' config file var exists then we try to perform a mini-scan for sheet files - if (IService::getInstance()->ConfigFile.getVarPtr(std::string("GeorgePaths"))!=NULL) + if (IService::isServiceInitialized() && (IService::getInstance()->ConfigFile.getVarPtr(std::string("GeorgePaths"))!=NULL)) { - loadForm( fileType, IService::getInstance()->WriteFilesDirectory.toString()+sheetFile, sheetMap, false, false); + loadForm( fileType, writeDirectory()+sheetFile, sheetMap, false, false); } // if we haven't succeeded in minimal scan (or 'GeorgePaths' wasn't found in config file) then perform standard scan @@ -133,7 +141,7 @@ template void loadSheetSet(const char *fileType,const char *sheetFile, { // if the 'GeorgePaths' variable exists and hasn't already been treated then add new paths to CPath singleton scanGeorgePaths(); - loadForm( fileType, IService::getInstance()->WriteFilesDirectory.toString()+sheetFile, sheetMap, true); + loadForm( fileType, writeDirectory()+sheetFile, sheetMap, true); } } @@ -148,9 +156,9 @@ template void loadSheetSet2(const char *fileType,const char *sheetFile sheetMap.clear(); // if the 'GeorgePaths' config file var exists then we try to perform a mini-scan for sheet files - if (IService::getInstance()->ConfigFile.getVarPtr(std::string("GeorgePaths"))!=NULL) + if (IService::isServiceInitialized() && (IService::getInstance()->ConfigFile.getVarPtr(std::string("GeorgePaths"))!=NULL)) { - loadForm2( fileType, IService::getInstance()->WriteFilesDirectory.toString()+sheetFile, sheetMap, false, false); + loadForm2( fileType, writeDirectory()+sheetFile, sheetMap, false, false); } // if we haven't succeeded in minimal scan (or 'GeorgePaths' wasn't found in config file) then perform standard scan @@ -158,7 +166,7 @@ template void loadSheetSet2(const char *fileType,const char *sheetFile { // if the 'GeorgePaths' variable exists and hasn't already been treated then add new paths to CPath singleton scanGeorgePaths(); - loadForm2( fileType, IService::getInstance()->WriteFilesDirectory.toString()+sheetFile, sheetMap, true); + loadForm2( fileType, writeDirectory()+sheetFile, sheetMap, true); } } @@ -172,9 +180,9 @@ template void loadSheetSet(const vector &fileTypes,const char sheetMap.clear(); // if the 'GeorgePaths' config file var exists then we try to perform a mini-scan for sheet files - if (IService::getInstance()->ConfigFile.getVarPtr(std::string("GeorgePaths"))!=NULL) + if (IService::isServiceInitialized() && (IService::getInstance()->ConfigFile.getVarPtr(std::string("GeorgePaths"))!=NULL)) { - loadForm( fileTypes, IService::getInstance()->WriteFilesDirectory.toString()+sheetFile, sheetMap, false, false); + loadForm( fileTypes, writeDirectory()+sheetFile, sheetMap, false, false); } // if we haven't succeeded in minimal scan (or 'GeorgePaths' wasn't found in config file) then perform standard scan @@ -182,7 +190,7 @@ template void loadSheetSet(const vector &fileTypes,const char { // if the 'GeorgePaths' variable exists and hasn't already been treated then add new paths to CPath singleton scanGeorgePaths(); - loadForm( fileTypes, IService::getInstance()->WriteFilesDirectory.toString()+sheetFile, sheetMap, true); + loadForm( fileTypes, writeDirectory()+sheetFile, sheetMap, true); } } @@ -196,9 +204,9 @@ void loadSheetSetForHashMap(const vector &fileTypes,const char *sheetFil map sheetMap; // if the 'GeorgePaths' config file var exists then we try to perform a mini-scan for sheet files - if (IService::getInstance()->ConfigFile.getVarPtr(std::string("GeorgePaths"))!=NULL) + if (IService::isServiceInitialized() && (IService::getInstance()->ConfigFile.getVarPtr(std::string("GeorgePaths"))!=NULL)) { - loadForm( fileTypes, IService::getInstance()->WriteFilesDirectory.toString()+sheetFile, sheetMap, false, false); + loadForm( fileTypes, writeDirectory()+sheetFile, sheetMap, false, false); } // if we haven't succeeded in minimal scan (or 'GeorgePaths' wasn't found in config file) then perform standard scan @@ -206,7 +214,7 @@ void loadSheetSetForHashMap(const vector &fileTypes,const char *sheetFil { // if the 'GeorgePaths' variable exists and hasn't already been treated then add new paths to CPath singleton scanGeorgePaths(); - loadForm( fileTypes, IService::getInstance()->WriteFilesDirectory.toString()+sheetFile, sheetMap, true); + loadForm( fileTypes, writeDirectory()+sheetFile, sheetMap, true); } // Convert map to hash_map @@ -705,11 +713,15 @@ template void reloadSheetSet(const vector &fileTypes, T &sheet sheetMap.clear(); // if the 'GeorgePaths' config file var exists then we try to perform a mini-scan for sheet files - if (IService::getInstance()->ConfigFile.getVarPtr(std::string("GeorgePaths"))!=NULL) + if (IService::isServiceInitialized() && (IService::getInstance()->ConfigFile.getVarPtr(std::string("GeorgePaths"))!=NULL)) { scanGeorgePaths(); loadFormNoPackedSheet( fileTypes, sheetMap, wildcardFilter); } + else + { + nlwarning("No GeorgePaths in EGS config"); + } } // variant with smart pointers, maintain with function above @@ -719,11 +731,15 @@ template void reloadSheetSet2(const vector &fileTypes, T &shee sheetMap.clear(); // if the 'GeorgePaths' config file var exists then we try to perform a mini-scan for sheet files - if (IService::getInstance()->ConfigFile.getVarPtr(std::string("GeorgePaths"))!=NULL) + if (IService::isServiceInitialized() && (IService::getInstance()->ConfigFile.getVarPtr(std::string("GeorgePaths"))!=NULL)) { scanGeorgePaths(); loadFormNoPackedSheet2( fileTypes, sheetMap, wildcardFilter); } + else + { + nlwarning("No GeorgePaths in EGS config"); + } } template void reloadSheetSet(const string &fileType, T &sheetMap, const string &wildcardFilter) diff --git a/code/ryzom/server/src/entities_game_service/egs_sheets/egs_static_game_item.cpp b/code/ryzom/server/src/entities_game_service/egs_sheets/egs_static_game_item.cpp index 94fbdcd11..f36fe91ab 100644 --- a/code/ryzom/server/src/entities_game_service/egs_sheets/egs_static_game_item.cpp +++ b/code/ryzom/server/src/entities_game_service/egs_sheets/egs_static_game_item.cpp @@ -1878,6 +1878,7 @@ void CStaticItem::reloadSheet(const CStaticItem &o) const_cast(o).clearPtrs(false); } +#ifndef NO_EGS_VARS // *************************************************************************** float CStaticItem::getBaseWeight() const { @@ -1990,6 +1991,7 @@ float CStaticItem::getBaseWeight() const return 0; } } +#endif // *************************************************************************** void CStaticItem::clearPtrs(bool doDelete) diff --git a/code/ryzom/server/src/entities_game_service/egs_sheets/egs_static_game_item.h b/code/ryzom/server/src/entities_game_service/egs_sheets/egs_static_game_item.h index 6fd990e65..ddea7be9c 100644 --- a/code/ryzom/server/src/entities_game_service/egs_sheets/egs_static_game_item.h +++ b/code/ryzom/server/src/entities_game_service/egs_sheets/egs_static_game_item.h @@ -838,11 +838,13 @@ public: /// called to copy from another sheet (operator= + care ptrs) void reloadSheet(const CStaticItem &o); +#ifndef NO_EGS_VARS /** Get the base weigth for an item. * This weight must be multiplied by the craft parameter weight value * to obtain the real item weight. */ float getBaseWeight() const; +#endif std::vector lookForEffects(ITEM_SPECIAL_EFFECT::TItemSpecialEffect effectType) const; diff --git a/code/ryzom/server/src/entities_game_service/egs_sheets/egs_static_game_sheet.cpp b/code/ryzom/server/src/entities_game_service/egs_sheets/egs_static_game_sheet.cpp index 0ee30916c..0cc44399d 100644 --- a/code/ryzom/server/src/entities_game_service/egs_sheets/egs_static_game_sheet.cpp +++ b/code/ryzom/server/src/entities_game_service/egs_sheets/egs_static_game_sheet.cpp @@ -2093,7 +2093,7 @@ void CStaticLootTable::readGeorges( const NLMISC::CSmartPtr &f } // CStaticLootTable::readGeorges // - +#ifndef NO_EGS_VARS /// selectRandomLootSet CSheetId CStaticLootTable::selectRandomLootSet() const { @@ -2173,6 +2173,7 @@ const CStaticLootSet *CStaticLootTable::selectRandomCustomLootSet() const nlwarning("Can't find any lootset rand=%d probabilitySum=%d weightCount=%d",randWeight,probabilitySum,CustomLootSets.size()); return 0; } +#endif /////////////////////////////////////////////////////////////////////////// ///////////////////// Static Race Statistics ////////////////////////////// diff --git a/code/ryzom/server/src/entities_game_service/egs_sheets/egs_static_game_sheet.h b/code/ryzom/server/src/entities_game_service/egs_sheets/egs_static_game_sheet.h index 9c88d3a91..527f5ee09 100644 --- a/code/ryzom/server/src/entities_game_service/egs_sheets/egs_static_game_sheet.h +++ b/code/ryzom/server/src/entities_game_service/egs_sheets/egs_static_game_sheet.h @@ -868,10 +868,12 @@ public: /// read the sheet virtual void readGeorges( const NLMISC::CSmartPtr &form, const NLMISC::CSheetId &sheetId ); +#ifndef NO_EGS_VARS /// select a loot set NLMISC::CSheetId selectRandomLootSet() const; const CStaticLootSet *selectRandomCustomLootSet() const; +#endif // return the version of this class, increments this value when the content of this class changed static uint getVersion () { return 1; } diff --git a/code/ryzom/server/src/entities_game_service/egs_sheets/egs_static_harvestable.cpp b/code/ryzom/server/src/entities_game_service/egs_sheets/egs_static_harvestable.cpp index abd96f45f..4aad89e50 100644 --- a/code/ryzom/server/src/entities_game_service/egs_sheets/egs_static_harvestable.cpp +++ b/code/ryzom/server/src/entities_game_service/egs_sheets/egs_static_harvestable.cpp @@ -31,6 +31,7 @@ const uint8 NbRawMaterials = 10; const float QuarteringForcedQuantities [6] = { 0, 1.0f, 2.0f, 3.0f, 4.0f, 0.5f }; +#ifndef NO_EGS_VARS const float *QuarteringQuantityByVariable [NBRMQuantityVariables] = { &QuarteringQuantityAverageForCraftHerbivore.get(), @@ -46,7 +47,7 @@ const float *QuarteringQuantityByVariable [NBRMQuantityVariables] = &QuarteringForcedQuantities[4], &QuarteringForcedQuantities[5] }; - +#endif CVariable VerboseQuartering( "egs", "VerboseQuartering", "", false, 0, true ); diff --git a/code/ryzom/server/src/entities_game_service/egs_sheets/egs_static_harvestable.h b/code/ryzom/server/src/entities_game_service/egs_sheets/egs_static_harvestable.h index b89948f49..f23803bd3 100644 --- a/code/ryzom/server/src/entities_game_service/egs_sheets/egs_static_harvestable.h +++ b/code/ryzom/server/src/entities_game_service/egs_sheets/egs_static_harvestable.h @@ -34,7 +34,9 @@ enum TRMUsage { RMUTotalQuantity, RMUFixedQuantity, NbRMUsages }; enum TRMQuantityVariable { RMQVHerbivore, RMQVCarnivore, RMQVBoss5, RMQVBossBegin=RMQVBoss5, RMQVBoss7, RMQVBossEnd=RMQVBoss7, RMQVInvasion5, RMQVInvasion7, RMQVForceBase, NBRMQuantityVariables=RMQVForceBase+6 }; +#ifndef NO_EGS_VARS extern const float *QuarteringQuantityByVariable [NBRMQuantityVariables]; +#endif /** diff --git a/code/ryzom/server/src/entities_game_service/entity_structure/resists.cpp b/code/ryzom/server/src/entities_game_service/entity_structure/resists.cpp index 89322cc9f..b8f195857 100644 --- a/code/ryzom/server/src/entities_game_service/entity_structure/resists.cpp +++ b/code/ryzom/server/src/entities_game_service/entity_structure/resists.cpp @@ -22,8 +22,6 @@ #include "stdpch.h" // #include "resists.h" -#include "player_manager/character.h" -#include "game_item_manager/game_item.h" ////////////// // USING // diff --git a/code/ryzom/tools/sheets_packer_shard/CMakeLists.txt b/code/ryzom/tools/sheets_packer_shard/CMakeLists.txt index 5b8d6b181..87172f439 100644 --- a/code/ryzom/tools/sheets_packer_shard/CMakeLists.txt +++ b/code/ryzom/tools/sheets_packer_shard/CMakeLists.txt @@ -1,15 +1,19 @@ FILE(GLOB SRC *.cpp *.h) +FILE(GLOB EGSSHEETS ${CMAKE_SOURCE_DIR}/ryzom/server/src/entities_game_service/egs_sheets/*.cpp ${CMAKE_SOURCE_DIR}/ryzom/server/src/entities_game_service/egs_sheets/*.h) -ADD_EXECUTABLE(sheets_packer_shard ${SRC} +ADD_EXECUTABLE(sheets_packer_shard ${SRC} ${EGSSHEETS} ${CMAKE_SOURCE_DIR}/ryzom/server/src/input_output_service/string_manager_sheet.cpp ${CMAKE_SOURCE_DIR}/ryzom/server/src/input_output_service/string_manager.h ${CMAKE_SOURCE_DIR}/ryzom/server/src/gpm_service/sheets.cpp - ${CMAKE_SOURCE_DIR}/ryzom/server/src/gpm_service/sheets.h) + ${CMAKE_SOURCE_DIR}/ryzom/server/src/gpm_service/sheets.h + ${CMAKE_SOURCE_DIR}/ryzom/server/src/entities_game_service/entity_structure/resists.cpp + ${CMAKE_SOURCE_DIR}/ryzom/server/src/entities_game_service/entity_structure/resists.h) -INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR} ${CMAKE_SOURCE_DIR}/ryzom/common/src ${CMAKE_SOURCE_DIR}/ryzom/server/src) +INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR} ${CMAKE_SOURCE_DIR}/ryzom/common/src ${CMAKE_SOURCE_DIR}/ryzom/server/src ${CMAKE_SOURCE_DIR}/ryzom/tools/sheets_packer_shard ${CMAKE_SOURCE_DIR}/ryzom/server/src/entities_game_service) TARGET_LINK_LIBRARIES(sheets_packer_shard ryzom_gameshare ryzom_servershare + ryzom_aishare nelmisc nelgeorges nelnet @@ -21,4 +25,6 @@ ADD_DEFINITIONS(${LIBXML2_DEFINITIONS}) NL_DEFAULT_PROPS(sheets_packer_shard "Ryzom, Tools: Sheets Packer Shard") NL_ADD_RUNTIME_FLAGS(sheets_packer_shard) +SET_TARGET_PROPERTIES(sheets_packer_shard PROPERTIES COMPILE_FLAGS -DNO_EGS_VARS) + INSTALL(TARGETS sheets_packer_shard RUNTIME DESTINATION ${RYZOM_BIN_PREFIX} COMPONENT tools) diff --git a/code/ryzom/tools/sheets_packer_shard/sheets_packer_shard.cpp b/code/ryzom/tools/sheets_packer_shard/sheets_packer_shard.cpp index 1d146758a..3d3372302 100644 --- a/code/ryzom/tools/sheets_packer_shard/sheets_packer_shard.cpp +++ b/code/ryzom/tools/sheets_packer_shard/sheets_packer_shard.cpp @@ -30,11 +30,13 @@ #include #include #include +#include #include #include #include #include #include +#include // Project includes // ... @@ -43,6 +45,15 @@ namespace { } /* anonymous namespace */ +// EGS +NLMISC::CVariable EGSLight("egs","EGSLight", "Load EGS with a minimal set of feature loaded", false, 0, true); +NLMISC::CVariable LoadOutposts("egs", "LoadOutposts", "If false outposts won't be loaded", true, 0, true ); +static std::string s_WriteDirectory; +std::string writeDirectory() +{ + return s_WriteDirectory; +} + //////////////////////////////////////////////////////////////////////// // note: *.packed_sheets files are placed in // // and will need to be moved to the right location by // @@ -55,10 +66,12 @@ int main(int nNbArg, char **ppArgs) NLMISC::createDebug(); // verify all params - if (nNbArg < 5) + if (nNbArg < 6) { + // >sheets_packer_shard.exe L:\leveldesign L:\leveldesign\DFN R:\code\ryzom\server\data_shard\mirror_sheets T:\export\common\leveldesign\visual_slot_tab T:\test_shard nlinfo("ERROR : Wrong number of arguments\n"); - nlinfo("USAGE : sheets_packer_shard \n"); + nlinfo("USAGE : sheets_packer_shard \n"); + nlinfo(" : Directory containing visual_slots.tab"); return EXIT_FAILURE; } std::string leveldesignDir = std::string(ppArgs[1]); @@ -79,18 +92,29 @@ int main(int nNbArg, char **ppArgs) nlerrornoex("Directory datasets '%s' does not exist", datasetsDir.c_str()); return EXIT_FAILURE; } - std::string exportDir = std::string(ppArgs[4]); + std::string tabDir = std::string(ppArgs[4]); + if (!NLMISC::CFile::isDirectory(tabDir)) + { + nlerrornoex("Directory tab '%s' does not exist", tabDir.c_str()); + return EXIT_FAILURE; + } + std::string exportDir = std::string(ppArgs[5]); if (!NLMISC::CFile::isDirectory(exportDir)) { nlerrornoex("Directory build_packed_sheets '%s' does not exist", exportDir.c_str()); return EXIT_FAILURE; } + s_WriteDirectory = exportDir + "/"; // add search paths NLMISC::CPath::addSearchPath(leveldesignDir, true, false); NLMISC::CPath::addSearchPath(dfnDir, true, false); - NLMISC::CPath::addSearchPath(datasetsDir, true, false); + NLMISC::CPath::addSearchPath(datasetsDir, false, false); + NLMISC::CPath::addSearchPath(tabDir, false, false); + // init sheet_id.bin + NLMISC::CSheetId::init(false); + // this here does the magic // MS { @@ -123,7 +147,12 @@ int main(int nNbArg, char **ppArgs) // CContinentContainer { CContinentContainer continents; - continents.buildSheets(exportDir + "/"); + continents.buildSheets(s_WriteDirectory); + } + + // EGS + { + CSheets::init(); } // and that's all folks