Make packed sheets behaviour consistent accross services

This commit is contained in:
kaetemi 2014-02-20 21:53:11 +01:00
parent 020bfb775e
commit 91d453dd63
8 changed files with 79 additions and 10 deletions

View file

@ -2315,7 +2315,17 @@ void CMirror::init( std::vector<std::string>& dataSetsToLoad,
CUnifiedNetwork::getInstance()->addCallbackArray( MirrorCbArray, NB_MIRROR_CALLBACKS ); CUnifiedNetwork::getInstance()->addCallbackArray( MirrorCbArray, NB_MIRROR_CALLBACKS );
// Load the sheets of the datasets // 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 // Set the tag
nlassert( (tag >= AllTag) && (tag != ExcludedTag) ); nlassert( (tag >= AllTag) && (tag != ExcludedTag) );

View file

@ -47,7 +47,17 @@ void CTimeDateSeasonManager::init( uint32 /* startDay */, float /* startTime */)
void CTimeDateSeasonManager::packSheets(const std::string &writeDirectory) 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);
}
} }

View file

@ -63,7 +63,17 @@ void CGpmSheets::init()
filters.push_back("creature"); filters.push_back("creature");
filters.push_back("player"); 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; _initialised=true;
} }

View file

@ -1871,7 +1871,12 @@ void CStringManager::init(NLMISC::CLog *log)
//exts.push_back("item"); //exts.push_back("item");
//exts.push_back("sitem"); // not more needed ! //exts.push_back("sitem"); // not more needed !
exts.push_back("race_stats"); exts.push_back("race_stats");
// 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); loadForm(exts, NLNET::IService::getInstance()->WriteFilesDirectory.toString() + "ios_sheets.packed_sheets", _SheetInfo, false, false);
}
if (_SheetInfo.empty()) if (_SheetInfo.empty())
{ {

View file

@ -178,7 +178,19 @@ void CMirrorService::init()
// Fill temporary sheet map, loading dataset information // Fill temporary sheet map, loading dataset information
TSDataSetSheets sDataSetSheets; 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() ) if ( sDataSetSheets.empty() )
{ {
nlwarning( "No dataset found, check if dataset.packed_sheets and the georges sheets are in the path" ); nlwarning( "No dataset found, check if dataset.packed_sheets and the georges sheets are in the path" );

View file

@ -64,7 +64,18 @@ void CContinentContainer::buildSheets(const string &packedSheetsDirectory)
{ {
std::vector<std::string> filters; std::vector<std::string> filters;
filters.push_back("continent"); 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);
}
} }
// //

View file

@ -145,7 +145,19 @@ void CRangeMirrorManager::init()
// Load datasets into temporary map to get the names // Load datasets into temporary map to get the names
TSDataSetSheets sDataSetSheets; 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; TSDataSetSheets::iterator ism;
for ( ism=sDataSetSheets.begin(); ism!=sDataSetSheets.end(); ++ism ) for ( ism=sDataSetSheets.begin(); ism!=sDataSetSheets.end(); ++ism )
{ {

View file

@ -124,9 +124,8 @@ int main(int nNbArg, char **ppArgs)
// Used by mirror_service.cpp // Used by mirror_service.cpp
// Used by range_mirror_manager.cpp // Used by range_mirror_manager.cpp
// Used by mirror.cpp // Used by mirror.cpp
// TSDataSetSheets sDataSetSheets; TSDataSetSheets sDataSetSheets;
// loadForm("dataset", exportDir + "/datasets.packed_sheets", 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.)
} }
// IOS // IOS