From affdb36a734a600798cf81df4fba57f2c6f7f393 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Thu, 20 Feb 2014 21:53:11 +0100 Subject: [PATCH] Make packed sheets behaviour consistent accross services --- code/ryzom/common/src/game_share/mirror.cpp | 12 +++++++++++- .../time_date_season_manager.cpp | 12 +++++++++++- code/ryzom/server/src/gpm_service/sheets.cpp | 12 +++++++++++- .../input_output_service/string_manager_parser.cpp | 7 ++++++- .../server/src/mirror_service/mirror_service.cpp | 14 +++++++++++++- .../src/server_share/continent_container.cpp | 13 ++++++++++++- .../src/tick_service/range_mirror_manager.cpp | 14 +++++++++++++- .../sheets_packer_shard/sheets_packer_shard.cpp | 5 ++--- 8 files changed, 79 insertions(+), 10 deletions(-) diff --git a/code/ryzom/common/src/game_share/mirror.cpp b/code/ryzom/common/src/game_share/mirror.cpp index cdf353143..ff0ed0b2c 100644 --- a/code/ryzom/common/src/game_share/mirror.cpp +++ b/code/ryzom/common/src/game_share/mirror.cpp @@ -2315,7 +2315,17 @@ void CMirror::init( std::vector& dataSetsToLoad, CUnifiedNetwork::getInstance()->addCallbackArray( MirrorCbArray, NB_MIRROR_CALLBACKS ); // Load the sheets of the datasets - loadForm( "dataset", IService::getInstance()->WriteFilesDirectory.toString()+"datasets.packed_sheets", _SDataSetSheets ); + // if the 'GeorgePaths' config file var exists then we try to perform a mini-scan for sheet files + if (IService::isServiceInitialized() && (IService::getInstance()->ConfigFile.getVarPtr(std::string("GeorgePaths"))!=NULL)) + { + loadForm("dataset", IService::getInstance()->WriteFilesDirectory.toString()+"datasets.packed_sheets", _SDataSetSheets, false, false); + } + + // if we haven't succeeded in minimal scan (or 'GeorgePaths' wasn't found in config file) then perform standard scan + if (_SDataSetSheets.empty()) + { + loadForm("dataset", IService::getInstance()->WriteFilesDirectory.toString()+"datasets.packed_sheets", _SDataSetSheets, true); + } // Set the tag nlassert( (tag >= AllTag) && (tag != ExcludedTag) ); diff --git a/code/ryzom/common/src/game_share/time_weather_season/time_date_season_manager.cpp b/code/ryzom/common/src/game_share/time_weather_season/time_date_season_manager.cpp index 12eebd0fd..dbd4fc0ad 100644 --- a/code/ryzom/common/src/game_share/time_weather_season/time_date_season_manager.cpp +++ b/code/ryzom/common/src/game_share/time_weather_season/time_date_season_manager.cpp @@ -47,7 +47,17 @@ void CTimeDateSeasonManager::init( uint32 /* startDay */, float /* startTime */) void CTimeDateSeasonManager::packSheets(const std::string &writeDirectory) { - loadForm("light_cycle", writeDirectory + "light_cycles.packed_sheets", _StaticLightCyclesHours); + // if the 'GeorgePaths' config file var exists then we try to perform a mini-scan for sheet files + if (IService::isServiceInitialized() && (IService::getInstance()->ConfigFile.getVarPtr(std::string("GeorgePaths"))!=NULL)) + { + loadForm("light_cycle", writeDirectory + "light_cycles.packed_sheets", _StaticLightCyclesHours, false, false); + } + + // if we haven't succeeded in minimal scan (or 'GeorgePaths' wasn't found in config file) then perform standard scan + if ( _StaticLightCyclesHours.empty() ) + { + loadForm("light_cycle", writeDirectory + "light_cycles.packed_sheets", _StaticLightCyclesHours, true); + } } diff --git a/code/ryzom/server/src/gpm_service/sheets.cpp b/code/ryzom/server/src/gpm_service/sheets.cpp index a65aa4456..72103ad75 100644 --- a/code/ryzom/server/src/gpm_service/sheets.cpp +++ b/code/ryzom/server/src/gpm_service/sheets.cpp @@ -63,7 +63,17 @@ void CGpmSheets::init() filters.push_back("creature"); filters.push_back("player"); - loadForm(filters, IService::getInstance()->WriteFilesDirectory.toString()+"gpms.packed_sheets", _sheets); + // if the 'GeorgePaths' config file var exists then we try to perform a mini-scan for sheet files + if (IService::isServiceInitialized() && (IService::getInstance()->ConfigFile.getVarPtr(std::string("GeorgePaths"))!=NULL)) + { + loadForm(filters, IService::getInstance()->WriteFilesDirectory.toString()+"gpms.packed_sheets", _sheets, false, false); + } + + // if we haven't succeeded in minimal scan (or 'GeorgePaths' wasn't found in config file) then perform standard scan + if (_sheets.empty()) + { + loadForm(filters, IService::getInstance()->WriteFilesDirectory.toString()+"gpms.packed_sheets", _sheets, true); + } _initialised=true; } diff --git a/code/ryzom/server/src/input_output_service/string_manager_parser.cpp b/code/ryzom/server/src/input_output_service/string_manager_parser.cpp index 6022b449d..67ce62f10 100644 --- a/code/ryzom/server/src/input_output_service/string_manager_parser.cpp +++ b/code/ryzom/server/src/input_output_service/string_manager_parser.cpp @@ -1871,7 +1871,12 @@ void CStringManager::init(NLMISC::CLog *log) //exts.push_back("item"); //exts.push_back("sitem"); // not more needed ! exts.push_back("race_stats"); - loadForm(exts, NLNET::IService::getInstance()->WriteFilesDirectory.toString() + "ios_sheets.packed_sheets", _SheetInfo, false, false); + + // if the 'GeorgePaths' config file var exists then we try to perform a mini-scan for sheet files + if (IService::isServiceInitialized() && (IService::getInstance()->ConfigFile.getVarPtr(std::string("GeorgePaths"))!=NULL)) + { + loadForm(exts, NLNET::IService::getInstance()->WriteFilesDirectory.toString() + "ios_sheets.packed_sheets", _SheetInfo, false, false); + } if (_SheetInfo.empty()) { diff --git a/code/ryzom/server/src/mirror_service/mirror_service.cpp b/code/ryzom/server/src/mirror_service/mirror_service.cpp index 651a509a8..9d1952cc7 100644 --- a/code/ryzom/server/src/mirror_service/mirror_service.cpp +++ b/code/ryzom/server/src/mirror_service/mirror_service.cpp @@ -178,7 +178,19 @@ void CMirrorService::init() // Fill temporary sheet map, loading dataset information TSDataSetSheets sDataSetSheets; - loadForm( "dataset", IService::getInstance()->WriteFilesDirectory.toString()+"datasets.packed_sheets", sDataSetSheets ); + + // if the 'GeorgePaths' config file var exists then we try to perform a mini-scan for sheet files + if (IService::isServiceInitialized() && (IService::getInstance()->ConfigFile.getVarPtr(std::string("GeorgePaths"))!=NULL)) + { + loadForm( "dataset", IService::getInstance()->WriteFilesDirectory.toString()+"datasets.packed_sheets", sDataSetSheets, false, false ); + } + + // if we haven't succeeded in minimal scan (or 'GeorgePaths' wasn't found in config file) then perform standard scan + if ( sDataSetSheets.empty() ) + { + loadForm( "dataset", IService::getInstance()->WriteFilesDirectory.toString()+"datasets.packed_sheets", sDataSetSheets, true ); + } + if ( sDataSetSheets.empty() ) { nlwarning( "No dataset found, check if dataset.packed_sheets and the georges sheets are in the path" ); diff --git a/code/ryzom/server/src/server_share/continent_container.cpp b/code/ryzom/server/src/server_share/continent_container.cpp index dc3d1ccc4..90b7b60c7 100644 --- a/code/ryzom/server/src/server_share/continent_container.cpp +++ b/code/ryzom/server/src/server_share/continent_container.cpp @@ -64,7 +64,18 @@ void CContinentContainer::buildSheets(const string &packedSheetsDirectory) { std::vector filters; filters.push_back("continent"); - loadForm(filters, packedSheetsDirectory+"continents.packed_sheets", _SheetMap); + + // if the 'GeorgePaths' config file var exists then we try to perform a mini-scan for sheet files + if (NLNET::IService::isServiceInitialized() && (NLNET::IService::getInstance()->ConfigFile.getVarPtr(std::string("GeorgePaths"))!=NULL)) + { + loadForm(filters, packedSheetsDirectory+"continents.packed_sheets", _SheetMap, false, false); + } + + // if we haven't succeeded in minimal scan (or 'GeorgePaths' wasn't found in config file) then perform standard scan + if (_SheetMap.empty()) + { + loadForm(filters, packedSheetsDirectory+"continents.packed_sheets", _SheetMap, true); + } } // diff --git a/code/ryzom/server/src/tick_service/range_mirror_manager.cpp b/code/ryzom/server/src/tick_service/range_mirror_manager.cpp index 14a2e8e85..f988ac054 100644 --- a/code/ryzom/server/src/tick_service/range_mirror_manager.cpp +++ b/code/ryzom/server/src/tick_service/range_mirror_manager.cpp @@ -145,7 +145,19 @@ void CRangeMirrorManager::init() // Load datasets into temporary map to get the names TSDataSetSheets sDataSetSheets; - loadForm( "dataset", IService::getInstance()->WriteFilesDirectory.toString()+"datasets.packed_sheets", sDataSetSheets ); + + // if the 'GeorgePaths' config file var exists then we try to perform a mini-scan for sheet files + if (IService::isServiceInitialized() && (IService::getInstance()->ConfigFile.getVarPtr(std::string("GeorgePaths"))!=NULL)) + { + loadForm( "dataset", IService::getInstance()->WriteFilesDirectory.toString()+"datasets.packed_sheets", sDataSetSheets, false, false ); + } + + // if we haven't succeeded in minimal scan (or 'GeorgePaths' wasn't found in config file) then perform standard scan + if ( sDataSetSheets.empty() ) + { + loadForm( "dataset", IService::getInstance()->WriteFilesDirectory.toString()+"datasets.packed_sheets", sDataSetSheets, true ); + } + TSDataSetSheets::iterator ism; for ( ism=sDataSetSheets.begin(); ism!=sDataSetSheets.end(); ++ism ) { 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 6d5eb2119..9c2212efa 100644 --- a/code/ryzom/tools/sheets_packer_shard/sheets_packer_shard.cpp +++ b/code/ryzom/tools/sheets_packer_shard/sheets_packer_shard.cpp @@ -124,9 +124,8 @@ int main(int nNbArg, char **ppArgs) // Used by mirror_service.cpp // Used by range_mirror_manager.cpp // Used by mirror.cpp - // TSDataSetSheets sDataSetSheets; - // loadForm("dataset", exportDir + "/datasets.packed_sheets", sDataSetSheets); - // FIXME: Somehow mirror.cpp overwrites the packed_sheets with an empty one... (the other cpp's don't do this, though.) + TSDataSetSheets sDataSetSheets; + loadForm("dataset", exportDir + "/datasets.packed_sheets", sDataSetSheets); } // IOS