From 013fed105fe1ac6cdd887bac04733a73f66599a3 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Tue, 16 Feb 2010 23:01:57 +0100 Subject: [PATCH] rnd-20100216-4-src * fixed bug with re-initializing already existing elements in function RelocatePlayer() in src/game.c (causing problems with Sokoban fields counted a second time, making the currently playing level unsolvable) --- ChangeLog | 3 +++ src/conftime.h | 2 +- src/game.c | 11 ++++++++++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7bab90c5..59251bf1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2010-02-16 * fixed bug in native Supaplex engine that broke several demo solutions + * fixed bug with re-initializing already existing elements in function + RelocatePlayer() in src/game.c (causing problems with Sokoban fields + counted a second time, making the currently playing level unsolvable) * done integrating R'n'D graphics engine into file "SnikSnaks.c" * done integrating R'n'D graphics engine into file "Electrons.c" * done integrating R'n'D graphics engine into file "Zonk.c" diff --git a/src/conftime.h b/src/conftime.h index f6b24ec4..b2c80b93 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "2010-02-16 17:44" +#define COMPILE_DATE_STRING "2010-02-16 22:55" diff --git a/src/game.c b/src/game.c index 1a04be1c..f8b9a085 100644 --- a/src/game.c +++ b/src/game.c @@ -5772,10 +5772,19 @@ void RelocatePlayer(int jx, int jy, int el_player_raw) Feld[jx][jy] = el_player; InitPlayerField(jx, jy, el_player, TRUE); + /* "InitPlayerField()" above sets Feld[jx][jy] to EL_EMPTY, but it may be + possible that the relocation target field did not contain a player element, + but a walkable element, to which the new player was relocated -- in this + case, restore that (already initialized!) element on the player field */ if (!ELEM_IS_PLAYER(element)) /* player may be set on walkable element */ { - Feld[jx][jy] = element; + Feld[jx][jy] = element; /* restore previously existing element */ +#if 0 + /* !!! do not initialize already initialized element a second time !!! */ + /* (this causes at least problems with "element creation" CE trigger for + already existing elements, and existing Sokoban fields counted twice) */ InitField(jx, jy, FALSE); +#endif } /* only visually relocate centered player */ -- 2.34.1