backup map is now based on casualpool

This commit is contained in:
jenz 2026-03-14 17:39:25 +01:00
parent 1bbed31610
commit 5855e49f78

View File

@ -1035,6 +1035,34 @@ public Action unfreeze_players2(Handle hTimer, Handle dp)
public Action Timer_fall_back_map_switch(Handle hTimer, Handle dp) public Action Timer_fall_back_map_switch(Handle hTimer, Handle dp)
{ {
static char map[PLATFORM_MAX_PATH];
Handle tempMaps = CloneArray(g_MapList);
//if we stop using the casual pool feature we instead just rely on the default map to be used.
if (g_iMapsFromCasualPool > 0)
{
int b;
for(int j = 0; j < 1000; j++)
{
b = GetRandomInt(0, GetArraySize(tempMaps) - 1);
GetArrayString(tempMaps, b, map, PLATFORM_MAX_PATH);
if (!InternalGetCasualPool(map))
{
continue;
}
if (InternalGetMapCooldownTime(map) > GetTime())
{
continue;
}
//found a map from casual pool to force to.
break;
}
ForceChangeLevel(map, "nobody voted at mapvote");
}
else
{
char map_line[256]; char map_line[256];
File f = OpenFile("cfg/defaultmap.cfg", "r"); File f = OpenFile("cfg/defaultmap.cfg", "r");
if (f != null) if (f != null)
@ -1046,6 +1074,7 @@ public Action Timer_fall_back_map_switch(Handle hTimer, Handle dp)
TrimString(map_line); TrimString(map_line);
//LogMessage("map_line: %s", map_line); //LogMessage("map_line: %s", map_line);
ForceChangeLevel(map_line, "nobody voted at mapvote"); ForceChangeLevel(map_line, "nobody voted at mapvote");
}
return Plugin_Handled; return Plugin_Handled;
} }