X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fevents.c;h=e03f58f9b942b80c3c3f204eb7f2c8af9e71d245;hb=c831745a2a0a43f22bf26b8217714d43cb8c8cbc;hp=985dc2a2e2e84f775fbbf2e2e3a650a6c179fa6d;hpb=a3563cfdc8ec434fe92e81a681a7695bece0e6e2;p=rocksndiamonds.git diff --git a/src/events.c b/src/events.c index 985dc2a2..e03f58f9 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) || !IN_SCR_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) || !IN_SCR_FIELD(old_xpos, new_ypos)) + new_ypos = old_ypos; SetTileCursorTargetXY(new_xpos, new_ypos); }