From: terencehill Date: Tue, 22 Mar 2016 00:20:44 +0000 (+0100) Subject: Fix race not starting (game ends) when the qualifying session ends (everyone readied... X-Git-Tag: xonotic-v0.8.2~993^2~4 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=b31c13cbd4fb79981e881e0599caf01d9d8dfd62;p=xonotic%2Fxonotic-data.pk3dir.git Fix race not starting (game ends) when the qualifying session ends (everyone readied up): the cause was timelimit being set to -1. Also fix timelimit_override and g_race_qualifying_timelimit_override not working. --- diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc index 6398cbe93..aa13afea3 100644 --- a/qcsrc/server/g_world.qc +++ b/qcsrc/server/g_world.qc @@ -562,6 +562,18 @@ void __init_dedicated_server_shutdown() { MapInfo_Shutdown(); } +void SetLimits(int fraglimit_override, int leadlimit_override, float timelimit_override, float qualifying_override) +{ + if(!autocvar_g_campaign) + { + if(fraglimit_override >= 0) cvar_set("fraglimit", ftos(fraglimit_override)); + if(timelimit_override >= 0) cvar_set("timelimit", ftos(timelimit_override)); + if(leadlimit_override >= 0) cvar_set("leadlimit", ftos(leadlimit_override)); + if(qualifying_override >= 0) cvar_set("g_race_qualifying_timelimit", ftos(qualifying_override)); + } + limits_are_set = true; +} + void Map_MarkAsRecent(string m); float world_already_spawned; void Nagger_Init(); @@ -718,6 +730,9 @@ spawnfunc(worldspawn) readlevelcvars(); GrappleHookInit(); + if(!limits_are_set) + SetLimits(autocvar_fraglimit_override, autocvar_leadlimit_override, autocvar_timelimit_override, -1); + player_count = 0; bot_waypoints_for_items = autocvar_g_waypoints_for_items; if(bot_waypoints_for_items == 1) diff --git a/qcsrc/server/g_world.qh b/qcsrc/server/g_world.qh index cd1cafd36..5366d0a78 100644 --- a/qcsrc/server/g_world.qh +++ b/qcsrc/server/g_world.qh @@ -10,6 +10,9 @@ const int WINNING_YES = 1; // winner found const int WINNING_NEVER = 2; // no winner, enter overtime if time limit is reached const int WINNING_STARTSUDDENDEATHOVERTIME = 3; // no winner, enter suddendeath overtime NOW +bool limits_are_set = false; +void SetLimits(int fraglimit_override, int leadlimit_override, float timelimit_override, float qualifying_override); + float WinningCondition_Scores(float limit, float leadlimit); void SetWinners(.float field, float value); void CheckRules_Player(); diff --git a/qcsrc/server/mutators/mutator/gamemode_assault.qc b/qcsrc/server/mutators/mutator/gamemode_assault.qc index e9c31f326..2f0d89903 100644 --- a/qcsrc/server/mutators/mutator/gamemode_assault.qc +++ b/qcsrc/server/mutators/mutator/gamemode_assault.qc @@ -3,7 +3,6 @@ #define GAMEMODE_ASSAULT_H void assault_ScoreRules(); -void ActivateTeamplay(); REGISTER_MUTATOR(as, false) { diff --git a/qcsrc/server/mutators/mutator/gamemode_race.qc b/qcsrc/server/mutators/mutator/gamemode_race.qc index bbcf56ae5..691d87c98 100644 --- a/qcsrc/server/mutators/mutator/gamemode_race.qc +++ b/qcsrc/server/mutators/mutator/gamemode_race.qc @@ -468,9 +468,8 @@ void rc_SetLimits() qualifying_override = autocvar_g_race_qualifying_timelimit_override; fraglimit_override = autocvar_g_race_laps_limit; leadlimit_override = 0; // currently not supported by race - timelimit_override = -1; // use default if we don't set it below + timelimit_override = autocvar_timelimit_override; - // we need to find out the correct value for g_race_qualifying float want_qualifying = ((qualifying_override >= 0) ? qualifying_override : autocvar_g_race_qualifying_timelimit) > 0; if(autocvar_g_campaign) @@ -478,20 +477,20 @@ void rc_SetLimits() g_race_qualifying = 1; independent_players = 1; } - else if(!autocvar_g_campaign && want_qualifying) + else if(want_qualifying) { g_race_qualifying = 2; independent_players = 1; - race_fraglimit = (race_fraglimit >= 0) ? fraglimit_override : autocvar_fraglimit; - race_leadlimit = (race_leadlimit >= 0) ? leadlimit_override : autocvar_leadlimit; - race_timelimit = (race_timelimit >= 0) ? timelimit_override : autocvar_timelimit; + race_fraglimit = (fraglimit_override >= 0) ? fraglimit_override : autocvar_fraglimit; + race_leadlimit = (leadlimit_override >= 0) ? leadlimit_override : autocvar_leadlimit; + race_timelimit = (timelimit_override >= 0) ? timelimit_override : autocvar_timelimit; + qualifying_override = (qualifying_override >= 0) ? qualifying_override : autocvar_g_race_qualifying_timelimit; fraglimit_override = 0; leadlimit_override = 0; - timelimit_override = autocvar_g_race_qualifying_timelimit; + timelimit_override = qualifying_override; } else g_race_qualifying = 0; - SetLimits(fraglimit_override, leadlimit_override, timelimit_override, qualifying_override); } diff --git a/qcsrc/server/teamplay.qc b/qcsrc/server/teamplay.qc index 34ee3277a..675bbb065 100644 --- a/qcsrc/server/teamplay.qc +++ b/qcsrc/server/teamplay.qc @@ -44,23 +44,6 @@ void ActivateTeamplay() cvar_set("teamplay", "2"); // DP needs this for sending proper getstatus replies. } -void SetLimits(int fraglimit_override, int leadlimit_override, float timelimit_override, float qualifying_override) -{ - // enforce the server's universal frag/time limits - // set to -1 to not change value - if(!autocvar_g_campaign) - { - if(fraglimit_override >= 0) - cvar_set("fraglimit", ftos(fraglimit_override)); - if(timelimit_override >= 0) - cvar_set("timelimit", ftos(timelimit_override)); - if(leadlimit_override >= 0) - cvar_set("leadlimit", ftos(leadlimit_override)); - if(qualifying_override >= 0) - cvar_set("g_race_qualifying_timelimit", ftos(qualifying_override)); - } -} - void InitGameplayMode() { VoteReset(); @@ -89,8 +72,6 @@ void InitGameplayMode() MapInfo_ClearTemps(); - // set both here, gamemode can override it later - SetLimits(autocvar_fraglimit_override, autocvar_leadlimit_override, autocvar_timelimit_override, -1); gamemode_name = MapInfo_Type_ToText(MapInfo_LoadedGametype); cache_mutatormsg = strzone(""); diff --git a/qcsrc/server/teamplay.qh b/qcsrc/server/teamplay.qh index 5a2fe7b12..519ae16fe 100644 --- a/qcsrc/server/teamplay.qh +++ b/qcsrc/server/teamplay.qh @@ -20,8 +20,6 @@ void default_delayedinit(); void ActivateTeamplay(); -void SetLimits(int fraglimit_override, int leadlimit_override, float timelimit_override, float qualifying_override); - void InitGameplayMode(); string GetClientVersionMessage();