From: Mario Date: Sun, 14 Aug 2016 10:11:19 +0000 (+1000) Subject: Registrize team and fraglimit setting X-Git-Tag: xonotic-v0.8.2~718^2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=refs%2Fmerge-requests%2F349%2Fhead;p=xonotic%2Fxonotic-data.pk3dir.git Registrize team and fraglimit setting --- diff --git a/qcsrc/common/mapinfo.qc b/qcsrc/common/mapinfo.qc index 4b5b92143..2bc84c459 100644 --- a/qcsrc/common/mapinfo.qc +++ b/qcsrc/common/mapinfo.qc @@ -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"); diff --git a/qcsrc/common/mapinfo.qh b/qcsrc/common/mapinfo.qh index d84d86cad..f37e2db06 100644 --- a/qcsrc/common/mapinfo.qh +++ b/qcsrc/common/mapinfo.qh @@ -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