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().
This commit is contained in:
Ben Harris
2023-06-04 18:42:58 +01:00
parent b08c13f5f4
commit a9af3fda1d
42 changed files with 216 additions and 216 deletions

View File

@ -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;