void CUIMapList::SaveMapList() { string_path temp; FS.update_path (temp,"$app_data_root$", MAP_ROTATION_LIST); if(m_pList2->GetSize()<=1){ FS.file_delete(temp); return; } IWriter* pW = FS.w_open (temp); if (!pW){ Msg("! Cant create map rotation file [%s]", temp); return; } string_path map_name; for(u32 idx=0; idx<m_pList2->GetSize(); ++idx) { CUIListBoxItem* itm = m_pList2->GetItemByIDX(idx); u32 _idx = (u32)(__int64)(itm->GetData()); const shared_str& _map_name = GetMapNameInt(GetCurGameType(), _idx); sprintf_s (map_name, "sv_addmap %s", _map_name.c_str() ); pW->w_string (map_name); } FS.w_close (pW); }
const char* CUIMapList::GetCommandLine(LPCSTR player_name){ string16 buf; CUIListBoxItem* itm = m_pList2->GetItemByIDX(0); if (!itm) return NULL; u32 _idx = (u32)(__int64)(itm->GetData()); const shared_str& _map_name = GetMapNameInt (GetCurGameType(), _idx); m_command.clear(); m_command = "start server("; m_command += _map_name.c_str(); m_command += "/"; m_command += GetCLGameModeName(); m_command += m_srv_params; m_command += "/estime="; const char* weather = m_pWeatherSelector->GetText(); int estime = (*m_mapWeather.find(weather)).second; m_command += itoa(estime/60,buf,10); m_command += ":"; m_command += itoa(estime%60,buf,10); m_command += ")"; m_command +=" client(localhost/name="; if (player_name == NULL || 0 == xr_strlen(player_name)) m_command += Core.UserName; else m_command +=player_name; m_command +=")"; return m_command.c_str(); }
const char* CUIMapList::GetCommandLine(LPCSTR player_name){ CUIListBoxItem* itm = m_pList2->GetItemByIDX(0); if (!itm) return NULL; u32 _idx = (u32)(__int64)(itm->GetData()); const SGameTypeMaps::SMapItm& M = GetMapNameInt (GetCurGameType(), _idx); m_command.clear(); m_command = "start server("; m_command += M.map_name.c_str(); m_command += "/"; m_command += GameTypeToString(GetCurGameType(),true); m_command += m_srv_params; m_command += "/ver="; m_command += M.map_ver.c_str(); m_command += "/estime="; u32 id = m_pWeatherSelector->m_list_box.GetSelectedItem()->GetTAG(); m_command += m_mapWeather[id].weather_time.c_str(); m_command += ")"; m_command += " client(localhost/name="; if (player_name == NULL || 0 == xr_strlen(player_name)) { string64 player_name2; GetPlayerName_FromRegistry( player_name2, sizeof(player_name2) ); if ( xr_strlen(player_name2) == 0 ) { xr_strcpy( player_name2, xr_strlen(Core.UserName) ? Core.UserName : Core.CompName ); } VERIFY( xr_strlen(player_name2) ); m_command += player_name2; } else { m_command += player_name; } m_command += ")"; return m_command.c_str(); }
void CUIMapList::OnListItemClicked() { xr_string map_name = "intro\\intro_map_pic_"; CUIListBoxItem* itm = m_pList1->GetSelectedItem(); u32 _idx = (u32)(__int64)(itm->GetData()); const shared_str& _map_name = GetMapNameInt(GetCurGameType(), _idx); map_name += _map_name.c_str(); xr_string full_name = map_name + ".dds"; if (FS.exist("$game_textures$",full_name.c_str())) m_pMapPic->InitTexture(map_name.c_str()); else m_pMapPic->InitTexture("ui\\ui_noise"); m_pMapInfo->InitMap(_map_name.c_str()); }
void CUIMapList::OnListItemClicked() { xr_string map_name = "intro\\intro_map_pic_"; CUIListBoxItem* itm = m_pList1->GetSelectedItem(); u32 _idx = (u32)(__int64)(itm->GetData()); const SGameTypeMaps::SMapItm& M = GetMapNameInt(GetCurGameType(), _idx); map_name += M.map_name.c_str(); xr_string full_name = map_name + ".dds"; Frect orig_rect = m_pMapPic->GetTextureRect(); if (FS.exist("$game_textures$",full_name.c_str())) m_pMapPic->InitTexture (map_name.c_str()); else m_pMapPic->InitTexture ("ui\\ui_noise"); m_pMapPic->SetTextureRect(orig_rect); m_pMapInfo->InitMap (M.map_name.c_str(), M.map_ver.c_str()); }