From: Rudolf Polzer Date: Fri, 23 Dec 2011 09:00:04 +0000 (+0100) Subject: fix maxplayers etc. in +serverconfig X-Git-Tag: xonotic-v0.6.0~74^2~66^2~1 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=c8d05950089f36b4eea93fbcc8e7831f2d71766c;p=xonotic%2Fxonotic-data.pk3dir.git fix maxplayers etc. in +serverconfig --- diff --git a/qcsrc/common/campaign_setup.qc b/qcsrc/common/campaign_setup.qc index 3aae078ad..525b2856d 100644 --- a/qcsrc/common/campaign_setup.qc +++ b/qcsrc/common/campaign_setup.qc @@ -8,5 +8,5 @@ void CampaignSetup(float n) localcmd(ftos(campaign_offset + n)); localcmd("\n"); localcmd("disconnect\nmaxplayers 16\n"); - MapInfo_LoadMap(campaign_mapname[n]); + MapInfo_LoadMap(campaign_mapname[n], 1); } diff --git a/qcsrc/common/mapinfo.qc b/qcsrc/common/mapinfo.qc index aad95a1fe..a419e395a 100644 --- a/qcsrc/common/mapinfo.qc +++ b/qcsrc/common/mapinfo.qc @@ -1290,7 +1290,7 @@ void MapInfo_SwitchGameType(float t) 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 @@ -1299,7 +1299,11 @@ void MapInfo_LoadMap(string s) // 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) diff --git a/qcsrc/common/mapinfo.qh b/qcsrc/common/mapinfo.qh index ebfc0e443..4de17c924 100644 --- a/qcsrc/common/mapinfo.qh +++ b/qcsrc/common/mapinfo.qh @@ -67,7 +67,7 @@ string MapInfo_FixName(string s); // 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); diff --git a/qcsrc/menu/xonotic/dialog_singleplayer.c b/qcsrc/menu/xonotic/dialog_singleplayer.c index aff39ec17..6e1be0067 100644 --- a/qcsrc/menu/xonotic/dialog_singleplayer.c +++ b/qcsrc/menu/xonotic/dialog_singleplayer.c @@ -94,7 +94,7 @@ void InstantAction_LoadMap(entity btn, entity dummy) s = MapInfo_BSPName_ByID(m); } while(!fexists(sprintf("maps/%s.waypoints", s))); - MapInfo_LoadMap(s); + MapInfo_LoadMap(s, 1); // configure bots float p; diff --git a/qcsrc/menu/xonotic/maplist.c b/qcsrc/menu/xonotic/maplist.c index 9ce298082..650e343c6 100644 --- a/qcsrc/menu/xonotic/maplist.c +++ b/qcsrc/menu/xonotic/maplist.c @@ -284,7 +284,7 @@ void MapList_LoadMap(entity btn, entity me) 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 { diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index 8489145c1..9ddcaabac 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -311,7 +311,7 @@ entity SelectSpawnPoint (float anypoint) if (!spot) { if(autocvar_spawn_debug) - GotoNextMap(); + GotoNextMap(0); else { if(some_spawn_has_been_used) diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc index 95e3f7d61..8ce4ebdae 100644 --- a/qcsrc/server/g_world.qc +++ b/qcsrc/server/g_world.qc @@ -44,9 +44,9 @@ float world_initialized; string GetMapname(); string GetGametype(); -void GotoNextMap(); +void GotoNextMap(float reinit); void ShuffleMaplist() -float() DoNextMapOverride; +float(float reinit) DoNextMapOverride; void SetDefaultAlpha() { @@ -189,8 +189,8 @@ void GotoFirstMap() MapInfo_Enumerate(); MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures(), MapInfo_RequiredFlags(), MapInfo_ForbiddenFlags(), 0); - if(!DoNextMapOverride()) - GotoNextMap(); + if(!DoNextMapOverride(1)) + GotoNextMap(1); return; } @@ -1141,10 +1141,10 @@ void GameResetCfg() 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: @@ -1280,7 +1280,7 @@ string GetNextMap() return ""; } -float DoNextMapOverride() +float DoNextMapOverride(float reinit) { if(autocvar_g_campaign) { @@ -1313,7 +1313,7 @@ float DoNextMapOverride() if(MapInfo_CheckMap(autocvar_nextmap)) { Map_Goto_SetStr(autocvar_nextmap); - Map_Goto(); + Map_Goto(reinit); alreadychangedlevel = TRUE; return TRUE; } @@ -1327,7 +1327,7 @@ float DoNextMapOverride() return FALSE; } -void GotoNextMap() +void GotoNextMap(float reinit) { //string nextmap; //float n, nummaps; @@ -1359,7 +1359,7 @@ void GotoNextMap() error("Everything is broken - not even the default map list works. Please report this to the developers."); } } - Map_Goto(); + Map_Goto(reinit); } } @@ -2631,7 +2631,7 @@ float MapVote_Finished(float mappos) FixClientCvars(other); Map_Goto_SetStr(mapvote_maps[mappos]); - Map_Goto(); + Map_Goto(0); alreadychangedlevel = TRUE; return TRUE; } @@ -2827,11 +2827,11 @@ void MapVote_Think() } mapvote_initialized = TRUE; - if(DoNextMapOverride()) + if(DoNextMapOverride(0)) return; if(!autocvar_g_maplist_votable || player_count <= 0) { - GotoNextMap(); + GotoNextMap(0); return; } MapVote_Init(); @@ -2848,7 +2848,7 @@ string GotoMap(string m) 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."; diff --git a/qcsrc/server/gamecommand.qc b/qcsrc/server/gamecommand.qc index 986f2dd84..b4846d2fa 100644 --- a/qcsrc/server/gamecommand.qc +++ b/qcsrc/server/gamecommand.qc @@ -229,7 +229,7 @@ void RadarMap_Next() 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;