aboutsummaryrefslogtreecommitdiff
path: root/unfinished
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2008-11-16 15:47:55 +0000
committerSimon Tatham <anakin@pobox.com>2008-11-16 15:47:55 +0000
commitb2f1b324fe0cde3049af897d7b6c6d312fd8ccc0 (patch)
treed760fab44e7ba80c543576b034d2832a290d8cb5 /unfinished
parent33be388d4117860cb842ac13aa1dfa1a2761db0a (diff)
downloadpuzzles-b2f1b324fe0cde3049af897d7b6c6d312fd8ccc0.zip
puzzles-b2f1b324fe0cde3049af897d7b6c6d312fd8ccc0.tar.gz
puzzles-b2f1b324fe0cde3049af897d7b6c6d312fd8ccc0.tar.bz2
puzzles-b2f1b324fe0cde3049af897d7b6c6d312fd8ccc0.tar.xz
Patch from Lee Dowling to implement mouse control in Sokoban, along
pretty much the same lines as Cube and Inertia. [originally from svn r8301]
Diffstat (limited to 'unfinished')
-rw-r--r--unfinished/sokoban.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/unfinished/sokoban.c b/unfinished/sokoban.c
index 91f02a6..c9cf2de 100644
--- a/unfinished/sokoban.c
+++ b/unfinished/sokoban.c
@@ -1044,7 +1044,7 @@ int move_type(game_state *state, int dx, int dy)
static char *interpret_move(game_state *state, game_ui *ui, game_drawstate *ds,
int x, int y, int button)
{
- int dx, dy;
+ int dx=0, dy=0;
char *move;
/*
@@ -1071,9 +1071,23 @@ static char *interpret_move(game_state *state, game_ui *ui, game_drawstate *ds,
dx = -1, dy = +1;
else if (button == (MOD_NUM_KEYPAD | '3'))
dx = +1, dy = +1;
+ else if (button == LEFT_BUTTON)
+ {
+ if(x < COORD(state->px))
+ dx = -1;
+ else if (x > COORD(state->px + 1))
+ dx = 1;
+ if(y < COORD(state->py))
+ dy = -1;
+ else if (y > COORD(state->py + 1))
+ dy = 1;
+ }
else
return NULL;
+ if((dx == 0) && (dy == 0))
+ return(NULL);
+
if (move_type(state, dx, dy) < 0)
return NULL;