]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix race not starting (game ends) when the qualifying session ends (everyone readied...
authorterencehill <piuntn@gmail.com>
Tue, 22 Mar 2016 00:20:44 +0000 (01:20 +0100)
committerterencehill <piuntn@gmail.com>
Tue, 22 Mar 2016 18:46:17 +0000 (19:46 +0100)
qcsrc/server/g_world.qc
qcsrc/server/g_world.qh
qcsrc/server/mutators/mutator/gamemode_assault.qc
qcsrc/server/mutators/mutator/gamemode_race.qc
qcsrc/server/teamplay.qc
qcsrc/server/teamplay.qh

index 6398cbe939d72be500f4fb542536e06af27fa3de..aa13afea347cd39f537c02ff6e1f54607fa84e26 100644 (file)
@@ -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)
index cd1cafd36a2fd0a5ca60ab1b011391a8a740c559..5366d0a782129ff2cce3e1064a76c14fb877f337 100644 (file)
@@ -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();
index e9c31f3269f8cf73817fc7c3c993b8a95978bc6c..2f0d899036117150e8c56a232f71b48656f7c74d 100644 (file)
@@ -3,7 +3,6 @@
 #define GAMEMODE_ASSAULT_H
 
 void assault_ScoreRules();
-void ActivateTeamplay();
 
 REGISTER_MUTATOR(as, false)
 {
index bbcf56ae5171bf65e0186a0b583ffe24d99fcfe8..691d87c98afa0f5a10c8219699ef31f21740172a 100644 (file)
@@ -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);
 }
 
index 34ee3277a5fa6ce755520cfe520db6f29e030fe9..675bbb065588dfdd7bf651e6d0b8c33fb41dfcce 100644 (file)
@@ -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("");
index 5a2fe7b12e950322efd833c821d490f880b5d557..519ae16feb8f19c23cef03bf5e7ad403122f7ffe 100644 (file)
@@ -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();