mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-21 08:01:30 -07:00
Solo, Undead: support 'm' to fill in all pencils.
Keen, Towers and Unequal (and Group) already have this feature in common: pressing m while no square is selected, causes a full set of pencil marks to be filled in for every square without a real number/ letter/whatever in it. Solo and Undead share the basic UI principles (left-click to select a square then type a thing to go in it, vs right-click to select a square then type things to pencil-mark in it), but did not have that same feature. Now they do.
This commit is contained in:
18
solo.c
18
solo.c
@ -4614,6 +4614,9 @@ static char *interpret_move(const game_state *state, game_ui *ui,
|
|||||||
return dupstr(buf);
|
return dupstr(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (button == 'M' || button == 'm')
|
||||||
|
return dupstr("M");
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4665,6 +4668,21 @@ static game_state *execute_move(const game_state *from, const char *move)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
} else if (move[0] == 'M') {
|
||||||
|
/*
|
||||||
|
* Fill in absolutely all pencil marks in unfilled squares,
|
||||||
|
* for those who like to play by the rigorous approach of
|
||||||
|
* starting off in that state and eliminating things.
|
||||||
|
*/
|
||||||
|
ret = dup_game(from);
|
||||||
|
for (y = 0; y < cr; y++) {
|
||||||
|
for (x = 0; x < cr; x++) {
|
||||||
|
if (!ret->grid[y*cr+x]) {
|
||||||
|
memset(ret->pencil + (y*cr+x)*cr, 1, cr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
} else
|
} else
|
||||||
return NULL; /* couldn't parse move string */
|
return NULL; /* couldn't parse move string */
|
||||||
}
|
}
|
||||||
|
16
undead.c
16
undead.c
@ -1728,6 +1728,10 @@ static char *interpret_move(const game_state *state, game_ui *ui,
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (button == 'm' || button == 'M') {
|
||||||
|
return dupstr("M");
|
||||||
|
}
|
||||||
|
|
||||||
if (ui->hshow == 1 && ui->hpencil == 0) {
|
if (ui->hshow == 1 && ui->hpencil == 0) {
|
||||||
xi = state->common->xinfo[ui->hx + ui->hy*(state->common->params.w+2)];
|
xi = state->common->xinfo[ui->hx + ui->hy*(state->common->params.w+2)];
|
||||||
if (xi >= 0 && !state->common->fixed[xi]) {
|
if (xi >= 0 && !state->common->fixed[xi]) {
|
||||||
@ -2020,6 +2024,18 @@ static game_state *execute_move(const game_state *state, const char *move)
|
|||||||
ret->hints_done[clue_index(ret, x, y)] ^= 1;
|
ret->hints_done[clue_index(ret, x, y)] ^= 1;
|
||||||
move += n + 1;
|
move += n + 1;
|
||||||
}
|
}
|
||||||
|
if (c == 'M') {
|
||||||
|
/*
|
||||||
|
* Fill in absolutely all pencil marks in unfilled
|
||||||
|
* squares, for those who like to play by the rigorous
|
||||||
|
* approach of starting off in that state and eliminating
|
||||||
|
* things.
|
||||||
|
*/
|
||||||
|
for (i = 0; i < ret->common->wh; i++)
|
||||||
|
if (ret->guess[i] == 7)
|
||||||
|
ret->pencils[i] = 7;
|
||||||
|
move++;
|
||||||
|
}
|
||||||
if (*move == ';') move++;
|
if (*move == ';') move++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user