]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Registrize team and fraglimit setting 349/head
authorMario <mario@smbclan.net>
Sun, 14 Aug 2016 10:11:19 +0000 (20:11 +1000)
committerMario <mario@smbclan.net>
Sun, 14 Aug 2016 10:11:19 +0000 (20:11 +1000)
qcsrc/common/mapinfo.qc
qcsrc/common/mapinfo.qh

index 4b5b9214300913de3d4c1daed3010a27319514d0..2bc84c4593afec5e62a5ddcbbfc689cd2c92d71f 100644 (file)
@@ -476,56 +476,14 @@ void _MapInfo_Map_ApplyGametype(string s, Gametype pWantedType, Gametype pThisTy
                cvar_set("timelimit", sa);
        s = cdr(s);
 
-       if(pWantedType == MAPINFO_TYPE_TEAM_DEATHMATCH)
+       if(pWantedType.m_setTeams)
        {
                sa = car(s);
                if(sa != "")
-                       cvar_set("g_tdm_teams", sa);
+                       pWantedType.m_setTeams(sa);
                s = cdr(s);
        }
 
-       if(pWantedType == MAPINFO_TYPE_KEYHUNT)
-       {
-               sa = car(s);
-               if(sa != "")
-                       cvar_set("g_keyhunt_teams", sa);
-               s = cdr(s);
-       }
-
-       if(pWantedType == MAPINFO_TYPE_CA)
-       {
-               sa = car(s);
-               if(sa != "")
-                       cvar_set("g_ca_teams", sa);
-               s = cdr(s);
-       }
-
-       if(pWantedType == MAPINFO_TYPE_FREEZETAG)
-       {
-               sa = car(s);
-               if(sa != "")
-                       cvar_set("g_freezetag_teams", sa);
-               s = cdr(s);
-       }
-
-       if(pWantedType == MAPINFO_TYPE_CTF)
-       {
-               sa = car(s);
-               if(sa != "")
-                       cvar_set("fraglimit", sa);
-               s = cdr(s);
-       }
-
-       /* keepaway wuz here
-       if(pWantedType == MAPINFO_TYPE_KEEPAWAY)
-       {
-               sa = car(s);
-               if(sa != "")
-                       cvar_set("fraglimit", sa);
-               s = cdr(s);
-       }
-       */
-
        // rc = timelimit timelimit_qualification laps laps_teamplay
        if(pWantedType == MAPINFO_TYPE_RACE)
        {
@@ -546,19 +504,6 @@ void _MapInfo_Map_ApplyGametype(string s, Gametype pWantedType, Gametype pThisTy
                s = cdr(s);
        }
 
-       if(pWantedType == MAPINFO_TYPE_CTS)
-       {
-               sa = car(s);
-
-               // this is the skill of the map
-               // not parsed by anything yet
-               // for map databases
-               //if(sa != "")
-               //      cvar_set("fraglimit", sa);
-
-               s = cdr(s);
-       }
-
        if(pWantedType == MAPINFO_TYPE_ASSAULT || pWantedType == MAPINFO_TYPE_ONSLAUGHT || pWantedType == MAPINFO_TYPE_CTS) // these modes don't use fraglimit
        {
                cvar_set("leadlimit", "0");
index d84d86cad607026dc4004cee70063adc345f7d25..f37e2db060881e23088652e012926e668b731216 100644 (file)
@@ -169,6 +169,13 @@ CLASS(RaceCTS, Gametype)
         if(v == "target_startTimer")
             MapInfo_Map_supportedGametypes |= this.m_flags;
     }
+    METHOD(RaceCTS, m_setTeams, void(string sa))
+    {
+        // this is the skill of the map
+        // not parsed by anything yet
+        // for map databases
+        //  cvar_set("fraglimit", sa);
+    }
 #ifdef CSQC
     ATTRIB(RaceCTS, m_modicons, void(vector pos, vector mySize), HUD_Mod_Race);
 #endif
@@ -200,6 +207,10 @@ CLASS(TeamDeathmatch, Gametype)
             return true;
         return false;
     }
+    METHOD(TeamDeathmatch, m_setTeams, void(string sa))
+    {
+        cvar_set("g_tdm_teams", sa);
+    }
 ENDCLASS(TeamDeathmatch)
 REGISTER_GAMETYPE(TEAM_DEATHMATCH, NEW(TeamDeathmatch));
 #define g_tdm IS_GAMETYPE(TEAM_DEATHMATCH)
@@ -222,6 +233,10 @@ CLASS(CaptureTheFlag, Gametype)
     {
         return true;
     }
+    METHOD(CaptureTheFlag, m_setTeams, void(string sa))
+    {
+        cvar_set("fraglimit", sa);
+    }
 #ifdef CSQC
     ATTRIB(CaptureTheFlag, m_modicons, void(vector pos, vector mySize), HUD_Mod_CTF);
     ATTRIB(CaptureTheFlag, m_modicons_reset, void(), HUD_Mod_CTF_Reset);
@@ -257,6 +272,10 @@ CLASS(ClanArena, Gametype)
             return true;
         return false;
     }
+    METHOD(ClanArena, m_setTeams, void(string sa))
+    {
+        cvar_set("g_ca_teams", sa);
+    }
 #ifdef CSQC
     ATTRIB(ClanArena, m_modicons, void(vector pos, vector mySize), HUD_Mod_CA);
 #endif
@@ -323,6 +342,10 @@ CLASS(KeyHunt, Gametype)
             return true;
         return false;
     }
+    METHOD(KeyHunt, m_setTeams, void(string sa))
+    {
+        cvar_set("g_keyhunt_teams", sa);
+    }
 #ifdef CSQC
     ATTRIB(KeyHunt, m_modicons, void(vector pos, vector mySize), HUD_Mod_KH);
 #endif
@@ -408,6 +431,10 @@ CLASS(FreezeTag, Gametype)
             return true;
         return false;
     }
+    METHOD(FreezeTag, m_setTeams, void(string sa))
+    {
+        cvar_set("g_freezetag_teams", sa);
+    }
 #ifdef CSQC
     ATTRIB(FreezeTag, m_modicons, void(vector pos, vector mySize), HUD_Mod_CA);
 #endif