localcmd(ftos(campaign_offset + n));
localcmd("\n");
localcmd("disconnect\nmaxplayers 16\n");
- MapInfo_LoadMap(campaign_mapname[n]);
+ MapInfo_LoadMap(campaign_mapname[n], 1);
}
cvar_set("g_keepaway", (t == MAPINFO_TYPE_KEEPAWAY) ? "1" : "0");
}
-void MapInfo_LoadMap(string s)
+void MapInfo_LoadMap(string s, float reinit)
{
MapInfo_Map_supportedGametypes = 0;
// we shouldn't need this, as LoadMapSettings already fixes the gametype
// print("EMERGENCY: can't play the selected map in the given game mode. Falling back to DM.\n");
// MapInfo_SwitchGameType(MAPINFO_TYPE_DEATHMATCH);
//}
- localcmd(strcat("\nsettemp_restore\nchangelevel ", s, "\n"));
+
+ if(reinit)
+ localcmd(strcat("\nsettemp_restore\nmap ", s, "\n"));
+ else
+ localcmd(strcat("\nsettemp_restore\nchangelevel ", s, "\n"));
}
string MapInfo_ListAllowedMaps(float pRequiredFlags, float pForbiddenFlags)
// play a map
float MapInfo_CheckMap(string s); // returns 0 if the map can't be played with the current settings
-void MapInfo_LoadMap(string s);
+void MapInfo_LoadMap(string s, float reinit);
// list all maps for the current game type
string MapInfo_ListAllowedMaps(float pFlagsRequired, float pFlagsForbidden);
s = MapInfo_BSPName_ByID(m);
}
while(!fexists(sprintf("maps/%s.waypoints", s)));
- MapInfo_LoadMap(s);
+ MapInfo_LoadMap(s, 1);
// configure bots
float p;
localcmd("\nmenu_loadmap_prepare\n");
if(cvar("menu_use_default_hostname"))
localcmd("hostname \"", sprintf(_("%s's Xonotic Server"), strdecolorize(cvar_string("_cl_name"))), "\"\n");
- MapInfo_LoadMap(m);
+ MapInfo_LoadMap(m, 1);
}
else
{
if (!spot)
{
if(autocvar_spawn_debug)
- GotoNextMap();
+ GotoNextMap(0);
else
{
if(some_spawn_has_been_used)
string GetMapname();
string GetGametype();
-void GotoNextMap();
+void GotoNextMap(float reinit);
void ShuffleMaplist()
-float() DoNextMapOverride;
+float(float reinit) DoNextMapOverride;
void SetDefaultAlpha()
{
MapInfo_Enumerate();
MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures(), MapInfo_RequiredFlags(), MapInfo_ForbiddenFlags(), 0);
- if(!DoNextMapOverride())
- GotoNextMap();
+ if(!DoNextMapOverride(1))
+ GotoNextMap(1);
return;
}
localcmd("\nsettemp_restore\n");
}
-void Map_Goto()
+void Map_Goto(float reinit)
{
GameResetCfg();
- MapInfo_LoadMap(getmapname_stored);
+ MapInfo_LoadMap(getmapname_stored, reinit);
}
// return codes of map selectors:
return "";
}
-float DoNextMapOverride()
+float DoNextMapOverride(float reinit)
{
if(autocvar_g_campaign)
{
if(MapInfo_CheckMap(autocvar_nextmap))
{
Map_Goto_SetStr(autocvar_nextmap);
- Map_Goto();
+ Map_Goto(reinit);
alreadychangedlevel = TRUE;
return TRUE;
}
return FALSE;
}
-void GotoNextMap()
+void GotoNextMap(float reinit)
{
//string nextmap;
//float n, nummaps;
error("Everything is broken - not even the default map list works. Please report this to the developers.");
}
}
- Map_Goto();
+ Map_Goto(reinit);
}
}
FixClientCvars(other);
Map_Goto_SetStr(mapvote_maps[mappos]);
- Map_Goto();
+ Map_Goto(0);
alreadychangedlevel = TRUE;
return TRUE;
}
}
mapvote_initialized = TRUE;
- if(DoNextMapOverride())
+ if(DoNextMapOverride(0))
return;
if(!autocvar_g_maplist_votable || player_count <= 0)
{
- GotoNextMap();
+ GotoNextMap(0);
return;
}
MapVote_Init();
cvar_set("timelimit", "-1");
if(mapvote_initialized || alreadychangedlevel)
{
- if(DoNextMapOverride())
+ if(DoNextMapOverride(0))
return "Map switch initiated.";
else
return "Hm... no. For some reason I like THIS map more.";
else if(radarmapper.count & 2)
{
localcmd(strcat("defer 1 \"sv_cmd radarmap --flags ", ftos(radarmapper.count), strcat(" --res ", ftos(radarmapper.size_x), " ", ftos(radarmapper.size_y), " --sharpen ", ftos(radarmapper.ltime), " --qual ", ftos(radarmapper.size_z)), "\"\n"));
- GotoNextMap();
+ GotoNextMap(0);
}
remove(radarmapper);
radarmapper = world;