diff options
| author | Ben Harris <bjh21@bjh21.me.uk> | 2023-06-04 18:42:58 +0100 |
|---|---|---|
| committer | Ben Harris <bjh21@bjh21.me.uk> | 2023-06-11 00:33:27 +0100 |
| commit | a9af3fda1d784c42d486a019a0a4e947f762af70 (patch) | |
| tree | 8cb5d37274541dae804cd11d944feb41ffa1d40b /signpost.c | |
| parent | b08c13f5f47a8541961fc150142523b061d3d9c6 (diff) | |
| download | puzzles-a9af3fda1d784c42d486a019a0a4e947f762af70.zip puzzles-a9af3fda1d784c42d486a019a0a4e947f762af70.tar.gz puzzles-a9af3fda1d784c42d486a019a0a4e947f762af70.tar.bz2 puzzles-a9af3fda1d784c42d486a019a0a4e947f762af70.tar.xz | |
Rename UI_UPDATE as MOVE_UI_UPDATE
All the other constants named UI_* are special key names that can be
passed to midend_process_key(), but UI_UPDATE is a special return value
from the back-end interpret_move() function instead. This renaming
makes the distinction clear and provides a naming convention for future
special return values from interpret_move().
Diffstat (limited to 'signpost.c')
| -rw-r--r-- | signpost.c | 24 |
1 files changed, 12 insertions, 12 deletions
@@ -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); |