fixed bug in counter wait function
authorHolger Schemel <info@artsoft.org>
Mon, 18 May 2015 06:58:04 +0000 (08:58 +0200)
committerHolger Schemel <info@artsoft.org>
Mon, 18 May 2015 06:58:04 +0000 (08:58 +0200)
src/libgame/misc.c

index 6d80620b99c61c1ebad5f5c5445c153ec6e5887d..cf387ceb9234585a7ea7a2ed850ddffc3d85fb0e 100644 (file)
@@ -427,7 +427,9 @@ int WaitUntilDelayReached(unsigned int *counter_var, unsigned int delay)
       break;
   }
 
-  if (*counter_var != 0 && actual_counter >= *counter_var + delay)
+  if (*counter_var != 0 &&
+      delay != 0 &&
+      actual_counter >= *counter_var + delay)
   {
     int lag = actual_counter - (*counter_var + delay);
     int delay2 = (delay + 1) / 2;