From: Holger Schemel Date: Fri, 31 Mar 2023 14:04:48 +0000 (+0200) Subject: added removing existing McDuffin when drawing new one in level editor X-Git-Tag: 4.3.5.3~11 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=705e3b6aebabeb67c50be0b57c1d3fd58b67b1a5;hp=b66bf285376f1a2c08ba8f7624fa48ffbcd898a9;p=rocksndiamonds.git added removing existing McDuffin when drawing new one in level editor --- diff --git a/src/editor.c b/src/editor.c index 52df4dfa..21cee41c 100644 --- a/src/editor.c +++ b/src/editor.c @@ -13227,7 +13227,7 @@ static void HandleDrawingAreas(struct GadgetInfo *gi) { SetDrawModeHiRes(new_element); - if (IS_PLAYER_ELEMENT(new_element)) + if (IS_PLAYER_ELEMENT(new_element) || IS_MM_MCDUFFIN(new_element)) { // remove player at old position for (y = 0; y < lev_fieldy; y++) @@ -13236,7 +13236,8 @@ static void HandleDrawingAreas(struct GadgetInfo *gi) { int old_element = Tile[x][y]; - if (IS_PLAYER_ELEMENT(old_element)) + if (IS_PLAYER_ELEMENT(old_element) && + IS_PLAYER_ELEMENT(new_element)) { int replaced_with_element = (old_element == EL_SOKOBAN_FIELD_PLAYER && @@ -13256,6 +13257,12 @@ static void HandleDrawingAreas(struct GadgetInfo *gi) SetElement(x, y, replaced_with_element); } + else if (IS_MM_MCDUFFIN(old_element) && + IS_MM_MCDUFFIN(new_element)) + { + // remove McDuffin at old position + SetElement(x, y, EL_EMPTY); + } } } }