Add EGS sheets to shard sheets packer tool
This commit is contained in:
parent
f65a48cc4b
commit
30030220c1
10 changed files with 88 additions and 29 deletions
|
@ -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 <class C> 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 <class C> 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 <class C> 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 <class C> 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 <class T> void loadSheetSet(const vector<string> &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 <class T> void loadSheetSet(const vector<string> &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<string> &fileTypes,const char *sheetFil
|
|||
map<CSheetId,T> 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<string> &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 <class T> void reloadSheetSet(const vector<string> &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 <class T> void reloadSheetSet2(const vector<string> &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 <class T> void reloadSheetSet(const string &fileType, T &sheetMap, const string &wildcardFilter)
|
||||
|
|
|
@ -1878,6 +1878,7 @@ void CStaticItem::reloadSheet(const CStaticItem &o)
|
|||
const_cast<CStaticItem&>(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)
|
||||
|
|
|
@ -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<SItemSpecialEffect> lookForEffects(ITEM_SPECIAL_EFFECT::TItemSpecialEffect effectType) const;
|
||||
|
||||
|
|
|
@ -2093,7 +2093,7 @@ void CStaticLootTable::readGeorges( const NLMISC::CSmartPtr<NLGEORGES::UForm> &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 //////////////////////////////
|
||||
|
|
|
@ -868,10 +868,12 @@ public:
|
|||
/// read the sheet
|
||||
virtual void readGeorges( const NLMISC::CSmartPtr<NLGEORGES::UForm> &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; }
|
||||
|
|
|
@ -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<bool> VerboseQuartering( "egs", "VerboseQuartering", "", false, 0, true );
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -22,8 +22,6 @@
|
|||
#include "stdpch.h"
|
||||
//
|
||||
#include "resists.h"
|
||||
#include "player_manager/character.h"
|
||||
#include "game_item_manager/game_item.h"
|
||||
|
||||
//////////////
|
||||
// USING //
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -30,11 +30,13 @@
|
|||
#include <nel/misc/file.h>
|
||||
#include <nel/misc/log.h>
|
||||
#include <nel/misc/path.h>
|
||||
#include <nel/misc/sheet_id.h>
|
||||
#include <nel/georges/load_form.h>
|
||||
#include <game_share/data_set_base.h>
|
||||
#include <input_output_service/string_manager.h>
|
||||
#include <gpm_service/sheets.h>
|
||||
#include <server_share/continent_container.h>
|
||||
#include <entities_game_service/egs_sheets/egs_sheets.h>
|
||||
|
||||
// Project includes
|
||||
// ...
|
||||
|
@ -43,6 +45,15 @@ namespace {
|
|||
|
||||
} /* anonymous namespace */
|
||||
|
||||
// EGS
|
||||
NLMISC::CVariable<bool> EGSLight("egs","EGSLight", "Load EGS with a minimal set of feature loaded", false, 0, true);
|
||||
NLMISC::CVariable<bool> 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 <build_packed_sheets> //
|
||||
// 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 <leveldesign> <dfn> <datasets> <build_packed_sheets>\n");
|
||||
nlinfo("USAGE : sheets_packer_shard <leveldesign> <dfn> <datasets> <tab> <build_packed_sheets>\n");
|
||||
nlinfo("<tab> : Directory containing visual_slots.tab");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
std::string leveldesignDir = std::string(ppArgs[1]);
|
||||
|
@ -79,17 +92,28 @@ 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
|
||||
|
|
Loading…
Reference in a new issue