]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Replace "arena" with "ca" when parsing Q3 .arena and .defi files
authorMario <mario.mario@y7mail.com>
Wed, 5 Aug 2020 02:00:50 +0000 (12:00 +1000)
committerMario <mario.mario@y7mail.com>
Wed, 5 Aug 2020 02:00:50 +0000 (12:00 +1000)
qcsrc/client/mapvoting.qc
qcsrc/common/mapinfo.qc
qcsrc/common/mapinfo.qh
qcsrc/common/mapobjects/target/changelevel.qc
qcsrc/menu/xonotic/dialog_multiplayer_join_serverinfo.qc
qcsrc/server/campaign.qc
qcsrc/server/command/sv_cmd.qc
qcsrc/server/mapvoting.qc

index a38bb76cfc5b4bd4300bbcd5a3405f5f765e5c30..76c1e75fcceaeeffbc421893db42d0b2668b65e3 100644 (file)
@@ -637,7 +637,7 @@ void GameTypeVote_ReadOption(int i)
        }
        else
        {
-               Gametype type = MapInfo_Type_FromString(gt, false);
+               Gametype type = MapInfo_Type_FromString(gt, false, false);
                mv_pk3[i] = strzone(MapInfo_Type_ToText(type));
                mv_desc[i] = MapInfo_Type_Description(type);
        }
index 9e0648db4393580a8e79a8dd6af2460f9d653a1f..08db62281e958b6b4f4f2447e19440110857a330 100644 (file)
@@ -610,7 +610,7 @@ void _MapInfo_Map_ApplyGametypeEx(string s, Gametype pWantedType, Gametype pThis
        }
 }
 
-Gametype MapInfo_Type_FromString(string gtype, bool dowarn)
+Gametype MapInfo_Type_FromString(string gtype, bool dowarn, bool is_q3compat)
 {
        string replacement = "";
        bool do_warn = true;
@@ -628,6 +628,7 @@ Gametype MapInfo_Type_FromString(string gtype, bool dowarn)
                case "oneflag":   replacement = "ctf"; do_warn = false; break;
                case "team":      replacement = "tdm"; do_warn = false; break;
                case "tourney":   replacement = "duel"; do_warn = false; break;
+               case "arena":     if(is_q3compat) { replacement = "ca"; do_warn = false; } break;
        }
        if (replacement != "")
        {
@@ -900,7 +901,7 @@ bool _MapInfo_ParseArena(string arena_filename, int fh, string pFilename, Gamety
                        // type in quake 3 holds all the supported gametypes, so we must loop through all of them
                        FOREACH_WORD(s, true,
                        {
-                               Gametype f = MapInfo_Type_FromString(it, false);
+                               Gametype f = MapInfo_Type_FromString(it, false, true);
                                if(f)
                                        stored_supportedGametypes |= f.m_flags;
                        });
@@ -1155,7 +1156,7 @@ float MapInfo_Get_ByName_NoFallbacks(string pFilename, int pAllowGenerate, Gamet
                else if(t == "type")
                {
                        t = car(s); s = cdr(s);
-                       Gametype f = MapInfo_Type_FromString(t, true);
+                       Gametype f = MapInfo_Type_FromString(t, true, false);
                        //if(WARN_COND)
                                //LOG_WARN("Map ", pFilename, " contains the legacy 'type' keyword which is deprecated and will be removed in the future. Please migrate the mapinfo file to 'gametype'.");
                        if(f)
@@ -1166,7 +1167,7 @@ float MapInfo_Get_ByName_NoFallbacks(string pFilename, int pAllowGenerate, Gamet
                else if(t == "gametype")
                {
                        t = car(s); s = cdr(s);
-                       Gametype f = MapInfo_Type_FromString(t, true);
+                       Gametype f = MapInfo_Type_FromString(t, true, false);
                        if(f)
                                _MapInfo_Map_ApplyGametypeEx (s, pGametypeToSet, f);
                        else if(WARN_COND)
@@ -1217,7 +1218,7 @@ float MapInfo_Get_ByName_NoFallbacks(string pFilename, int pAllowGenerate, Gamet
                        t = car(s); s = cdr(s);
                        bool all = t == "all";
                        Gametype f = NULL;
-                       if(all || (f = MapInfo_Type_FromString(t, true)))
+                       if(all || (f = MapInfo_Type_FromString(t, true, false)))
                        {
                                if((all ? MAPINFO_TYPE_ALL : f.m_flags) & pGametypeToSet.m_flags)
                                {
@@ -1234,7 +1235,7 @@ float MapInfo_Get_ByName_NoFallbacks(string pFilename, int pAllowGenerate, Gamet
                        t = car(s); s = cdr(s);
                        bool all = t == "all";
                        Gametype f = NULL;
-                       if(all || (f = MapInfo_Type_FromString(t, true)))
+                       if(all || (f = MapInfo_Type_FromString(t, true, false)))
                        {
                                if((all ? MAPINFO_TYPE_ALL : f.m_flags) & pGametypeToSet.m_flags)
                                {
@@ -1383,7 +1384,7 @@ int MapInfo_CurrentFeatures()
 
 Gametype MapInfo_CurrentGametype()
 {
-       Gametype prev = MapInfo_Type_FromString(cvar_string("gamecfg"), false);
+       Gametype prev = MapInfo_Type_FromString(cvar_string("gamecfg"), false, false);
        FOREACH(Gametypes, cvar(it.netname) && it != prev, return it);
        return prev ? prev : MAPINFO_TYPE_DEATHMATCH;
 }
index 18044b1b45e5e45a69a13b9ea797e63062f687f8..b10f930d0c0b292df98714fb18e3c9888491e4a1 100644 (file)
@@ -175,7 +175,7 @@ string MapInfo_ListAllAllowedMaps(float pFlagsRequired, float pFlagsForbidden);
 // gets a gametype from a string
 string _MapInfo_GetDefaultEx(Gametype t);
 float _MapInfo_GetTeamPlayBool(Gametype t);
-Gametype MapInfo_Type_FromString(string t, bool dowarn);
+Gametype MapInfo_Type_FromString(string t, bool dowarn, bool is_q3compat);
 string MapInfo_Type_Description(Gametype t);
 string MapInfo_Type_ToString(Gametype t);
 string MapInfo_Type_ToText(Gametype t);
index 876fed7a7306cab48686a8adef6c1e18caf94e0c..2cc3c58ba4f32479b8213528b3fd4aea6adfb655 100644 (file)
@@ -28,7 +28,7 @@ void target_changelevel_use(entity this, entity actor, entity trigger)
        }
 
        if(this.gametype != "")
-               MapInfo_SwitchGameType(MapInfo_Type_FromString(this.gametype, false));
+               MapInfo_SwitchGameType(MapInfo_Type_FromString(this.gametype, false, false));
 
        if (this.chmap == "")
        {
index cf542f39c8f47d0d6120c6ef1e56336a07676e90..a4577d31f2704f614d0cd8732a72088b69afb3fe 100644 (file)
@@ -84,7 +84,7 @@ void XonoticServerInfoDialog_loadServerInfo(entity me, float i)
        if(s != "data")
                modname = sprintf("%s (%s)", modname, s);
 
-       Gametype j = MapInfo_Type_FromString(typestr, false); // try and get the real name of the game type
+       Gametype j = MapInfo_Type_FromString(typestr, false, false); // try and get the real name of the game type
        if(j) { typestr = MapInfo_Type_ToText(j); } // only set it if we actually found it
 
        me.currentServerType = strzone(typestr);
index de46e57d508f12fcdb37a95f38da8ebee27da7ac..8f78d56670b9138f3075b2ec58dc174c526e365c 100644 (file)
@@ -34,7 +34,7 @@ float Campaign_Invalid()
        string thismapname, wantedmapname;
        thismapname = GetMapname();
        wantedmapname = campaign_gametype[0];
-       if(MapInfo_CurrentGametype() != MapInfo_Type_FromString(wantedmapname, false))
+       if(MapInfo_CurrentGametype() != MapInfo_Type_FromString(wantedmapname, false, false))
                return CampaignBailout("wrong game type!");
        wantedmapname = campaign_mapname[0];
        if(wantedmapname != thismapname)
@@ -68,7 +68,7 @@ void CampaignPreInit()
 
        if(autocvar_sv_cheats)
        {
-               MapInfo_SwitchGameType(MapInfo_Type_FromString(campaign_gametype[0], false));
+               MapInfo_SwitchGameType(MapInfo_Type_FromString(campaign_gametype[0], false, false));
                CampaignFile_Unload();
                CampaignBailout("JOLLY CHEATS AHAHAHAHAHAHAH))");
                return;
@@ -97,7 +97,7 @@ void CampaignPreInit()
        cvar_settemp("skill", ftos(baseskill));
        cvar_settemp("bot_number", ftos(campaign_bots[0]));
 
-       MapInfo_SwitchGameType(MapInfo_Type_FromString(campaign_gametype[0], false));
+       MapInfo_SwitchGameType(MapInfo_Type_FromString(campaign_gametype[0], false, false));
 
        if(Campaign_Invalid())
                return;
index 7de740bdde1049fc7b1f8c7c8e4d797ef91df4ae..f316a14bcc0c6f984c9c079eac0bc10776df7694 100644 (file)
@@ -723,7 +723,7 @@ void GameCommand_gametype(int request, int argc)
                        if (argv(1) != "")
                        {
                                string s = argv(1);
-                               Gametype t = MapInfo_Type_FromString(s, false), tsave = MapInfo_CurrentGametype();
+                               Gametype t = MapInfo_Type_FromString(s, false, false), tsave = MapInfo_CurrentGametype();
 
                                if (t)
                                {
index ac64f630ff1d5181372a33c21fb4e67bde03588a..dea10ac3202e411ab599e0acc76ded04a955c326 100644 (file)
@@ -49,10 +49,10 @@ entity mapvote_ent;
  */
 Gametype GameTypeVote_Type_FromString(string type_name)
 {
-       Gametype type = MapInfo_Type_FromString(type_name, false);
+       Gametype type = MapInfo_Type_FromString(type_name, false, false);
        if (type == NULL)
                type = MapInfo_Type_FromString(cvar_string(
-                       strcat("sv_vote_gametype_",type_name,"_type")), false);
+                       strcat("sv_vote_gametype_",type_name,"_type")), false, false);
        return type;
 }
 
@@ -60,11 +60,11 @@ int GameTypeVote_AvailabilityStatus(string type_name)
 {
        int flag = GTV_FORBIDDEN;
 
-       Gametype type = MapInfo_Type_FromString(type_name, false);
+       Gametype type = MapInfo_Type_FromString(type_name, false, false);
        if ( type == NULL )
        {
                type = MapInfo_Type_FromString(cvar_string(
-                       strcat("sv_vote_gametype_",type_name,"_type")), false);
+                       strcat("sv_vote_gametype_",type_name,"_type")), false, false);
                flag |= GTV_CUSTOM;
        }