aboutsummaryrefslogtreecommitdiff
path: root/dominosa.c
diff options
context:
space:
mode:
Diffstat (limited to 'dominosa.c')
-rw-r--r--dominosa.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/dominosa.c b/dominosa.c
index 2f8638c..0be1c68 100644
--- a/dominosa.c
+++ b/dominosa.c
@@ -2734,6 +2734,33 @@ static void game_changed_state(game_ui *ui, const game_state *oldstate,
ui->cur_visible = false;
}
+static const char *current_key_label(const game_ui *ui,
+ const game_state *state, int button)
+{
+ if (IS_CURSOR_SELECT(button)) {
+ int d1, d2, w = state->w;
+
+ if (!((ui->cur_x ^ ui->cur_y) & 1))
+ return ""; /* must have exactly one dimension odd */
+ d1 = (ui->cur_y / 2) * w + (ui->cur_x / 2);
+ d2 = ((ui->cur_y+1) / 2) * w + ((ui->cur_x+1) / 2);
+
+ /* We can't mark an edge next to any domino. */
+ if (button == CURSOR_SELECT2 &&
+ (state->grid[d1] != d1 || state->grid[d2] != d2))
+ return "";
+ if (button == CURSOR_SELECT) {
+ if (state->grid[d1] == d2) return "Remove";
+ return "Place";
+ } else {
+ int edge = d2 == d1 + 1 ? EDGE_R : EDGE_B;
+ if (state->edges[d1] & edge) return "Remove";
+ return "Line";
+ }
+ }
+ return "";
+}
+
#define PREFERRED_TILESIZE 32
#define TILESIZE (ds->tilesize)
#define BORDER (TILESIZE * 3 / 4)
@@ -3417,6 +3444,7 @@ const struct game thegame = {
decode_ui,
NULL, /* game_request_keys */
game_changed_state,
+ current_key_label,
interpret_move,
execute_move,
PREFERRED_TILESIZE, game_compute_size, game_set_size,