]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
round_handler: be sure to reset the countdown when warmup stage ends
authorterencehill <piuntn@gmail.com>
Wed, 19 Dec 2012 11:40:28 +0000 (12:40 +0100)
committerterencehill <piuntn@gmail.com>
Wed, 19 Dec 2012 11:40:28 +0000 (12:40 +0100)
qcsrc/server/arena.qc
qcsrc/server/round_handler.qc
qcsrc/server/round_handler.qh

index e2d73cc44287778c6f66e2de08803c13481a5346..14caab85b81cdb98b6b5231380efc2dcd1aaa5b7 100644 (file)
@@ -29,6 +29,9 @@ void reset_map(float dorespawn)
        entity oldself;
        oldself = self;
 
+       if(time <= game_starttime && round_handler_IsActive())
+               round_handler_Reset(game_starttime + 1);
+
        if(g_arena)
        {
                warmup = max(time, game_starttime);
index 622347c534ff65900b10186bf8821809a9d9c3f8..2bac357fba292ee5cc6f11538022c83ce893860c 100644 (file)
@@ -3,17 +3,15 @@ void round_handler_Think()
        entity e;
        float f;
 
-       if(time < game_starttime)
+       if(time <= game_starttime)
        {
-               self.wait = FALSE;
-               round_handler_ResetCountdown();
-               self.nextthink = game_starttime + 1;
+               round_handler_Reset(game_starttime + 1);
                return;
        }
 
        if(gameover)
        {
-               round_handler_ResetCountdown();
+               round_handler_Reset(0);
                round_handler_Remove();
                return;
        }
@@ -50,7 +48,7 @@ void round_handler_Think()
                }
                else
                {
-                       round_handler_ResetCountdown();
+                       round_handler_Reset(0);
                }
                self.nextthink = time + 1; // canRoundStart every second
        }
@@ -86,12 +84,12 @@ void round_handler_Spawn(float() canRoundStart_func, float() canRoundEnd_func, f
        round_handler.count = fabs(floor(the_count));
        round_handler.wait = FALSE;
        round_handler.cnt = round_handler.count + 1;
-       round_handler.nextthink = time;
+       round_handler.nextthink = max(time, game_starttime + 1);
 }
 
 float round_handler_IsActive()
 {
-       return (round_handler && time > game_starttime);
+       return (round_handler != world);
 }
 
 float round_handler_AwaitingNextRound()
@@ -109,9 +107,10 @@ float round_handler_IsRoundStarted()
        return (!round_handler.wait && !round_handler.cnt);
 }
 
-void round_handler_ResetCountdown()
+void round_handler_Reset(float next_think)
 {
        entity e;
+       round_handler.wait = FALSE;
        if(round_handler.count)
        if(round_handler.cnt < round_handler.count + 1)
        {
@@ -119,6 +118,7 @@ void round_handler_ResetCountdown()
                        Send_CSQC_Centerprint_Generic_Expire(e, CPID_ROUND_STARTING);
                round_handler.cnt = round_handler.count + 1;
        }
+       round_handler.nextthink = next_think;
 }
 
 void round_handler_Remove()
index 2539e08fbc98c682f6b6c1f59f684a1c118ae62b..55026fa84401565d9aca334ee75021c6d07b87d9 100644 (file)
@@ -12,6 +12,6 @@ float round_handler_IsActive();
 float round_handler_AwaitingNextRound();
 float round_handler_CountdownRunning();
 float round_handler_IsRoundStarted();
-void round_handler_ResetCountdown();
+void round_handler_Reset(float next_think);
 void round_handler_Remove();