]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/mapinfo.qc
Remove a leftover debug print from the disabled gametype fallback code
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / mapinfo.qc
index 257e5e40f185ddc0bf254b9dc11d926258365cc2..f6137ed4a12765ab970ac055361e659d7c94b88b 100644 (file)
@@ -671,11 +671,8 @@ void _MapInfo_Parse_Settemp(string pFilename, string acl, float type, string s,
                        }
                        else
                        {
-                               for (;;)
+                               while((s = fgets(fh)))
                                {
-                                       if (!((s = fgets(fh))))
-                                               break;
-
                                        // catch different sorts of comments
                                        if(s == "")                    // empty lines
                                                continue;
@@ -1150,7 +1147,7 @@ int MapInfo_CurrentFeatures()
 
 Gametype MapInfo_CurrentGametype()
 {
-       Gametype prev = Gametypes_from(cvar("gamecfg"));
+       Gametype prev = REGISTRY_GET(Gametypes, cvar("gamecfg"));
        FOREACH(Gametypes, cvar(it.netname) && it != prev, return it);
        return prev ? prev : MAPINFO_TYPE_DEATHMATCH;
 }
@@ -1261,14 +1258,24 @@ void MapInfo_LoadMapSettings(string s) // to be called from worldspawn
                        return; // do not call Get_ByName!
                }
 
+#if 0
+               // find the lowest bit in the supported gametypes
+               // unnecessary now that we select one at random
                int _t = 1;
                while(!(MapInfo_Map_supportedGametypes & 1))
                {
                        _t <<= 1;
                        MapInfo_Map_supportedGametypes = floor(MapInfo_Map_supportedGametypes >> 1);
                }
+#endif
+               RandomSelection_Init();
                Gametype t_prev = t;
-               FOREACH(Gametypes, it.m_flags == _t, { t = it; break; });
+               FOREACH(Gametypes, MapInfo_Map_supportedGametypes & it.m_flags,
+               {
+                       RandomSelection_AddEnt(it, 1, it.m_priority);
+               });
+               if(RandomSelection_chosen_ent)
+                       t = RandomSelection_chosen_ent;
 
                // t is now a supported mode!
                LOG_WARNF("can't play the selected map in the given game mode (%s). Falling back to a supported mode (%s).", t_prev.mdl, t.mdl);