fixed triggering CE actions by digging or collecting
authorHolger Schemel <info@artsoft.org>
Sun, 18 Jul 2021 10:49:52 +0000 (12:49 +0200)
committerHolger Schemel <info@artsoft.org>
Sun, 18 Jul 2021 11:01:56 +0000 (13:01 +0200)
The improvement for CE actions by digging or collecting elements not
triggering before the dig or collect action was completely finished
had a very nasty bug in that such CE events when triggered by snapping
that element (which also counts as digging or collecting) just did not
work. This bug is fixed by this change.

This fixes commit ca2d6507.

src/game.c

index 2535720ae6a4af3b9ab39825e58b344802e2dce5..c3dc82cc2631d07c03bc56ce83bb4b3e9ddd6e8a 100644 (file)
@@ -13968,7 +13968,11 @@ static void TestFieldAfterSnapping(int x, int y, int element, int direction,
   if (level.finish_dig_collect)
   {
     int dig_side = MV_DIR_OPPOSITE(direction);
+    int change_event = (IS_DIGGABLE(element) ? CE_PLAYER_DIGS_X :
+                       CE_PLAYER_COLLECTS_X);
 
+    CheckTriggeredElementChangeByPlayer(x, y, element, change_event,
+                                       player_index_bit, dig_side);
     CheckTriggeredElementChangeByPlayer(x, y, element, CE_PLAYER_SNAPS_X,
                                        player_index_bit, dig_side);
   }