chiark
/
gitweb
/
~ian
/
sgt-puzzles.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
New name UI_UPDATE for interpret_move's return "".
[sgt-puzzles.git]
/
pegs.c
diff --git
a/pegs.c
b/pegs.c
index 82868519546e872f79c39d6a149d2e6dbae361a2..38e73b74f65698115ab48faa4eb34deaf25f7952 100644
(file)
--- a/
pegs.c
+++ b/
pegs.c
@@
-848,7
+848,7
@@
static char *interpret_move(const game_state *state, game_ui *ui,
ui->dx = x;
ui->dy = y;
ui->cur_visible = ui->cur_jumping = 0;
ui->dx = x;
ui->dy = y;
ui->cur_visible = ui->cur_jumping = 0;
- return
""; /* ui modified */
+ return
UI_UPDATE;
}
} else if (button == LEFT_DRAG && ui->dragging) {
/*
}
} else if (button == LEFT_DRAG && ui->dragging) {
/*
@@
-856,7
+856,7
@@
static char *interpret_move(const game_state *state, game_ui *ui,
*/
ui->dx = x;
ui->dy = y;
*/
ui->dx = x;
ui->dy = y;
- return
""; /* ui modified */
+ return
UI_UPDATE;
} else if (button == LEFT_RELEASE && ui->dragging) {
int tx, ty, dx, dy;
} else if (button == LEFT_RELEASE && ui->dragging) {
int tx, ty, dx, dy;
@@
-868,18
+868,18
@@
static char *interpret_move(const game_state *state, game_ui *ui,
tx = FROMCOORD(x);
ty = FROMCOORD(y);
if (tx < 0 || tx >= w || ty < 0 || ty >= h)
tx = FROMCOORD(x);
ty = FROMCOORD(y);
if (tx < 0 || tx >= w || ty < 0 || ty >= h)
- return
"";
/* target out of range */
+ return
UI_UPDATE;
/* target out of range */
dx = tx - ui->sx;
dy = ty - ui->sy;
if (max(abs(dx),abs(dy)) != 2 || min(abs(dx),abs(dy)) != 0)
dx = tx - ui->sx;
dy = ty - ui->sy;
if (max(abs(dx),abs(dy)) != 2 || min(abs(dx),abs(dy)) != 0)
- return
"";
/* move length was wrong */
+ return
UI_UPDATE;
/* move length was wrong */
dx /= 2;
dy /= 2;
if (state->grid[ty*w+tx] != GRID_HOLE ||
state->grid[(ty-dy)*w+(tx-dx)] != GRID_PEG ||
state->grid[ui->sy*w+ui->sx] != GRID_PEG)
dx /= 2;
dy /= 2;
if (state->grid[ty*w+tx] != GRID_HOLE ||
state->grid[(ty-dy)*w+(tx-dx)] != GRID_PEG ||
state->grid[ui->sy*w+ui->sx] != GRID_PEG)
- return
"";
/* grid contents were invalid */
+ return
UI_UPDATE;
/* grid contents were invalid */
/*
* We have a valid move. Encode it simply as source and
/*
* We have a valid move. Encode it simply as source and
@@
-899,7
+899,7
@@
static char *interpret_move(const game_state *state, game_ui *ui,
ui->cur_x = cx;
ui->cur_y = cy;
}
ui->cur_x = cx;
ui->cur_y = cy;
}
- return
""
;
+ return
UI_UPDATE
;
} else {
int dx, dy, mx, my, jx, jy;
} else {
int dx, dy, mx, my, jx, jy;
@@
-922,21
+922,21
@@
static char *interpret_move(const game_state *state, game_ui *ui,
ui->cur_x = jx; ui->cur_y = jy;
return dupstr(buf);
}
ui->cur_x = jx; ui->cur_y = jy;
return dupstr(buf);
}
- return
""
;
+ return
UI_UPDATE
;
}
} else if (IS_CURSOR_SELECT(button)) {
if (!ui->cur_visible) {
ui->cur_visible = 1;
}
} else if (IS_CURSOR_SELECT(button)) {
if (!ui->cur_visible) {
ui->cur_visible = 1;
- return
""
;
+ return
UI_UPDATE
;
}
if (ui->cur_jumping) {
ui->cur_jumping = 0;
}
if (ui->cur_jumping) {
ui->cur_jumping = 0;
- return
""
;
+ return
UI_UPDATE
;
}
if (state->grid[ui->cur_y*w+ui->cur_x] == GRID_PEG) {
/* cursor is on peg: next arrow-move wil jump. */
ui->cur_jumping = 1;
}
if (state->grid[ui->cur_y*w+ui->cur_x] == GRID_PEG) {
/* cursor is on peg: next arrow-move wil jump. */
ui->cur_jumping = 1;
- return
""
;
+ return
UI_UPDATE
;
}
return NULL;
}
}
return NULL;
}