]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
mapinfo: fix and rename noautomaplist flag to donotwant
authorbones_was_here <bones_was_here@xonotic.au>
Mon, 23 Oct 2023 15:30:36 +0000 (01:30 +1000)
committerbones_was_here <bones_was_here@xonotic.au>
Sat, 10 Feb 2024 08:16:53 +0000 (18:16 +1000)
This flag was ignored in the code paths used on most servers, and its
name and behaviour were not ideal for its intended use, see
7d48e976c8a9b3f80350b2ad41d9feec2797cf76 description which seems clear
that it's for allowing a certain kind of map to be available on the
server but not be included in the usual voting pool.

This updated implementation omits the flagged maps from GUI voting and
prevents them being selected by other GotoNextMap()/GetNextMap() code
paths, unless there aren't enough viable maps in which case they
can still be used as fallbacks.

The flagged maps are always listed in CLI and may be nominated with
`suggestmap` or vcalled with `gotomap` or `nextmap`.

qcsrc/common/mapinfo.qc
qcsrc/common/mapinfo.qh
qcsrc/server/intermission.qc

index 82a7e758413de31ffd73eae094b93717c67fb678..e66ebb7671d4b85e9dc832d690d9e11e67392b44 100644 (file)
@@ -1167,14 +1167,14 @@ float MapInfo_Get_ByName_NoFallbacks(string pFilename, int pAllowGenerate, Gamet
                {
                        MapInfo_Map_flags |= MAPINFO_FLAG_FRUSTRATING;
                }
-               else if(t == "noautomaplist")
+               else if(t == "donotwant" || t == "noautomaplist")
                {
-                       MapInfo_Map_flags |= MAPINFO_FLAG_NOAUTOMAPLIST;
+                       MapInfo_Map_flags |= MAPINFO_FLAG_DONOTWANT;
                }
                else if(t == "gameversion_min")
                {
                        if (cvar("gameversion") < stof(s))
-                               MapInfo_Map_flags |= MAPINFO_FLAG_NOAUTOMAPLIST;
+                               MapInfo_Map_flags |= MAPINFO_FLAG_DONOTWANT;
                }
                else if(t == "type")
                {
index b8eefcea3a6f163a6f365f65d0a6c4ef3535c603..4d65695ae41a9391d19b1f145440c1942bfc5e70 100644 (file)
@@ -143,7 +143,7 @@ const int MAPINFO_FEATURE_MONSTERS      = 8;
 const int MAPINFO_FLAG_HIDDEN           = 1; // not in lsmaps/menu/vcall/etc., can just be changed to manually
 const int MAPINFO_FLAG_FORBIDDEN        = 2; // don't even allow the map by a cvar setting that allows hidden maps
 const int MAPINFO_FLAG_FRUSTRATING      = 4; // this map is near impossible to play, enable at your own risk
-const int MAPINFO_FLAG_NOAUTOMAPLIST    = 8; // do not include when automatically building maplist (counts as hidden for maplist building purposes)
+const int MAPINFO_FLAG_DONOTWANT        = 8; // do not include in GUI voting screen or select in GotoNextMap()/GetNextMap(), unless added with `suggestmap` or required as a fallback
 
 float MapInfo_count;
 
index 9392c2399f3942aac3a2598568b4e7111be6971e..31b0559c7d1f979fc60148586b568fd4aaa13e68 100644 (file)
@@ -130,6 +130,9 @@ bool Map_Check(int position, float pass)
        {
                if(pass == 2)
                        return true;
+               // MapInfo_Map_flags was set by MapInfo_CheckMap()
+               if (MapInfo_Map_flags & MAPINFO_FLAG_DONOTWANT)
+                       return false;
                if(MapHasRightSize(map_next))
                        return true;
                return false;
@@ -275,7 +278,7 @@ void Maplist_Init()
        if (i == Map_Count)
        {
                bprint( "Maplist contains no usable maps!  Resetting it to default map list.\n" );
-               cvar_set("g_maplist", MapInfo_ListAllAllowedMaps(MapInfo_RequiredFlags(), MapInfo_ForbiddenFlags() | MAPINFO_FLAG_NOAUTOMAPLIST));
+               cvar_set("g_maplist", MapInfo_ListAllAllowedMaps(MapInfo_RequiredFlags(), MapInfo_ForbiddenFlags()));
                if(autocvar_g_maplist_shuffle)
                        ShuffleMaplist();
                if(!server_is_dedicated)