diff --git a/ryzom/server/src/CMakeLists.txt b/ryzom/server/src/CMakeLists.txt index fc91decc43..4249f25c8b 100644 --- a/ryzom/server/src/CMakeLists.txt +++ b/ryzom/server/src/CMakeLists.txt @@ -4,6 +4,7 @@ IF(WITH_RYZOM_TOOLS OR WITH_RYZOM_SERVER) ADD_SUBDIRECTORY(server_share) ADD_SUBDIRECTORY(ai_share) + ADD_SUBDIRECTORY(egs_sheets) ENDIF() IF(WITH_RYZOM_SERVER) diff --git a/ryzom/server/src/ai_service/ai_script_comp.h b/ryzom/server/src/ai_service/ai_script_comp.h index d4782ac188..0d3e17285d 100644 --- a/ryzom/server/src/ai_service/ai_script_comp.h +++ b/ryzom/server/src/ai_service/ai_script_comp.h @@ -17,31 +17,7 @@ #ifndef _SCRIPT_COMP_H_ #define _SCRIPT_COMP_H_ - -struct ReadFightActionException :public NLMISC::Exception -{ - ReadFightActionException(const std::string &reason):NLMISC::Exception(reason){} -}; - -class CSpawnBot; - -class CFightScriptComp - :public NLMISC::CRefCount -{ -public: - CFightScriptComp() - {} - virtual ~CFightScriptComp() - {} - virtual std::string toString() const = 0; - - virtual bool update(CSpawnBot &bot) const = 0; // returns true if it behaves normally, false if there a problem and callers may not consider it behaves normally. - // for instance ONCE may not consider that this call happened. - virtual void remove(CFightScriptComp *child) - {} -protected: -private: -}; +#include "ai_script_comp_base.h" class CFightScriptCompReader :public NLMISC::CRefCount diff --git a/ryzom/server/src/ai_service/ai_script_comp_base.h b/ryzom/server/src/ai_service/ai_script_comp_base.h new file mode 100644 index 0000000000..f63af886d6 --- /dev/null +++ b/ryzom/server/src/ai_service/ai_script_comp_base.h @@ -0,0 +1,47 @@ +// 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 . + +#ifndef _SCRIPT_COMP_BASE_H_ +#define _SCRIPT_COMP_BASE_H_ + +#include "nel/misc/smart_ptr.h" + +struct ReadFightActionException :public NLMISC::Exception +{ + ReadFightActionException(const std::string &reason):NLMISC::Exception(reason){} +}; + +class CSpawnBot; + +class CFightScriptComp + :public NLMISC::CRefCount +{ +public: + CFightScriptComp() + {} + virtual ~CFightScriptComp() + {} + virtual std::string toString() const = 0; + + virtual bool update(CSpawnBot &bot) const = 0; // returns true if it behaves normally, false if there a problem and callers may not consider it behaves normally. + // for instance ONCE may not consider that this call happened. + virtual void remove(CFightScriptComp *child) + {} +protected: +private: +}; + +#endif diff --git a/ryzom/server/src/ai_service/ai_sheets_creature.cpp b/ryzom/server/src/ai_service/ai_sheets_creature.cpp new file mode 100644 index 0000000000..94d9dafd33 --- /dev/null +++ b/ryzom/server/src/ai_service/ai_sheets_creature.cpp @@ -0,0 +1,151 @@ +// Ryzom - MMORPG Framework +// Copyright (C) 2010 Winch Gate Property Limited +// +// This source file has been modified by the following contributors: +// Copyright (C) 2014 Jan BOON (Kaetemi) +// +// 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 . + +// AI-service-specific sheets overrides. +// These depend on ai_script_comp.cpp (CFightScriptCompReader, +// CFightSelectFilter) and are kept separate from the base CCreature +// so the base class can be used independently (e.g. by sheets_packer_shard). + +#include "stdpch.h" + +#include "ai_sheets_creature.h" +#include "ai_script_comp.h" + +#include "nel/net/service.h" +#include "nel/georges/load_form.h" + +using namespace std; +using namespace NLMISC; +using namespace NLNET; + +extern char const* AISPackedSheetsFilename; +extern char const* AISPackedFightConfigSheetsFilename; +extern char const* AISPackedActionSheetsFilename; +extern char const* AISPackedRaceStatsSheetsFilename; + +void AISHEETS::CCreatureAI::onScriptComp(const std::string &scriptCompStr) +{ + CFightScriptComp* scriptComp; + try + { + scriptComp = CFightScriptCompReader::createScriptComp(scriptCompStr); + registerScriptComp(scriptComp); + } + catch (const ReadFightActionException& ex) + { + nlwarning("script read error (ignored): %s", ex.what()); + } +} + +void AISHEETS::CCreatureAI::registerScriptComp(CFightScriptComp* scriptComp) +{ + _ScriptCompList.push_back(scriptComp); + + CFightSelectFilter* filter = dynamic_cast(scriptComp); + if (!filter) + return; + + std::string const& param = filter->getParam(); + if (param == "ON_UPDATE") + _UpdateScriptList.push_back(scriptComp); + if (param == "ON_DEATH") + _DeathScriptList.push_back(scriptComp); + if (param == "ON_BIRTH") + _BirthScriptList.push_back(scriptComp); +} + +void AISHEETS::CSheetsAI::initInstance() +{ + setInstance(new CSheetsAI); +} + +void AISHEETS::CSheetsAI::packSheets(const std::string &writeFilesDirectoryName) +{ + CConfigFile::CVar *varPtr = IService::isServiceInitialized() ? IService::getInstance()->ConfigFile.getVarPtr(std::string("GeorgePaths")) : NULL; + + // Use CCreatureAI map so script comps are processed during loading + std::map sheetsAI; + + // if config file variable 'GeorgePaths' exists then only do a minimal loadForms otherwise do the full works + if (varPtr != NULL) + { + bool addSearchPath = false; + + loadForm2("aiaction", writeFilesDirectoryName + AISPackedActionSheetsFilename, _ActionSheets, false, false); + if (_ActionSheets.empty()) + { + if (!addSearchPath) + { + addSearchPath = true; + for (uint32 i = 0; i < varPtr->size(); ++i) + CPath::addSearchPath(NLMISC::expandEnvironmentVariables(varPtr->asString(i)), true, false); + } + loadForm2("aiaction", writeFilesDirectoryName + AISPackedActionSheetsFilename, _ActionSheets, true); + } + + loadForm("actionlist", writeFilesDirectoryName + AISPackedFightConfigSheetsFilename, _ActionListSheets, false, false); + if (_ActionListSheets.empty()) + { + if (!addSearchPath) + { + addSearchPath = true; + for (uint32 i = 0; i < varPtr->size(); ++i) + CPath::addSearchPath(NLMISC::expandEnvironmentVariables(varPtr->asString(i)), true, false); + } + loadForm("actionlist", writeFilesDirectoryName + AISPackedFightConfigSheetsFilename, _ActionListSheets, true); + } + + loadForm2("creature", writeFilesDirectoryName + AISPackedSheetsFilename, sheetsAI, false, false); + if (sheetsAI.empty()) + { + if (!addSearchPath) + { + addSearchPath = true; + for (uint32 i = 0; i < varPtr->size(); ++i) + CPath::addSearchPath(NLMISC::expandEnvironmentVariables(varPtr->asString(i)), true, false); + } + loadForm2("creature", writeFilesDirectoryName + AISPackedSheetsFilename, sheetsAI, true); + } + + loadForm2("race_stats", writeFilesDirectoryName + AISPackedRaceStatsSheetsFilename, _RaceStatsSheets, false, false); + if (_RaceStatsSheets.empty()) + { + if (!addSearchPath) + { + addSearchPath = true; + for (uint32 i = 0; i < varPtr->size(); ++i) + CPath::addSearchPath(NLMISC::expandEnvironmentVariables(varPtr->asString(i)), true, false); + } + loadForm2("race_stats", writeFilesDirectoryName + AISPackedRaceStatsSheetsFilename, _RaceStatsSheets, true); + } + } + else + { + loadForm2("aiaction", writeFilesDirectoryName + AISPackedActionSheetsFilename, _ActionSheets, true); + loadForm("actionlist", writeFilesDirectoryName + AISPackedFightConfigSheetsFilename, _ActionListSheets, true); + loadForm2("creature", writeFilesDirectoryName + AISPackedSheetsFilename, sheetsAI, true); + loadForm2("race_stats", writeFilesDirectoryName + AISPackedRaceStatsSheetsFilename, _RaceStatsSheets, true); + } + + // Transfer CCreatureAI pointers into the base _Sheets map + for (std::map::iterator it = sheetsAI.begin(); it != sheetsAI.end(); ++it) + { + _Sheets.insert(std::make_pair(it->first, CCreaturePtr(it->second))); + } +} diff --git a/ryzom/server/src/ai_service/ai_sheets_creature.h b/ryzom/server/src/ai_service/ai_sheets_creature.h new file mode 100644 index 0000000000..755fcb51b7 --- /dev/null +++ b/ryzom/server/src/ai_service/ai_sheets_creature.h @@ -0,0 +1,60 @@ +// Ryzom - MMORPG Framework +// Copyright (C) 2010 Winch Gate Property Limited +// +// This source file has been modified by the following contributors: +// Copyright (C) 2014 Jan BOON (Kaetemi) +// +// 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 RYAI_SHEETS_CREATURE_H +#define RYAI_SHEETS_CREATURE_H + +#include "sheets.h" + +namespace AISHEETS { + +/** + * AI-service-specific creature sheet class. + * Extends CCreature with script comp processing that depends on + * ai_script_comp.cpp (CFightScriptCompReader, CFightSelectFilter). + */ +class CCreatureAI +: public CCreature +{ +protected: + void onScriptComp(const std::string &scriptCompStr); + +public: + void registerScriptComp(CFightScriptComp* scriptComp); +}; +typedef NLMISC::CSmartPtr CCreatureAIPtr; + +/** + * AI-service-specific sheets singleton. + * Overrides packSheets to load CCreatureAI instead of CCreature, + * enabling script comp processing without preprocessor hacks. + */ +class CSheetsAI +: public CSheets +{ +public: + void packSheets(const std::string &writeFilesDirectoryName); + + /// Register CSheetsAI as the singleton. Call before getInstance(). + static void initInstance(); +}; + +} + +#endif diff --git a/ryzom/server/src/ai_service/service_main.cpp b/ryzom/server/src/ai_service/service_main.cpp index d4a66dc15b..c72a3f80b2 100644 --- a/ryzom/server/src/ai_service/service_main.cpp +++ b/ryzom/server/src/ai_service/service_main.cpp @@ -37,6 +37,7 @@ #include "aids_interface.h" #include "game_share/fame.h" #include "visual_properties_interface.h" +#include "ai_sheets_creature.h" #include "ais_user_models.h" @@ -208,6 +209,7 @@ void CAIService::init (void) CAIKeywords::init(); CMirrors::init(cbTick, NULL, cbTickRelease); CMessages::init(); + AISHEETS::CSheetsAI::initInstance(); AISHEETS::CSheets::getInstance()->init(); // initialise the AI_SHARE library diff --git a/ryzom/server/src/ai_service/sheets.cpp b/ryzom/server/src/ai_service/sheets.cpp index 924b299855..1dec5f8ad3 100644 --- a/ryzom/server/src/ai_service/sheets.cpp +++ b/ryzom/server/src/ai_service/sheets.cpp @@ -628,18 +628,7 @@ void AISHEETS::CCreature::readGeorges(NLMISC::CSmartPtr const& { std::string scriptCompStr; scriptCompNode->getArrayValue(scriptCompStr, arrayIndex); -#ifndef NO_AI_COMP - CFightScriptComp* scriptComp; - try - { - scriptComp = CFightScriptCompReader::createScriptComp(scriptCompStr); - registerScriptComp(scriptComp); - } - catch (const ReadFightActionException& ex) - { - nlwarning("script read error (ignored): %s", ex.what()); - } -#endif + onScriptComp(scriptCompStr); } } // Creature race @@ -653,23 +642,6 @@ void AISHEETS::CCreature::readGeorges(NLMISC::CSmartPtr const& } } -void AISHEETS::CCreature::registerScriptComp(CFightScriptComp* scriptComp) -{ - _ScriptCompList.push_back(scriptComp); - - CFightSelectFilter* filter = dynamic_cast(scriptComp); - if (!filter) - return; - - std::string const& param = filter->getParam(); - if (param=="ON_UPDATE") - _UpdateScriptList.push_back(scriptComp); - if (param=="ON_DEATH") - _DeathScriptList.push_back(scriptComp); - if (param=="ON_BIRTH") - _BirthScriptList.push_back(scriptComp); -} - uint AISHEETS::CCreature::getVersion() { @@ -766,19 +738,7 @@ void AISHEETS::CCreature::serial(NLMISC::IStream &s) { string scriptCompStr; s.serial(scriptCompStr); - -#ifndef NO_AI_COMP - CFightScriptComp* scriptComp; - try - { - scriptComp = CFightScriptCompReader::createScriptComp(scriptCompStr); - registerScriptComp(scriptComp); - } - catch (const ReadFightActionException& ex) - { - nlwarning("script read error (ignored): %s", ex.what()); - } -#endif + onScriptComp(scriptCompStr); } } else @@ -872,6 +832,11 @@ void AISHEETS::CSheets::destroyInstance() _Instance = NULL; } +void AISHEETS::CSheets::setInstance(CSheets* instance) +{ + _Instance = instance; +} + AISHEETS::CSheets::CSheets() : _Initialised(false) { diff --git a/ryzom/server/src/ai_service/sheets.h b/ryzom/server/src/ai_service/sheets.h index cd1a5ccfbc..4afbae0c54 100644 --- a/ryzom/server/src/ai_service/sheets.h +++ b/ryzom/server/src/ai_service/sheets.h @@ -37,7 +37,7 @@ #include "game_share/visual_slot_manager.h" -#include "ai_script_comp.h" +#include "ai_script_comp_base.h" #include "game_share/people_pd.h" @@ -494,12 +494,14 @@ class CCreature std::string _BotName; +protected: TScriptCompList _ScriptCompList; TScriptCompList _UpdateScriptList; TScriptCompList _DeathScriptList; TScriptCompList _BirthScriptList; +private: // Character Race EGSPD::CPeople::TPeople _Race; @@ -607,8 +609,8 @@ class CCreature //@} public: - void readGeorges(NLMISC::CSmartPtr const& form, NLMISC::CSheetId const& sheetId); - void serial(NLMISC::IStream& s); + virtual void readGeorges(NLMISC::CSmartPtr const& form, NLMISC::CSheetId const& sheetId); + virtual void serial(NLMISC::IStream& s); uint32 minFightDist() const { return MinFightDist(); } void calcFightAndVisualValues(std::string* left = NULL, std::string* right = NULL); @@ -621,8 +623,12 @@ class CCreature void addActionConfig(std::string const& sheetIdName, NLMISC::CDbgPtr& actionConfigList); bool addActionConfig(NLMISC::CSheetId const& sheetId, NLMISC::CDbgPtr& actionConfigList); void removed() { } - void registerScriptComp(CFightScriptComp* scriptComp); +protected: + /// Called for each script comp string read from sheets. Override to create script comps. + virtual void onScriptComp(const std::string &scriptCompStr) { } + +public: TGroupPropertiesLine _GroupPropertiesTbl; private: @@ -688,11 +694,12 @@ class CSheets public: static CSheets* getInstance(); static void destroyInstance(); + static void setInstance(CSheets* instance); public: // load the creature data from the george files void init(); - void packSheets(const std::string &writeFilesDirectoryName); + virtual void packSheets(const std::string &writeFilesDirectoryName); // display the creature data for all known creature types void display(NLMISC::CSmartPtr stringWriter, uint infoSelect = 0); @@ -710,14 +717,16 @@ class CSheets uint32 playerGroupIndex() { return _PlayerGroupIndex; } -private: + virtual ~CSheets() { } + +protected: friend class CCreature; -private: +protected: // prohibit cnstructor as this is a singleton CSheets(); -private: +protected: CDefaultGroupProperties _DefaultGroupProp; std::map _Sheets; diff --git a/ryzom/server/src/egs_sheets/CMakeLists.txt b/ryzom/server/src/egs_sheets/CMakeLists.txt new file mode 100644 index 0000000000..cc1203544b --- /dev/null +++ b/ryzom/server/src/egs_sheets/CMakeLists.txt @@ -0,0 +1,36 @@ +FILE(GLOB SRC ${CMAKE_SOURCE_DIR}/ryzom/server/src/entities_game_service/egs_sheets/*.cpp ${CMAKE_SOURCE_DIR}/ryzom/server/src/entities_game_service/egs_sheets/*.h) + +LIST(APPEND SRC + ${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 +) + +NL_TARGET_LIB(ryzom_egs_sheets ${SRC}) + +TARGET_INCLUDE_DIRECTORIES(ryzom_egs_sheets PRIVATE ${CMAKE_SOURCE_DIR}/ryzom/common/src ${CMAKE_SOURCE_DIR}/ryzom/server/src ${CMAKE_SOURCE_DIR}/ryzom/server/src/entities_game_service) + +TARGET_LINK_LIBRARIES(ryzom_egs_sheets + PUBLIC + ryzom_gameshare + ryzom_servershare + ryzom_aishare + NeL::misc + NeL::net + NeL::georges +) + +NL_DEFAULT_PROPS(ryzom_egs_sheets "Ryzom, Library: EGS Sheets") +NL_ADD_RUNTIME_FLAGS(ryzom_egs_sheets) +NL_ADD_LIB_SUFFIX(ryzom_egs_sheets) + +IF(MSVC) + SET_TARGET_PROPERTIES(ryzom_egs_sheets PROPERTIES COMPILE_FLAGS "/bigobj") +ENDIF() + +IF(WITH_PCH) + target_precompile_headers(ryzom_egs_sheets PRIVATE ${CMAKE_SOURCE_DIR}/ryzom/server/src/entities_game_service/stdpch.h) +ENDIF() + +IF(WITH_INSTALL_LIBRARIES) + INSTALL(TARGETS ryzom_egs_sheets LIBRARY DESTINATION ${RYZOM_LIB_PREFIX} ARCHIVE DESTINATION ${RYZOM_LIB_PREFIX} COMPONENT libraries) +ENDIF() diff --git a/ryzom/server/src/entities_game_service/egs_sheets/egs_sheets.cpp b/ryzom/server/src/entities_game_service/egs_sheets/egs_sheets.cpp index 712417691f..3b682b6139 100644 --- a/ryzom/server/src/entities_game_service/egs_sheets/egs_sheets.cpp +++ b/ryzom/server/src/entities_game_service/egs_sheets/egs_sheets.cpp @@ -47,8 +47,6 @@ using namespace NLMISC; using namespace NLGEORGES; //extern CPlayerManager PlayerManager; -extern CVariable LoadOutposts; -extern CVariable EGSLight; //------------------------------------------------------------------------------------------ @@ -58,15 +56,39 @@ extern CVariable EGSLight; CSheets CSheets::_StaticSheets; // the singleton instance bool CSheets::_Initialised=false; // - set true by constructor bool CSheets::_Destroyed=false; // - set true by destructor +std::string CSheets::_WriteDirectory; +bool CSheets::_EGSLight=false; +bool CSheets::_LoadOutposts=true; + +void CSheets::setWriteDirectory(const std::string &dir) +{ + _WriteDirectory = dir; +} + +const std::string &CSheets::getWriteDirectory() +{ + return _WriteDirectory; +} + +void CSheets::setEGSLight(bool light) +{ + _EGSLight = light; +} + +bool CSheets::getEGSLight() +{ + return _EGSLight; +} + +void CSheets::setLoadOutposts(bool load) +{ + _LoadOutposts = load; +} -#ifndef NO_EGS_VARS static std::string writeDirectory() { - return IService::getInstance()->WriteFilesDirectory.toString(); + return CSheets::getWriteDirectory(); } -#else -extern std::string writeDirectory(); -#endif //--------------------------------------------------- // scanDirectoriesForFiles : utility routine for init() @@ -261,7 +283,7 @@ void CSheets::init() loadSheetSet( "continent", "egs_continents.packed_sheets", _StaticSheets._StaticContinents); // only load outpost sheets if outpost system is activated - if (LoadOutposts.get()) + if (_LoadOutposts) { loadSheetSet( "outpost_building", "egs_outpost_building.packed_sheets", _StaticSheets._StaticOutpostBuilding); loadSheetSet( "outpost_squad", "egs_outpost_squads.packed_sheets", _StaticSheets._StaticOutpostSquads); @@ -289,7 +311,7 @@ void CSheets::init() } } - if (!EGSLight) + if (!_EGSLight) { // Emotes std::map< NLMISC::CSheetId, CStaticTextEmotes > emoteTexts; @@ -313,7 +335,7 @@ void CSheets::init() // Encyclopedia _StaticSheets._Encyclopedia = new CStaticEncyclo; - if (!EGSLight) + if (!_EGSLight) { loadSheetSet( "encyclo_album", "egs_encyclo_album.packed_sheets", _StaticSheets._Encyclopedia->_AlbumsFromSheet); loadSheetSet( "encyclo_thema", "egs_encyclo_thema.packed_sheets", _StaticSheets._Encyclopedia->_ThemasFromSheet); diff --git a/ryzom/server/src/entities_game_service/egs_sheets/egs_sheets.h b/ryzom/server/src/entities_game_service/egs_sheets/egs_sheets.h index 5df123d403..4ae9e4d808 100644 --- a/ryzom/server/src/entities_game_service/egs_sheets/egs_sheets.h +++ b/ryzom/server/src/entities_game_service/egs_sheets/egs_sheets.h @@ -79,6 +79,34 @@ public : public: + /** + * Set the write directory for packed sheets output. + * Must be called before init(). + */ + static void setWriteDirectory(const std::string &dir); + + /** + * Get the write directory for packed sheets output. + */ + static const std::string &getWriteDirectory(); + + /** + * Set whether to load with a minimal set of features (EGS Light mode). + * Must be called before init(). Default is false. + */ + static void setEGSLight(bool light); + + /** + * Get whether EGS Light mode is enabled. + */ + static bool getEGSLight(); + + /** + * Set whether outposts should be loaded. + * Must be called before init(). Default is true. + */ + static void setLoadOutposts(bool load); + /** * Init the manager (register callbacks) */ @@ -295,6 +323,9 @@ private : static CSheets _StaticSheets; //the singleton instance static bool _Initialised; //default =false - set true by constructor static bool _Destroyed; //default =false - set true by destructor + static std::string _WriteDirectory; // write directory for packed sheets + static bool _EGSLight; //default =false - load with minimal features + static bool _LoadOutposts; //default =true - load outpost sheets }; #endif // SHEETS_H diff --git a/ryzom/server/src/entities_game_service/egs_sheets/egs_static_encyclo.cpp b/ryzom/server/src/entities_game_service/egs_sheets/egs_static_encyclo.cpp index 91f17c7978..3e72e300b4 100644 --- a/ryzom/server/src/entities_game_service/egs_sheets/egs_static_encyclo.cpp +++ b/ryzom/server/src/entities_game_service/egs_sheets/egs_static_encyclo.cpp @@ -27,7 +27,7 @@ using namespace NLMISC; using namespace NLGEORGES; using namespace std; -extern CVariable EGSLight; +#include "egs_sheets/egs_sheets.h" NL_INSTANCE_COUNTER_IMPL(CStaticEncyclo); /////////////////////////////////////////////////////////////////////////////////////////// @@ -123,7 +123,7 @@ void CStaticEncyclo::init() { _OrderedAlbums.clear(); - if (EGSLight) + if (CSheets::getEGSLight()) return; // Get the higher album number diff --git a/ryzom/server/src/entities_game_service/egs_sheets/egs_static_game_item.cpp b/ryzom/server/src/entities_game_service/egs_sheets/egs_static_game_item.cpp index b2811d9a59..15f0fbb8fa 100644 --- a/ryzom/server/src/entities_game_service/egs_sheets/egs_static_game_item.cpp +++ b/ryzom/server/src/entities_game_service/egs_sheets/egs_static_game_item.cpp @@ -32,8 +32,6 @@ // georges #include "nel/georges/u_type.h" -#include "game_item_manager/weapon_craft_parameters.h" - #include "egs_sheets/egs_sheets.h" //-------------------- @@ -1910,121 +1908,6 @@ void CStaticItem::reloadSheet(const CStaticItem &o) const_cast(o).clearPtrs(false); } -#ifndef NO_EGS_VARS -// *************************************************************************** -float CStaticItem::getBaseWeight() const -{ - switch( Type ) - { - // melee weapons - case ITEM_TYPE::DAGGER: - return CWeaponCraftParameters::DaggerWeight; - case ITEM_TYPE::SWORD: - return CWeaponCraftParameters::SwordWeight; - case ITEM_TYPE::MACE: - return CWeaponCraftParameters::MaceWeight; - case ITEM_TYPE::AXE: - return CWeaponCraftParameters::AxeWeight; - case ITEM_TYPE::SPEAR: - return CWeaponCraftParameters::SpearWeight; - case ITEM_TYPE::STAFF: - return CWeaponCraftParameters::StaffWeight; - case ITEM_TYPE::MAGICIAN_STAFF: - return CWeaponCraftParameters::MagicianStaffWeight; - case ITEM_TYPE::TWO_HAND_SWORD: - return CWeaponCraftParameters::TwoHandSwordWeight; - case ITEM_TYPE::TWO_HAND_AXE: - return CWeaponCraftParameters::TwoHandAxeWeight; - case ITEM_TYPE::PIKE: - return CWeaponCraftParameters::PikeWeight; - case ITEM_TYPE::TWO_HAND_MACE: - return CWeaponCraftParameters::TwoHandMaceWeight; - - // range weapon - case ITEM_TYPE::AUTOLAUCH: - return CWeaponCraftParameters::AutolauchWeight; - case ITEM_TYPE::BOWRIFLE: - return CWeaponCraftParameters::BowrifleWeight; - case ITEM_TYPE::LAUNCHER: - return CWeaponCraftParameters::LauncherWeight; - case ITEM_TYPE::PISTOL: - return CWeaponCraftParameters::PistolWeight; - case ITEM_TYPE::BOWPISTOL: - return CWeaponCraftParameters::BowpistolWeight; - case ITEM_TYPE::RIFLE: - return CWeaponCraftParameters::RifleWeight; - - // ammo - case ITEM_TYPE::AUTOLAUNCH_AMMO: - return CWeaponCraftParameters::AutolaunchAmmoWeight; - case ITEM_TYPE::BOWRIFLE_AMMO: - return CWeaponCraftParameters::BowrifleAmmoWeight; - case ITEM_TYPE::LAUNCHER_AMMO: - return CWeaponCraftParameters::LauncherAmmoWeight; - case ITEM_TYPE::PISTOL_AMMO: - return CWeaponCraftParameters::PistolAmmoWeight; - case ITEM_TYPE::BOWPISTOL_AMMO: - return CWeaponCraftParameters::BowpistolAmmoWeight; - case ITEM_TYPE::RIFLE_AMMO: - return CWeaponCraftParameters::RifleAmmoWeight; - - // armor and shield - case ITEM_TYPE::SHIELD: - return CWeaponCraftParameters::ShieldWeight; - case ITEM_TYPE::BUCKLER: - return CWeaponCraftParameters::BucklerWeight; - case ITEM_TYPE::LIGHT_BOOTS: - return CWeaponCraftParameters::LightBootsWeight; - case ITEM_TYPE::LIGHT_GLOVES: - return CWeaponCraftParameters::LightGlovesWeight; - case ITEM_TYPE::LIGHT_PANTS: - return CWeaponCraftParameters::LightPantsWeight; - case ITEM_TYPE::LIGHT_SLEEVES: - return CWeaponCraftParameters::LightSleevesWeight; - case ITEM_TYPE::LIGHT_VEST: - return CWeaponCraftParameters::LightVestWeight; - case ITEM_TYPE::MEDIUM_BOOTS: - return CWeaponCraftParameters::MediumBootsWeight; - case ITEM_TYPE::MEDIUM_GLOVES: - return CWeaponCraftParameters::MediumGlovesWeight; - case ITEM_TYPE::MEDIUM_PANTS: - return CWeaponCraftParameters::MediumPantsWeight; - case ITEM_TYPE::MEDIUM_SLEEVES: - return CWeaponCraftParameters::MediumSleevesWeight; - case ITEM_TYPE::MEDIUM_VEST: - return CWeaponCraftParameters::MediumVestWeight; - case ITEM_TYPE::HEAVY_BOOTS: - return CWeaponCraftParameters::HeavyBootsWeight; - case ITEM_TYPE::HEAVY_GLOVES: - return CWeaponCraftParameters::HeavyGlovesWeight; - case ITEM_TYPE::HEAVY_PANTS: - return CWeaponCraftParameters::HeavyPantsWeight; - case ITEM_TYPE::HEAVY_SLEEVES: - return CWeaponCraftParameters::HeavySleevesWeight; - case ITEM_TYPE::HEAVY_VEST: - return CWeaponCraftParameters::HeavyVestWeight; - case ITEM_TYPE::HEAVY_HELMET: - return CWeaponCraftParameters::HeavyHelmetWeight; - - // jewel - case ITEM_TYPE::ANKLET: - return CWeaponCraftParameters::AnkletWeight; - case ITEM_TYPE::BRACELET: - return CWeaponCraftParameters::BraceletWeight; - case ITEM_TYPE::DIADEM: - return CWeaponCraftParameters::DiademWeight; - case ITEM_TYPE::EARING: - return CWeaponCraftParameters::EaringWeight; - case ITEM_TYPE::PENDANT: - return CWeaponCraftParameters::PendantWeight; - case ITEM_TYPE::RING: - return CWeaponCraftParameters::RingWeight; - default: - return 0; - } -} -#endif - uint32 CStaticItem::getMaxStackSize() const { diff --git a/ryzom/server/src/entities_game_service/egs_sheets/egs_static_game_item.h b/ryzom/server/src/entities_game_service/egs_sheets/egs_static_game_item.h index d64b9d5f77..b7dd101783 100644 --- a/ryzom/server/src/entities_game_service/egs_sheets/egs_static_game_item.h +++ b/ryzom/server/src/entities_game_service/egs_sheets/egs_static_game_item.h @@ -841,13 +841,11 @@ class CStaticItem /// 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/ryzom/server/src/entities_game_service/egs_sheets/egs_static_game_sheet.cpp b/ryzom/server/src/entities_game_service/egs_sheets/egs_static_game_sheet.cpp index 19a0a167c0..d557897c6d 100644 --- a/ryzom/server/src/entities_game_service/egs_sheets/egs_static_game_sheet.cpp +++ b/ryzom/server/src/entities_game_service/egs_sheets/egs_static_game_sheet.cpp @@ -45,8 +45,6 @@ const float MeanSuccessFactor = 0.65f; const float Offset = -0.5f; */ -extern CRandom RandomGenerator; - map< pair, CStaticGameBrick *> CStaticGameBrick::_Bricks; /////////////////////////////////////////////////////////////////////////// @@ -2092,88 +2090,6 @@ void CStaticLootTable::readGeorges( const NLMISC::CSmartPtr &f } // CStaticLootTable::readGeorges // -#ifndef NO_EGS_VARS -/// selectRandomLootSet -CSheetId CStaticLootTable::selectRandomLootSet() const -{ - if( LootSets.empty() ) - return CSheetId::Unknown; - - // compute the probability sum - uint16 probabilitySum = 0; - map::const_iterator itconst; - for( itconst = LootSets.begin(); itconst != LootSets.end(); ++itconst ) - { - probabilitySum += (*itconst).second; - } - - // choose a random number between and probabilitySum - uint32 randWeight; - if( probabilitySum == 0 ) - randWeight = 0; - else - randWeight = RandomGenerator.rand(probabilitySum-1) + 1; - - // "concatenate" weights of each index, when the random value is reached we'll have the index to use - uint16 w = 0; - for( itconst = LootSets.begin(); itconst != LootSets.end(); ++itconst ) - { - w += (*itconst).second; - if( randWeight <= w ) - { - break; - } - } - if( itconst != LootSets.end() ) - { - return (*itconst).first; - } - - nlwarning(" can't find any lootset rand=%d probabilitySum=%d weightCount=%d",randWeight,probabilitySum,LootSets.size()); - return CSheetId::Unknown; -} - -const CStaticLootSet *CStaticLootTable::selectRandomCustomLootSet() const -{ - if( CustomLootSets.empty() ) - return 0; - - // compute the probability sum - uint16 probabilitySum = 0; - multimap::const_iterator it = CustomLootSets.begin(); - for( ; it != CustomLootSets.end(); ++it ) - { - probabilitySum += (*it).first; - } - - // choose a random number between and probabilitySum - uint32 randWeight; - if( probabilitySum == 0 ) - randWeight = 0; - else - randWeight = RandomGenerator.rand(probabilitySum-1) + 1; - - // "concatenate" weights of each index, when the random value is reached we'll have the index to use - uint16 w = 0; - for (it = CustomLootSets.begin(); it != CustomLootSets.end(); ++it ) - { - w += (*it).first; - if( randWeight <= w ) - { - break; - } - } - - if( it != CustomLootSets.end() ) - { - return &(it->second); - } - - 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/ryzom/server/src/entities_game_service/egs_sheets/egs_static_game_sheet.h b/ryzom/server/src/entities_game_service/egs_sheets/egs_static_game_sheet.h index 3a06cdd171..90c9602601 100644 --- a/ryzom/server/src/entities_game_service/egs_sheets/egs_static_game_sheet.h +++ b/ryzom/server/src/entities_game_service/egs_sheets/egs_static_game_sheet.h @@ -871,12 +871,10 @@ class CStaticLootTable /// 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/ryzom/server/src/entities_game_service/egs_sheets/egs_static_harvestable.cpp b/ryzom/server/src/entities_game_service/egs_sheets/egs_static_harvestable.cpp index 05296e163a..729bb21e47 100644 --- a/ryzom/server/src/entities_game_service/egs_sheets/egs_static_harvestable.cpp +++ b/ryzom/server/src/entities_game_service/egs_sheets/egs_static_harvestable.cpp @@ -23,7 +23,6 @@ #include "egs_sheets/egs_static_harvestable.h" #include "egs_sheets/egs_sheets.h" -#include "../egs_variables.h" using namespace std; using namespace NLMISC; @@ -32,26 +31,6 @@ using namespace NLGEORGES; 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(), - &QuarteringQuantityAverageForCraftCarnivore.get(), - &QuarteringQuantityAverageForBoss5.get(), - &QuarteringQuantityAverageForBoss7.get(), - &QuarteringQuantityForInvasion5.get(), - &QuarteringQuantityForInvasion7.get(), - &QuarteringForcedQuantities[0], - &QuarteringForcedQuantities[1], - &QuarteringForcedQuantities[2], - &QuarteringForcedQuantities[3], - &QuarteringForcedQuantities[4], - &QuarteringForcedQuantities[5] -}; -#endif - CVariable VerboseQuartering( "egs", "VerboseQuartering", "", false, 0, true ); //-------------------------------------------------------------- diff --git a/ryzom/server/src/entities_game_service/egs_sheets/egs_static_harvestable.h b/ryzom/server/src/entities_game_service/egs_sheets/egs_static_harvestable.h index b083973542..f039c805d7 100644 --- a/ryzom/server/src/entities_game_service/egs_sheets/egs_static_harvestable.h +++ b/ryzom/server/src/entities_game_service/egs_sheets/egs_static_harvestable.h @@ -37,9 +37,7 @@ 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/ryzom/server/src/entities_game_service/egs_sheets_egs_impl.cpp b/ryzom/server/src/entities_game_service/egs_sheets_egs_impl.cpp new file mode 100644 index 0000000000..cf5b7aae86 --- /dev/null +++ b/ryzom/server/src/entities_game_service/egs_sheets_egs_impl.cpp @@ -0,0 +1,257 @@ +// Ryzom - MMORPG Framework +// Copyright (C) 2010 Winch Gate Property Limited +// +// This source file has been modified by the following contributors: +// Copyright (C) 2014 Jan BOON (Kaetemi) +// +// 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 . + +// EGS-specific implementations of egs_sheets methods. +// These depend on EGS globals and are kept separate from the +// egs_sheets library so the library can be used independently +// (e.g. by the sheets_packer_shard tool). + +#include "stdpch.h" + +#include "egs_sheets/egs_static_game_item.h" +#include "egs_sheets/egs_static_game_sheet.h" +#include "egs_sheets/egs_static_harvestable.h" +#include "egs_sheets/egs_sheets.h" +#include "egs_variables.h" +#include "egs_globals.h" +#include "game_item_manager/weapon_craft_parameters.h" + +using namespace std; +using namespace NLMISC; + +// *************************************************************************** +// CStaticItem::getBaseWeight +// *************************************************************************** +float CStaticItem::getBaseWeight() const +{ + switch( Type ) + { + // melee weapons + case ITEM_TYPE::DAGGER: + return CWeaponCraftParameters::DaggerWeight; + case ITEM_TYPE::SWORD: + return CWeaponCraftParameters::SwordWeight; + case ITEM_TYPE::MACE: + return CWeaponCraftParameters::MaceWeight; + case ITEM_TYPE::AXE: + return CWeaponCraftParameters::AxeWeight; + case ITEM_TYPE::SPEAR: + return CWeaponCraftParameters::SpearWeight; + case ITEM_TYPE::STAFF: + return CWeaponCraftParameters::StaffWeight; + case ITEM_TYPE::MAGICIAN_STAFF: + return CWeaponCraftParameters::MagicianStaffWeight; + case ITEM_TYPE::TWO_HAND_SWORD: + return CWeaponCraftParameters::TwoHandSwordWeight; + case ITEM_TYPE::TWO_HAND_AXE: + return CWeaponCraftParameters::TwoHandAxeWeight; + case ITEM_TYPE::PIKE: + return CWeaponCraftParameters::PikeWeight; + case ITEM_TYPE::TWO_HAND_MACE: + return CWeaponCraftParameters::TwoHandMaceWeight; + + // range weapon + case ITEM_TYPE::AUTOLAUCH: + return CWeaponCraftParameters::AutolauchWeight; + case ITEM_TYPE::BOWRIFLE: + return CWeaponCraftParameters::BowrifleWeight; + case ITEM_TYPE::LAUNCHER: + return CWeaponCraftParameters::LauncherWeight; + case ITEM_TYPE::PISTOL: + return CWeaponCraftParameters::PistolWeight; + case ITEM_TYPE::BOWPISTOL: + return CWeaponCraftParameters::BowpistolWeight; + case ITEM_TYPE::RIFLE: + return CWeaponCraftParameters::RifleWeight; + + // ammo + case ITEM_TYPE::AUTOLAUNCH_AMMO: + return CWeaponCraftParameters::AutolaunchAmmoWeight; + case ITEM_TYPE::BOWRIFLE_AMMO: + return CWeaponCraftParameters::BowrifleAmmoWeight; + case ITEM_TYPE::LAUNCHER_AMMO: + return CWeaponCraftParameters::LauncherAmmoWeight; + case ITEM_TYPE::PISTOL_AMMO: + return CWeaponCraftParameters::PistolAmmoWeight; + case ITEM_TYPE::BOWPISTOL_AMMO: + return CWeaponCraftParameters::BowpistolAmmoWeight; + case ITEM_TYPE::RIFLE_AMMO: + return CWeaponCraftParameters::RifleAmmoWeight; + + // armor and shield + case ITEM_TYPE::SHIELD: + return CWeaponCraftParameters::ShieldWeight; + case ITEM_TYPE::BUCKLER: + return CWeaponCraftParameters::BucklerWeight; + case ITEM_TYPE::LIGHT_BOOTS: + return CWeaponCraftParameters::LightBootsWeight; + case ITEM_TYPE::LIGHT_GLOVES: + return CWeaponCraftParameters::LightGlovesWeight; + case ITEM_TYPE::LIGHT_PANTS: + return CWeaponCraftParameters::LightPantsWeight; + case ITEM_TYPE::LIGHT_SLEEVES: + return CWeaponCraftParameters::LightSleevesWeight; + case ITEM_TYPE::LIGHT_VEST: + return CWeaponCraftParameters::LightVestWeight; + case ITEM_TYPE::MEDIUM_BOOTS: + return CWeaponCraftParameters::MediumBootsWeight; + case ITEM_TYPE::MEDIUM_GLOVES: + return CWeaponCraftParameters::MediumGlovesWeight; + case ITEM_TYPE::MEDIUM_PANTS: + return CWeaponCraftParameters::MediumPantsWeight; + case ITEM_TYPE::MEDIUM_SLEEVES: + return CWeaponCraftParameters::MediumSleevesWeight; + case ITEM_TYPE::MEDIUM_VEST: + return CWeaponCraftParameters::MediumVestWeight; + case ITEM_TYPE::HEAVY_BOOTS: + return CWeaponCraftParameters::HeavyBootsWeight; + case ITEM_TYPE::HEAVY_GLOVES: + return CWeaponCraftParameters::HeavyGlovesWeight; + case ITEM_TYPE::HEAVY_PANTS: + return CWeaponCraftParameters::HeavyPantsWeight; + case ITEM_TYPE::HEAVY_SLEEVES: + return CWeaponCraftParameters::HeavySleevesWeight; + case ITEM_TYPE::HEAVY_VEST: + return CWeaponCraftParameters::HeavyVestWeight; + case ITEM_TYPE::HEAVY_HELMET: + return CWeaponCraftParameters::HeavyHelmetWeight; + + // jewel + case ITEM_TYPE::ANKLET: + return CWeaponCraftParameters::AnkletWeight; + case ITEM_TYPE::BRACELET: + return CWeaponCraftParameters::BraceletWeight; + case ITEM_TYPE::DIADEM: + return CWeaponCraftParameters::DiademWeight; + case ITEM_TYPE::EARING: + return CWeaponCraftParameters::EaringWeight; + case ITEM_TYPE::PENDANT: + return CWeaponCraftParameters::PendantWeight; + case ITEM_TYPE::RING: + return CWeaponCraftParameters::RingWeight; + default: + return 0; + } +} + +// *************************************************************************** +// CStaticLootTable::selectRandomLootSet +// *************************************************************************** +CSheetId CStaticLootTable::selectRandomLootSet() const +{ + if( LootSets.empty() ) + return CSheetId::Unknown; + + // compute the probability sum + uint16 probabilitySum = 0; + map::const_iterator itconst; + for( itconst = LootSets.begin(); itconst != LootSets.end(); ++itconst ) + { + probabilitySum += (*itconst).second; + } + + // choose a random number between and probabilitySum + uint32 randWeight; + if( probabilitySum == 0 ) + randWeight = 0; + else + randWeight = RandomGenerator.rand(probabilitySum-1) + 1; + + // "concatenate" weights of each index, when the random value is reached we'll have the index to use + uint16 w = 0; + for( itconst = LootSets.begin(); itconst != LootSets.end(); ++itconst ) + { + w += (*itconst).second; + if( randWeight <= w ) + { + break; + } + } + if( itconst != LootSets.end() ) + { + return (*itconst).first; + } + + nlwarning(" can't find any lootset rand=%d probabilitySum=%d weightCount=%d",randWeight,probabilitySum,LootSets.size()); + return CSheetId::Unknown; +} + +// *************************************************************************** +// CStaticLootTable::selectRandomCustomLootSet +// *************************************************************************** +const CStaticLootSet *CStaticLootTable::selectRandomCustomLootSet() const +{ + if( CustomLootSets.empty() ) + return 0; + + // compute the probability sum + uint16 probabilitySum = 0; + multimap::const_iterator it = CustomLootSets.begin(); + for( ; it != CustomLootSets.end(); ++it ) + { + probabilitySum += (*it).first; + } + + // choose a random number between and probabilitySum + uint32 randWeight; + if( probabilitySum == 0 ) + randWeight = 0; + else + randWeight = RandomGenerator.rand(probabilitySum-1) + 1; + + // "concatenate" weights of each index, when the random value is reached we'll have the index to use + uint16 w = 0; + for (it = CustomLootSets.begin(); it != CustomLootSets.end(); ++it ) + { + w += (*it).first; + if( randWeight <= w ) + { + break; + } + } + + if( it != CustomLootSets.end() ) + { + return &(it->second); + } + + nlwarning("Can't find any lootset rand=%d probabilitySum=%d weightCount=%d",randWeight,probabilitySum,CustomLootSets.size()); + return 0; +} + +// *************************************************************************** +// QuarteringQuantityByVariable - EGS-specific initialization +// *************************************************************************** +static const float QuarteringForcedQuantities [6] = { 0, 1.0f, 2.0f, 3.0f, 4.0f, 0.5f }; + +const float *QuarteringQuantityByVariable [NBRMQuantityVariables] = +{ + &QuarteringQuantityAverageForCraftHerbivore.get(), + &QuarteringQuantityAverageForCraftCarnivore.get(), + &QuarteringQuantityAverageForBoss5.get(), + &QuarteringQuantityAverageForBoss7.get(), + &QuarteringQuantityForInvasion5.get(), + &QuarteringQuantityForInvasion7.get(), + &QuarteringForcedQuantities[0], + &QuarteringForcedQuantities[1], + &QuarteringForcedQuantities[2], + &QuarteringForcedQuantities[3], + &QuarteringForcedQuantities[4], + &QuarteringForcedQuantities[5] +}; diff --git a/ryzom/server/src/entities_game_service/entities_game_service.cpp b/ryzom/server/src/entities_game_service/entities_game_service.cpp index 8f7819b344..1ea52cec85 100644 --- a/ryzom/server/src/entities_game_service/entities_game_service.cpp +++ b/ryzom/server/src/entities_game_service/entities_game_service.cpp @@ -153,6 +153,7 @@ void foo() extern void cbClientReady(NLNET::CMessage& msgin, const std::string &serviceName, NLNET::TServiceId serviceId); extern CVariable EGSLight; +extern CVariable LoadOutposts; // Local use variable CVariable MonkeyLoadEnable("egs","MonkeyLoadEnable","1 enabling fixed sequence monkey simulation, 2 enabling random sequence monkey simulation, 3 restart Monkey 2/ 0 disabling the Monkey Load simulation", 0, 0, true); @@ -1487,6 +1488,9 @@ nlassert(nodeLeaf->getType() == ICDBStructNode::TEXT); CDynamicSheetManager::getInstance(); // Init Sheets manager + CSheets::setWriteDirectory(IService::getInstance()->WriteFilesDirectory.toString()); + CSheets::setEGSLight(EGSLight.get()); + CSheets::setLoadOutposts(LoadOutposts.get()); CSheets::init(); //CCharacter::initMountInventoryBulkMax(); // must be called after CSheets::init() // Init item manager diff --git a/ryzom/tools/CMakeLists.txt b/ryzom/tools/CMakeLists.txt index 76f824621a..56dc21a7d1 100644 --- a/ryzom/tools/CMakeLists.txt +++ b/ryzom/tools/CMakeLists.txt @@ -21,10 +21,8 @@ IF(WITH_RYZOM_TOOLS) ADD_SUBDIRECTORY(pdr_util) ADD_SUBDIRECTORY(patch_gen) - IF(WIN32) - IF(MYSQL_FOUND) - ADD_SUBDIRECTORY(sheets_packer_shard) - ENDIF() + IF(MYSQL_FOUND) + ADD_SUBDIRECTORY(sheets_packer_shard) ENDIF() ENDIF() diff --git a/ryzom/tools/sheets_packer_shard/CMakeLists.txt b/ryzom/tools/sheets_packer_shard/CMakeLists.txt index e9540d41a1..348f4a7f69 100644 --- a/ryzom/tools/sheets_packer_shard/CMakeLists.txt +++ b/ryzom/tools/sheets_packer_shard/CMakeLists.txt @@ -2,18 +2,11 @@ FILE(GLOB SRC *.cpp *.h *.rc) SOURCE_GROUP("" FILES ${SRC}) -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) - -SOURCE_GROUP("" FILES ${SRC}) -SOURCE_GROUP("EGS Sheets" FILES ${EGSSHEETS}) - -ADD_EXECUTABLE(sheets_packer_shard ${SRC} ${EGSSHEETS} +ADD_EXECUTABLE(sheets_packer_shard ${SRC} ${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/entities_game_service/entity_structure/resists.cpp - ${CMAKE_SOURCE_DIR}/ryzom/server/src/entities_game_service/entity_structure/resists.h ${CMAKE_SOURCE_DIR}/ryzom/server/src/ai_service/sheets.cpp ${CMAKE_SOURCE_DIR}/ryzom/server/src/ai_service/sheets.h ${CMAKE_SOURCE_DIR}/ryzom/server/src/ai_service/commands_mlf.cpp) @@ -23,6 +16,7 @@ TARGET_INCLUDE_DIRECTORIES(sheets_packer_shard PRIVATE ${CMAKE_SOURCE_DIR}/ryzom TARGET_LINK_LIBRARIES(sheets_packer_shard PRIVATE + ryzom_egs_sheets ryzom_gameshare ryzom_servershare ryzom_aishare @@ -35,8 +29,6 @@ TARGET_LINK_LIBRARIES(sheets_packer_shard NL_DEFAULT_PROPS(sheets_packer_shard "Ryzom, Tools: Sheets Packer Shard") NL_ADD_RUNTIME_FLAGS(sheets_packer_shard) -TARGET_COMPILE_DEFINITIONS(sheets_packer_shard PRIVATE NO_EGS_VARS DNO_AI_COMP) - IF (MSVC) SET_TARGET_PROPERTIES(sheets_packer_shard PROPERTIES COMPILE_FLAGS "/bigobj") # TODO replace with target_compile_options ENDIF () diff --git a/ryzom/tools/sheets_packer_shard/sheets_packer_shard.cpp b/ryzom/tools/sheets_packer_shard/sheets_packer_shard.cpp index f5c3971d97..503e7dbd76 100644 --- a/ryzom/tools/sheets_packer_shard/sheets_packer_shard.cpp +++ b/ryzom/tools/sheets_packer_shard/sheets_packer_shard.cpp @@ -48,14 +48,7 @@ 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 // @@ -155,6 +148,7 @@ int main(int nNbArg, char **ppArgs) // EGS { + CSheets::setWriteDirectory(s_WriteDirectory); CSheets::init(); }