Skip to content

Commit

Permalink
Rename SGameTypeMaps::SMapItm -> MPLevelDesc, SGameWeathers -> MPWeat…
Browse files Browse the repository at this point in the history
…herDesc.
  • Loading branch information
Pavel Kovalenko committed Oct 4, 2014
1 parent e86bd60 commit f517280
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 22 deletions.
6 changes: 3 additions & 3 deletions src/xrGame/UIGameCustom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ void CMapListHelper::LoadMapInfo(const char* cfgName, const xr_string& levelName
lastItem.m_game_type_id = ParseStringToGameType(gameType.c_str());
suitableLevels = &m_storage.back();
}
SGameTypeMaps::SMapItm levelDesc;
MPLevelDesc levelDesc;
levelDesc.map_name = shLevelName;
levelDesc.map_ver = shLevelVer;
auto& levelNames = suitableLevels->m_map_names;
Expand Down Expand Up @@ -365,7 +365,7 @@ void CMapListHelper::Load()
m_weathers.reserve(weatherCfg.Data.size());
for (CInifile::Item& weatherDesc : weatherCfg.Data)
{
SGameWeathers gw;
MPWeatherDesc gw;
gw.Name = weatherDesc.first;
gw.StartTime = weatherDesc.second;
m_weathers.push_back(gw);
Expand Down Expand Up @@ -435,7 +435,7 @@ const SGameTypeMaps& CMapListHelper::GetMapListFor(const EGameIDs gameId)
return m_storage[0];
}

const xr_vector<SGameWeathers>& CMapListHelper::GetGameWeathers()
const xr_vector<MPWeatherDesc>& CMapListHelper::GetGameWeathers()
{
if (m_weathers.size() == 0)
Load();
Expand Down
22 changes: 11 additions & 11 deletions src/xrGame/UIGameCustom.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,21 @@ struct StaticDrawableWrapper : public IPureDestroyableObject
void SetText(const char* text);
};

struct SGameTypeMaps
struct MPLevelDesc
{
struct SMapItm
{
shared_str map_name;
shared_str map_ver;
bool operator == (const SMapItm& rhs) { return map_name == rhs.map_name && map_ver == rhs.map_ver; }
};
shared_str map_name;
shared_str map_ver;
bool operator == (const MPLevelDesc& rhs) { return map_name == rhs.map_name && map_ver == rhs.map_ver; }
};

struct SGameTypeMaps
{
shared_str m_game_type_name;
EGameIDs m_game_type_id;
xr_vector<SMapItm> m_map_names;
xr_vector<MPLevelDesc> m_map_names;
};

struct SGameWeathers
struct MPWeatherDesc
{
shared_str Name;
shared_str StartTime;
Expand All @@ -60,12 +60,12 @@ class CMapListHelper
{
private:
xr_vector<SGameTypeMaps> m_storage;
xr_vector<SGameWeathers> m_weathers;
xr_vector<MPWeatherDesc> m_weathers;

public:
const SGameTypeMaps& GetMapListFor(const shared_str& gameType);
const SGameTypeMaps& GetMapListFor(const EGameIDs gameId);
const xr_vector<SGameWeathers>& GetGameWeathers();
const xr_vector<MPWeatherDesc>& GetGameWeathers();

private:
void Load();
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/console_commands_mp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1342,7 +1342,7 @@ class CCC_ChangeLevelGameType : public IConsole_Command {
bool bMapFound = false;
for(u32 i=0; i<cnt; ++i)
{
const SGameTypeMaps::SMapItm& itm = M.m_map_names[i];
const MPLevelDesc& itm = M.m_map_names[i];
if (!xr_strcmp(itm.map_name.c_str(), LevelName) &&
!xr_strcmp(itm.map_ver.c_str(), LevelVersion))
{
Expand Down
10 changes: 5 additions & 5 deletions src/xrGame/ui/UIMapList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ void CUIMapList::OnListItemClicked()

CUIListBoxItem* itm = m_pList1->GetSelectedItem();
u32 _idx = (u32)(__int64)(itm->GetData());
const SGameTypeMaps::SMapItm& M = GetMapNameInt(GetCurGameType(), _idx);
const MPLevelDesc& M = GetMapNameInt(GetCurGameType(), _idx);

map_name += M.map_name.c_str();
xr_string full_name = map_name + ".dds";
Expand Down Expand Up @@ -203,7 +203,7 @@ const char* CUIMapList::GetCommandLine(LPCSTR player_name){
return NULL;

u32 _idx = (u32)(__int64)(itm->GetData());
const SGameTypeMaps::SMapItm& M = GetMapNameInt (GetCurGameType(), _idx);
const MPLevelDesc& M = GetMapNameInt(GetCurGameType(), _idx);

m_command.clear();
m_command = "start server(";
Expand Down Expand Up @@ -248,7 +248,7 @@ void CUIMapList::LoadMapList()
{
const auto& weathers = gMapListHelper.GetGameWeathers();
u32 cnt = 0;
for (const SGameWeathers& weather : weathers)
for (const MPWeatherDesc& weather : weathers)
AddWeather(weather.Name, weather.StartTime, cnt++);
if (weathers.size() > 0)
m_pWeatherSelector->SetItemIDX(0);
Expand All @@ -275,7 +275,7 @@ void CUIMapList::SaveMapList()
{
CUIListBoxItem* itm = m_pList2->GetItemByIDX(idx);
u32 _idx = (u32)(__int64)(itm->GetData());
const SGameTypeMaps::SMapItm& M = GetMapNameInt(GetCurGameType(), _idx);
const MPLevelDesc& M = GetMapNameInt(GetCurGameType(), _idx);

xr_sprintf (map_name, "sv_addmap %s/ver=%s", M.map_name.c_str(), M.map_ver.c_str() );
pW->w_string (map_name);
Expand Down Expand Up @@ -426,7 +426,7 @@ bool CUIMapList::IsEmpty()
return 0 == m_pList2->GetSize();
}

const SGameTypeMaps::SMapItm& CUIMapList::GetMapNameInt(EGameIDs _type, u32 idx)
const MPLevelDesc& CUIMapList::GetMapNameInt(EGameIDs _type, u32 idx)
{
const SGameTypeMaps& M = gMapListHelper.GetMapListFor(_type);
R_ASSERT (M.m_map_names.size()>idx);
Expand Down
4 changes: 2 additions & 2 deletions src/xrGame/ui/UIMapList.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class CUIMapList : public CUIWindow {
void StartDedicatedServer();
void ClearList();
bool IsEmpty();
const SGameTypeMaps::SMapItm& GetMapNameInt(EGameIDs _type, u32 idx);
const MPLevelDesc& GetMapNameInt(EGameIDs _type, u32 idx);

private:
CUIListBoxItem* GetMapItem_fromList1(shared_str const& map_name);
Expand Down Expand Up @@ -69,7 +69,7 @@ class CUIMapList : public CUIWindow {
// CUISpinText* m_pModeSelector;
CUIStatic* m_pMapPic;
CUIMapInfo* m_pMapInfo;

// XXX nitrocaster: use MPWeatherDesc
struct Sw{
shared_str weather_name;
shared_str weather_time;
Expand Down

0 comments on commit f517280

Please sign in to comment.