From: TimePath Date: Sat, 7 Feb 2015 08:34:23 +0000 (+1100) Subject: Cleanup X-Git-Tag: xonotic-v0.8.1~124^2~1 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=38dcd70c248561ce1619b4074ee78de4c7329a11;p=xonotic%2Fxonotic-data.pk3dir.git Cleanup --- diff --git a/qcsrc/common/mapinfo.qc b/qcsrc/common/mapinfo.qc index 366f35ed6..c3f15d193 100644 --- a/qcsrc/common/mapinfo.qc +++ b/qcsrc/common/mapinfo.qc @@ -1287,11 +1287,11 @@ float MapInfo_CheckMap(string s) // returns 0 if the map can't be played with th return r; } -void MapInfo_SwitchGameType(float t) +void MapInfo_SwitchGameType(int t) { - entity e; - for(e = MapInfo_Type_first; e; e = e.enemy) + for (entity e = MapInfo_Type_first; e; e = e.enemy) { cvar_set(e.netname, (t == e.items) ? "1" : "0"); + } } void MapInfo_LoadMap(string s, float reinit) diff --git a/qcsrc/common/mapinfo.qh b/qcsrc/common/mapinfo.qh index 6083350fa..54255ec8d 100644 --- a/qcsrc/common/mapinfo.qh +++ b/qcsrc/common/mapinfo.qh @@ -152,7 +152,7 @@ float MapInfo_Type_FromString(string t); string MapInfo_Type_Description(float t); string MapInfo_Type_ToString(float t); string MapInfo_Type_ToText(float t); -void MapInfo_SwitchGameType(float t); +void MapInfo_SwitchGameType(int t); // to be called from worldspawn to set up cvars void MapInfo_LoadMapSettings(string s); diff --git a/qcsrc/menu/xonotic/gametypelist.qc b/qcsrc/menu/xonotic/gametypelist.qc index feb1d89b1..7469e6f8b 100644 --- a/qcsrc/menu/xonotic/gametypelist.qc +++ b/qcsrc/menu/xonotic/gametypelist.qc @@ -31,12 +31,11 @@ entity makeXonoticGametypeList(void) } void XonoticGametypeList_configureXonoticGametypeList(entity me) { - float i; me.configureXonoticListBox(me); me.nItems = GameType_GetCount(); // we want the pics mipmapped - for(i = 0; i < GameType_GetCount(); ++i) + for(int i = 0; i < GameType_GetCount(); ++i) draw_PreloadPictureWithFlags(GameType_GetIcon(i), PRECACHE_PIC_MIPMAP); me.loadCvars(me); @@ -67,10 +66,10 @@ void XonoticGametypeList_loadCvars(entity me) } void XonoticGametypeList_saveCvars(entity me) { - float t; - t = GameType_GetID(me.selectedItem); - if(t == MapInfo_CurrentGametype()) + int t = GameType_GetID(me.selectedItem); + if (t == MapInfo_CurrentGametype()) { return; + } MapInfo_SwitchGameType(t); me.parent.gameTypeChangeNotify(me.parent); } diff --git a/qcsrc/menu/xonotic/util.qc b/qcsrc/menu/xonotic/util.qc index 0846526d0..330b2bb72 100644 --- a/qcsrc/menu/xonotic/util.qc +++ b/qcsrc/menu/xonotic/util.qc @@ -665,12 +665,11 @@ float updateCompression() //GAMETYPE(MAPINFO_TYPE_INVASION) \ /* nothing */ -float GameType_GetID(float cnt) +int GameType_GetID(int cnt) { - float i; - i = 0; + int i = 0; - #define GAMETYPE(id) { if(i++ == cnt) return id; } + #define GAMETYPE(id) { if (i++ == cnt) return id; } GAMETYPES #undef GAMETYPE @@ -679,10 +678,9 @@ float GameType_GetID(float cnt) return 0; } -float GameType_GetCount() +int GameType_GetCount() { - float i; - i = 0; + int i = 0; #define GAMETYPE(id) ++i; GAMETYPES @@ -691,9 +689,9 @@ float GameType_GetCount() return i; } -string GameType_GetName(float cnt) +string GameType_GetName(int cnt) { - float i = GameType_GetID(cnt); + int i = GameType_GetID(cnt); if(i) return MapInfo_Type_ToText(i); @@ -701,9 +699,9 @@ string GameType_GetName(float cnt) return ""; } -string GameType_GetIcon(float cnt) +string GameType_GetIcon(int cnt) { - float i = GameType_GetID(cnt); + int i = GameType_GetID(cnt); if(i) return strcat("gametype_", MapInfo_Type_ToString(i)); diff --git a/qcsrc/menu/xonotic/util.qh b/qcsrc/menu/xonotic/util.qh index 64072977f..80803f854 100644 --- a/qcsrc/menu/xonotic/util.qh +++ b/qcsrc/menu/xonotic/util.qh @@ -34,11 +34,11 @@ void URI_Get_Callback(float id, float status, string data); // game type list box stuff (does not NEED to contain all game types, other // types stay available via console) -float GameType_GetID(float cnt); -string GameType_GetName(float cnt); -string GameType_GetIcon(float cnt); +int GameType_GetID(int cnt); +string GameType_GetName(int cnt); +string GameType_GetIcon(int cnt); //string GameType_GetTeams(float cnt); -float GameType_GetCount(); +int GameType_GetCount(); void dialog_hudpanel_common_notoggle(entity me, string panelname); #define DIALOG_HUDPANEL_COMMON_NOTOGGLE() \