From: bones_was_here Date: Mon, 23 Oct 2023 15:30:36 +0000 (+1000) Subject: mapinfo: fix and rename noautomaplist flag to donotwant X-Git-Url: http://git.xonotic.org/?a=commitdiff_plain;h=bd7d909f5a201d0a5cb2585ba358b27a8abe4526;p=xonotic%2Fxonotic-data.pk3dir.git mapinfo: fix and rename noautomaplist flag to donotwant 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`. --- diff --git a/qcsrc/common/mapinfo.qc b/qcsrc/common/mapinfo.qc index 82a7e7584..e66ebb767 100644 --- a/qcsrc/common/mapinfo.qc +++ b/qcsrc/common/mapinfo.qc @@ -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") { diff --git a/qcsrc/common/mapinfo.qh b/qcsrc/common/mapinfo.qh index b8eefcea3..4d65695ae 100644 --- a/qcsrc/common/mapinfo.qh +++ b/qcsrc/common/mapinfo.qh @@ -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; diff --git a/qcsrc/server/intermission.qc b/qcsrc/server/intermission.qc index 9392c2399..31b0559c7 100644 --- a/qcsrc/server/intermission.qc +++ b/qcsrc/server/intermission.qc @@ -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)