]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/menu/xonotic/util.qc
Merge branch 'master' into Mario/intrusive_2
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / xonotic / util.qc
index ec76d389e6cd8d9206162aa7645dc8527a8ab3b8..e746bd725746a2a93a6e84812e8810b3cf74deac 100644 (file)
@@ -685,16 +685,21 @@ float updateCompression()
        GAMETYPE(MAPINFO_TYPE_NEXBALL) \
        GAMETYPE(MAPINFO_TYPE_ONSLAUGHT) \
        GAMETYPE(MAPINFO_TYPE_ASSAULT) \
-       if (cvar("developer")) GAMETYPE(MAPINFO_TYPE_RACE) \
-       if (cvar("developer")) GAMETYPE(MAPINFO_TYPE_CTS) \
        /* GAMETYPE(MAPINFO_TYPE_INVASION) */ \
        /**/
 
+// hidden gametypes come last so indexing always works correctly
+#define HIDDEN_GAMETYPES \
+       GAMETYPE(MAPINFO_TYPE_RACE) \
+       GAMETYPE(MAPINFO_TYPE_CTS) \
+       /**/
+
 Gametype GameType_GetID(int cnt)
 {
        int i = 0;
        #define GAMETYPE(it) { if (i++ == cnt) return it; }
        GAMETYPES
+       HIDDEN_GAMETYPES
        #undef GAMETYPE
        return NULL;
 }
@@ -705,6 +710,19 @@ int GameType_GetCount()
        #define GAMETYPE(id) ++i;
        GAMETYPES
        #undef GAMETYPE
+       #define GAMETYPE(it) if (cvar("developer")) ++i;
+       HIDDEN_GAMETYPES
+       #undef GAMETYPE
+       return i;
+}
+
+int GameType_GetTotalCount()
+{
+       int i = 0;
+       #define GAMETYPE(id) ++i;
+       GAMETYPES
+       HIDDEN_GAMETYPES
+       #undef GAMETYPE
        return i;
 }