static char *game_text_format(const game_state *state)
{
- int cellsize, r, c, i, w_string, h_string, n_string;
+ int r, c, i, w_string, h_string, n_string;
+ char cellsize;
char *ret, *buf, *gridline;
int const w = state->params.w, h = state->params.h;
enum {none, forwards, backwards, hint};
int const w = state->params.w, h = state->params.h;
int r = ui->r, c = ui->c, action = none, cell;
+ int shift = button & MOD_SHFT;
+ button &= ~shift;
if (IS_CURSOR_SELECT(button) && !ui->cursor_show) return NULL;
int i;
for (i = 0; i < 4 && cursors[i] != button; ++i);
assert (i < 4);
- if (!out_of_bounds(ui->r + dr[i], ui->c + dc[i], w, h)) {
+ if (shift) {
+ int pre_r = r, pre_c = c, do_pre, do_post;
+ cell = state->grid[idx(r, c, state->params.w)];
+ do_pre = (cell == EMPTY);
+
+ if (out_of_bounds(ui->r + dr[i], ui->c + dc[i], w, h)) {
+ if (do_pre)
+ return nfmtstr(40, "W,%d,%d", pre_r, pre_c);
+ else
+ return NULL;
+ }
+
+ ui->r += dr[i];
+ ui->c += dc[i];
+
+ cell = state->grid[idx(ui->r, ui->c, state->params.w)];
+ do_post = (cell == EMPTY);
+
+ /* (do_pre ? "..." : "") concat (do_post ? "..." : "") */
+ if (do_pre && do_post)
+ return nfmtstr(80, "W,%d,%dW,%d,%d",
+ pre_r, pre_c, ui->r, ui->c);
+ else if (do_pre)
+ return nfmtstr(40, "W,%d,%d", pre_r, pre_c);
+ else if (do_post)
+ return nfmtstr(40, "W,%d,%d", ui->r, ui->c);
+ else
+ return "";
+
+ } else if (!out_of_bounds(ui->r + dr[i], ui->c + dc[i], w, h)) {
ui->r += dr[i];
ui->c += dc[i];
}
if (!ds->started) {
ds->started = TRUE;
draw_rect(dr, 0, 0, wpx, hpx, COL_BACKGROUND);
- draw_rect(dr, BORDER-1, BORDER-1,
- ds->tilesize*w+2, ds->tilesize*h+2, COL_GRID);
draw_update(dr, 0, 0, wpx, hpx);
}
cell.flash || cell.cursor ?
COL_LOWLIGHT : COL_BACKGROUND);
- draw_rect (draw, x, y, ts, ts, colour);
- draw_rect_outline(draw, x, y, ts, ts, COL_GRID);
+ draw_rect_outline(draw, x, y, ts + 1, ts + 1, COL_GRID);
+ draw_rect (draw, x + 1, y + 1, ts - 1, ts - 1, colour);
+ if (cell.error)
+ draw_rect_outline(draw, x + 1, y + 1, ts - 1, ts - 1, COL_ERROR);
switch (cell.value) {
case WHITE: draw_rect(draw, tx - dotsz / 2, ty - dotsz / 2, dotsz, dotsz,
cell.error ? COL_ERROR : COL_USER);
- case BLACK: break;
- case EMPTY:
- if (cell.error)
- draw_circle(draw, tx, ty, dotsz / 2, COL_ERROR, COL_GRID);
- break;
+ case BLACK: case EMPTY: break;
default:
{
int const colour = (cell.error ? COL_ERROR : COL_GRID);
}
}
- draw_update(draw, x, y, ts, ts);
+ draw_update(draw, x, y, ts + 1, ts + 1);
}
static int game_timing_state(const game_state *state, game_ui *ui)
struct game const thegame = {
"Range", "games.range", "range",
default_params,
- game_fetch_preset,
+ game_fetch_preset, NULL,
decode_params,
encode_params,
free_params,