fixed delaying immediate events after game status has changed
authorHolger Schemel <info@artsoft.org>
Mon, 21 Dec 2020 22:47:24 +0000 (23:47 +0100)
committerHolger Schemel <info@artsoft.org>
Mon, 21 Dec 2020 22:48:04 +0000 (23:48 +0100)
src/events.c

index 1a6ac788b29aab28eca2f5918725cf3aeb09284d..2bc1aff077847a132313588f3c9959ea1fe5571f 100644 (file)
@@ -214,6 +214,8 @@ static void HandleEvents(void)
 
   while (NextValidEvent(&event))
   {
+    int game_status_last = game_status;
+
     switch (event.type)
     {
       case EVENT_BUTTONPRESS:
@@ -264,6 +266,10 @@ static void HandleEvents(void)
        break;
     }
 
+    // always handle events within delay period if game status has changed
+    if (game_status != game_status_last)
+      ResetDelayCounter(&event_frame_delay);
+
     // do not handle events for longer than standard frame delay period
     if (DelayReached(&event_frame_delay, event_frame_delay_value))
       break;