From: Holger Schemel Date: Mon, 3 Apr 2023 09:06:02 +0000 (+0200) Subject: code cleanup (no functional change) X-Git-Tag: 4.3.5.4~2 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=63ede61180a6bb7e9efa77d05dfcf5e5c5b9487e;p=rocksndiamonds.git code cleanup (no functional change) --- diff --git a/src/events.c b/src/events.c index 985dc2a2..2810e84f 100644 --- a/src/events.c +++ b/src/events.c @@ -2553,14 +2553,14 @@ static void HandleTileCursor(int dx, int dy, int button) { int old_xpos = tile_cursor.xpos; int old_ypos = tile_cursor.ypos; - int new_xpos = old_xpos; - int new_ypos = old_ypos; + int new_xpos = tile_cursor.xpos + dx; + int new_ypos = tile_cursor.ypos + dy; - if (IN_LEV_FIELD(old_xpos + dx, old_ypos)) - new_xpos = old_xpos + dx; + if (!IN_LEV_FIELD(new_xpos, old_ypos)) + new_xpos = old_xpos; - if (IN_LEV_FIELD(old_xpos, old_ypos + dy)) - new_ypos = old_ypos + dy; + if (!IN_LEV_FIELD(old_xpos, new_ypos)) + new_ypos = old_ypos; SetTileCursorTargetXY(new_xpos, new_ypos); }