void CUIMapList::LoadMapList() { string_path fn; FS.update_path (fn, "$game_config$", MAP_LIST); CInifile map_list_cfg (fn); // maps for (int k=0; game_types[k].name; ++k) { EGameTypes _id = (EGameTypes)game_types[k].id; LPCSTR _name = game_types[k].name; if( !map_list_cfg.section_exist(_name) ) continue; CInifile::Sect& S = map_list_cfg.r_section(_name); CInifile::SectIt it = S.begin(), end = S.end(); for (;it!=end; ++it){ shared_str _map_name = it->first; m_maps[_id].push_back (_map_name); } } //weather shared_str weather_sect = "weather"; CInifile::Sect& S = map_list_cfg.r_section(weather_sect); CInifile::SectIt it = S.begin(), end = S.end(); shared_str WeatherType; shared_str WeatherTime; for (u32 cnt=0; it!=end; ++it, ++cnt) { WeatherType = it->first; WeatherTime = map_list_cfg.r_string(weather_sect, *WeatherType); AddWeather (WeatherType, WeatherTime, cnt); } if(S.size()) m_pWeatherSelector->SetItem(0); }
void CServerDlg::LoadMapList() { string_path fn; FS.update_path (fn, "$game_config$", MAP_LIST); CInifile map_list_cfg(fn); // maps for (int k=0; game_types[k].name; ++k) { EGameTypes _id = (EGameTypes)game_types[k].id; LPCSTR _name = game_types[k].name; if( !map_list_cfg.section_exist(_name) ) continue; CInifile::Sect& S = map_list_cfg.r_section(_name); CInifile::SectCIt it = S.Data.begin(), end = S.Data.end(); for (;it!=end; ++it) { shared_str _map_name = it->first; m_maps[_id].push_back (_map_name); // strcpy(m_Maps[MapListType][m_MapsNum[MapListType]++], token); } // std::sort(m_maps[_id].begin(), m_maps[_id].end(), MP_map_cmp); } //weather shared_str weather_sect = "weather"; CInifile::Sect& S = map_list_cfg.r_section(weather_sect); CInifile::SectCIt it = S.Data.begin(), end = S.Data.end(); shared_str WeatherType; shared_str WeatherTime; for (;it!=end; ++it){ WeatherType = it->first; WeatherTime = map_list_cfg.r_string(weather_sect, *WeatherType); // AddWeather (WeatherType, WeatherTime); if (m_pSVWeatherOptDlg) m_pSVWeatherOptDlg->AddWeather(*WeatherType, *WeatherTime); } }
void CUIChangeMap::FillUpList() { lst->Clear (); maps.clear_not_free (); string_path fn; FS.update_path (fn, "$game_config$", MAP_LIST); CInifile map_list_cfg (fn); LPCSTR sect_name = get_token_name( game_types, GameID() ); CInifile::Sect& S = map_list_cfg.r_section(sect_name); CInifile::SectIt it = S.begin(), end = S.end(); for (;it!=end; ++it) { shared_str _map_name = it->first; maps.push_back (_map_name); lst->AddItem ( CStringTable().translate(_map_name).c_str() ); } }
void CMapListHelper::Load() { string_path fn; FS.update_path (fn, "$game_config$", "mp\\map_list.ltx"); CInifile map_list_cfg (fn); //read weathers set CInifile::Sect w = map_list_cfg.r_section("weather"); CInifile::SectCIt wi = w.Data.begin(); CInifile::SectCIt wi_e = w.Data.end(); for( ;wi!=wi_e; ++wi) { m_weathers.resize (m_weathers.size()+1); SGameWeathers& gw = m_weathers.back(); gw.m_weather_name = (*wi).first; gw.m_start_time = (*wi).second; } // scan for additional maps FS_FileSet fset; FS.file_list (fset,"$game_levels$",FS_ListFiles,"*level.ltx"); FS_FileSetIt fit = fset.begin(); FS_FileSetIt fit_e = fset.end(); for( ;fit!=fit_e; ++fit) { string_path map_cfg_fn; FS.update_path (map_cfg_fn, "$game_levels$", (*fit).name.c_str()); LoadMapInfo (map_cfg_fn, (*fit).name); } //scan all not laoded archieves LPCSTR tmp_entrypoint = "temporary_gamedata\\"; FS_Path* game_levels = FS.get_path("$game_levels$"); xr_string prev_root = game_levels->m_Root; game_levels->_set_root (tmp_entrypoint); CLocatorAPI::archives_it it = FS.m_archives.begin(); CLocatorAPI::archives_it it_e = FS.m_archives.end(); for(;it!=it_e;++it) { CLocatorAPI::archive& A = *it; if(A.hSrcFile) continue; LPCSTR ln = A.header->r_string("header", "level_name"); LPCSTR lv = A.header->r_string("header", "level_ver"); FS.LoadArchive (A, tmp_entrypoint); string_path map_cfg_fn; FS.update_path (map_cfg_fn, "$game_levels$", ln); xr_strcat (map_cfg_fn,"\\level.ltx"); LoadMapInfo (map_cfg_fn, ln, lv); FS.unload_archive (A); } game_levels->_set_root (prev_root.c_str()); R_ASSERT2 (m_storage.size(), "unable to fill map list"); R_ASSERT2 (m_weathers.size(), "unable to fill weathers list"); }