Add preferences for existing UI style controls

Some puzzles have keys that make changes to the display style in ways
that would probably have been user preferences if they had existed.
I've added a user preference for each of these.  The keys still work,
and unlike the preferences can be changed without saving any state.

The affected settings are:
 * Labelling colours with numbers in Guess ("L" key)
 * Labelling regions with numbers in Map ("L" key)
 * Whether monsters are shown as letters or pictures in Undead ("A" key)
This commit is contained in:
Ben Harris
2023-05-30 19:57:15 +02:00
parent 5acce15ed9
commit 4227ac1fd5
4 changed files with 80 additions and 11 deletions

View File

@ -1656,6 +1656,30 @@ static game_ui *new_ui(const game_state *state)
return ui;
}
static config_item *get_prefs(game_ui *ui)
{
config_item *ret;
ret = snewn(2, config_item);
ret[0].name = "Monster representation";
ret[0].kw = "monsters";
ret[0].type = C_CHOICES;
ret[0].u.choices.choicenames = ":Pictures:Letters";
ret[0].u.choices.choicekws = ":pictures:letters";
ret[0].u.choices.selected = ui->ascii;
ret[1].name = NULL;
ret[1].type = C_END;
return ret;
}
static void set_prefs(game_ui *ui, const config_item *cfg)
{
ui->ascii = cfg[0].u.choices.selected;
}
static void free_ui(game_ui *ui) {
sfree(ui);
return;
@ -2784,7 +2808,7 @@ const struct game thegame = {
free_game,
true, solve_game,
true, game_can_format_as_text_now, game_text_format,
NULL, NULL, /* get_prefs, set_prefs */
get_prefs, set_prefs,
new_ui,
free_ui,
NULL, /* encode_ui */