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 /pearl.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 'pearl.c')
| -rw-r--r-- | pearl.c | 24 |
1 files changed, 12 insertions, 12 deletions
@@ -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)) { |