From: Holger Schemel Date: Sun, 8 Oct 2023 21:33:54 +0000 (+0200) Subject: fixed bug with CE replacing exploding player, causing half-dead player X-Git-Tag: 4.3.7.0~8 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=84142e69a27536756a54fc9a78763c32d0eb8b46;p=rocksndiamonds.git fixed bug with CE replacing exploding player, causing half-dead player This bug could happen when a player was just exploding (for whatever reason) and an adjacent CE replaced the explosion's center element with something else, leading to the player not being totally removed, potentially causing some strange effects afterwards. This change adds some cleanup required to prevent such cases. --- diff --git a/src/game.c b/src/game.c index ef117c8f..33835539 100644 --- a/src/game.c +++ b/src/game.c @@ -10642,6 +10642,15 @@ static void CreateFieldExt(int x, int y, int element, boolean is_change) if (GFX_CRUMBLED(new_element)) TEST_DrawLevelFieldCrumbledNeighbours(x, y); + if (old_element == EL_EXPLOSION) + { + Store[x][y] = Store2[x][y] = 0; + + // check if new element replaces an exploding player, requiring cleanup + if (IS_PLAYER(x, y) && !PLAYERINFO(x, y)->present) + StorePlayer[x][y] = 0; + } + // check if element under the player changes from accessible to unaccessible // (needed for special case of dropping element which then changes) // (must be checked after creating new element for walkable group elements)