mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-21 08:01:30 -07:00
Use semantic enum entry names for pref indices
[Commit message added by SGT: this makes it easier to allocate indices in the config_item array, and keep them in sync between get_prefs and set_prefs for each game.]
This commit is contained in:
22
solo.c
22
solo.c
@ -140,6 +140,11 @@ enum {
|
||||
NCOLOURS
|
||||
};
|
||||
|
||||
enum {
|
||||
PREF_PENCIL_KEEP_HIGHLIGHT,
|
||||
N_PREF_ITEMS
|
||||
};
|
||||
|
||||
/*
|
||||
* To determine all possible ways to reach a given sum by adding two or
|
||||
* three numbers from 1..9, each of which occurs exactly once in the sum,
|
||||
@ -4592,22 +4597,23 @@ static config_item *get_prefs(game_ui *ui)
|
||||
{
|
||||
config_item *ret;
|
||||
|
||||
ret = snewn(2, config_item);
|
||||
ret = snewn(N_PREF_ITEMS+1, config_item);
|
||||
|
||||
ret[0].name = "Keep mouse highlight after changing a pencil mark";
|
||||
ret[0].kw = "pencil-keep-highlight";
|
||||
ret[0].type = C_BOOLEAN;
|
||||
ret[0].u.boolean.bval = ui->pencil_keep_highlight;
|
||||
ret[PREF_PENCIL_KEEP_HIGHLIGHT].name =
|
||||
"Keep mouse highlight after changing a pencil mark";
|
||||
ret[PREF_PENCIL_KEEP_HIGHLIGHT].kw = "pencil-keep-highlight";
|
||||
ret[PREF_PENCIL_KEEP_HIGHLIGHT].type = C_BOOLEAN;
|
||||
ret[PREF_PENCIL_KEEP_HIGHLIGHT].u.boolean.bval = ui->pencil_keep_highlight;
|
||||
|
||||
ret[1].name = NULL;
|
||||
ret[1].type = C_END;
|
||||
ret[N_PREF_ITEMS].name = NULL;
|
||||
ret[N_PREF_ITEMS].type = C_END;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void set_prefs(game_ui *ui, const config_item *cfg)
|
||||
{
|
||||
ui->pencil_keep_highlight = cfg[0].u.boolean.bval;
|
||||
ui->pencil_keep_highlight = cfg[PREF_PENCIL_KEEP_HIGHLIGHT].u.boolean.bval;
|
||||
}
|
||||
|
||||
static void game_changed_state(game_ui *ui, const game_state *oldstate,
|
||||
|
Reference in New Issue
Block a user