aboutsummaryrefslogtreecommitdiff
path: root/towers.c
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2010-01-12 18:34:06 +0000
committerSimon Tatham <anakin@pobox.com>2010-01-12 18:34:06 +0000
commit7aefa1110afd73c9bfba0ba3af34e8ce78b96ce6 (patch)
tree5328e07d71d40fec941489d95d6cf444e08e887b /towers.c
parentf3d39a0abb30053fa399dbf12e16da7d9a9fc9df (diff)
downloadpuzzles-7aefa1110afd73c9bfba0ba3af34e8ce78b96ce6.zip
puzzles-7aefa1110afd73c9bfba0ba3af34e8ce78b96ce6.tar.gz
puzzles-7aefa1110afd73c9bfba0ba3af34e8ce78b96ce6.tar.bz2
puzzles-7aefa1110afd73c9bfba0ba3af34e8ce78b96ce6.tar.xz
Add a couple more checks to the 3d collision detection, without
which a click miles above the invisible RH surface of a tower would sometimes select that tower. [originally from svn r8833]
Diffstat (limited to 'towers.c')
-rw-r--r--towers.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/towers.c b/towers.c
index f06f2ad..c3372a3 100644
--- a/towers.c
+++ b/towers.c
@@ -1290,10 +1290,11 @@ static char *interpret_move(game_state *state, game_ui *ui, game_drawstate *ds,
(x - ox >= 0 && x - ox < TILESIZE &&
y - oy >= 0 && y - oy < TILESIZE) ||
/* in triangle between top-left corners? */
- (ox > bx && x >= bx && x <= ox &&
+ (ox > bx && x >= bx && x <= ox && y <= by &&
(by-y) * (ox-bx) <= (by-oy) * (x-bx)) ||
/* in triangle between bottom-right corners? */
(ox > bx && x >= bx+TILESIZE && x <= ox+TILESIZE &&
+ y >= oy+TILESIZE &&
(by-y+TILESIZE)*(ox-bx) >= (by-oy)*(x-bx-TILESIZE))) {
tx = cx;
ty = cy;