Make packed sheets behaviour consistent accross services

hg/feature/sse2
kaetemi 11 years ago
parent 020bfb775e
commit 91d453dd63

@ -2315,7 +2315,17 @@ void CMirror::init( std::vector<std::string>& 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) );

@ -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);
}
}

@ -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;
}

@ -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())
{

@ -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" );

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

@ -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 )
{

@ -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

Loading…
Cancel
Save