]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/menu/xonotic/util.qc
Better gametype listing methods
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / xonotic / util.qc
index 74fe810fe74759d9d015e69f1248c4207e4cb8a4..5c0a958d0f6b96396cf263bd0b70ddc9b64266f4 100644 (file)
@@ -565,21 +565,62 @@ float GameType_GetID(float cnt)
 {
        float i;
        i = 0;
-#define GAMETYPE(id) if(i++ == cnt) return id;
+       
+       #define GAMETYPE(id) if(i++ == cnt) return id;
        GAMETYPES
-#undef GAMETYPE
+       #undef GAMETYPE
+       
        return 0;
 }
+
 float GameType_GetCount()
 {
        float i;
        i = 0;
-#define GAMETYPE(id) ++i;
+       
+       #define GAMETYPE(id) ++i;
        GAMETYPES
-#undef GAMETYPE
+       #undef GAMETYPE
+       
        return i;
 }
 
+string GameType_GetName(float cnt)
+{
+       float i = GameType_GetID(cnt);
+       
+       if(i)
+               return MapInfo_Type_ToText(i);
+       
+       return "";
+}
+
+string GameType_GetIcon(float cnt)
+{
+       float i = GameType_GetID(cnt);
+       
+       if(i)
+               return strcat("gametype_", MapInfo_Type_ToString(i));
+       
+       return "";
+}
+
+string GameType_GetTeams(float cnt)
+{
+       float i = GameType_GetID(cnt);
+       string s = _MapInfo_GetDefaultEx(i);
+       
+       if(i)
+       {
+               if(strstrofs(s, "teams", 0) >= 0)
+                       return _("teamplay");
+               else
+                       return _("free for all");
+       }
+       
+       return _("tuba for all");
+}
+
 void dialog_hudpanel_common_notoggle(entity me, string panelname)
 {
        float i;