diff --git a/blackbox.c b/blackbox.c index 1b7241d..01833f4 100644 --- a/blackbox.c +++ b/blackbox.c @@ -939,7 +939,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, ui->cur_x = cx; ui->cur_y = cy; ui->cur_visible = true; - return UI_UPDATE; + return MOVE_UI_UPDATE; } if (button == LEFT_BUTTON || button == RIGHT_BUTTON) { @@ -949,7 +949,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, wouldflash = 1; } else if (button == LEFT_RELEASE) { ui->flash_laser = 0; - return UI_UPDATE; + return MOVE_UI_UPDATE; } else if (IS_CURSOR_SELECT(button)) { if (ui->cur_visible) { gx = ui->cur_x; @@ -958,7 +958,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, wouldflash = 2; } else { ui->cur_visible = true; - return UI_UPDATE; + return MOVE_UI_UPDATE; } /* Fix up 'button' for the below logic. */ if (button == CURSOR_SELECT2) button = RIGHT_BUTTON; @@ -1007,9 +1007,9 @@ static char *interpret_move(const game_state *state, game_ui *ui, return nullret; ui->flash_laserno = rangeno; ui->flash_laser = wouldflash; - nullret = UI_UPDATE; + nullret = MOVE_UI_UPDATE; if (state->exits[rangeno] != LASER_EMPTY) - return UI_UPDATE; + return MOVE_UI_UPDATE; sprintf(buf, "F%d", rangeno); break; diff --git a/bridges.c b/bridges.c index acb64dc..7997c69 100644 --- a/bridges.c +++ b/bridges.c @@ -2126,7 +2126,7 @@ static char *ui_cancel_drag(game_ui *ui) ui->dragx_src = ui->dragy_src = -1; ui->dragx_dst = ui->dragy_dst = -1; ui->dragging = false; - return UI_UPDATE; + return MOVE_UI_UPDATE; } static game_ui *new_ui(const game_state *state) @@ -2333,7 +2333,7 @@ static char *update_drag_dst(const game_state *state, game_ui *ui, /*debug(("update_drag src (%d,%d) d(%d,%d) dst (%d,%d)\n", ui->dragx_src, ui->dragy_src, dx, dy, ui->dragx_dst, ui->dragy_dst));*/ - return UI_UPDATE; + return MOVE_UI_UPDATE; } static char *finish_drag(const game_state *state, game_ui *ui) @@ -2376,7 +2376,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, if (ggrid & G_ISLAND) { ui->dragx_src = gx; ui->dragy_src = gy; - return UI_UPDATE; + return MOVE_UI_UPDATE; } else return ui_cancel_drag(ui); } else if (button == LEFT_DRAG || button == RIGHT_DRAG) { @@ -2390,7 +2390,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, /* cancel a drag when we go back to the starting point */ ui->dragx_dst = -1; ui->dragy_dst = -1; - return UI_UPDATE; + return MOVE_UI_UPDATE; } } else if (button == LEFT_RELEASE || button == RIGHT_RELEASE) { if (ui->dragging) { @@ -2477,19 +2477,19 @@ static char *interpret_move(const game_state *state, game_ui *ui, if (!dingrid) break; } - if (!oingrid) return UI_UPDATE; + if (!oingrid) return MOVE_UI_UPDATE; } /* not reached */ found: ui->cur_x = nx; ui->cur_y = ny; - return UI_UPDATE; + return MOVE_UI_UPDATE; } } else if (IS_CURSOR_SELECT(button)) { if (!ui->cur_visible) { ui->cur_visible = true; - return UI_UPDATE; + return MOVE_UI_UPDATE; } if (ui->dragging || button == CURSOR_SELECT2) { ui_cancel_drag(ui); @@ -2497,7 +2497,7 @@ found: sprintf(buf, "M%d,%d", ui->cur_x, ui->cur_y); return dupstr(buf); } else - return UI_UPDATE; + return MOVE_UI_UPDATE; } else { grid_type v = GRID(state, ui->cur_x, ui->cur_y); if (v & G_ISLAND) { @@ -2506,7 +2506,7 @@ found: ui->dragy_src = ui->cur_y; ui->dragx_dst = ui->dragy_dst = -1; ui->drag_is_noline = (button == CURSOR_SELECT2); - return UI_UPDATE; + return MOVE_UI_UPDATE; } } } else if ((button >= '0' && button <= '9') || @@ -2524,7 +2524,7 @@ found: if (!ui->cur_visible) { ui->cur_visible = true; - return UI_UPDATE; + return MOVE_UI_UPDATE; } for (i = 0; i < state->n_islands; ++i) { @@ -2551,12 +2551,12 @@ found: if (best_x != -1 && best_y != -1) { ui->cur_x = best_x; ui->cur_y = best_y; - return UI_UPDATE; + return MOVE_UI_UPDATE; } else return NULL; } else if (button == 'g' || button == 'G') { ui->show_hints = !ui->show_hints; - return UI_UPDATE; + return MOVE_UI_UPDATE; } return NULL; diff --git a/devel.but b/devel.but index bbf98a4..a17d3b9 100644 --- a/devel.but +++ b/devel.but @@ -1062,7 +1062,7 @@ divide mouse coordinates by it.) in response to the input event; the puzzle was not interested in it at all. -\b Returning the special value \cw{UI_UPDATE} indicates that the input +\b Returning the special value \cw{MOVE_UI_UPDATE} indicates that the input event has resulted in a change being made to the \c{game_ui} which will require a redraw of the game window, but that no actual \e{move} was made (i.e. no new \c{game_state} needs to be created). @@ -1080,7 +1080,7 @@ strings can be written to disk when saving the game and fed to The return value from \cw{interpret_move()} is expected to be dynamically allocated if and only if it is not either \cw{NULL} -\e{or} the special string constant \c{UI_UPDATE}. +\e{or} the special string constant \c{MOVE_UI_UPDATE}. After this function is called, the back end is permitted to rely on some subsequent operations happening in sequence: @@ -5804,7 +5804,7 @@ be: \b Put cursor position fields in the \c{game_ui}. \b \cw{interpret_move()} responds to arrow keys by modifying the -cursor position fields and returning \cw{UI_UPDATE}. +cursor position fields and returning \cw{MOVE_UI_UPDATE}. \b \cw{interpret_move()} responds to some other button \dash either \cw{CURSOR_SELECT} or some more specific thing like a number key \dash diff --git a/dominosa.c b/dominosa.c index e1bd96a..b7e66fa 100644 --- a/dominosa.c +++ b/dominosa.c @@ -2834,7 +2834,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, move_cursor(button, &ui->cur_x, &ui->cur_y, 2*w-1, 2*h-1, false); - return UI_UPDATE; + return MOVE_UI_UPDATE; } else if (IS_CURSOR_SELECT(button)) { int d1, d2; @@ -2867,7 +2867,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, } else { return NULL; } - return UI_UPDATE; + return MOVE_UI_UPDATE; } return NULL; diff --git a/filling.c b/filling.c index 09156b0..9a4aa98 100644 --- a/filling.c +++ b/filling.c @@ -1493,22 +1493,22 @@ static char *interpret_move(const game_state *state, game_ui *ui, ui->sel[w*ty+tx] = true; } ui->cur_visible = false; - return UI_UPDATE; + return MOVE_UI_UPDATE; } if (IS_CURSOR_MOVE(button)) { ui->cur_visible = true; move_cursor(button, &ui->cur_x, &ui->cur_y, w, h, false); if (ui->keydragging) goto select_square; - return UI_UPDATE; + return MOVE_UI_UPDATE; } if (button == CURSOR_SELECT) { if (!ui->cur_visible) { ui->cur_visible = true; - return UI_UPDATE; + return MOVE_UI_UPDATE; } ui->keydragging = !ui->keydragging; - if (!ui->keydragging) return UI_UPDATE; + if (!ui->keydragging) return MOVE_UI_UPDATE; select_square: if (!ui->sel) { @@ -1517,12 +1517,12 @@ static char *interpret_move(const game_state *state, game_ui *ui, } if (!state->shared->clues[w*ui->cur_y + ui->cur_x]) ui->sel[w*ui->cur_y + ui->cur_x] = true; - return UI_UPDATE; + return MOVE_UI_UPDATE; } if (button == CURSOR_SELECT2) { if (!ui->cur_visible) { ui->cur_visible = true; - return UI_UPDATE; + return MOVE_UI_UPDATE; } if (!ui->sel) { ui->sel = snewn(w*h, bool); @@ -1536,14 +1536,14 @@ static char *interpret_move(const game_state *state, game_ui *ui, sfree(ui->sel); ui->sel = NULL; } - return UI_UPDATE; + return MOVE_UI_UPDATE; } if (button == '\b' || button == 27) { sfree(ui->sel); ui->sel = NULL; ui->keydragging = false; - return UI_UPDATE; + return MOVE_UI_UPDATE; } if (button < '0' || button > '9') return NULL; @@ -1578,7 +1578,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, sfree(ui->sel); ui->sel = NULL; /* Need to update UI at least, as we cleared the selection */ - return move ? move : UI_UPDATE; + return move ? move : MOVE_UI_UPDATE; } static game_state *execute_move(const game_state *state, const char *move) diff --git a/flip.c b/flip.c index 1a24e81..c53d2b9 100644 --- a/flip.c +++ b/flip.c @@ -961,7 +961,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, tx = ui->cx; ty = ui->cy; ui->cdraw = true; } - nullret = UI_UPDATE; + nullret = MOVE_UI_UPDATE; if (tx >= 0 && tx < w && ty >= 0 && ty < h) { /* @@ -996,7 +996,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, ui->cx = min(max(ui->cx, 0), state->w - 1); ui->cy = min(max(ui->cy, 0), state->h - 1); ui->cdraw = true; - nullret = UI_UPDATE; + nullret = MOVE_UI_UPDATE; } return nullret; diff --git a/flood.c b/flood.c index 87d0bf2..12bea69 100644 --- a/flood.c +++ b/flood.c @@ -838,19 +838,19 @@ static char *interpret_move(const game_state *state, game_ui *ui, } else if (button == CURSOR_LEFT && ui->cx > 0) { ui->cx--; ui->cursor_visible = true; - return UI_UPDATE; + return MOVE_UI_UPDATE; } else if (button == CURSOR_RIGHT && ui->cx+1 < w) { ui->cx++; ui->cursor_visible = true; - return UI_UPDATE; + return MOVE_UI_UPDATE; } else if (button == CURSOR_UP && ui->cy > 0) { ui->cy--; ui->cursor_visible = true; - return UI_UPDATE; + return MOVE_UI_UPDATE; } else if (button == CURSOR_DOWN && ui->cy+1 < h) { ui->cy++; ui->cursor_visible = true; - return UI_UPDATE; + return MOVE_UI_UPDATE; } else if (button == CURSOR_SELECT) { tx = ui->cx; ty = ui->cy; diff --git a/galaxies.c b/galaxies.c index ffc64e3..0841994 100644 --- a/galaxies.c +++ b/galaxies.c @@ -2963,13 +2963,13 @@ static char *interpret_move(const game_state *state, game_ui *ui, ui->dy = y; ui->dotx = dot->x; ui->doty = dot->y; - return UI_UPDATE; + return MOVE_UI_UPDATE; } } else if (button == RIGHT_DRAG && ui->dragging) { /* just move the drag coords. */ ui->dx = x; ui->dy = y; - return UI_UPDATE; + return MOVE_UI_UPDATE; } else if (button == RIGHT_RELEASE && ui->dragging) { /* * Drags are always targeted at a single square. @@ -2984,7 +2984,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, * is a null move; just update the ui and finish. */ if (px == ui->srcx && py == ui->srcy) - return UI_UPDATE; + return MOVE_UI_UPDATE; /* * Otherwise, we remove the arrow from its starting @@ -3018,7 +3018,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, if (buf[0]) return dupstr(buf); else - return UI_UPDATE; + return MOVE_UI_UPDATE; } else if (IS_CURSOR_MOVE(button)) { move_cursor(button, &ui->cur_x, &ui->cur_y, state->sx-1, state->sy-1, false); if (ui->cur_x < 1) ui->cur_x = 1; @@ -3028,11 +3028,11 @@ static char *interpret_move(const game_state *state, game_ui *ui, ui->dx = SCOORD(ui->cur_x); ui->dy = SCOORD(ui->cur_y); } - return UI_UPDATE; + return MOVE_UI_UPDATE; } else if (IS_CURSOR_SELECT(button)) { if (!ui->cur_visible) { ui->cur_visible = true; - return UI_UPDATE; + return MOVE_UI_UPDATE; } sp = &SPACE(state, ui->cur_x, ui->cur_y); if (ui->dragging) { @@ -3044,7 +3044,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, ui->dy = SCOORD(ui->cur_y); ui->dotx = ui->srcx = ui->cur_x; ui->doty = ui->srcy = ui->cur_y; - return UI_UPDATE; + return MOVE_UI_UPDATE; } else if (sp->flags & F_TILE_ASSOC) { assert(sp->type == s_tile); ui->dragging = true; @@ -3054,7 +3054,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, ui->doty = sp->doty; ui->srcx = ui->cur_x; ui->srcy = ui->cur_y; - return UI_UPDATE; + return MOVE_UI_UPDATE; } else if (sp->type == s_edge && edge_placement_legal(state, ui->cur_x, ui->cur_y)) { sprintf(buf, "E%d,%d", ui->cur_x, ui->cur_y); diff --git a/guess.c b/guess.c index 949641a..6a4bddb 100644 --- a/guess.c +++ b/guess.c @@ -814,7 +814,7 @@ static char *interpret_move(const game_state *from, game_ui *ui, */ if (button == 'l' || button == 'L') { ui->show_labels = !ui->show_labels; - return UI_UPDATE; + return MOVE_UI_UPDATE; } if (from->solved) return NULL; @@ -871,13 +871,13 @@ static char *interpret_move(const game_state *from, game_ui *ui, ui->drag_y = y; debug(("Start dragging, col = %d, (%d,%d)", ui->drag_col, ui->drag_x, ui->drag_y)); - ret = UI_UPDATE; + ret = MOVE_UI_UPDATE; } } else if (button == LEFT_DRAG && ui->drag_col) { ui->drag_x = x; ui->drag_y = y; debug(("Keep dragging, (%d,%d)", ui->drag_x, ui->drag_y)); - ret = UI_UPDATE; + ret = MOVE_UI_UPDATE; } else if (button == LEFT_RELEASE && ui->drag_col) { if (over_guess > -1) { debug(("Dropping colour %d onto guess peg %d", @@ -894,13 +894,13 @@ static char *interpret_move(const game_state *from, game_ui *ui, ui->drag_opeg = -1; ui->display_cur = false; debug(("Stop dragging.")); - ret = UI_UPDATE; + ret = MOVE_UI_UPDATE; } else if (button == RIGHT_BUTTON) { if (over_guess > -1) { /* we use ths feedback in the game_ui to signify * 'carry this peg to the next guess as well'. */ ui->holds[over_guess] ^= 1; - ret = UI_UPDATE; + ret = MOVE_UI_UPDATE; } } else if (button == LEFT_RELEASE && over_hint && ui->markable) { /* NB this won't trigger if on the end of a drag; that's on @@ -915,10 +915,10 @@ static char *interpret_move(const game_state *from, game_ui *ui, ui->colour_cur++; if (button == CURSOR_UP && ui->colour_cur > 0) ui->colour_cur--; - ret = UI_UPDATE; + ret = MOVE_UI_UPDATE; } else if (button == 'h' || button == 'H' || button == '?') { compute_hint(from, ui); - ret = UI_UPDATE; + ret = MOVE_UI_UPDATE; } else if (button == CURSOR_LEFT || button == CURSOR_RIGHT) { int maxcur = from->params.npegs; if (ui->markable) maxcur++; @@ -928,14 +928,14 @@ static char *interpret_move(const game_state *from, game_ui *ui, ui->peg_cur++; if (button == CURSOR_LEFT && ui->peg_cur > 0) ui->peg_cur--; - ret = UI_UPDATE; + ret = MOVE_UI_UPDATE; } else if (button == CURSOR_SELECT) { ui->display_cur = true; if (ui->peg_cur == from->params.npegs) { ret = encode_move(from, ui); } else { set_peg(&from->params, ui, ui->peg_cur, ui->colour_cur+1); - ret = UI_UPDATE; + ret = MOVE_UI_UPDATE; } } else if (((button >= '1' && button <= '0' + from->params.ncolours) || (button == '0' && from->params.ncolours == 10)) && @@ -946,17 +946,17 @@ static char *interpret_move(const game_state *from, game_ui *ui, button == '0' ? 10 : button - '0'); if (ui->peg_cur + 1 < from->params.npegs + ui->markable) ui->peg_cur++; - ret = UI_UPDATE; + ret = MOVE_UI_UPDATE; } else if (button == 'D' || button == 'd' || button == '\b') { ui->display_cur = true; set_peg(&from->params, ui, ui->peg_cur, 0); - ret = UI_UPDATE; + ret = MOVE_UI_UPDATE; } else if (button == CURSOR_SELECT2) { if (ui->peg_cur == from->params.npegs) return NULL; ui->display_cur = true; ui->holds[ui->peg_cur] ^= 1; - ret = UI_UPDATE; + ret = MOVE_UI_UPDATE; } return ret; } diff --git a/keen.c b/keen.c index 333164f..b8c73fb 100644 --- a/keen.c +++ b/keen.c @@ -1724,7 +1724,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, ui->hpencil = false; } ui->hcursor = false; - return UI_UPDATE; + return MOVE_UI_UPDATE; } if (button == RIGHT_BUTTON) { /* @@ -1744,20 +1744,20 @@ static char *interpret_move(const game_state *state, game_ui *ui, ui->hshow = false; } ui->hcursor = false; - return UI_UPDATE; + return MOVE_UI_UPDATE; } } if (IS_CURSOR_MOVE(button)) { move_cursor(button, &ui->hx, &ui->hy, w, w, false); ui->hshow = true; ui->hcursor = true; - return UI_UPDATE; + return MOVE_UI_UPDATE; } if (ui->hshow && (button == CURSOR_SELECT)) { ui->hpencil ^= 1; ui->hcursor = true; - return UI_UPDATE; + return MOVE_UI_UPDATE; } if (ui->hshow && @@ -1783,7 +1783,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, /* ... expect to remove the cursor in mouse mode. */ if (!ui->hcursor) { ui->hshow = false; - return UI_UPDATE; + return MOVE_UI_UPDATE; } return NULL; } diff --git a/lightup.c b/lightup.c index 39ada9f..15e0a67 100644 --- a/lightup.c +++ b/lightup.c @@ -1954,7 +1954,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, enum { NONE, FLIP_LIGHT, FLIP_IMPOSSIBLE } action = NONE; int cx = -1, cy = -1; unsigned int flags; - char buf[80], *nullret = UI_UPDATE, *empty = UI_UPDATE, c; + char buf[80], *nullret = MOVE_UI_UPDATE, *empty = MOVE_UI_UPDATE, c; if (button == LEFT_BUTTON || button == RIGHT_BUTTON) { if (ui->cur_visible) diff --git a/magnets.c b/magnets.c index e58d8bf..2d17cd1 100644 --- a/magnets.c +++ b/magnets.c @@ -1845,11 +1845,11 @@ static char *interpret_move(const game_state *state, game_ui *ui, if (IS_CURSOR_MOVE(button)) { move_cursor(button, &ui->cur_x, &ui->cur_y, state->w, state->h, false); ui->cur_visible = true; - return UI_UPDATE; + return MOVE_UI_UPDATE; } else if (IS_CURSOR_SELECT(button)) { if (!ui->cur_visible) { ui->cur_visible = true; - return UI_UPDATE; + return MOVE_UI_UPDATE; } action = (button == CURSOR_SELECT) ? CYCLE_MAGNET : CYCLE_NEUTRAL; gx = ui->cur_x; @@ -1858,7 +1858,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, (button == LEFT_BUTTON || button == RIGHT_BUTTON)) { if (ui->cur_visible) { ui->cur_visible = false; - nullret = UI_UPDATE; + nullret = MOVE_UI_UPDATE; } action = (button == LEFT_BUTTON) ? CYCLE_MAGNET : CYCLE_NEUTRAL; } else if (button == LEFT_BUTTON && is_clue(state, gx, gy)) { diff --git a/map.c b/map.c index 127db04..e7681a0 100644 --- a/map.c +++ b/map.c @@ -2481,7 +2481,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, */ if (button == 'l' || button == 'L') { ui->show_numbers = !ui->show_numbers; - return UI_UPDATE; + return MOVE_UI_UPDATE; } if (IS_CURSOR_MOVE(button)) { @@ -2490,12 +2490,12 @@ static char *interpret_move(const game_state *state, game_ui *ui, ui->cur_visible = true; ui->cur_moved = true; ui->cur_lastmove = button; - return UI_UPDATE; + return MOVE_UI_UPDATE; } if (IS_CURSOR_SELECT(button)) { if (!ui->cur_visible) { ui->cur_visible = true; - return UI_UPDATE; + return MOVE_UI_UPDATE; } if (ui->drag_colour == -2) { /* not currently cursor-dragging, start. */ int r = region_from_ui_cursor(state, ui); @@ -2507,7 +2507,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, ui->drag_pencil = 0; } ui->cur_moved = false; - return UI_UPDATE; + return MOVE_UI_UPDATE; } else { /* currently cursor-dragging; drop the colour in the new region. */ alt_button = (button == CURSOR_SELECT2); /* Double-select removes current colour. */ @@ -2532,14 +2532,14 @@ static char *interpret_move(const game_state *state, game_ui *ui, ui->dragx = x; ui->dragy = y; ui->cur_visible = false; - return UI_UPDATE; + return MOVE_UI_UPDATE; } if ((button == LEFT_DRAG || button == RIGHT_DRAG) && ui->drag_colour > -2) { ui->dragx = x; ui->dragy = y; - return UI_UPDATE; + return MOVE_UI_UPDATE; } if ((button == LEFT_RELEASE || button == RIGHT_RELEASE) && @@ -2564,18 +2564,18 @@ drag_dropped: ui->drag_colour = -2; if (r < 0) - return UI_UPDATE; /* drag into border; do nothing else */ + return MOVE_UI_UPDATE; /* drag into border; do nothing else */ if (state->map->immutable[r]) - return UI_UPDATE; /* can't change this region */ + return MOVE_UI_UPDATE; /* can't change this region */ if (state->colouring[r] == c && state->pencil[r] == p) - return UI_UPDATE; /* don't _need_ to change this region */ + return MOVE_UI_UPDATE; /* don't _need_ to change this region */ if (alt_button) { if (state->colouring[r] >= 0) { /* Can't pencil on a coloured region */ - return UI_UPDATE; + return MOVE_UI_UPDATE; } else if (c >= 0) { /* Right-dragging from colour to blank toggles one pencil */ p = state->pencil[r] ^ (1 << c); diff --git a/midend.c b/midend.c index 1092a3b..5de84c0 100644 --- a/midend.c +++ b/midend.c @@ -1027,7 +1027,7 @@ static bool midend_really_process_key(midend *me, int x, int y, int button, goto done; } else { *handled = true; - if (movestr == UI_UPDATE) + if (movestr == MOVE_UI_UPDATE) s = me->states[me->statepos-1].state; else { assert_printable_ascii(movestr); @@ -2039,7 +2039,7 @@ const char *midend_solve(midend *me) movestr = me->ourgame->solve(me->states[0].state, me->states[me->statepos-1].state, me->aux_info, &msg); - assert(movestr != UI_UPDATE); + assert(movestr != MOVE_UI_UPDATE); if (!movestr) { if (!msg) msg = "Solve operation failed"; /* _shouldn't_ happen, but can */ diff --git a/mines.c b/mines.c index ebd3c58..de82716 100644 --- a/mines.c +++ b/mines.c @@ -2425,14 +2425,14 @@ static char *interpret_move(const game_state *from, game_ui *ui, if (IS_CURSOR_MOVE(button)) { move_cursor(button, &ui->cur_x, &ui->cur_y, from->w, from->h, false); ui->cur_visible = true; - return UI_UPDATE; + return MOVE_UI_UPDATE; } if (IS_CURSOR_SELECT(button)) { int v = from->grid[ui->cur_y * from->w + ui->cur_x]; if (!ui->cur_visible) { ui->cur_visible = true; - return UI_UPDATE; + return MOVE_UI_UPDATE; } if (button == CURSOR_SELECT2) { /* As for RIGHT_BUTTON; only works on covered square. */ @@ -2472,7 +2472,7 @@ static char *interpret_move(const game_state *from, game_ui *ui, else if (button == MIDDLE_BUTTON) ui->validradius = 1; ui->cur_visible = false; - return UI_UPDATE; + return MOVE_UI_UPDATE; } if (button == RIGHT_BUTTON) { @@ -2500,10 +2500,10 @@ static char *interpret_move(const game_state *from, game_ui *ui, /* * At this stage we must never return NULL: we have adjusted - * the ui, so at worst we return UI_UPDATE. + * the ui, so at worst we return MOVE_UI_UPDATE. */ if (cx < 0 || cx >= from->w || cy < 0 || cy >= from->h) - return UI_UPDATE; + return MOVE_UI_UPDATE; /* * Left-clicking on a covered square opens a tile. Not @@ -2581,7 +2581,7 @@ uncover: } } - return UI_UPDATE; + return MOVE_UI_UPDATE; } } diff --git a/misc.c b/misc.c index 5621597..341b5ac 100644 --- a/misc.c +++ b/misc.c @@ -15,7 +15,7 @@ #include "puzzles.h" -char UI_UPDATE[] = ""; +char MOVE_UI_UPDATE[] = ""; void free_cfg(config_item *cfg) { diff --git a/mosaic.c b/mosaic.c index 1fb58b6..7c18920 100644 --- a/mosaic.c +++ b/mosaic.c @@ -1194,13 +1194,13 @@ static char *interpret_move(const game_state *state, game_ui *ui, move_cursor(button, &ui->cur_x, &ui->cur_y, state->width, state->height, false); ui->cur_visible = true; - return UI_UPDATE; + return MOVE_UI_UPDATE; } else if (IS_CURSOR_SELECT(button)) { if (!ui->cur_visible) { ui->cur_x = 0; ui->cur_y = 0; ui->cur_visible = true; - return UI_UPDATE; + return MOVE_UI_UPDATE; } if (button == CURSOR_SELECT2) { diff --git a/net.c b/net.c index 9748482..c899e5a 100644 --- a/net.c +++ b/net.c @@ -2161,7 +2161,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, if (ui->cur_visible) { ui->cur_visible = false; - nullret = UI_UPDATE; + nullret = MOVE_UI_UPDATE; } /* @@ -2401,7 +2401,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, OFFSET(ui->cur_x, ui->cur_y, ui->cur_x, ui->cur_y, dir, state); ui->cur_visible = true; } - return UI_UPDATE; + return MOVE_UI_UPDATE; } else { return NULL; } diff --git a/netslide.c b/netslide.c index d58a615..33447ae 100644 --- a/netslide.c +++ b/netslide.c @@ -1073,7 +1073,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, } ui->cur_visible = true; - return UI_UPDATE; + return MOVE_UI_UPDATE; } if (button == LEFT_BUTTON || button == RIGHT_BUTTON) { @@ -1087,7 +1087,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, } else { /* 'click' when cursor is invisible just makes cursor visible. */ ui->cur_visible = true; - return UI_UPDATE; + return MOVE_UI_UPDATE; } } else return NULL; diff --git a/palisade.c b/palisade.c index 2d9c990..67fb9a1 100644 --- a/palisade.c +++ b/palisade.c @@ -993,7 +993,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, ui->x, ui->y, flag, x, y, newflag); } else { move_cursor(button, &ui->x, &ui->y, w, h, false); - return UI_UPDATE; + return MOVE_UI_UPDATE; } } diff --git a/pattern.c b/pattern.c index 9748c6f..7bcca82 100644 --- a/pattern.c +++ b/pattern.c @@ -1336,7 +1336,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, ui->drag_start_y = ui->drag_end_y = y; ui->cur_visible = false; - return UI_UPDATE; + return MOVE_UI_UPDATE; } if (ui->dragging && button == ui->drag) { @@ -1365,7 +1365,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, ui->drag_end_x = x; ui->drag_end_y = y; - return UI_UPDATE; + return MOVE_UI_UPDATE; } if (ui->dragging && button == ui->release) { @@ -1393,7 +1393,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, x1, y1, x2-x1+1, y2-y1+1); return dupstr(buf); } else - return UI_UPDATE; + return MOVE_UI_UPDATE; } if (IS_CURSOR_MOVE(button)) { @@ -1401,12 +1401,12 @@ static char *interpret_move(const game_state *state, game_ui *ui, char buf[80]; move_cursor(button, &ui->cur_x, &ui->cur_y, state->common->w, state->common->h, false); ui->cur_visible = true; - if (!control && !shift) return UI_UPDATE; + if (!control && !shift) return MOVE_UI_UPDATE; newstate = control ? shift ? GRID_UNKNOWN : GRID_FULL : GRID_EMPTY; if (state->grid[y * state->common->w + x] == newstate && state->grid[ui->cur_y * state->common->w + ui->cur_x] == newstate) - return UI_UPDATE; + return MOVE_UI_UPDATE; sprintf(buf, "%c%d,%d,%d,%d", control ? shift ? 'U' : 'F' : 'E', min(x, ui->cur_x), min(y, ui->cur_y), @@ -1421,7 +1421,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, if (!ui->cur_visible) { ui->cur_visible = true; - return UI_UPDATE; + return MOVE_UI_UPDATE; } if (button == CURSOR_SELECT2) diff --git a/pearl.c b/pearl.c index 0e90044..efa3fa2 100644 --- a/pearl.c +++ b/pearl.c @@ -2144,11 +2144,11 @@ static char *mark_in_direction(const game_state *state, int x, int y, int dir, char ch = primary ? 'F' : 'M', *other; - if (!INGRID(state, x, y) || !INGRID(state, x2, y2)) return UI_UPDATE; + if (!INGRID(state, x, y) || !INGRID(state, x2, y2)) return MOVE_UI_UPDATE; /* disallow laying a mark over a line, or vice versa. */ other = primary ? state->marks : state->lines; - if (other[y*w+x] & dir || other[y2*w+x2] & dir2) return UI_UPDATE; + if (other[y*w+x] & dir || other[y2*w+x2] & dir2) return MOVE_UI_UPDATE; sprintf(buf, "%c%d,%d,%d;%c%d,%d,%d", ch, dir, x, y, ch, dir2, x2, y2); return dupstr(buf); @@ -2182,12 +2182,12 @@ static char *interpret_move(const game_state *state, game_ui *ui, ui->dragcoords[0] = gy * w + gx; ui->ndragcoords = 0; /* will be 1 once drag is confirmed */ - return UI_UPDATE; + return MOVE_UI_UPDATE; } if (button == LEFT_DRAG && ui->ndragcoords >= 0) { update_ui_drag(state, ui, gx, gy); - return UI_UPDATE; + return MOVE_UI_UPDATE; } if (IS_MOUSE_RELEASE(button)) release = true; @@ -2209,30 +2209,30 @@ static char *interpret_move(const game_state *state, game_ui *ui, if (ui->ndragcoords >= 0) update_ui_drag(state, ui, ui->curx, ui->cury); } - return UI_UPDATE; + return MOVE_UI_UPDATE; } if (IS_CURSOR_SELECT(button)) { if (!ui->cursor_active) { ui->cursor_active = true; - return UI_UPDATE; + return MOVE_UI_UPDATE; } else if (button == CURSOR_SELECT) { if (ui->ndragcoords == -1) { ui->ndragcoords = 0; ui->dragcoords[0] = ui->cury * w + ui->curx; ui->clickx = CENTERED_COORD(ui->curx); ui->clicky = CENTERED_COORD(ui->cury); - return UI_UPDATE; + return MOVE_UI_UPDATE; } else release = true; } else if (button == CURSOR_SELECT2 && ui->ndragcoords >= 0) { ui->ndragcoords = -1; - return UI_UPDATE; + return MOVE_UI_UPDATE; } } if ((button == 27 || button == '\b') && ui->ndragcoords >= 0) { ui->ndragcoords = -1; - return UI_UPDATE; + return MOVE_UI_UPDATE; } if (release) { @@ -2264,7 +2264,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, ui->ndragcoords = -1; - return buf ? buf : UI_UPDATE; + return buf ? buf : MOVE_UI_UPDATE; } else if (ui->ndragcoords == 0) { /* Click (or tiny drag). Work out which edge we were * closest to. */ @@ -2285,12 +2285,12 @@ static char *interpret_move(const game_state *state, game_ui *ui, cx = CENTERED_COORD(gx); cy = CENTERED_COORD(gy); - if (!INGRID(state, gx, gy)) return UI_UPDATE; + if (!INGRID(state, gx, gy)) return MOVE_UI_UPDATE; if (max(abs(x-cx),abs(y-cy)) < TILE_SIZE/4) { /* TODO closer to centre of grid: process as a cell click not an edge click. */ - return UI_UPDATE; + return MOVE_UI_UPDATE; } else { int direction; if (abs(x-cx) < abs(y-cy)) { diff --git a/pegs.c b/pegs.c index 35c9a1e..badfbdd 100644 --- a/pegs.c +++ b/pegs.c @@ -896,7 +896,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, ui->dy = y; ui->cur_visible = false; ui->cur_jumping = false; - return UI_UPDATE; + return MOVE_UI_UPDATE; } } else if (button == LEFT_DRAG && ui->dragging) { /* @@ -904,7 +904,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, */ ui->dx = x; ui->dy = y; - return UI_UPDATE; + return MOVE_UI_UPDATE; } else if (button == LEFT_RELEASE && ui->dragging) { int tx, ty, dx, dy; @@ -916,18 +916,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) - return UI_UPDATE; /* target out of range */ + return MOVE_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) - return UI_UPDATE; /* move length was wrong */ + return MOVE_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) - return UI_UPDATE; /* grid contents were invalid */ + return MOVE_UI_UPDATE; /* grid contents were invalid */ /* * We have a valid move. Encode it simply as source and @@ -947,7 +947,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, ui->cur_x = cx; ui->cur_y = cy; } - return UI_UPDATE; + return MOVE_UI_UPDATE; } else { int dx, dy, mx, my, jx, jy; @@ -970,21 +970,21 @@ static char *interpret_move(const game_state *state, game_ui *ui, ui->cur_x = jx; ui->cur_y = jy; return dupstr(buf); } - return UI_UPDATE; + return MOVE_UI_UPDATE; } } else if (IS_CURSOR_SELECT(button)) { if (!ui->cur_visible) { ui->cur_visible = true; - return UI_UPDATE; + return MOVE_UI_UPDATE; } if (ui->cur_jumping) { ui->cur_jumping = false; - return UI_UPDATE; + return MOVE_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 = true; - return UI_UPDATE; + return MOVE_UI_UPDATE; } return NULL; } diff --git a/puzzles.h b/puzzles.h index 1221afb..0222f8b 100644 --- a/puzzles.h +++ b/puzzles.h @@ -805,7 +805,7 @@ extern const game thegame; * appended to the undo chain. Must be declared as a non-const char, * but should never actually be modified by anyone. */ -extern char UI_UPDATE[]; +extern char MOVE_UI_UPDATE[]; /* A little bit of help to lazy developers */ #define DEFAULT_STATUSBAR_TEXT "Use status_bar() to fill this in." diff --git a/range.c b/range.c index 4cb771a..bc29f76 100644 --- a/range.c +++ b/range.c @@ -1405,14 +1405,14 @@ static char *interpret_move(const game_state *state, game_ui *ui, else if (do_post) return nfmtstr(40, "W,%d,%d", ui->r, ui->c); else - return UI_UPDATE; + return MOVE_UI_UPDATE; } else if (!out_of_bounds(ui->r + dr[i], ui->c + dc[i], w, h)) { ui->r += dr[i]; ui->c += dc[i]; } } else ui->cursor_show = true; - return UI_UPDATE; + return MOVE_UI_UPDATE; } if (action == hint) { diff --git a/rect.c b/rect.c index 2c41db8..a20cf18 100644 --- a/rect.c +++ b/rect.c @@ -2418,7 +2418,7 @@ static char *interpret_move(const game_state *from, game_ui *ui, move_cursor(button, &ui->cur_x, &ui->cur_y, from->w, from->h, false); ui->cur_visible = true; active = true; - if (!ui->cur_dragging) return UI_UPDATE; + if (!ui->cur_dragging) return MOVE_UI_UPDATE; coord_round((float)ui->cur_x + 0.5F, (float)ui->cur_y + 0.5F, &xc, &yc); } else if (IS_CURSOR_SELECT(button)) { if (ui->drag_start_x >= 0 && !ui->cur_dragging) { @@ -2431,7 +2431,7 @@ static char *interpret_move(const game_state *from, game_ui *ui, if (!ui->cur_visible) { assert(!ui->cur_dragging); ui->cur_visible = true; - return UI_UPDATE; + return MOVE_UI_UPDATE; } coord_round((float)ui->cur_x + 0.5F, (float)ui->cur_y + 0.5F, &xc, &yc); erasing = (button == CURSOR_SELECT2); @@ -2452,7 +2452,7 @@ static char *interpret_move(const game_state *from, game_ui *ui, reset_ui(ui); /* cancel keyboard dragging */ ui->cur_dragging = false; } - return UI_UPDATE; + return MOVE_UI_UPDATE; } else if (button != LEFT_DRAG && button != RIGHT_DRAG) { return NULL; } @@ -2536,7 +2536,7 @@ static char *interpret_move(const game_state *from, game_ui *ui, if (ret) return ret; /* a move has been made */ else if (active) - return UI_UPDATE; + return MOVE_UI_UPDATE; else return NULL; } diff --git a/samegame.c b/samegame.c index f228b19..5e79115 100644 --- a/samegame.c +++ b/samegame.c @@ -1285,7 +1285,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, int x, int y, int button) { int tx, ty; - char *ret = UI_UPDATE; + char *ret = MOVE_UI_UPDATE; ui->displaysel = false; diff --git a/signpost.c b/signpost.c index 9c1bae3..4f7eaf3 100644 --- a/signpost.c +++ b/signpost.c @@ -1517,20 +1517,20 @@ static char *interpret_move(const game_state *state, game_ui *ui, ui->dx = COORD(ui->cx) + TILE_SIZE/2; ui->dy = COORD(ui->cy) + TILE_SIZE/2; } - return UI_UPDATE; + return MOVE_UI_UPDATE; } else if (IS_CURSOR_SELECT(button)) { if (!ui->cshow) ui->cshow = true; else if (ui->dragging) { ui->dragging = false; - if (ui->sx == ui->cx && ui->sy == ui->cy) return UI_UPDATE; + if (ui->sx == ui->cx && ui->sy == ui->cy) return MOVE_UI_UPDATE; if (ui->drag_is_from) { if (!isvalidmove(state, false, ui->sx, ui->sy, ui->cx, ui->cy)) - return UI_UPDATE; + return MOVE_UI_UPDATE; sprintf(buf, "L%d,%d-%d,%d", ui->sx, ui->sy, ui->cx, ui->cy); } else { if (!isvalidmove(state, false, ui->cx, ui->cy, ui->sx, ui->sy)) - return UI_UPDATE; + return MOVE_UI_UPDATE; sprintf(buf, "L%d,%d-%d,%d", ui->cx, ui->cy, ui->sx, ui->sy); } return dupstr(buf); @@ -1542,7 +1542,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, ui->dy = COORD(ui->cy) + TILE_SIZE/2; ui->drag_is_from = (button == CURSOR_SELECT); } - return UI_UPDATE; + return MOVE_UI_UPDATE; } if (IS_MOUSE_DOWN(button)) { if (ui->cshow) { @@ -1571,19 +1571,19 @@ static char *interpret_move(const game_state *state, game_ui *ui, ui->dx = mx; ui->dy = my; ui->cshow = false; - return UI_UPDATE; + return MOVE_UI_UPDATE; } else if (IS_MOUSE_DRAG(button) && ui->dragging) { ui->dx = mx; ui->dy = my; - return UI_UPDATE; + return MOVE_UI_UPDATE; } else if (IS_MOUSE_RELEASE(button) && ui->dragging) { ui->dragging = false; - if (ui->sx == x && ui->sy == y) return UI_UPDATE; /* single click */ + if (ui->sx == x && ui->sy == y) return MOVE_UI_UPDATE; /* single click */ if (!INGRID(state, x, y)) { int si = ui->sy*w+ui->sx; if (state->prev[si] == -1 && state->next[si] == -1) - return UI_UPDATE; + return MOVE_UI_UPDATE; sprintf(buf, "%c%d,%d", (int)(ui->drag_is_from ? 'C' : 'X'), ui->sx, ui->sy); return dupstr(buf); @@ -1591,11 +1591,11 @@ static char *interpret_move(const game_state *state, game_ui *ui, if (ui->drag_is_from) { if (!isvalidmove(state, false, ui->sx, ui->sy, x, y)) - return UI_UPDATE; + return MOVE_UI_UPDATE; sprintf(buf, "L%d,%d-%d,%d", ui->sx, ui->sy, x, y); } else { if (!isvalidmove(state, false, x, y, ui->sx, ui->sy)) - return UI_UPDATE; + return MOVE_UI_UPDATE; sprintf(buf, "L%d,%d-%d,%d", x, y, ui->sx, ui->sy); } return dupstr(buf); @@ -1604,7 +1604,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, else if ((button == 'x' || button == 'X') && ui->cshow) { int si = ui->cy*w + ui->cx; if (state->prev[si] == -1 && state->next[si] == -1) - return UI_UPDATE; + return MOVE_UI_UPDATE; sprintf(buf, "%c%d,%d", (int)((button == 'x') ? 'C' : 'X'), ui->cx, ui->cy); return dupstr(buf); diff --git a/singles.c b/singles.c index 7b7b48f..0270331 100644 --- a/singles.c +++ b/singles.c @@ -1533,7 +1533,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, action = TOGGLE_CIRCLE; } } - if (action == UI) return UI_UPDATE; + if (action == UI) return MOVE_UI_UPDATE; if (action == TOGGLE_BLACK || action == TOGGLE_CIRCLE) { i = y * state->w + x; diff --git a/sixteen.c b/sixteen.c index 57be015..1f4c7e1 100644 --- a/sixteen.c +++ b/sixteen.c @@ -626,7 +626,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, if (IS_CURSOR_MOVE(button) || pad) { if (!ui->cur_visible) { ui->cur_visible = true; - return UI_UPDATE; + return MOVE_UI_UPDATE; } if (control || shift || ui->cur_mode) { @@ -681,7 +681,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, } ui->cur_visible = true; - return UI_UPDATE; + return MOVE_UI_UPDATE; } } @@ -699,11 +699,11 @@ static char *interpret_move(const game_state *state, game_ui *ui, const enum cursor_mode m = (button == CURSOR_SELECT2 ? lock_position : lock_tile); ui->cur_mode = (ui->cur_mode == m ? unlocked : m); - return UI_UPDATE; + return MOVE_UI_UPDATE; } } else { ui->cur_visible = true; - return UI_UPDATE; + return MOVE_UI_UPDATE; } } else { return NULL; @@ -718,7 +718,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, else if (cy == state->h && cx >= 0 && cx < state->w) dy = +1, dx = 0; else - return UI_UPDATE; /* invalid click location */ + return MOVE_UI_UPDATE; /* invalid click location */ /* reverse direction if right hand button is pressed */ if (button == RIGHT_BUTTON || button == CURSOR_SELECT2) { diff --git a/slant.c b/slant.c index 14edf00..ef4e208 100644 --- a/slant.c +++ b/slant.c @@ -1732,7 +1732,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, } else if (IS_CURSOR_SELECT(button)) { if (!ui->cur_visible) { ui->cur_visible = true; - return UI_UPDATE; + return MOVE_UI_UPDATE; } x = ui->cur_x; y = ui->cur_y; @@ -1741,7 +1741,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, } else if (IS_CURSOR_MOVE(button)) { move_cursor(button, &ui->cur_x, &ui->cur_y, w, h, false); ui->cur_visible = true; - return UI_UPDATE; + return MOVE_UI_UPDATE; } else if (button == '\\' || button == '\b' || button == '/') { int x = ui->cur_x, y = ui->cur_y; if (button == ("\\" "\b" "/")[state->soln[y*w + x] + 1]) return NULL; diff --git a/solo.c b/solo.c index 2cfa0f3..d934110 100644 --- a/solo.c +++ b/solo.c @@ -4637,7 +4637,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, ui->hpencil = false; } ui->hcursor = false; - return UI_UPDATE; + return MOVE_UI_UPDATE; } if (button == RIGHT_BUTTON) { /* @@ -4657,20 +4657,20 @@ static char *interpret_move(const game_state *state, game_ui *ui, ui->hshow = false; } ui->hcursor = false; - return UI_UPDATE; + return MOVE_UI_UPDATE; } } if (IS_CURSOR_MOVE(button)) { move_cursor(button, &ui->hx, &ui->hy, cr, cr, false); ui->hshow = true; ui->hcursor = true; - return UI_UPDATE; + return MOVE_UI_UPDATE; } if (ui->hshow && (button == CURSOR_SELECT)) { ui->hpencil = !ui->hpencil; ui->hcursor = true; - return UI_UPDATE; + return MOVE_UI_UPDATE; } if (ui->hshow && @@ -4714,7 +4714,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, /* ... expect to remove the cursor in mouse mode. */ if (!ui->hcursor) { ui->hshow = false; - return UI_UPDATE; + return MOVE_UI_UPDATE; } return NULL; } diff --git a/tents.c b/tents.c index e772e57..ff4af33 100644 --- a/tents.c +++ b/tents.c @@ -1589,7 +1589,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, ui->dsy = ui->dey = y; ui->drag_ok = true; ui->cdisp = false; - return UI_UPDATE; + return MOVE_UI_UPDATE; } if ((IS_MOUSE_DRAG(button) || IS_MOUSE_RELEASE(button)) && @@ -1621,14 +1621,14 @@ static char *interpret_move(const game_state *state, game_ui *ui, } if (IS_MOUSE_DRAG(button)) - return UI_UPDATE; + return MOVE_UI_UPDATE; /* * The drag has been released. Enact it. */ if (!ui->drag_ok) { ui->drag_button = -1; - return UI_UPDATE; /* drag was just cancelled */ + return MOVE_UI_UPDATE; /* drag was just cancelled */ } xmin = min(ui->dsx, ui->dex); @@ -1666,7 +1666,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, if (buflen == 0) { sfree(buf); - return UI_UPDATE; /* drag was terminated */ + return MOVE_UI_UPDATE; /* drag was terminated */ } else { buf[buflen] = '\0'; return buf; @@ -1694,7 +1694,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, if (len) return dupstr(tmpbuf); } else move_cursor(button, &ui->cx, &ui->cy, w, h, false); - return UI_UPDATE; + return MOVE_UI_UPDATE; } if (ui->cdisp) { char rep = 0; @@ -1721,7 +1721,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, } } else if (IS_CURSOR_SELECT(button)) { ui->cdisp = true; - return UI_UPDATE; + return MOVE_UI_UPDATE; } return NULL; diff --git a/towers.c b/towers.c index 84a8e71..718f9f6 100644 --- a/towers.c +++ b/towers.c @@ -1458,7 +1458,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, ui->hpencil = false; } ui->hcursor = false; - return UI_UPDATE; + return MOVE_UI_UPDATE; } if (button == RIGHT_BUTTON) { /* @@ -1478,7 +1478,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, ui->hshow = false; } ui->hcursor = false; - return UI_UPDATE; + return MOVE_UI_UPDATE; } } else if (button == LEFT_BUTTON) { if (is_clue(state, tx, ty)) { @@ -1504,13 +1504,13 @@ static char *interpret_move(const game_state *state, game_ui *ui, move_cursor(button, &ui->hx, &ui->hy, w, w, false); ui->hshow = true; ui->hcursor = true; - return UI_UPDATE; + return MOVE_UI_UPDATE; } if (ui->hshow && (button == CURSOR_SELECT)) { ui->hpencil = !ui->hpencil; ui->hcursor = true; - return UI_UPDATE; + return MOVE_UI_UPDATE; } if (ui->hshow && @@ -1542,7 +1542,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, /* ... expect to remove the cursor in mouse mode. */ if (!ui->hcursor) { ui->hshow = false; - return UI_UPDATE; + return MOVE_UI_UPDATE; } return NULL; } diff --git a/tracks.c b/tracks.c index 4578296..a2d4560 100644 --- a/tracks.c +++ b/tracks.c @@ -2279,13 +2279,13 @@ static char *interpret_move(const game_state *state, game_ui *ui, ui->drag_sx = ui->drag_ex = gx; ui->drag_sy = ui->drag_ey = gy; - return UI_UPDATE; + return MOVE_UI_UPDATE; } if (IS_MOUSE_DRAG(button)) { ui->cursor_active = false; update_ui_drag(state, ui, gx, gy); - return UI_UPDATE; + return MOVE_UI_UPDATE; } if (IS_MOUSE_RELEASE(button)) { @@ -2322,12 +2322,12 @@ static char *interpret_move(const game_state *state, game_ui *ui, cy = CENTERED_COORD(gy); if (!INGRID(state, gx, gy) || FROMCOORD(x) != gx || FROMCOORD(y) != gy) - return UI_UPDATE; + return MOVE_UI_UPDATE; if (max(abs(x-cx),abs(y-cy)) < TILE_SIZE/4) { if (ui_can_flip_square(state, gx, gy, button == RIGHT_RELEASE)) return square_flip_str(state, gx, gy, button == RIGHT_RELEASE, tmpbuf); - return UI_UPDATE; + return MOVE_UI_UPDATE; } else { if (abs(x-cx) < abs(y-cy)) { /* Closest to top/bottom edge. */ @@ -2341,7 +2341,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, return edge_flip_str(state, gx, gy, direction, button == RIGHT_RELEASE, tmpbuf); else - return UI_UPDATE; + return MOVE_UI_UPDATE; } } } @@ -2354,7 +2354,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, if (!ui->cursor_active) { ui->cursor_active = true; - return UI_UPDATE; + return MOVE_UI_UPDATE; } ui->curx = ui->curx + dx; @@ -2365,17 +2365,17 @@ static char *interpret_move(const game_state *state, game_ui *ui, } ui->curx = min(max(ui->curx, 1), 2*w-1); ui->cury = min(max(ui->cury, 1), 2*h-1); - return UI_UPDATE; + return MOVE_UI_UPDATE; } if (IS_CURSOR_SELECT(button)) { if (!ui->cursor_active) { ui->cursor_active = true; - return UI_UPDATE; + return MOVE_UI_UPDATE; } /* click on square corner does nothing (shouldn't get here) */ if ((ui->curx % 2) == 0 && (ui->cury % 2 == 0)) - return UI_UPDATE; + return MOVE_UI_UPDATE; gx = ui->curx / 2; gy = ui->cury / 2; @@ -2387,7 +2387,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, else if (!direction && ui_can_flip_square(state, gx, gy, button == CURSOR_SELECT2)) return square_flip_str(state, gx, gy, button == CURSOR_SELECT2, tmpbuf); - return UI_UPDATE; + return MOVE_UI_UPDATE; } #if 0 diff --git a/twiddle.c b/twiddle.c index f7216df..23241da 100644 --- a/twiddle.c +++ b/twiddle.c @@ -676,7 +676,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, if (button == CURSOR_DOWN && (ui->cur_y+n) < (h)) ui->cur_y++; ui->cur_visible = true; - return UI_UPDATE; + return MOVE_UI_UPDATE; } if (button == LEFT_BUTTON || button == RIGHT_BUTTON) { @@ -700,7 +700,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, dir = (button == CURSOR_SELECT2) ? -1 : +1; } else { ui->cur_visible = true; - return UI_UPDATE; + return MOVE_UI_UPDATE; } } else if (button == 'a' || button == 'A' || button==MOD_NUM_KEYPAD+'7') { x = y = 0; diff --git a/undead.c b/undead.c index 4784754..d2a07a3 100644 --- a/undead.c +++ b/undead.c @@ -1774,7 +1774,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, if (button == 'a' || button == 'A') { ui->ascii = !ui->ascii; - return UI_UPDATE; + return MOVE_UI_UPDATE; } if (button == 'm' || button == 'M') { @@ -1787,21 +1787,21 @@ static char *interpret_move(const game_state *state, game_ui *ui, if (button == 'g' || button == 'G' || button == '1') { if (!ui->hcursor) ui->hshow = false; if (state->guess[xi] == 1) - return ui->hcursor ? NULL : UI_UPDATE; + return ui->hcursor ? NULL : MOVE_UI_UPDATE; sprintf(buf,"G%d",xi); return dupstr(buf); } if (button == 'v' || button == 'V' || button == '2') { if (!ui->hcursor) ui->hshow = false; if (state->guess[xi] == 2) - return ui->hcursor ? NULL : UI_UPDATE; + return ui->hcursor ? NULL : MOVE_UI_UPDATE; sprintf(buf,"V%d",xi); return dupstr(buf); } if (button == 'z' || button == 'Z' || button == '3') { if (!ui->hcursor) ui->hshow = false; if (state->guess[xi] == 4) - return ui->hcursor ? NULL : UI_UPDATE; + return ui->hcursor ? NULL : MOVE_UI_UPDATE; sprintf(buf,"Z%d",xi); return dupstr(buf); } @@ -1809,7 +1809,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, button == '0' || button == '\b' ) { if (!ui->hcursor) ui->hshow = false; if (state->guess[xi] == 7 && state->pencils[xi] == 0) - return ui->hcursor ? NULL : UI_UPDATE; + return ui->hcursor ? NULL : MOVE_UI_UPDATE; sprintf(buf,"E%d",xi); return dupstr(buf); } @@ -1829,12 +1829,12 @@ static char *interpret_move(const game_state *state, game_ui *ui, } ui->hshow = true; ui->hcursor = true; - return UI_UPDATE; + return MOVE_UI_UPDATE; } if (ui->hshow && button == CURSOR_SELECT) { ui->hpencil = !ui->hpencil; ui->hcursor = true; - return UI_UPDATE; + return MOVE_UI_UPDATE; } if (ui->hshow && ui->hpencil) { @@ -1871,7 +1871,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, ui->hshow = false; } if (state->pencils[xi] == 0) - return ui->hcursor ? NULL : UI_UPDATE; + return ui->hcursor ? NULL : MOVE_UI_UPDATE; sprintf(buf,"E%d",xi); return dupstr(buf); } @@ -1888,14 +1888,14 @@ static char *interpret_move(const game_state *state, game_ui *ui, ui->hpencil = false; ui->hcursor = false; ui->hx = gx; ui->hy = gy; - return UI_UPDATE; + return MOVE_UI_UPDATE; } else if (button == RIGHT_BUTTON && g == 7) { ui->hshow = true; ui->hpencil = true; ui->hcursor = false; ui->hx = gx; ui->hy = gy; - return UI_UPDATE; + return MOVE_UI_UPDATE; } } else if (ui->hshow) { @@ -1906,14 +1906,14 @@ static char *interpret_move(const game_state *state, game_ui *ui, ui->hpencil = false; ui->hcursor = false; ui->hx = 0; ui->hy = 0; - return UI_UPDATE; + return MOVE_UI_UPDATE; } else { ui->hshow = true; ui->hpencil = false; ui->hcursor = false; ui->hx = gx; ui->hy = gy; - return UI_UPDATE; + return MOVE_UI_UPDATE; } } else { @@ -1921,7 +1921,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, ui->hpencil = false; ui->hcursor = false; ui->hx = gx; ui->hy = gy; - return UI_UPDATE; + return MOVE_UI_UPDATE; } } else if (button == RIGHT_BUTTON) { @@ -1930,7 +1930,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, ui->hpencil = true; ui->hcursor = false; ui->hx = gx; ui->hy = gy; - return UI_UPDATE; + return MOVE_UI_UPDATE; } else { if (gx == ui->hx && gy == ui->hy) { @@ -1938,14 +1938,14 @@ static char *interpret_move(const game_state *state, game_ui *ui, ui->hpencil = false; ui->hcursor = false; ui->hx = 0; ui->hy = 0; - return UI_UPDATE; + return MOVE_UI_UPDATE; } else if (g == 7) { ui->hshow = true; ui->hpencil = true; ui->hcursor = false; ui->hx = gx; ui->hy = gy; - return UI_UPDATE; + return MOVE_UI_UPDATE; } } } diff --git a/unequal.c b/unequal.c index e67f028..4b2bc42 100644 --- a/unequal.c +++ b/unequal.c @@ -1531,7 +1531,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, ui->hshow = true; } ui->hcursor = false; - return UI_UPDATE; + return MOVE_UI_UPDATE; } if (button == RIGHT_BUTTON) { /* pencil highlighting for non-filled squares */ @@ -1545,7 +1545,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, ui->hshow = true; } ui->hcursor = false; - return UI_UPDATE; + return MOVE_UI_UPDATE; } } @@ -1561,12 +1561,12 @@ static char *interpret_move(const game_state *state, game_ui *ui, ny != ui->hy + adjthan[i].dy); ++i); if (i == 4) - return UI_UPDATE; /* invalid direction, i.e. out of + return MOVE_UI_UPDATE; /* invalid direction, i.e. out of * the board */ if (!(GRID(state, flags, ui->hx, ui->hy) & adjthan[i].f || GRID(state, flags, nx, ny ) & adjthan[i].fo)) - return UI_UPDATE; /* no clue to toggle */ + return MOVE_UI_UPDATE; /* no clue to toggle */ if (state->mode == MODE_ADJACENT) self = (adjthan[i].dx >= 0 && adjthan[i].dy >= 0); @@ -1585,13 +1585,13 @@ static char *interpret_move(const game_state *state, game_ui *ui, move_cursor(button, &ui->hx, &ui->hy, ds->order, ds->order, false); ui->hshow = true; ui->hcursor = true; - return UI_UPDATE; + return MOVE_UI_UPDATE; } } if (ui->hshow && IS_CURSOR_SELECT(button)) { ui->hpencil = !ui->hpencil; ui->hcursor = true; - return UI_UPDATE; + return MOVE_UI_UPDATE; } n = c2n(button, state->order); @@ -1622,7 +1622,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, /* ... expect to remove the cursor in mouse mode. */ if (!ui->hcursor) { ui->hshow = false; - return UI_UPDATE; + return MOVE_UI_UPDATE; } return NULL; } diff --git a/unfinished/group.c b/unfinished/group.c index 7faee89..b008e82 100644 --- a/unfinished/group.c +++ b/unfinished/group.c @@ -1519,13 +1519,13 @@ static char *interpret_move(const game_state *state, game_ui *ui, ui->drag |= 4; /* some movement has happened */ if (tcoord >= 0 && tcoord < w) { ui->dragpos = tcoord; - return UI_UPDATE; + return MOVE_UI_UPDATE; } } else if (IS_MOUSE_RELEASE(button)) { if (ui->drag & 4) { ui->drag = 0; /* end drag */ if (state->sequence[ui->dragpos] == ui->dragnum) - return UI_UPDATE; /* drag was a no-op overall */ + return MOVE_UI_UPDATE; /* drag was a no-op overall */ sprintf(buf, "D%d,%d", ui->dragnum, ui->dragpos); return dupstr(buf); } else { @@ -1536,7 +1536,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, state->sequence[ui->edgepos]); return dupstr(buf); } else - return UI_UPDATE; /* no-op */ + return MOVE_UI_UPDATE; /* no-op */ } } } else if (IS_MOUSE_DOWN(button)) { @@ -1559,7 +1559,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, ui->hpencil = false; } ui->hcursor = false; - return UI_UPDATE; + return MOVE_UI_UPDATE; } if (button == RIGHT_BUTTON) { /* @@ -1583,20 +1583,20 @@ static char *interpret_move(const game_state *state, game_ui *ui, ui->hshow = false; } ui->hcursor = false; - return UI_UPDATE; + return MOVE_UI_UPDATE; } } else if (tx >= 0 && tx < w && ty == -1) { ui->drag = 2; ui->dragnum = state->sequence[tx]; ui->dragpos = tx; ui->edgepos = FROMCOORD(x + TILESIZE/2); - return UI_UPDATE; + return MOVE_UI_UPDATE; } else if (ty >= 0 && ty < w && tx == -1) { ui->drag = 1; ui->dragnum = state->sequence[ty]; ui->dragpos = ty; ui->edgepos = FROMCOORD(y + TILESIZE/2); - return UI_UPDATE; + return MOVE_UI_UPDATE; } } else if (IS_MOUSE_DRAG(button)) { if (!ui->hpencil && @@ -1609,7 +1609,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, ui->odx = ui->ody = 0; ui->odn = 1; } - return UI_UPDATE; + return MOVE_UI_UPDATE; } if (IS_CURSOR_MOVE(button)) { @@ -1620,13 +1620,13 @@ static char *interpret_move(const game_state *state, game_ui *ui, ui->hy = state->sequence[cy]; ui->hshow = true; ui->hcursor = true; - return UI_UPDATE; + return MOVE_UI_UPDATE; } if (ui->hshow && (button == CURSOR_SELECT)) { ui->hpencil = !ui->hpencil; ui->hcursor = true; - return UI_UPDATE; + return MOVE_UI_UPDATE; } if (ui->hshow && diff --git a/unfinished/slide.c b/unfinished/slide.c index c797d7e..4c4d989 100644 --- a/unfinished/slide.c +++ b/unfinished/slide.c @@ -1345,7 +1345,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, * And that's it. Update the display to reflect the start * of a drag. */ - return UI_UPDATE; + return MOVE_UI_UPDATE; } else if (button == LEFT_DRAG && ui->dragging) { int dist, distlimit, dx, dy, s, px, py; @@ -1372,7 +1372,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, if (px >= 0 && px < w && py >= 0 && py < h && ui->reachable[py*w+px]) { ui->drag_currpos = py*w+px; - return UI_UPDATE; + return MOVE_UI_UPDATE; } } } @@ -1389,7 +1389,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, sprintf(data, "M%d-%d", ui->drag_anchor, ui->drag_currpos); str = dupstr(data); } else - str = UI_UPDATE; + str = MOVE_UI_UPDATE; ui->dragging = false; ui->drag_anchor = ui->drag_currpos = -1; diff --git a/unruly.c b/unruly.c index 2f2e51e..191be78 100644 --- a/unruly.c +++ b/unruly.c @@ -1628,7 +1628,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, if (IS_CURSOR_MOVE(button)) { move_cursor(button, &ui->cx, &ui->cy, w2, h2, false); ui->cursor = true; - return UI_UPDATE; + return MOVE_UI_UPDATE; } /* Place one */ diff --git a/untangle.c b/untangle.c index eff77f8..a61e59c 100644 --- a/untangle.c +++ b/untangle.c @@ -1208,12 +1208,12 @@ static char *interpret_move(const game_state *state, game_ui *ui, if (bestd <= DRAG_THRESHOLD * DRAG_THRESHOLD) { ui->dragpoint = best; place_dragged_point(state, ui, ds, x, y); - return UI_UPDATE; + return MOVE_UI_UPDATE; } } else if (IS_MOUSE_DRAG(button) && ui->dragpoint >= 0) { place_dragged_point(state, ui, ds, x, y); - return UI_UPDATE; + return MOVE_UI_UPDATE; } else if (IS_MOUSE_RELEASE(button) && ui->dragpoint >= 0) { int p = ui->dragpoint; char buf[80]; @@ -1228,7 +1228,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, ui->newpoint.x >= (long)state->w*ui->newpoint.d || ui->newpoint.y < 0 || ui->newpoint.y >= (long)state->h*ui->newpoint.d) - return UI_UPDATE; + return MOVE_UI_UPDATE; /* * We aren't cancelling the drag. Construct a move string