chiark / gitweb /
Fix trivial UI glitch involving clicking on the border outside the
authorSimon Tatham <anakin@pobox.com>
Tue, 26 Apr 2005 08:20:25 +0000 (08:20 +0000)
committerSimon Tatham <anakin@pobox.com>
Tue, 26 Apr 2005 08:20:25 +0000 (08:20 +0000)
grid. I'm really starting to get annoyed by the default round-
towards-zero behaviour of C integer division.

[originally from svn r5681]

solo.c

diff --git a/solo.c b/solo.c
index a023eff766fcf5c70524f52cf21c39453ee31a7a..8ef1caddf188754ba0b149350b48a911bc38d0da 100644 (file)
--- a/solo.c
+++ b/solo.c
@@ -1209,8 +1209,8 @@ static game_state *make_move(game_state *from, game_ui *ui, int x, int y,
     int tx, ty;
     game_state *ret;
 
-    tx = (x - BORDER) / TILE_SIZE;
-    ty = (y - BORDER) / TILE_SIZE;
+    tx = (x + TILE_SIZE - BORDER) / TILE_SIZE - 1;
+    ty = (y + TILE_SIZE - BORDER) / TILE_SIZE - 1;
 
     if (tx >= 0 && tx < cr && ty >= 0 && ty < cr && button == LEFT_BUTTON) {
        if (tx == ui->hx && ty == ui->hy) {