ThemePlayer::ThemePlayer( PlayerCityPtr city ) : Srvc( city, defaultName() ), _d( new Impl ) { vfs::Path path = SETTINGS_RC_PATH( soundThemesModel ); if( path.exist() ) { _d->playlist = config::load( path ).get( "items" ).toStringArray(); } _d->lastIndex = 0; }
void initialize(ClimateType climate) { VariantMap climateArchives = config::load( SETTINGS_RC_PATH( climateModel ) ); std::string optName; if( climate == central ) { optName = CAESARIA_STR_A(central); } else if( climate == northen ) { optName = "north"; } else if( climate == desert ) { optName = "south"; } StringArray archives = climateArchives.get( optName ).toStringArray(); for( auto& str : archives ) { Path archivePath = str; Directory dir = archivePath.directory(); archivePath = dir.find( archivePath.baseName(), Path::ignoreCase ); ArchivePtr archive = FileSystem::instance().mountArchive( archivePath ); if( archive.isNull() ) { Logger::warning( "ClimateManager: can't load file " + archivePath.toString() ); continue; } ResourceLoader rc; NFile atlasInfo = archive->createAndOpenFile( "info" ); if( atlasInfo.isOpen() ) { rc.loadAtlases( atlasInfo, false ); } else { rc.loadFiles( archive ); } } }
void addEvents(PlayerCityPtr city) { VariantMap freeplayVm = config::load( SETTINGS_RC_PATH( freeplay_opts ) ); __loadEventsFromSection( freeplayVm[ "events" ].toMap() ); }
void addPopulationMilestones(PlayerCityPtr city) { VariantMap freeplayVm = config::load( SETTINGS_RC_PATH( freeplay_opts ) ); __loadEventsFromSection( freeplayVm[ "population_milestones" ].toMap() ); }