From f12a9dbdca47a64ef3bd3c7fc0560e75cfef32b8 Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Wed, 20 Jul 2011 13:50:02 +0200 Subject: [PATCH] automatic g_maplist: rather collect maps for ALL game types in there --- qcsrc/common/mapinfo.qc | 18 ++++++++++++++++++ qcsrc/common/mapinfo.qh | 2 ++ qcsrc/server/g_world.qc | 6 +++--- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/qcsrc/common/mapinfo.qc b/qcsrc/common/mapinfo.qc index 902479c43..cca716a33 100644 --- a/qcsrc/common/mapinfo.qc +++ b/qcsrc/common/mapinfo.qc @@ -1253,6 +1253,24 @@ string MapInfo_ListAllowedMaps(float pRequiredFlags, float pForbiddenFlags) return substring(out, 1, strlen(out) - 1); } +string MapInfo_ListAllAllowedMaps(float pRequiredFlags, float pForbiddenFlags) +{ + string out; + float i; + + // to make absolutely sure: + MapInfo_Enumerate(); + MapInfo_FilterGametype(MAPINFO_TYPE_ALL, 0, pRequiredFlags, pForbiddenFlags, 0); + + out = ""; + for(i = 0; i < MapInfo_count; ++i) + out = strcat(out, " ", _MapInfo_GlobItem(MapInfo_FilterList_Lookup(i))); + + MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures(), pRequiredFlags, pForbiddenFlags, 0); + + return substring(out, 1, strlen(out) - 1); +} + void MapInfo_LoadMapSettings(string s) // to be called from worldspawn { float t, t0; diff --git a/qcsrc/common/mapinfo.qh b/qcsrc/common/mapinfo.qh index 12026689b..2ce5d60c9 100644 --- a/qcsrc/common/mapinfo.qh +++ b/qcsrc/common/mapinfo.qh @@ -68,6 +68,8 @@ void MapInfo_LoadMap(string s); // list all maps for the current game type string MapInfo_ListAllowedMaps(float pFlagsRequired, float pFlagsForbidden); +// list all allowed maps (for any game type) +string MapInfo_ListAllAllowedMaps(float pFlagsRequired, float pFlagsForbidden); // gets a gametype from a string float MapInfo_Type_FromString(string t); diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc index 5b273a9c9..047d2c0be 100644 --- a/qcsrc/server/g_world.qc +++ b/qcsrc/server/g_world.qc @@ -1194,7 +1194,7 @@ void Maplist_Init() if(Map_Count == 0) { bprint( "Maplist is empty! Resetting it to default map list.\n" ); - cvar_set("g_maplist", MapInfo_ListAllowedMaps(MapInfo_RequiredFlags(), MapInfo_ForbiddenFlags())); + cvar_set("g_maplist", MapInfo_ListAllAllowedMaps(MapInfo_RequiredFlags(), MapInfo_ForbiddenFlags())); if(autocvar_g_maplist_shuffle) ShuffleMaplist(); localcmd("\nmenu_cmd sync\n"); @@ -1314,7 +1314,7 @@ void GotoNextMap() if(allowReset) { bprint( "Maplist contains no single playable map! Resetting it to default map list.\n" ); - cvar_set("g_maplist", MapInfo_ListAllowedMaps(MapInfo_RequiredFlags(), MapInfo_ForbiddenFlags())); + cvar_set("g_maplist", MapInfo_ListAllAllowedMaps(MapInfo_RequiredFlags(), MapInfo_ForbiddenFlags())); if(autocvar_g_maplist_shuffle) ShuffleMaplist(); localcmd("\nmenu_cmd sync\n"); @@ -2425,7 +2425,7 @@ void MapVote_Init() if(mapvote_count == 0) { bprint( "Maplist contains no single playable map! Resetting it to default map list.\n" ); - cvar_set("g_maplist", MapInfo_ListAllowedMaps(MapInfo_RequiredFlags(), MapInfo_ForbiddenFlags())); + cvar_set("g_maplist", MapInfo_ListAllAllowedMaps(MapInfo_RequiredFlags(), MapInfo_ForbiddenFlags())); if(autocvar_g_maplist_shuffle) ShuffleMaplist(); localcmd("\nmenu_cmd sync\n"); -- 2.39.2