]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix other round countdown issues by improving workaround for uninitialized game_start...
authorterencehill <piuntn@gmail.com>
Sat, 9 Mar 2013 16:13:18 +0000 (17:13 +0100)
committerterencehill <piuntn@gmail.com>
Sat, 9 Mar 2013 16:31:13 +0000 (17:31 +0100)
qcsrc/server/command/cmd.qc
qcsrc/server/command/vote.qc
qcsrc/server/round_handler.qc

index 4cb66508961208c521710164013dcd8da3aa2961..0d773368784a0740ca216f513afdddfea45a745f 100644 (file)
@@ -195,7 +195,7 @@ void ClientCommand_ready(float request) // todo: anti-spam for toggling readynes
                                {
                                        if(!readyrestart_happened || autocvar_sv_ready_restart_repeatable)
                                        {
-                                               if(time < game_starttime + 1) // game is already restarting
+                                               if(time < game_starttime) // game is already restarting
                                                        return;
                                                if (self.ready) // toggle
                                                {
index 507fcfe284e82bc5796a935cf3cef7253d90bfa3..a296c7a1d41b7517376bf76401474568c6411040 100644 (file)
@@ -326,7 +326,7 @@ void reset_map(float dorespawn)
        oldself = self;
 
        if(time <= game_starttime && round_handler_IsActive())
-               round_handler_Reset(game_starttime + 1);
+               round_handler_Reset(game_starttime);
 
        if(g_race || g_cts)
                race_ReadyRestart();
index 15c0c49248ad73d6f12e7b48866567705cc1e978..65de5b44fb94c7a3fd67fb6e879bbcdacf53a8d3 100644 (file)
@@ -2,12 +2,6 @@ void round_handler_Think()
 {
        float f;
 
-       if(time < game_starttime)
-       {
-               round_handler_Reset(game_starttime);
-               return;
-       }
-
        if(gameover)
        {
                round_handler_Reset(0);
@@ -70,6 +64,15 @@ void round_handler_Init(float the_delay, float the_count, float the_round_timeli
        round_handler.round_timelimit = max(10, the_round_timelimit);
 }
 
+// NOTE: this is only needed because if round_handler spawns at time 1
+// gamestarttime isn't initialized yet
+void round_handler_FirstThink()
+{
+       round_starttime = max(time, game_starttime) + round_handler.count;
+       round_handler.think = round_handler_Think;
+       round_handler.nextthink = max(time, game_starttime);
+}
+
 void round_handler_Spawn(float() canRoundStart_func, float() canRoundEnd_func, void() roundStart_func)
 {
        if(round_handler)
@@ -80,16 +83,13 @@ void round_handler_Spawn(float() canRoundStart_func, float() canRoundEnd_func, v
        round_handler = spawn();
        round_handler.classname = "round_handler";
 
-       round_handler.think = round_handler_Think;
+       round_handler.think = round_handler_FirstThink;
        round_handler.canRoundStart = canRoundStart_func;
        round_handler.canRoundEnd = canRoundEnd_func;
        round_handler.roundStart = roundStart_func;
        round_handler.wait = FALSE;
        round_handler_Init(5, 5, 180);
-       // if round_handler spawns at time 1 gamestarttime isn't initialized yet
-       //round_handler.nextthink = max(time, game_starttime + 1);
        round_handler.nextthink = time;
-       round_starttime = time + round_handler.count;
 }
 
 void round_handler_Reset(float next_think)