summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/birth.cc18
-rw-r--r--src/cave.cc79
-rw-r--r--src/cmd1.cc18
-rw-r--r--src/cmd2.cc20
-rw-r--r--src/cmd3.cc2
-rw-r--r--src/cmd4.cc155
-rw-r--r--src/dungeon.cc81
-rw-r--r--src/files.cc60
-rw-r--r--src/generate.cc163
-rw-r--r--src/help.cc2
-rw-r--r--src/init2.cc13
-rw-r--r--src/joke.cc2
-rw-r--r--src/loadsave.cc30
-rw-r--r--src/melee2.cc49
-rw-r--r--src/monster2.cc56
-rw-r--r--src/object1.cc2
-rw-r--r--src/object2.cc66
-rw-r--r--src/options.cc108
-rw-r--r--src/options.hpp312
-rw-r--r--src/q_ultrag.cc9
-rw-r--r--src/randart.cc5
-rw-r--r--src/spells1.cc28
-rw-r--r--src/spells2.cc10
-rw-r--r--src/store.cc6
-rw-r--r--src/tables.cc214
-rw-r--r--src/tables.hpp1
-rw-r--r--src/util.cc25
-rw-r--r--src/variable.cc5
-rw-r--r--src/variable.hpp2
-rw-r--r--src/wild.cc7
-rw-r--r--src/xtra1.cc19
-rw-r--r--src/xtra2.cc12
32 files changed, 770 insertions, 809 deletions
diff --git a/src/birth.cc b/src/birth.cc
index e581d8f0..c4d3718e 100644
--- a/src/birth.cc
+++ b/src/birth.cc
@@ -820,11 +820,7 @@ static void player_wipe(void)
p_ptr->food = PY_FOOD_FULL - 1;
/* Clear "cheat" options */
- cheat_peek = FALSE;
- cheat_hear = FALSE;
- cheat_room = FALSE;
- cheat_xtra = FALSE;
- cheat_live = FALSE;
+ options->reset_cheat_options();
/* Assume no winning game */
total_winner = 0;
@@ -2174,7 +2170,7 @@ static bool_ player_birth_aux_ask()
/*** User enters number of quests ***/
/* Heino Vander Sanden and Jimmy De Laet */
- if (!ironman_rooms)
+ if (!options->ironman_rooms)
{
if (do_quick_start)
{
@@ -2467,7 +2463,7 @@ static bool_ player_birth_aux_auto()
/* Initialize */
- if (autoroll)
+ if (options->autoroll)
{
int mval[6];
@@ -2530,7 +2526,7 @@ static bool_ player_birth_aux_auto()
if (!askfor_aux(inp, 8)) inp[0] = '\0';
/* Weirdos stat display .. erm .. I mean, original stat display */
- if (!linear_stats)
+ if (!options->linear_stats)
{
/* Hack -- add a fake slash */
strcat(inp, "/");
@@ -2570,7 +2566,7 @@ static bool_ player_birth_aux_auto()
while (TRUE)
{
/* Feedback */
- if (autoroll)
+ if (options->autoroll)
{
Term_clear();
@@ -2610,7 +2606,7 @@ static bool_ player_birth_aux_auto()
}
/* Auto-roll */
- while (autoroll)
+ while (options->autoroll)
{
bool_ accept = TRUE;
@@ -2832,7 +2828,7 @@ static bool_ player_birth_aux()
else
{
/* Point based */
- if (point_based)
+ if (options->point_based)
{
if (!player_birth_aux_point()) return FALSE;
}
diff --git a/src/cave.cc b/src/cave.cc
index 22ec8d39..956088e0 100644
--- a/src/cave.cc
+++ b/src/cave.cc
@@ -940,7 +940,7 @@ static void map_info(int y, int x, byte *ap, char *cp)
/**** Step 2 -- Apply special random effects ****/
- if (!avoid_other && !avoid_shimmer)
+ if (!options->avoid_other && !options->avoid_shimmer)
{
/* Special terrain effect */
if (c_ptr->effect)
@@ -971,7 +971,7 @@ static void map_info(int y, int x, byte *ap, char *cp)
*/
/* view_special_lite: lighting effects for boring features */
- if (view_special_lite &&
+ if (options->view_special_lite &&
((f_ptr->flags & (FF_FLOOR | FF_REMEMBER)) == FF_FLOOR))
{
if (!p_ptr->wild_mode && !(info & (CAVE_TRDT)))
@@ -980,7 +980,7 @@ static void map_info(int y, int x, byte *ap, char *cp)
if (info & (CAVE_SEEN))
{
/* Only lit by "torch" light */
- if (view_yellow_lite && !(info & (CAVE_GLOW)))
+ if (options->view_yellow_lite && !(info & (CAVE_GLOW)))
{
/* Use "yellow" */
a = TERM_YELLOW;
@@ -1002,7 +1002,7 @@ static void map_info(int y, int x, byte *ap, char *cp)
}
/* "Out-of-sight" glowing grids -- handle "view_bright_lite" */
- else if (view_bright_lite)
+ else if (options->view_bright_lite)
{
/* Use darker colour */
a = dark_attrs[a & 0xF];
@@ -1011,7 +1011,7 @@ static void map_info(int y, int x, byte *ap, char *cp)
}
/* view_granite_lite: lighting effects for walls and doors */
- else if (view_granite_lite &&
+ else if (options->view_granite_lite &&
(f_ptr->flags & (FF_NO_VISION | FF_DOOR)))
{
if (!p_ptr->wild_mode && !(info & (CAVE_TRDT)))
@@ -1030,7 +1030,7 @@ static void map_info(int y, int x, byte *ap, char *cp)
}
/* Handle "view_bright_lite" */
- else if (view_bright_lite)
+ else if (options->view_bright_lite)
{
/* Use darker colour */
a = dark_attrs[a & 0xF];
@@ -1092,7 +1092,7 @@ static void map_info(int y, int x, byte *ap, char *cp)
*ap = object_attr(o_ptr);
/* Multi-hued attr */
- if (!avoid_other && (k_info[o_ptr->k_idx].flags & TR_ATTR_MULTI))
+ if (!options->avoid_other && (k_info[o_ptr->k_idx].flags & TR_ATTR_MULTI))
{
*ap = get_shimmer_color();
}
@@ -1129,7 +1129,7 @@ static void map_info(int y, int x, byte *ap, char *cp)
*ap = object_attr(o_ptr);
/* Multi-hued attr */
- if (!avoid_other && (k_info[o_ptr->k_idx].flags & TR_ATTR_MULTI))
+ if (!options->avoid_other && (k_info[o_ptr->k_idx].flags & TR_ATTR_MULTI))
{
*ap = get_shimmer_color();
}
@@ -1148,7 +1148,7 @@ static void map_info(int y, int x, byte *ap, char *cp)
a = r_ptr->x_attr;
/* Ignore weird codes */
- if (avoid_other)
+ if (options->avoid_other)
{
/* Use char */
*cp = c;
@@ -1237,7 +1237,7 @@ static void map_info(int y, int x, byte *ap, char *cp)
monster_race *r_ptr = &r_info[p_ptr->body_monster];
/* Get the "player" attr */
- if (!avoid_other && (r_ptr->flags & RF_ATTR_MULTI))
+ if (!options->avoid_other && (r_ptr->flags & RF_ATTR_MULTI))
{
a = get_shimmer_color();
}
@@ -1250,7 +1250,7 @@ static void map_info(int y, int x, byte *ap, char *cp)
c = r_ptr->x_char;
/* Show player health char instead? */
- if (player_char_health)
+ if (options->player_char_health)
{
int percent = p_ptr->chp * 10 / p_ptr->mhp;
@@ -1279,10 +1279,13 @@ void map_info_default(int y, int x, byte *ap, char *cp)
byte c;
+ /* Shorthand */
+ auto const avoid_other = options->avoid_other;
+
/**** Preparation ****/
/* Access the grid */
- cave_type *c_ptr = &cave[y][x];
+ auto const c_ptr = &cave[y][x];
/* Cache some frequently used values */
@@ -1304,7 +1307,7 @@ void map_info_default(int y, int x, byte *ap, char *cp)
}
/* Access floor */
- feature_type *f_ptr = &f_info[feat];
+ feature_type const *f_ptr = &f_info[feat];
/**** Layer 1 -- Terrain feature ****/
@@ -1405,7 +1408,7 @@ void map_info_default(int y, int x, byte *ap, char *cp)
*/
/* view_special_lite: lighting effects for boring features */
- if (view_special_lite &&
+ if (options->view_special_lite &&
((f_ptr->flags & (FF_FLOOR | FF_REMEMBER)) == FF_FLOOR))
{
if (!p_ptr->wild_mode && !(info & (CAVE_TRDT)))
@@ -1414,7 +1417,7 @@ void map_info_default(int y, int x, byte *ap, char *cp)
if (info & (CAVE_SEEN))
{
/* Only lit by "torch" light */
- if (view_yellow_lite && !(info & (CAVE_GLOW)))
+ if (options->view_yellow_lite && !(info & (CAVE_GLOW)))
{
/* Use "yellow" */
a = TERM_YELLOW;
@@ -1436,7 +1439,7 @@ void map_info_default(int y, int x, byte *ap, char *cp)
}
/* "Out-of-sight" glowing grids -- handle "view_bright_lite" */
- else if (view_bright_lite)
+ else if (options->view_bright_lite)
{
/* Use darker colour */
a = dark_attrs[a & 0xF];
@@ -1445,7 +1448,7 @@ void map_info_default(int y, int x, byte *ap, char *cp)
}
/* view_granite_lite: lighting effects for walls and doors */
- else if (view_granite_lite &&
+ else if (options->view_granite_lite &&
(f_ptr->flags & (FF_NO_VISION | FF_DOOR)))
{
if (!p_ptr->wild_mode && !(info & (CAVE_TRDT)))
@@ -1464,7 +1467,7 @@ void map_info_default(int y, int x, byte *ap, char *cp)
}
/* Handle "view_bright_lite" */
- else if (view_bright_lite)
+ else if (options->view_bright_lite)
{
/* Use darker colour */
a = dark_attrs[a & 0xF];
@@ -1799,18 +1802,18 @@ void note_spot(int y, int x)
/* Hack -- memorize grids */
- if (!(info & (CAVE_MARK)))
+ if (!(info & CAVE_MARK))
{
/* Memorise some "boring" grids */
if (cave_plain_floor_grid(c_ptr))
{
/* Option -- memorise certain floors */
- if ((info & (CAVE_TRDT)) ||
- ((info & (CAVE_GLOW)) && view_perma_grids ) ||
- view_torch_grids)
+ if ((info & CAVE_TRDT) ||
+ ((info & CAVE_GLOW) && options->view_perma_grids) ||
+ options->view_torch_grids)
{
/* Memorize */
- c_ptr->info |= (CAVE_MARK);
+ c_ptr->info |= CAVE_MARK;
}
}
@@ -1818,7 +1821,7 @@ void note_spot(int y, int x)
else
{
/* Memorize */
- c_ptr->info |= (CAVE_MARK);
+ c_ptr->info |= CAVE_MARK;
}
}
}
@@ -2036,9 +2039,6 @@ void display_map(int *cy, int *cx)
byte tp;
- bool_ old_view_special_lite;
- bool_ old_view_granite_lite;
-
int hgt, wid, yrat, xrat, yfactor, xfactor;
@@ -2063,12 +2063,12 @@ void display_map(int *cy, int *cx)
/* Save lighting effects */
- old_view_special_lite = view_special_lite;
- old_view_granite_lite = view_granite_lite;
+ auto const old_view_special_lite = options->view_special_lite;
+ auto const old_view_granite_lite = options->view_granite_lite;
/* Disable lighting effects */
- view_special_lite = FALSE;
- view_granite_lite = FALSE;
+ options->view_special_lite = FALSE;
+ options->view_granite_lite = FALSE;
/* Set up initial maps */
@@ -2165,8 +2165,8 @@ void display_map(int *cy, int *cx)
*cx = p_ptr->px * xfactor / xrat + COL_MAP;
/* Restore lighting effects */
- view_special_lite = old_view_special_lite;
- view_granite_lite = old_view_granite_lite;
+ options->view_special_lite = old_view_special_lite;
+ options->view_granite_lite = old_view_granite_lite;
}
@@ -3871,7 +3871,7 @@ void update_flow(void)
int x, y, d;
/* Hack -- disabled */
- if (!flow_by_sound) return;
+ if (!options->flow_by_sound) return;
/* Paranoia -- make sure the array is empty */
if (temp_n) return;
@@ -4057,7 +4057,7 @@ void wiz_lite(void)
}
/* Normally, memorize floors (see above) */
- if (view_perma_grids && !view_torch_grids)
+ if (options->view_perma_grids && !options->view_torch_grids)
{
/* Memorize the grid */
c_ptr->info |= (CAVE_MARK);
@@ -4454,7 +4454,10 @@ void disturb(int stop_search)
}
/* Flush the input if requested */
- if (flush_disturb) flush();
+ if (options->flush_disturb)
+ {
+ flush();
+ }
}
@@ -4464,7 +4467,7 @@ void disturb(int stop_search)
*/
void disturb_on_state()
{
- if (disturb_state)
+ if (options->disturb_state)
{
disturb(0);
}
@@ -4477,7 +4480,7 @@ void disturb_on_state()
*/
void disturb_on_other()
{
- if (disturb_other)
+ if (options->disturb_other)
{
disturb(1);
}
diff --git a/src/cmd1.cc b/src/cmd1.cc
index d0541eb3..c54e3dbd 100644
--- a/src/cmd1.cc
+++ b/src/cmd1.cc
@@ -1770,7 +1770,7 @@ static void py_attack_hand(int *k, monster_type *m_ptr, s32b *special)
{
old_ptr = ma_ptr;
- if (wizard && cheat_xtra)
+ if (wizard && options->cheat_xtra)
{
msg_print("Attack re-selected.");
}
@@ -2403,7 +2403,7 @@ void py_attack(int y, int x, int max_blow)
{
drain_heal = damroll(4, (drain_result / 6));
- if (cheat_xtra)
+ if (options->cheat_xtra)
{
msg_format("Draining left: %d", drain_left);
}
@@ -3080,7 +3080,7 @@ void move_player_aux(int dir, int do_pickup, int run, bool_ disarm)
new_dtrap = ((cave[y][x].info & CAVE_DETECT) != 0);
/* Normal movement */
- if (oktomove && running && disturb_detect)
+ if (oktomove && running && options->disturb_detect)
{
/*
* Disturb the player when about to leave the trap detected
@@ -3720,7 +3720,7 @@ static bool_ run_test(void)
case FEAT_BROKEN:
{
/* Option -- ignore */
- if (find_ignore_doors) notice = FALSE;
+ if (options->find_ignore_doors) notice = FALSE;
/* Done */
break;
@@ -3746,7 +3746,7 @@ static bool_ run_test(void)
case FEAT_BETWEEN2:
{
/* Option -- ignore */
- if (find_ignore_stairs) notice = FALSE;
+ if (options->find_ignore_stairs) notice = FALSE;
/* Done */
break;
@@ -3925,7 +3925,7 @@ static bool_ run_test(void)
}
/* Two options, examining corners */
- else if (find_examine && !find_cut)
+ else if (options->find_examine && !options->find_cut)
{
/* Primary option */
find_current = option;
@@ -3947,7 +3947,7 @@ static bool_ run_test(void)
{
/* Can not see anything ahead and in the direction we */
/* are turning, assume that it is a potential corner. */
- if (find_examine &&
+ if (options->find_examine &&
see_nothing(option, row, col) &&
see_nothing(option2, row, col))
{
@@ -3963,7 +3963,7 @@ static bool_ run_test(void)
}
/* This corner is seen to be enclosed; we cut the corner. */
- else if (find_cut)
+ else if (options->find_cut)
{
find_current = option2;
find_prevdir = option2;
@@ -4044,7 +4044,7 @@ void run_step(int dir)
/* Move the player, using the "pickup" flag */
- move_player_aux(find_current, always_pickup, 1, TRUE);
+ move_player_aux(find_current, options->always_pickup, 1, TRUE);
}
diff --git a/src/cmd2.cc b/src/cmd2.cc
index 7f57bd08..a67f1fda 100644
--- a/src/cmd2.cc
+++ b/src/cmd2.cc
@@ -140,7 +140,7 @@ static bool_ stair_hooks(stairs_direction direction)
*/
static bool ask_leave()
{
- if (confirm_stairs)
+ if (options->confirm_stairs)
{
if (get_check("Really leave the level? "))
{
@@ -2102,7 +2102,7 @@ void do_cmd_disarm(void)
more = FALSE;
}
else
- more = do_cmd_disarm_aux(y, x, dir, always_pickup);
+ more = do_cmd_disarm_aux(y, x, dir, options->always_pickup);
}
}
@@ -2185,7 +2185,7 @@ static bool_ do_cmd_bash_aux(int y, int x, int dir)
}
/* Hack -- Fall through the door. Can't disarm while falling. */
- move_player_aux(dir, always_pickup, 0, FALSE);
+ move_player_aux(dir, options->always_pickup, 0, FALSE);
/* Update some things */
p_ptr->update |= (PU_VIEW | PU_MON_LITE);
@@ -2389,7 +2389,7 @@ void do_cmd_alter(void)
else if (c_ptr->t_idx != 0)
{
/* Tunnel */
- more = do_cmd_disarm_aux(y, x, dir, always_pickup);
+ more = do_cmd_disarm_aux(y, x, dir, options->always_pickup);
}
/* Oops */
@@ -2713,7 +2713,7 @@ static void do_cmd_unwalk()
else if (((feat >= FEAT_QUEST_ENTER) && (feat <= FEAT_QUEST_UP)) ||
((feat >= FEAT_LESS) && (feat <= FEAT_MORE)))
{
- move_player(dir, always_pickup, TRUE);
+ move_player(dir, options->always_pickup, TRUE);
more = FALSE;
}
@@ -2730,7 +2730,7 @@ static void do_cmd_unwalk()
while (dir == 5);
}
- move_player(dir, always_pickup, TRUE);
+ move_player(dir, options->always_pickup, TRUE);
}
/* Walking semantics */
@@ -3124,7 +3124,7 @@ void do_cmd_fire(void)
char o_name[80];
- int msec = delay_factor * delay_factor * delay_factor;
+ auto const msec = options->delay_factor_ms();
/* Get the "bow" (if any) */
@@ -3554,7 +3554,7 @@ void do_cmd_throw(void)
char o_name[80];
- int msec = delay_factor * delay_factor * delay_factor;
+ auto const msec = options->delay_factor_ms();
/* Get an item */
int item;
@@ -3925,7 +3925,7 @@ void do_cmd_boomerang(void)
s32b special = 0;
- int msec = delay_factor * delay_factor * delay_factor;
+ auto const msec = options->delay_factor_ms();
/* Get the "bow" (if any) */
@@ -4367,7 +4367,7 @@ void do_cmd_immovable_special(void)
if (!get_aim_dir(&dir)) return;
fetch(dir, p_ptr->lev * 15, FALSE);
- py_pickup_floor(always_pickup);
+ py_pickup_floor(options->always_pickup);
did_act = TRUE;
break;
diff --git a/src/cmd3.cc b/src/cmd3.cc
index dd837906..b6787d56 100644
--- a/src/cmd3.cc
+++ b/src/cmd3.cc
@@ -248,7 +248,7 @@ void do_cmd_wield(void)
return;
}
- if ((cursed_p(o_ptr)) && (wear_confirm)
+ if ((cursed_p(o_ptr)) && (options->wear_confirm)
&& (object_known_p(o_ptr) || (o_ptr->ident & (IDENT_SENSE))))
{
char dummy[512];
diff --git a/src/cmd4.cc b/src/cmd4.cc
index 0d15e0b8..2b51a102 100644
--- a/src/cmd4.cc
+++ b/src/cmd4.cc
@@ -500,7 +500,7 @@ namespace {
/**
* Interact with given vector of options.
*/
-static void interact_with_options(std::vector<option_type *> const &options, char const *info, interaction_mode_t interaction_mode)
+static void interact_with_options(std::vector<option_type> const &options, char const *info, interaction_mode_t interaction_mode)
{
size_t n = options.size();
@@ -528,9 +528,9 @@ static void interact_with_options(std::vector<option_type *> const &options, cha
/* Display the option text */
strnfmt(buf, 80, "%-48s: %s (%s)",
- options[i]->o_desc,
- (*options[i]->o_var ? "yes" : "no "),
- options[i]->o_text);
+ options[i].o_desc,
+ (*options[i].o_var) ? "yes" : "no ",
+ options[i].o_text);
c_prt(a, buf, i + 2, 0);
}
@@ -586,7 +586,7 @@ static void interact_with_options(std::vector<option_type *> const &options, cha
{
break;
}
- *(options[k]->o_var) = TRUE;
+ *(options[k].o_var) = TRUE;
k = (k + 1) % n;
break;
}
@@ -600,7 +600,7 @@ static void interact_with_options(std::vector<option_type *> const &options, cha
break;
}
- *(options[k]->o_var) = FALSE;
+ *(options[k].o_var) = FALSE;
k = (k + 1) % n;
break;
}
@@ -620,55 +620,26 @@ static void interact_with_options(std::vector<option_type *> const &options, cha
/*
- * Cheating options
- */
-static option_type cheat_info[6] =
-{
- { &cheat_peek, FALSE, 0, 0, "cheat_peek", "Peek into object creation" },
- { &cheat_hear, FALSE, 0, 1, "cheat_hear", "Peek into monster creation" },
- { &cheat_room, FALSE, 0, 2, "cheat_room", "Peek into dungeon creation" },
- { &cheat_xtra, FALSE, 0, 3, "cheat_xtra", "Peek into something else" },
- { &cheat_live, FALSE, 0, 5, "cheat_live", "Allow player to avoid death" }
-};
-
-/*
* Interact with some options for cheating
*/
static void do_cmd_options_cheat(cptr info)
{
- // Calculate number of cheat options
- size_t n = std::distance(std::begin(cheat_info), std::end(cheat_info));
-
- // Build the vector of options we're going to interact with
- std::vector<option_type *> options;
- options.reserve(n);
- for (auto &option : cheat_info)
- {
- options.push_back(&option);
- }
-
// Interact
- interact_with_options(options, info, interaction_mode_t::READ_WRITE);
+ interact_with_options(options->cheat_options, info, interaction_mode_t::READ_WRITE);
// If user toggled any of the options to TRUE, then we add those cheats
// to the player's "noscore" flags. Note that it doesn't matter what the
// previous value was -- we don't "unset" noscore flags anyway.
- for (auto &option: options)
+ for (auto const &option: options->cheat_options)
{
- if (*option->o_var)
+ if (*option.o_var)
{
- noscore |= (option->o_page * 256 + option->o_bit);
+ noscore |= (option.o_page * 256 + option.o_bit);
}
}
}
-static option_type autosave_info[2] =
-{
- { &autosave_l, FALSE, 0, 6, "autosave_l", "Autosave when entering new levels" },
- { &autosave_t, FALSE, 0, 7, "autosave_t", "Timed autosave" },
-};
-
s16b toggle_frequency(s16b current)
{
if (current == 0) return (50);
@@ -692,7 +663,9 @@ static void do_cmd_options_autosave(cptr info)
{
char ch;
- int i, k = 0, n = 2;
+ int i, k = 0;
+
+ int n = options->autosave_options.size();
int dir;
@@ -719,15 +692,18 @@ static void do_cmd_options_autosave(cptr info)
/* Color current option */
if (i == k) a = TERM_L_BLUE;
+ /* Get the option */
+ auto const option = &options->autosave_options[i];
+
/* Display the option text */
strnfmt(buf, 80, "%-48s: %s (%s)",
- autosave_info[i].o_desc,
- (*autosave_info[i].o_var ? "yes" : "no "),
- autosave_info[i].o_text);
+ option->o_desc,
+ (*option->o_var) ? "yes" : "no ",
+ option->o_text);
c_prt(a, buf, i + 2, 0);
}
- prt(format("Timed autosave frequency: every %d turns", autosave_freq), 5, 0);
+ prt(format("Timed autosave frequency: every %d turns", options->autosave_freq), 5, 0);
/* Hilite current option */
@@ -773,8 +749,7 @@ static void do_cmd_options_autosave(cptr info)
case 'Y':
case '6':
{
-
- (*autosave_info[k].o_var) = TRUE;
+ (*options->autosave_options[k].o_var) = TRUE;
k = (k + 1) % n;
break;
@@ -784,7 +759,7 @@ static void do_cmd_options_autosave(cptr info)
case 'N':
case '4':
{
- (*autosave_info[k].o_var) = FALSE;
+ (*options->autosave_options[k].o_var) = FALSE;
k = (k + 1) % n;
break;
@@ -793,9 +768,9 @@ static void do_cmd_options_autosave(cptr info)
case 'f':
case 'F':
{
- autosave_freq = toggle_frequency(autosave_freq);
- prt(format("Timed autosave frequency: every %d turns",
- autosave_freq), 5, 0);
+ options->autosave_freq = toggle_frequency(options->autosave_freq);
+ prt(fmt::format("Timed autosave frequency: every {} turns",
+ options->autosave_freq), 5, 0);
break;
}
@@ -816,21 +791,22 @@ static void do_cmd_options_autosave(cptr info)
void do_cmd_options_aux(int page, cptr info, bool_ read_only)
{
// Scrape together all the options from the relevant page.
- std::vector<option_type *> options;
- options.reserve(64); // Seems a reasonable number; anything more would be unusable anyway
- for (size_t i = 0; option_info[i].o_desc; i++)
- {
- if (option_info[i].o_page == page)
- {
- options.push_back(&option_info[i]);
- }
- }
+ std::vector<option_type> page_options;
+ page_options.reserve(options->standard_options.size());
+ std::copy_if(
+ std::begin(options->standard_options),
+ std::end(options->standard_options),
+ std::back_inserter(page_options),
+ [=](option_type const &option) -> bool {
+ return (option.o_page == page);
+ }
+ );
// Interact with the options
interaction_mode_t interaction_mode = read_only
? interaction_mode_t::READ_ONLY
: interaction_mode_t::READ_WRITE;
- interact_with_options(options, info, interaction_mode);
+ interact_with_options(page_options, info, interaction_mode);
}
@@ -1042,25 +1018,25 @@ static errr option_dump(cptr fname)
fprintf(fff, "# Automatic option dump\n\n");
/* Dump options (skip cheat, adult, score) */
- for (i = 0; option_info[i].o_var != NULL; i++)
+ for (auto const &option: options->standard_options)
{
/* Require a real option */
- if (!option_info[i].o_text) continue;
+ if (!option.o_text) continue;
/* No birth options */
- if (option_info[i].o_page == 6) continue;
+ if (option.o_page == 6) continue;
/* Comment */
- fprintf(fff, "# Option '%s'\n", option_info[i].o_desc);
+ fprintf(fff, "# Option '%s'\n", option.o_desc);
/* Dump the option */
- if ((*option_info[i].o_var))
+ if (*option.o_var)
{
- fprintf(fff, "Y:%s\n", option_info[i].o_text);
+ fprintf(fff, "Y:%s\n", option.o_text);
}
else
{
- fprintf(fff, "X:%s\n", option_info[i].o_text);
+ fprintf(fff, "X:%s\n", option.o_text);
}
/* Skip a line */
@@ -1345,14 +1321,26 @@ void do_cmd_options(void)
/* Get a new value */
while (1)
{
- int msec = delay_factor * delay_factor * delay_factor;
- prt(format("Current base delay factor: %d (%d msec)",
- delay_factor, msec), 22, 0);
+ auto const msec = options->delay_factor_ms();
+
+ prt(fmt::format("Current base delay factor: {:d} ({:d} msec)",
+ options->delay_factor, msec), 22, 0);
prt("Delay Factor (0-9 or ESC to accept): ", 23, 0);
+
k = inkey();
- if (k == ESCAPE) break;
- if (isdigit(k)) delay_factor = D2I(k);
- else bell();
+ if (k == ESCAPE)
+ {
+ break;
+ }
+
+ if (isdigit(k))
+ {
+ options->delay_factor = D2I(k);
+ }
+ else
+ {
+ bell();
+ }
}
break;
@@ -1368,13 +1356,24 @@ void do_cmd_options(void)
/* Get a new value */
while (1)
{
- prt(format("Current hitpoint warning: %d0%%",
- hitpoint_warn), 22, 0);
+ prt(fmt::format("Current hitpoint warning: {:d}0%",
+ options->hitpoint_warn), 22, 0);
prt("Hitpoint Warning (0-9 or ESC to accept): ", 20, 0);
+
k = inkey();
- if (k == ESCAPE) break;
- if (isdigit(k)) hitpoint_warn = D2I(k);
- else bell();
+ if (k == ESCAPE)
+ {
+ break;
+ }
+
+ if (isdigit(k))
+ {
+ options->hitpoint_warn = D2I(k);
+ }
+ else
+ {
+ bell();
+ }
}
break;
diff --git a/src/dungeon.cc b/src/dungeon.cc
index 076369dd..b2f8aa25 100644
--- a/src/dungeon.cc
+++ b/src/dungeon.cc
@@ -1274,7 +1274,7 @@ static void process_world(void)
}
/* Check the fate */
- if (fate_option && (p_ptr->lev > 10))
+ if (options->fate_option && (p_ptr->lev > 10))
{
/*
* WAS: == 666 against randint(50000).
@@ -1301,9 +1301,9 @@ static void process_world(void)
}
/*** Attempt timed autosave ***/
- if (autosave_t && autosave_freq)
+ if (options->autosave_t && options->autosave_freq)
{
- if ((turn % ((s32b)autosave_freq * 10)) == 0)
+ if ((turn % (static_cast<s32b>(options->autosave_freq) * 10)) == 0)
{
is_autosave = TRUE;
msg_print("Autosaving the game...");
@@ -1341,10 +1341,13 @@ static void process_world(void)
c_ptr = &cave[y][x];
/* Assume lit */
- c_ptr->info |= (CAVE_GLOW);
+ c_ptr->info |= CAVE_GLOW;
/* Hack -- Memorize lit grids if allowed */
- if (view_perma_grids) c_ptr->info |= (CAVE_MARK);
+ if (options->view_perma_grids)
+ {
+ c_ptr->info |= CAVE_MARK;
+ }
/* Hack -- Notice spot */
note_spot(y, x);
@@ -1847,7 +1850,7 @@ static void process_world(void)
if (p_ptr->necro_extra & CLASS_UNDEAD)
{
int old_chp = p_ptr->chp;
- int warning = (p_ptr->mhp * hitpoint_warn / 10);
+ int warning = (p_ptr->mhp * options->hitpoint_warn / 10);
/* Bypass invulnerability and wraithform */
p_ptr->chp--;
@@ -1861,10 +1864,10 @@ static void process_world(void)
/* Dead player */
if (p_ptr->chp < 0)
{
- bool_ old_quick = quick_messages;
+ bool_ old_quick = options->quick_messages;
/* Hack -- Note death */
- if (!last_words)
+ if (!options->last_words)
{
msg_print("You die.");
msg_print(NULL);
@@ -1891,12 +1894,12 @@ static void process_world(void)
/* Note death */
death = TRUE;
- quick_messages = FALSE;
+ options->quick_messages = FALSE;
if (get_check("Make a last screenshot? "))
{
do_cmd_html_dump();
}
- quick_messages = old_quick;
+ options->quick_messages = old_quick;
/* Dead */
return;
@@ -2610,7 +2613,10 @@ static void process_world(void)
/* The light is getting dim */
else if ((o_ptr->timeout < 100) && (o_ptr->timeout % 10 == 0))
{
- if (disturb_minor) disturb(0);
+ if (options->disturb_minor)
+ {
+ disturb(0);
+ }
cmsg_print(TERM_YELLOW, "Your light is growing faint.");
}
}
@@ -3370,7 +3376,7 @@ static void process_command(void)
{
if (do_control_walk()) break;
- do_cmd_walk(always_pickup, TRUE);
+ do_cmd_walk(options->always_pickup, TRUE);
break;
}
@@ -3380,7 +3386,7 @@ static void process_command(void)
{
if (do_control_walk()) break;
- do_cmd_walk(!always_pickup, TRUE);
+ do_cmd_walk(!options->always_pickup, TRUE);
break;
}
@@ -3400,7 +3406,7 @@ static void process_command(void)
case ',':
{
if (do_control_pickup()) break;
- do_cmd_stay(always_pickup);
+ do_cmd_stay(options->always_pickup);
break;
}
@@ -3408,7 +3414,7 @@ static void process_command(void)
case 'g':
{
if (p_ptr->control) break;
- do_cmd_stay(!always_pickup);
+ do_cmd_stay(!options->always_pickup);
break;
}
@@ -4139,7 +4145,7 @@ static void process_command(void)
case CMD_BLUNDER:
{
if (do_control_walk()) break;
- do_cmd_walk(always_pickup, FALSE);
+ do_cmd_walk(options->always_pickup, FALSE);
break;
}
/* Hack -- Unknown command */
@@ -4253,7 +4259,7 @@ static void process_player(void)
}
/* Handle "abort" */
- if (!avoid_abort)
+ if (!options->avoid_abort)
{
/* Check for "player abort" (semi-efficiently for resting) */
if (running || command_rep || (resting && !(resting & 0x0F)))
@@ -4300,7 +4306,7 @@ static void process_player(void)
move_cursor_relative(p_ptr->py, p_ptr->px);
/* Refresh (optional) */
- if (fresh_before) Term_fresh();
+ if (options->fresh_before) Term_fresh();
/* Hack -- Pack Overflow */
if (p_ptr->inventory[INVEN_PACK].k_idx)
@@ -4443,7 +4449,7 @@ static void process_player(void)
/* Shimmer monsters if needed */
- if (!avoid_other && shimmer_monsters)
+ if (!options->avoid_other && shimmer_monsters)
{
/* Clear the flag */
shimmer_monsters = FALSE;
@@ -4472,7 +4478,7 @@ static void process_player(void)
}
/* Shimmer objects if needed and requested */
- if (!avoid_other && !avoid_shimmer && shimmer_objects)
+ if (!options->avoid_other && !options->avoid_shimmer && shimmer_objects)
{
/* Clear the flag */
shimmer_objects = FALSE;
@@ -4508,7 +4514,7 @@ static void process_player(void)
* fast, and that's why shimmering has been limited to small
* number of monsters -- pelpel
*/
- if (!avoid_other && !avoid_shimmer &&
+ if (!options->avoid_other && !options->avoid_shimmer &&
!resting && !running)
{
for (j = panel_row_min; j <= panel_row_max; j++)
@@ -4685,8 +4691,8 @@ static void dungeon(void)
if (!dun_level) create_down_shaft = create_up_shaft = FALSE;
/* Option -- no connected stairs */
- if (!dungeon_stair) create_down_stair = create_up_stair = FALSE;
- if (!dungeon_stair) create_down_shaft = create_up_shaft = FALSE;
+ if (!options->dungeon_stair) create_down_stair = create_up_stair = FALSE;
+ if (!options->dungeon_stair) create_down_shaft = create_up_shaft = FALSE;
/* no connecting stairs on special levels */
if (!(dungeon_flags & DF_NO_STAIR)) create_down_stair = create_up_stair = FALSE;
@@ -4893,7 +4899,7 @@ static void dungeon(void)
move_cursor_relative(p_ptr->py, p_ptr->px);
/* Optional fresh */
- if (fresh_after) Term_fresh();
+ if (options->fresh_after) Term_fresh();
/* Hack -- Notice death or departure */
if (!alive || death) break;
@@ -4921,7 +4927,7 @@ static void dungeon(void)
move_cursor_relative(p_ptr->py, p_ptr->px);
/* Optional fresh */
- if (fresh_after) Term_fresh();
+ if (options->fresh_after) Term_fresh();
/* Hack -- Notice death or departure */
if (!alive || death) break;
@@ -4955,7 +4961,7 @@ static void dungeon(void)
move_cursor_relative(p_ptr->py, p_ptr->px);
/* Optional fresh */
- if (fresh_after) Term_fresh();
+ if (options->fresh_after) Term_fresh();
/* Hack -- Notice death or departure */
if (!alive || death) break;
@@ -5142,26 +5148,21 @@ void play_game()
}
/* Extract the options */
- for (i = 0; option_info[i].o_desc; i++)
+ for (auto const &option: options->standard_options)
{
- int os = option_info[i].o_page;
- int ob = option_info[i].o_bit;
+ int os = option.o_page;
+ int ob = option.o_bit;
/* Set the "default" options */
- if (option_info[i].o_var)
+ if (option.o_var)
{
- /* Set */
if (option_flag[os] & (1L << ob))
{
- /* Set */
- (*option_info[i].o_var) = TRUE;
+ *option.o_var = TRUE;
}
-
- /* Clear */
else
{
- /* Clear */
- (*option_info[i].o_var) = FALSE;
+ *option.o_var = FALSE;
}
}
}
@@ -5232,8 +5233,8 @@ void play_game()
load_all_pref_files();
/* Set or clear "rogue_like_commands" if requested */
- if (arg_force_original) rogue_like_commands = FALSE;
- if (arg_force_roguelike) rogue_like_commands = TRUE;
+ if (arg_force_original) options->rogue_like_commands = FALSE;
+ if (arg_force_roguelike) options->rogue_like_commands = TRUE;
/* Initialize vault info */
if (init_v_info()) quit("Cannot initialize vaults");
@@ -5409,7 +5410,7 @@ void play_game()
}
/* Cheat death option */
- else if ((wizard || cheat_live) && !get_check("Die? "))
+ else if ((wizard || options->cheat_live) && !get_check("Die? "))
{
cheat_death = TRUE;
diff --git a/src/files.cc b/src/files.cc
index 1f0d72d9..4e70acde 100644
--- a/src/files.cc
+++ b/src/files.cc
@@ -594,14 +594,12 @@ errr process_pref_file_aux(char *buf)
/* Process "X:<str>" -- turn option off */
else if (buf[0] == 'X')
{
- for (i = 0; option_info[i].o_desc; i++)
+ for (auto const &option: options->standard_options)
{
- if (option_info[i].o_var &&
- option_info[i].o_text &&
- streq(option_info[i].o_text, buf + 2))
+ if (option.o_var && streq(option.o_text, buf + 2))
{
- (*option_info[i].o_var) = FALSE;
- return (0);
+ *option.o_var = FALSE;
+ return 0;
}
}
}
@@ -609,14 +607,12 @@ errr process_pref_file_aux(char *buf)
/* Process "Y:<str>" -- turn option on */
else if (buf[0] == 'Y')
{
- for (i = 0; option_info[i].o_desc; i++)
+ for (auto const &option: options->standard_options)
{
- if (option_info[i].o_var &&
- option_info[i].o_text &&
- streq(option_info[i].o_text, buf + 2))
+ if (option.o_var && streq(option.o_text, buf + 2))
{
- (*option_info[i].o_var) = TRUE;
- return (0);
+ *option.o_var = TRUE;
+ return 0;
}
}
}
@@ -1175,7 +1171,7 @@ static void display_player_middle(void)
{
color = TERM_L_BLUE;
}
- else if (p_ptr->chp > (p_ptr->mhp * hitpoint_warn) / 10)
+ else if (p_ptr->chp > (p_ptr->mhp * options->hitpoint_warn) / 10)
{
color = TERM_VIOLET;
}
@@ -1196,7 +1192,7 @@ static void display_player_middle(void)
{
color = TERM_L_GREEN;
}
- else if (p_ptr->chp > (p_ptr->mhp * hitpoint_warn) / 10)
+ else if (p_ptr->chp > (p_ptr->mhp * options->hitpoint_warn) / 10)
{
color = TERM_YELLOW;
}
@@ -1216,7 +1212,7 @@ static void display_player_middle(void)
{
color = TERM_L_GREEN;
}
- else if (p_ptr->csp > (p_ptr->msp * hitpoint_warn) / 10)
+ else if (p_ptr->csp > (p_ptr->msp * options->hitpoint_warn) / 10)
{
color = TERM_YELLOW;
}
@@ -1235,7 +1231,7 @@ static void display_player_middle(void)
{
color = TERM_L_GREEN;
}
- else if (p_ptr->csane > (p_ptr->msane * hitpoint_warn) / 10)
+ else if (p_ptr->csane > (p_ptr->msane * options->hitpoint_warn) / 10)
{
color = TERM_YELLOW;
}
@@ -2657,34 +2653,34 @@ errr file_character(cptr name, bool_ full)
/* List the patches */
fprintf(fff, "\n\n [Miscellaneous information]\n");
- if (joke_monsters)
+ if (options->joke_monsters)
fprintf(fff, "\n Joke monsters: ON");
else
fprintf(fff, "\n Joke monsters: OFF");
- if (preserve)
+ if (options->preserve)
fprintf(fff, "\n Preserve Mode: ON");
else
fprintf(fff, "\n Preserve Mode: OFF");
- if (auto_scum)
+ if (options->auto_scum)
fprintf(fff, "\n Autoscum: ON");
else
fprintf(fff, "\n Autoscum: OFF");
- if (always_small_level)
+ if (options->always_small_level)
fprintf(fff, "\n Small Levels: ALWAYS");
- else if (small_levels)
+ else if (options->small_levels)
fprintf(fff, "\n Small Levels: ON");
else
fprintf(fff, "\n Small Levels: OFF");
- if (empty_levels)
+ if (options->empty_levels)
fprintf(fff, "\n Arena Levels: ON");
else
fprintf(fff, "\n Arena Levels: OFF");
- if (ironman_rooms)
+ if (options->ironman_rooms)
fprintf(fff, "\n Always unusual rooms: ON");
else
fprintf(fff, "\n Always unusual rooms: OFF");
@@ -3996,7 +3992,7 @@ void do_cmd_save_game(void)
*/
void autosave_checkpoint()
{
- if (autosave_l)
+ if (options->autosave_l)
{
is_autosave = TRUE;
msg_print("Autosaving the game...");
@@ -4017,12 +4013,12 @@ static long total_points(void)
if (!comp_death) comp_death = 1;
- if (preserve) mult -= 1; /* Penalize preserve, maximize modes */
+ if (options->preserve) mult -= 1; /* Penalize preserve, maximize modes */
mult -= 1; /* maximize pentalty, always on */
- if (auto_scum) mult -= 4;
- if (small_levels) mult += ((always_small_level) ? 4 : 10);
- if (empty_levels) mult += 2;
- if (smart_learn) mult += 4;
+ if (options->auto_scum) mult -= 4;
+ if (options->small_levels) mult += ((options->always_small_level) ? 4 : 10);
+ if (options->empty_levels) mult += 2;
+ if (options->smart_learn) mult += 4;
if (mult < 2) mult = 2; /* At least 10% of the original score */
/* mult is now between 2 and 40, i.e. 10% and 200% */
@@ -5261,7 +5257,7 @@ errr get_rnd_line(const char *file_name, char *output)
strcpy(output, "");
/* test hack */
- if (wizard && cheat_xtra) msg_print(file_name);
+ if (wizard && options->cheat_xtra) msg_print(file_name);
/* Build the filename */
path_build(buf, 1024, ANGBAND_DIR_FILE, file_name);
@@ -5383,7 +5379,7 @@ errr get_xtra_line(const char *file_name, monster_type *m_ptr, char *output)
strcpy(output, "");
/* test and DEBUG hack */
- if (wizard && cheat_xtra)
+ if (wizard && options->cheat_xtra)
{
msg_print(file_name);
}
@@ -5462,7 +5458,7 @@ errr get_xtra_line(const char *file_name, monster_type *m_ptr, char *output)
line = rand_int(num_entries);
/* test and DEBUG hack */
- if (wizard && cheat_xtra)
+ if (wizard && options->cheat_xtra)
{
sprintf(buf, "Line number %d", line);
msg_print(buf);
diff --git a/src/generate.cc b/src/generate.cc
index 8c02c58a..ec6d002d 100644
--- a/src/generate.cc
+++ b/src/generate.cc
@@ -744,7 +744,7 @@ bool_ new_player_spot(int branch)
p_ptr->px = x;
/* XXX XXX XXX */
- if (dungeon_stair && !(dungeon_flags & DF_NO_STAIR) && dun_level &&
+ if (options->dungeon_stair && !(dungeon_flags & DF_NO_STAIR) && dun_level &&
(!is_quest(dun_level) || (old_dun_level < dun_level)) && !branch)
{
if (old_dun_level < dun_level)
@@ -1148,7 +1148,7 @@ static void alloc_object(int set, int typ, int num)
if (dummy >= SAFE_MAX_ATTEMPTS)
{
- if (cheat_room)
+ if (options->cheat_room)
{
msg_format("Warning! Could not place object, type : %d!", typ);
}
@@ -1469,7 +1469,7 @@ static void build_streamer(int feat, int chance)
if (dummy >= SAFE_MAX_ATTEMPTS)
{
- if (cheat_room)
+ if (options->cheat_room)
{
msg_print("Warning! Could not place streamer!");
}
@@ -1622,7 +1622,7 @@ static void destroy_level(void)
cave_type *c_ptr;
/* Note destroyed levels */
- if ((cheat_room) || (p_ptr->precognition)) msg_print("Destroyed Level");
+ if ((options->cheat_room) || (p_ptr->precognition)) msg_print("Destroyed Level");
/* Drop a few epi-centers (usually about two) */
for (n = 0; n < randint(5); n++)
@@ -1832,7 +1832,7 @@ static void vault_objects(int y, int x, int num)
if (dummy >= SAFE_MAX_ATTEMPTS)
{
- if (cheat_room)
+ if (options->cheat_room)
{
msg_print("Warning! Could not place vault object!");
}
@@ -1883,7 +1883,7 @@ static void vault_trap_aux(int y, int x, int yd, int xd)
if (dummy >= SAFE_MAX_ATTEMPTS)
{
- if (cheat_room)
+ if (options->cheat_room)
{
msg_print("Warning! Could not place vault trap!");
}
@@ -3067,7 +3067,7 @@ static void build_type5(int by0, int bx0)
if (empty) return;
/* Describe */
- if (cheat_room || p_ptr->precognition)
+ if (options->cheat_room || p_ptr->precognition)
{
/* Room type */
msg_format("Monster nest (%s)", name);
@@ -3390,12 +3390,12 @@ static void build_type6(int by0, int bx0)
}
/* Message */
- if (cheat_room || p_ptr->precognition)
+ if (options->cheat_room || p_ptr->precognition)
{
/* Room type */
msg_format("Monster pit (%s)", name);
- if (cheat_hear || p_ptr->precognition)
+ if (options->cheat_hear || p_ptr->precognition)
{
/* Contents */
for (i = 0; i < 8; i++)
@@ -3761,13 +3761,16 @@ static void build_type7(int by0, int bx0)
/* Try to allocate space for room. If fails, exit */
if (!room_alloc(v_ptr->wid, v_ptr->hgt, FALSE, by0, bx0, &xval, &yval))
{
- if (cheat_room) msg_print("Could not allocate this vault here");
+ if (options->cheat_room)
+ {
+ msg_print("Could not allocate this vault here");
+ }
return;
}
if (dummy >= SAFE_MAX_ATTEMPTS)
{
- if (cheat_room)
+ if (options->cheat_room)
{
msg_print("Warning! Could not place lesser vault!");
}
@@ -3776,7 +3779,10 @@ static void build_type7(int by0, int bx0)
/* Message */
- if (cheat_room || p_ptr->precognition) msg_print("Lesser Vault");
+ if (options->cheat_room || p_ptr->precognition)
+ {
+ msg_print("Lesser Vault");
+ }
/* Boost the rating */
rating += v_ptr->rat;
@@ -3817,13 +3823,16 @@ static void build_type8(int by0, int bx0)
/* Try to allocate space for room. If fails, exit */
if (!room_alloc(v_ptr->wid, v_ptr->hgt, FALSE, by0, bx0, &xval, &yval))
{
- if (cheat_room) msg_print("Could not allocate this vault here");
+ if (options->cheat_room)
+ {
+ msg_print("Could not allocate this vault here");
+ }
return;
}
if (dummy >= SAFE_MAX_ATTEMPTS)
{
- if (cheat_room)
+ if (options->cheat_room)
{
msg_print("Warning! Could not place greater vault!");
}
@@ -3832,7 +3841,10 @@ static void build_type8(int by0, int bx0)
/* Message */
- if (cheat_room || p_ptr->precognition) msg_print("Greater Vault");
+ if (options->cheat_room || p_ptr->precognition)
+ {
+ msg_print("Greater Vault");
+ }
/* Boost the rating */
rating += v_ptr->rat;
@@ -4828,7 +4840,10 @@ static void build_bubble_vault(int x0, int y0, int xsize, int ysize)
int xhsize = xsize / 2;
int yhsize = ysize / 2;
- if (cheat_room) msg_print("Bubble Vault");
+ if (options->cheat_room)
+ {
+ msg_print("Bubble Vault");
+ }
/* Allocate center of bubbles */
center[0].x = randint(xsize - 3) + 1;
@@ -5030,7 +5045,10 @@ static void build_room_vault(int x0, int y0, int xsize, int ysize)
xhsize = xsize / 2;
yhsize = ysize / 2;
- if (cheat_room) msg_print("Room Vault");
+ if (options->cheat_room)
+ {
+ msg_print("Room Vault");
+ }
/* Fill area so don't get problems with arena levels */
for (x1 = 0; x1 <= xsize; x1++)
@@ -5088,7 +5106,10 @@ static void build_cave_vault(int x0, int y0, int xsiz, int ysiz)
xsize = xhsize * 2;
ysize = yhsize * 2;
- if (cheat_room) msg_print("Cave Vault");
+ if (options->cheat_room)
+ {
+ msg_print("Cave Vault");
+ }
light = done = FALSE;
room = TRUE;
@@ -5255,7 +5276,10 @@ static void build_maze_vault(int x0, int y0, int xsize, int ysize)
cave_type *c_ptr;
- if (cheat_room) msg_print("Maze Vault");
+ if (options->cheat_room)
+ {
+ msg_print("Maze Vault");
+ }
/* Choose lite or dark */
light = (dun_level <= randint(25));
@@ -5321,7 +5345,10 @@ static void build_mini_c_vault(int x0, int y0, int xsize, int ysize)
int y1, x1, y2, x2, y, x, total;
int m, n, num_vertices;
- if (cheat_room) msg_print("Mini Checker Board Vault");
+ if (options->cheat_room)
+ {
+ msg_print("Mini Checker Board Vault");
+ }
/* Pick a random room size */
dy = ysize / 2 - 1;
@@ -5627,7 +5654,10 @@ static void build_castle_vault(int x0, int y0, int xsize, int ysize)
y2 = y0 + dy;
x2 = x0 + dx;
- if (cheat_room) msg_print("Castle Vault");
+ if (options->cheat_room)
+ {
+ msg_print("Castle Vault");
+ }
/* Generate the room */
for (y = y1 - 1; y <= y2 + 1; y++)
@@ -5751,7 +5781,10 @@ static void build_target_vault(int x0, int y0, int xsize, int ysize)
h3 = randint(32);
h4 = randint(32) - 16;
- if (cheat_room) msg_print("Target Vault");
+ if (options->cheat_room)
+ {
+ msg_print("Target Vault");
+ }
/* Work out outer radius */
if (xsize > ysize)
@@ -6527,7 +6560,7 @@ static void try_doors(int y, int x)
static bool_ room_build(int y, int x, int typ)
{
/* Restrict level */
- if ((dun_level < roomdep[typ]) && !ironman_rooms) return (FALSE);
+ if ((dun_level < roomdep[typ]) && !options->ironman_rooms) return (FALSE);
/* Restrict "crowded" rooms */
if (dun->crowded && ((typ == 5) || (typ == 6))) return (FALSE);
@@ -6660,11 +6693,11 @@ bool_ level_generate_dungeon()
/* Check for arena level */
if ((dungeon_flags & DF_EMPTY) ||
- (empty_levels && (rand_int(EMPTY_LEVEL) == 0)))
+ (options->empty_levels && (rand_int(EMPTY_LEVEL) == 0)))
{
empty_level = TRUE;
- if (cheat_room || p_ptr->precognition)
+ if (options->cheat_room || p_ptr->precognition)
{
msg_print("Arena level.");
}
@@ -6679,7 +6712,7 @@ bool_ level_generate_dungeon()
cavern = TRUE;
/* Make a large fractal cave in the middle of the dungeon */
- if (cheat_room)
+ if (options->cheat_room)
{
msg_print("Cavern on level.");
}
@@ -6727,7 +6760,7 @@ bool_ level_generate_dungeon()
x = rand_int(dun->col_rooms);
/* Align dungeon rooms */
- if (dungeon_align)
+ if (options->dungeon_align)
{
/* Slide some rooms right */
if ((x % 3) == 0) x++;
@@ -6750,7 +6783,7 @@ bool_ level_generate_dungeon()
x = rand_int(dun->col_rooms);
/* Align dungeon rooms */
- if (dungeon_align)
+ if (options->dungeon_align)
{
/* Slide some rooms right */
if ((x % 3) == 0) x++;
@@ -6789,13 +6822,13 @@ bool_ level_generate_dungeon()
/* Attempt an "unusual" room -- no vaults on town levels */
if (!town_level &&
- (ironman_rooms || (rand_int(DUN_UNUSUAL) < dun_level)))
+ (options->ironman_rooms || (rand_int(DUN_UNUSUAL) < dun_level)))
{
/* Roll for room type */
- k = (ironman_rooms ? 0 : rand_int(100));
+ k = (options->ironman_rooms ? 0 : rand_int(100));
/* Attempt a very unusual room */ /* test hack */
- if (ironman_rooms || (rand_int(DUN_UNUSUAL) < dun_level))
+ if (options->ironman_rooms || (rand_int(DUN_UNUSUAL) < dun_level))
{
/* Type 8 -- Greater vault (10%) */
if (k < 10)
@@ -6806,7 +6839,10 @@ bool_ level_generate_dungeon()
}
else
{
- if (cheat_room) msg_print("Refusing a greater vault.");
+ if (options->cheat_room)
+ {
+ msg_print("Refusing a greater vault.");
+ }
}
}
@@ -6819,7 +6855,10 @@ bool_ level_generate_dungeon()
}
else
{
- if (cheat_room) msg_print("Refusing a lesser vault.");
+ if (options->cheat_room)
+ {
+ msg_print("Refusing a lesser vault.");
+ }
}
}
@@ -6951,7 +6990,10 @@ bool_ level_generate_dungeon()
/* Add some sand streamers */
if ((dungeon_flags & DF_SAND_VEIN) && !rand_int(4))
{
- if ((cheat_room) || (p_ptr->precognition)) msg_print("Sand vein.");
+ if (options->cheat_room || p_ptr->precognition)
+ {
+ msg_print("Sand vein.");
+ }
build_streamer(FEAT_SANDWALL, DUN_STR_SC);
}
@@ -6967,12 +7009,18 @@ bool_ level_generate_dungeon()
/* Hack -- Add some rivers if requested */
if ((dungeon_flags & DF_WATER_RIVER) && !rand_int(4))
{
- if (cheat_room || p_ptr->precognition) msg_print("River of water.");
+ if (options->cheat_room || p_ptr->precognition)
+ {
+ msg_print("River of water.");
+ }
add_river(FEAT_DEEP_WATER, FEAT_SHAL_WATER);
}
if ((dungeon_flags & DF_LAVA_RIVER) && !rand_int(4))
{
- if ((cheat_room) || (p_ptr->precognition)) msg_print("River of lava.");
+ if (options->cheat_room || p_ptr->precognition)
+ {
+ msg_print("River of lava.");
+ }
add_river(FEAT_DEEP_LAVA, FEAT_SHAL_LAVA);
}
@@ -6986,7 +7034,10 @@ bool_ level_generate_dungeon()
if (rand_int(3) == 0)
{
add_river(FEAT_DEEP_WATER, FEAT_SHAL_WATER);
- if (!said && ((cheat_room) || (p_ptr->precognition))) msg_print("Rivers of water.");
+ if (!said && (options->cheat_room || p_ptr->precognition))
+ {
+ msg_print("Rivers of water.");
+ }
said = TRUE;
}
}
@@ -7002,7 +7053,10 @@ bool_ level_generate_dungeon()
if (rand_int(3) == 0)
{
add_river(FEAT_DEEP_LAVA, FEAT_SHAL_LAVA);
- if (!said && ((cheat_room) || (p_ptr->precognition))) msg_print("Rivers of lava.");
+ if (!said && (options->cheat_room || p_ptr->precognition))
+ {
+ msg_print("Rivers of lava.");
+ }
said = TRUE;
}
}
@@ -7661,8 +7715,11 @@ static bool_ cave_gen(void)
i = (i * cur_wid) / MAX_WID;
i += 1;
- if (i > small_tester) i = small_tester;
- else if (cheat_hear)
+ if (i > small_tester)
+ {
+ i = small_tester;
+ }
+ else if (options->cheat_hear)
{
msg_format("Reduced monsters base from %d to %d", small_tester, i);
}
@@ -8171,7 +8228,7 @@ static void generate_grid_mana()
{
xtra_magic = TRUE;
- if (cheat_room || p_ptr->precognition)
+ if (options->cheat_room || p_ptr->precognition)
{
msg_print("Magical level");
}
@@ -8394,7 +8451,7 @@ void generate_cave(void)
/* Requested size level */
if (d_ptr->size_x != -1)
{
- if (cheat_room || p_ptr->precognition)
+ if (options->cheat_room || p_ptr->precognition)
{
msg_print ("A 'size' dungeon level.");
}
@@ -8410,7 +8467,7 @@ void generate_cave(void)
panel_row_min = max_panel_rows * (SCREEN_HGT / 2);
panel_col_min = max_panel_cols * (SCREEN_WID / 2);
- if (cheat_room)
+ if (options->cheat_room)
{
msg_format("X:%d, Y:%d.", max_panel_cols, max_panel_rows);
}
@@ -8419,7 +8476,7 @@ void generate_cave(void)
else if (!(dungeon_flags & DF_BIG) &&
(dungeon_flags & DF_SMALLEST))
{
- if (cheat_room || p_ptr->precognition)
+ if (options->cheat_room || p_ptr->precognition)
{
msg_print ("A 'small' dungeon level.");
}
@@ -8435,7 +8492,7 @@ void generate_cave(void)
panel_row_min = max_panel_rows * (SCREEN_HGT / 2);
panel_col_min = max_panel_cols * (SCREEN_WID / 2);
- if (cheat_room)
+ if (options->cheat_room)
{
msg_format("X:1, Y:1.");
}
@@ -8443,11 +8500,11 @@ void generate_cave(void)
/* Small level */
else if (!(dungeon_flags & DF_BIG) &&
- (always_small_level ||
+ (options->always_small_level ||
(dungeon_flags & DF_SMALL) ||
- (small_levels && rand_int(SMALL_LEVEL) == 0)))
+ (options->small_levels && rand_int(SMALL_LEVEL) == 0)))
{
- if (cheat_room || p_ptr->precognition)
+ if (options->cheat_room || p_ptr->precognition)
{
msg_print ("A 'small' dungeon level.");
}
@@ -8466,7 +8523,7 @@ void generate_cave(void)
panel_row_min = max_panel_rows * (SCREEN_HGT / 2);
panel_col_min = max_panel_cols * (SCREEN_WID / 2);
- if (cheat_room)
+ if (options->cheat_room)
{
msg_format("X:%d, Y:%d.", max_panel_cols, max_panel_rows);
}
@@ -8508,7 +8565,7 @@ void generate_cave(void)
else feeling = 10;
/* Hack -- Have a special feeling sometimes */
- if (good_item_flag && !preserve) feeling = 1;
+ if (good_item_flag && !options->preserve) feeling = 1;
/* It takes 1000 game turns for "feelings" to recharge */
if ((turn - old_turn) < 1000) feeling = 0;
@@ -8538,7 +8595,7 @@ void generate_cave(void)
}
/* Mega-Hack -- "auto-scum" */
- if (auto_scum && (num < 100) && !p_ptr->inside_quest && dun_level)
+ if (options->auto_scum && (num < 100) && !p_ptr->inside_quest && dun_level)
{
/* Require "goodness" */
if ((feeling > 9) ||
@@ -8548,8 +8605,8 @@ void generate_cave(void)
((dun_level >= 40) && (feeling > 5)))
{
/* Give message to cheaters */
- if (cheat_room || cheat_hear ||
- cheat_peek || cheat_xtra || p_ptr->precognition)
+ if (options->cheat_room || options->cheat_hear ||
+ options->cheat_peek || options->cheat_xtra || p_ptr->precognition)
{
/* Message */
why = "boring level";
diff --git a/src/help.cc b/src/help.cc
index a0847af1..be078d59 100644
--- a/src/help.cc
+++ b/src/help.cc
@@ -597,7 +597,7 @@ static bool_ triggered_help_hook(void *data, void *in, void *out)
{
triggered_help_type *triggered_help = (triggered_help_type *) data;
/* Not triggered before and trigger now? */
- if ((option_ingame_help) &&
+ if (options->ingame_help &&
(!p_ptr->help.activated[triggered_help->help_index]) &&
triggered_help->trigger_func(in,out))
{
diff --git a/src/init2.cc b/src/init2.cc
index 7a7f6906..4c6f7f75 100644
--- a/src/init2.cc
+++ b/src/init2.cc
@@ -631,6 +631,9 @@ static void init_basic()
/* Extended trigger macros */
cli_info = make_array<cli_comm>(CLI_MAX);
+
+ /* Options */
+ options = new struct options();
}
@@ -810,19 +813,19 @@ static errr init_other(void)
/*** Prepare the options ***/
/* Scan the options */
- for (i = 0; option_info[i].o_desc; i++)
+ for (auto const &option : options->standard_options)
{
- int os = option_info[i].o_page;
- int ob = option_info[i].o_bit;
+ int os = option.o_page;
+ int ob = option.o_bit;
/* Set the "default" options */
- if (option_info[i].o_var)
+ if (option.o_var)
{
/* Accept */
option_mask[os] |= (1L << ob);
/* Set */
- if (option_info[i].o_norm)
+ if (option.o_norm)
{
/* Set */
option_flag[os] |= (1L << ob);
diff --git a/src/joke.cc b/src/joke.cc
index be272115..eefee404 100644
--- a/src/joke.cc
+++ b/src/joke.cc
@@ -24,7 +24,7 @@ static void gen_joke_place_monster(int r_idx)
bool_ gen_joke_monsters(void *data, void *in, void *out)
{
- if (joke_monsters)
+ if (options->joke_monsters)
{
if ((dungeon_type == 20) &&
(dun_level == 72))
diff --git a/src/loadsave.cc b/src/loadsave.cc
index aa2ca5a6..a46a8787 100644
--- a/src/loadsave.cc
+++ b/src/loadsave.cc
@@ -1709,23 +1709,23 @@ static void do_options(ls_flag_t flag)
/*** Special info */
/* Read "delay_factor" */
- do_byte(&delay_factor, flag);
+ do_byte(&options->delay_factor, flag);
/* Read "hitpoint_warn" */
- do_byte(&hitpoint_warn, flag);
+ do_byte(&options->hitpoint_warn, flag);
/*** Cheating options ***/
do_bool(&wizard, flag);
- do_bool(&cheat_peek, flag);
- do_bool(&cheat_hear, flag);
- do_bool(&cheat_room, flag);
- do_bool(&cheat_xtra, flag);
- do_bool(&cheat_live, flag);
+ do_bool(&options->cheat_peek, flag);
+ do_bool(&options->cheat_hear, flag);
+ do_bool(&options->cheat_room, flag);
+ do_bool(&options->cheat_xtra, flag);
+ do_bool(&options->cheat_live, flag);
/*** Autosave options */
- do_bool(&autosave_l, flag);
- do_bool(&autosave_t, flag);
- do_s16b(&autosave_freq, flag);
+ do_bool(&options->autosave_l, flag);
+ do_bool(&options->autosave_t, flag);
+ do_s16b(&options->autosave_freq, flag);
if (flag == ls_flag_t::LOAD)
{
@@ -1807,16 +1807,16 @@ static void do_options(ls_flag_t flag)
if (flag == ls_flag_t::SAVE)
{
/* Analyze the options */
- for (i = 0; option_info[i].o_desc; i++)
+ for (auto const &option: options->standard_options)
{
- int os = option_info[i].o_page;
- int ob = option_info[i].o_bit;
+ int os = option.o_page;
+ int ob = option.o_bit;
/* Process real entries */
- if (option_info[i].o_var)
+ if (option.o_var)
{
/* Set */
- if (*option_info[i].o_var)
+ if (*option.o_var)
{
/* Set */
option_flag[os] |= (1L << ob);
diff --git a/src/melee2.cc b/src/melee2.cc
index 91dfcaf2..49742a59 100644
--- a/src/melee2.cc
+++ b/src/melee2.cc
@@ -302,23 +302,22 @@ static void remove_bad_spells(int m_idx, monster_spell_flag_set *spells_p)
/* Too stupid to know anything? */
auto const r_ptr = m_ptr->race();
- if (r_ptr->flags & RF_STUPID) return;
-
+ if (r_ptr->flags & RF_STUPID)
+ {
+ return;
+ }
/* Must be cheating or learning */
- if (!smart_learn) return;
-
-
- /* Update acquired knowledge */
- if (smart_learn)
+ if (!options->smart_learn)
{
- /* Hack -- Occasionally forget player status */
- if (m_ptr->smart && magik(1)) m_ptr->smart = 0L;
-
- /* Use the memorized flags */
- smart = m_ptr->smart;
+ return;
}
+ /* Hack -- Occasionally forget player status */
+ if (m_ptr->smart && magik(1)) m_ptr->smart = 0L;
+
+ /* Use the memorized flags */
+ smart = m_ptr->smart;
/* Nothing known */
if (!smart) return;
@@ -897,7 +896,7 @@ static void monster_msg(cptr fmt, ...)
void monster_msg_simple(cptr s)
{
/* Display */
- if (disturb_other)
+ if (options->disturb_other)
{
msg_print(s);
}
@@ -924,7 +923,7 @@ void cmonster_msg(char a, cptr fmt, ...)
va_end(vp);
/* Display */
- if (disturb_other)
+ if (options->disturb_other)
cmsg_print(a, buf);
else
{
@@ -3933,7 +3932,10 @@ static int mon_will_run(int m_idx)
static bool_ get_fear_moves_aux(int m_idx, int *yp, int *xp)
{
/* Monster flowing disabled */
- if (!flow_by_sound) return (FALSE);
+ if (!options->flow_by_sound)
+ {
+ return (FALSE);
+ }
/* Monster location */
monster_type *m_ptr = &m_list[m_idx];
@@ -4051,7 +4053,7 @@ static bool_ find_safety(int m_idx, int *yp, int *xp)
if (distance(y, x, fy, fx) != d) continue;
/* Check for "availability" (if monsters can flow) */
- if (flow_by_sound)
+ if (options->flow_by_sound)
{
/* Ignore grids very far from the player */
if (cave[y][x].when < cave[p_ptr->py][p_ptr->px].when) continue;
@@ -4439,7 +4441,7 @@ static bool_ get_moves(int m_idx, int *mm)
else
{
/* Attempt to avoid the player */
- if (flow_by_sound)
+ if (options->flow_by_sound)
{
/* Adjust movement */
(void)get_fear_moves_aux(m_idx, &y, &x);
@@ -5846,7 +5848,10 @@ static void process_monster(int m_idx, bool_ is_frien)
msg_print("You hear a door burst open!");
/* Disturb (sometimes) */
- if (disturb_minor) disturb(0);
+ if (options->disturb_minor)
+ {
+ disturb(0);
+ }
/* The door was bashed open */
did_bash_door = TRUE;
@@ -6127,12 +6132,12 @@ static void process_monster(int m_idx, bool_ is_frien)
}
/* Possible disturb */
- if (m_ptr->ml && (disturb_move ||
+ if (m_ptr->ml && (options->disturb_move ||
((m_ptr->mflag & (MFLAG_VIEW)) &&
- disturb_near)))
+ options->disturb_near)))
{
/* Disturb */
- if ((is_friend(m_ptr) < 0) || disturb_pets)
+ if ((is_friend(m_ptr) < 0) || options->disturb_pets)
disturb(0);
}
@@ -6485,7 +6490,7 @@ void process_monsters(void)
/* Hack -- Monsters can "smell" the player from far away */
/* Note that most monsters have "aaf" of "20" or so */
- else if (flow_by_sound &&
+ else if (options->flow_by_sound &&
(cave[p_ptr->py][p_ptr->px].when == cave[fy][fx].when) &&
(cave[fy][fx].cost < MONSTER_FLOW_DEPTH) &&
(cave[fy][fx].cost < r_ptr->aaf))
diff --git a/src/monster2.cc b/src/monster2.cc
index 4051a872..4eb6a618 100644
--- a/src/monster2.cc
+++ b/src/monster2.cc
@@ -476,7 +476,7 @@ void delete_monster_idx(int i)
/* Hack -- efficiency */
o_ptr->held_m_idx = 0;
- if (preserve)
+ if (options->preserve)
{
/* Hack -- Preserve unknown artifacts */
if (artifact_p(o_ptr) && !object_known_p(o_ptr))
@@ -1018,7 +1018,7 @@ s16b get_mon_num(int level)
}
/* Joke monsters allowed ? or not ? */
- if (!joke_monsters && (r_ptr->flags & RF_JOKEANGBAND)) continue;
+ if (!options->joke_monsters && (r_ptr->flags & RF_JOKEANGBAND)) continue;
/* Some dungeon types restrict the possible monsters */
if (!summon_hack && !restrict_monster_to_dungeon(r_idx) && dun_level) continue;
@@ -1745,9 +1745,12 @@ void update_mon(int m_idx, bool_ full)
p_ptr->window |= (PW_M_LIST);
/* Disturb on appearance */
- if (disturb_move)
+ if (options->disturb_move)
{
- if (disturb_pets || (is_friend(m_ptr) <= 0)) disturb(1);
+ if (options->disturb_pets || (is_friend(m_ptr) <= 0))
+ {
+ disturb(1);
+ }
}
}
}
@@ -1771,9 +1774,12 @@ void update_mon(int m_idx, bool_ full)
p_ptr->window |= (PW_M_LIST);
/* Disturb on disappearance*/
- if (disturb_move)
+ if (options->disturb_move)
{
- if (disturb_pets || (is_friend(m_ptr) <= 0)) disturb(1);
+ if (options->disturb_pets || (is_friend(m_ptr) <= 0))
+ {
+ disturb(1);
+ }
}
}
}
@@ -1798,9 +1804,12 @@ void update_mon(int m_idx, bool_ full)
m_ptr->mflag |= (MFLAG_VIEW);
/* Disturb on appearance */
- if (disturb_near)
+ if (options->disturb_near)
{
- if (disturb_pets || (is_friend(m_ptr) <= 0)) disturb(1);
+ if (options->disturb_pets || (is_friend(m_ptr) <= 0))
+ {
+ disturb(1);
+ }
}
}
@@ -1819,9 +1828,12 @@ void update_mon(int m_idx, bool_ full)
p_ptr->window |= (PW_M_LIST);
/* Disturb on disappearance */
- if (disturb_near)
+ if (options->disturb_near)
{
- if (disturb_pets || (is_friend(m_ptr) <= 0)) disturb(1);
+ if (options->disturb_pets || (is_friend(m_ptr) <= 0))
+ {
+ disturb(1);
+ }
}
}
}
@@ -2118,7 +2130,10 @@ s16b place_monster_one(int y, int x, int r_idx, int ego, bool_ slp, int status)
if (r_ptr->flags & RF_UNIQUE)
{
/* Message for cheaters */
- if ((cheat_hear) || (p_ptr->precognition)) msg_format("Deep Unique (%s).", r_ptr->name);
+ if (options->cheat_hear || p_ptr->precognition)
+ {
+ msg_format("Deep Unique (%s).", r_ptr->name);
+ }
/* Boost rating by twice delta-depth */
rating += (r_ptr->level - dun_level) * 2;
@@ -2128,7 +2143,10 @@ s16b place_monster_one(int y, int x, int r_idx, int ego, bool_ slp, int status)
else
{
/* Message for cheaters */
- if ((cheat_hear) || (p_ptr->precognition)) msg_format("Deep Monster (%s).", r_ptr->name);
+ if (options->cheat_hear || p_ptr->precognition)
+ {
+ msg_format("Deep Monster (%s).", r_ptr->name);
+ }
/* Boost rating by delta-depth */
rating += (r_ptr->level - dun_level);
@@ -2139,7 +2157,10 @@ s16b place_monster_one(int y, int x, int r_idx, int ego, bool_ slp, int status)
else if (r_ptr->flags & RF_UNIQUE)
{
/* Unique monsters induce message */
- if ((cheat_hear) || (p_ptr->precognition)) msg_format("Unique (%s).", r_ptr->name);
+ if (options->cheat_hear || p_ptr->precognition)
+ {
+ msg_format("Unique (%s).", r_ptr->name);
+ }
}
@@ -2823,7 +2844,7 @@ bool_ alloc_monster(int dis, bool_ slp)
if (!attempts_left)
{
- if (cheat_xtra || cheat_hear)
+ if (options->cheat_xtra || options->cheat_hear)
{
msg_print("Warning! Could not allocate a new monster. Small level?");
}
@@ -2836,7 +2857,10 @@ bool_ alloc_monster(int dis, bool_ slp)
{
if (alloc_horde(y, x))
{
- if ((cheat_hear) || (p_ptr->precognition)) msg_print("Monster horde.");
+ if (options->cheat_hear || p_ptr->precognition)
+ {
+ msg_print("Monster horde.");
+ }
return (TRUE);
}
}
@@ -3662,7 +3686,7 @@ void message_pain(int m_idx, int dam)
void update_smart_learn(int m_idx, int what)
{
/* Not allowed to learn */
- if (!smart_learn)
+ if (!options->smart_learn)
{
return;
}
diff --git a/src/object1.cc b/src/object1.cc
index b0760abe..5f4db047 100644
--- a/src/object1.cc
+++ b/src/object1.cc
@@ -5896,7 +5896,7 @@ void py_pickup_floor(int pickup)
bool_ do_pickup = TRUE;
/* Hack -- query every item */
- if (carry_query_flag || (!can_carry_heavy(&o_list[floor_o_idx])))
+ if (options->carry_query_flag || !can_carry_heavy(&o_list[floor_o_idx]))
{
char o_name[80] = "";
object_desc(o_name, o_ptr, TRUE, 3);
diff --git a/src/object2.cc b/src/object2.cc
index 6185cc27..469a1ae0 100644
--- a/src/object2.cc
+++ b/src/object2.cc
@@ -387,7 +387,7 @@ void wipe_o_list(void)
if (!o_ptr->k_idx) continue;
/* Mega-Hack -- preserve artifacts */
- if (!character_dungeon || preserve)
+ if (!character_dungeon || options->preserve)
{
/* Hack -- Preserve unknown artifacts */
if (artifact_p(o_ptr) && !object_known_p(o_ptr))
@@ -2687,7 +2687,10 @@ static void a_m_aux_2(object_type *o_ptr, int level, int power)
rating += 30;
/* Mention the item */
- if ((cheat_peek) || (p_ptr->precognition)) object_mention(o_ptr);
+ if (options->cheat_peek || p_ptr->precognition)
+ {
+ object_mention(o_ptr);
+ }
break;
}
@@ -2699,7 +2702,10 @@ static void a_m_aux_2(object_type *o_ptr, int level, int power)
rating += 5;
/* Mention the item */
- if ((cheat_peek) || (p_ptr->precognition)) object_mention(o_ptr);
+ if (options->cheat_peek || p_ptr->precognition)
+ {
+ object_mention(o_ptr);
+ }
dragon_resist(o_ptr);
}
break;
@@ -2712,7 +2718,10 @@ static void a_m_aux_2(object_type *o_ptr, int level, int power)
rating += 5;
/* Mention the item */
- if ((cheat_peek) || (p_ptr->precognition)) object_mention(o_ptr);
+ if (options->cheat_peek || p_ptr->precognition)
+ {
+ object_mention(o_ptr);
+ }
dragon_resist(o_ptr);
}
break;
@@ -2843,7 +2852,10 @@ static void a_m_aux_3(object_type *o_ptr, int level, int power)
rating += 25;
/* Mention the item */
- if ((cheat_peek) || (p_ptr->precognition)) object_mention(o_ptr);
+ if (options->cheat_peek || p_ptr->precognition)
+ {
+ object_mention(o_ptr);
+ }
break;
}
@@ -3011,7 +3023,10 @@ static void a_m_aux_3(object_type *o_ptr, int level, int power)
o_ptr->pval = 1 + m_bonus(3, level);
/* Mention the item */
- if ((cheat_peek) || (p_ptr->precognition)) object_mention(o_ptr);
+ if (options->cheat_peek || p_ptr->precognition)
+ {
+ object_mention(o_ptr);
+ }
break;
}
@@ -3023,7 +3038,10 @@ static void a_m_aux_3(object_type *o_ptr, int level, int power)
o_ptr->to_d = 1 + m_bonus(5, level);
/* Mention the item */
- if ((cheat_peek) || (p_ptr->precognition)) object_mention(o_ptr);
+ if (options->cheat_peek || p_ptr->precognition)
+ {
+ object_mention(o_ptr);
+ }
break;
}
@@ -3113,7 +3131,10 @@ static void a_m_aux_3(object_type *o_ptr, int level, int power)
rating += 25;
/* Mention the item */
- if ((cheat_peek) || (p_ptr->precognition)) object_mention(o_ptr);
+ if (options->cheat_peek || p_ptr->precognition)
+ {
+ object_mention(o_ptr);
+ }
break;
}
@@ -3394,7 +3415,10 @@ static void a_m_aux_4(object_type *o_ptr, int level, int power)
/* Rating boost */
rating += 25;
/* Mention the item */
- if ((cheat_peek) || (p_ptr->precognition)) object_mention(o_ptr);
+ if (options->cheat_peek || p_ptr->precognition)
+ {
+ object_mention(o_ptr);
+ }
}
break;
case TV_POTION2:
@@ -3944,7 +3968,10 @@ void apply_magic(object_type *o_ptr, int lev, bool_ okay, bool_ good, bool_ grea
k_ptr->artifact = TRUE;
- if (cheat_peek || p_ptr->precognition) object_mention(o_ptr);
+ if (options->cheat_peek || p_ptr->precognition)
+ {
+ object_mention(o_ptr);
+ }
}
return;
@@ -4059,7 +4086,10 @@ void apply_magic(object_type *o_ptr, int lev, bool_ okay, bool_ good, bool_ grea
good_item_flag = TRUE;
/* Cheat -- peek at the item */
- if ((cheat_peek) || (p_ptr->precognition)) object_mention(o_ptr);
+ if (options->cheat_peek || p_ptr->precognition)
+ {
+ object_mention(o_ptr);
+ }
/* Spell in it? No! */
if (a_ptr->flags & TR_SPELL_CONTAIN)
@@ -4219,7 +4249,10 @@ try_an_other_ego:
}
/* Cheat -- describe the item */
- if ((cheat_peek) || (p_ptr->precognition)) object_mention(o_ptr);
+ if (options->cheat_peek || p_ptr->precognition)
+ {
+ object_mention(o_ptr);
+ }
}
@@ -4773,7 +4806,10 @@ bool_ make_object(object_type *j_ptr, bool_ good, bool_ great, obj_theme const &
rating += (k_info[j_ptr->k_idx].level - dun_level);
/* Cheat -- peek at items */
- if ((cheat_peek) || (p_ptr->precognition)) object_mention(j_ptr);
+ if (options->cheat_peek || p_ptr->precognition)
+ {
+ object_mention(j_ptr);
+ }
}
/* Success */
@@ -4930,8 +4966,10 @@ bool_ make_gold(object_type *j_ptr)
j_ptr->pval = (base + (8L * randint(base)) + randint(8));
/* Multiply value by 5 if selling is disabled */
- if (no_selling)
+ if (options->no_selling)
+ {
j_ptr->pval *= 5;
+ }
/* Success */
return (TRUE);
diff --git a/src/options.cc b/src/options.cc
index 1b0baccf..ea2f3172 100644
--- a/src/options.cc
+++ b/src/options.cc
@@ -1,102 +1,10 @@
#include "options.hpp"
-//
-// Option Set 1 -- User Interface
-//
-bool_ rogue_like_commands; /* Rogue-like commands */
-bool_ quick_messages; /* Activate quick messages */
-bool_ carry_query_flag; /* Prompt before picking things up */
-bool_ use_old_target; /* Use old target by default */
-bool_ always_pickup; /* Pick things up by default */
-bool_ always_repeat; /* Repeat obvious commands */
-bool_ ring_bell; /* Ring the bell (on errors, etc) */
-
-//
-// Option Set 2 -- Disturbance
-//
-bool_ find_ignore_stairs; /* Run past stairs */
-bool_ find_ignore_doors; /* Run through open doors */
-bool_ find_cut; /* Run past known corners */
-bool_ find_examine; /* Run into potential corners */
-bool_ disturb_move; /* Disturb whenever any monster moves */
-bool_ disturb_near; /* Disturb whenever viewable monster moves */
-bool_ disturb_panel; /* Disturb whenever map panel changes */
-bool_ disturb_detect; /* Disturb whenever leaving trap-detected area */
-bool_ disturb_state; /* Disturn whenever player state changes */
-bool_ disturb_minor; /* Disturb whenever boring things happen */
-bool_ disturb_other; /* Disturb whenever various things happen */
-bool_ last_words; /* Get last words upon dying */
-bool_ small_levels; /* Allow unusually small dungeon levels */
-bool_ empty_levels; /* Allow empty 'arena' levels */
-bool_ confirm_stairs; /* Prompt before staircases... */
-bool_ wear_confirm; /* Confirm before putting on known cursed items */
-bool_ disturb_pets; /* Pets moving nearby disturb us */
-
-//
-// Option Set 3 -- Game-Play
-//
-bool_ auto_scum; /* Auto-scum for good levels */
-bool_ view_perma_grids; /* Map remembers all perma-lit grids */
-bool_ view_torch_grids; /* Map remembers all torch-lit grids */
-bool_ dungeon_align; /* Generate dungeons with aligned rooms */
-bool_ dungeon_stair; /* Generate dungeons with connected stairs */
-bool_ flow_by_sound; /* Monsters track new player location */
-bool_ smart_learn; /* Monsters learn from their mistakes */
-
-//
-// Option Set 4 -- Efficiency
-//
-bool_ view_reduce_lite; /* Reduce lite-radius when running */
-bool_ avoid_abort; /* Avoid checking for user abort */
-bool_ avoid_shimmer; /* Avoid processing extra shimmering */
-bool_ avoid_other; /* Avoid processing special colors */
-bool_ flush_failure; /* Flush input on any failure */
-bool_ flush_disturb; /* Flush input on disturbance */
-bool_ flush_command; /* Flush input before every command */
-bool_ fresh_before; /* Flush output before normal commands */
-bool_ fresh_after; /* Flush output after normal commands */
-bool_ fresh_message; /* Flush output after all messages */
-bool_ hilite_player; /* Hilite the player with the cursor */
-bool_ view_yellow_lite; /* Use special colors for torch-lit grids */
-bool_ view_bright_lite; /* Use special colors for 'viewable' grids */
-bool_ view_granite_lite; /* Use special colors for wall grids (slow) */
-bool_ view_special_lite; /* Use special colors for floor grids (slow) */
-bool_ center_player; /* Center view on player */
-
-//
-// Option Set 5 - ToME options
-//
-bool_ linear_stats;
-bool_ player_char_health; /* Display the player as a special symbol when in bad health ? */
-bool_ option_ingame_help; /* Ingame contextual help */
-bool_ auto_more; /* Auto more */
-
-//
-// Option Set 6 - Birth options
-//
-bool_ always_small_level;
-bool_ autoroll;
-bool_ fate_option;
-bool_ ironman_rooms;
-bool_ joke_monsters;
-bool_ point_based;
-bool_ preserve;
-bool_ no_selling;
-
-//
-// Other options
-//
-
-bool_ cheat_peek; /* Peek into object creation */
-bool_ cheat_hear; /* Peek into monster creation */
-bool_ cheat_room; /* Peek into dungeon creation */
-bool_ cheat_xtra; /* Peek into something else */
-bool_ cheat_live; /* Allow player to avoid death */
-
-byte hitpoint_warn; /* Hitpoint warning (0 to 9) */
-
-byte delay_factor; /* Delay factor (0 to 9) */
-
-s16b autosave_freq; /* Autosave frequency */
-bool_ autosave_t; /* Timed autosave */
-bool_ autosave_l; /* Autosave before entering new levels */
+void options::reset_cheat_options()
+{
+ cheat_peek = FALSE;
+ cheat_hear = FALSE;
+ cheat_room = FALSE;
+ cheat_xtra = FALSE;
+ cheat_live = FALSE;
+}
diff --git a/src/options.hpp b/src/options.hpp
index 940f9a6c..a1b125a0 100644
--- a/src/options.hpp
+++ b/src/options.hpp
@@ -1,103 +1,217 @@
#pragma once
#include "h-basic.h"
+#include "option_type.hpp"
-//
-// Option Set 1 -- User Interface.
-//
-extern bool_ rogue_like_commands;
-extern bool_ quick_messages;
-extern bool_ carry_query_flag;
-extern bool_ use_old_target;
-extern bool_ always_pickup;
-extern bool_ always_repeat;
-extern bool_ ring_bell;
-
-//
-// Option Set 2 -- Disturbance
-//
-extern bool_ find_ignore_stairs;
-extern bool_ find_ignore_doors;
-extern bool_ find_cut;
-extern bool_ find_examine;
-extern bool_ disturb_move;
-extern bool_ disturb_near;
-extern bool_ disturb_panel;
-extern bool_ disturb_detect;
-extern bool_ disturb_state;
-extern bool_ disturb_minor;
-extern bool_ disturb_other;
-extern bool_ last_words;
-extern bool_ small_levels;
-extern bool_ empty_levels;
-extern bool_ confirm_stairs;
-extern bool_ wear_confirm;
-extern bool_ disturb_pets;
-
-//
-// Option Set 3 -- Game-Play
-//
-extern bool_ auto_scum;
-extern bool_ view_perma_grids;
-extern bool_ view_torch_grids;
-extern bool_ dungeon_align;
-extern bool_ dungeon_stair;
-extern bool_ flow_by_sound;
-extern bool_ smart_learn;
-
-//
-// Option Set 4 -- Efficiency
-//
-extern bool_ view_reduce_lite;
-extern bool_ avoid_abort;
-extern bool_ avoid_shimmer;
-extern bool_ avoid_other;
-extern bool_ flush_failure;
-extern bool_ flush_disturb;
-extern bool_ flush_command;
-extern bool_ fresh_before;
-extern bool_ fresh_after;
-extern bool_ fresh_message;
-extern bool_ hilite_player;
-extern bool_ view_yellow_lite;
-extern bool_ view_bright_lite;
-extern bool_ view_granite_lite;
-extern bool_ view_special_lite;
-extern bool_ center_player;
-
-//
-// Option Set 5 - ToME options
-//
-extern bool_ linear_stats;
-extern bool_ player_char_health;
-extern bool_ option_ingame_help;
-extern bool_ auto_more;
-
-//
-// Option Set 6 - Birth options
-//
-extern bool_ always_small_level;
-extern bool_ autoroll;
-extern bool_ fate_option;
-extern bool_ ironman_rooms;
-extern bool_ joke_monsters;
-extern bool_ point_based;
-extern bool_ preserve;
-extern bool_ no_selling;
-
-//
-// Other options
-//
-extern bool_ cheat_peek;
-extern bool_ cheat_hear;
-extern bool_ cheat_room;
-extern bool_ cheat_xtra;
-extern bool_ cheat_live;
-
-extern byte hitpoint_warn;
-
-extern byte delay_factor;
-
-extern s16b autosave_freq;
-extern bool_ autosave_t;
-extern bool_ autosave_l;
+#include <vector>
+
+/**
+ * Game options accessible via the '=' menu.
+ */
+struct options {
+
+ //
+ // Option Set 1 -- User Interface
+ //
+ bool_ rogue_like_commands; /* Rogue-like commands */
+ bool_ quick_messages; /* Activate quick messages */
+ bool_ carry_query_flag; /* Prompt before picking things up */
+ bool_ use_old_target; /* Use old target by default */
+ bool_ always_pickup; /* Pick things up by default */
+ bool_ always_repeat; /* Repeat obvious commands */
+ bool_ ring_bell; /* Ring the bell (on errors, etc) */
+
+ //
+ // Option Set 2 -- Disturbance
+ //
+ bool_ find_ignore_stairs; /* Run past stairs */
+ bool_ find_ignore_doors; /* Run through open doors */
+ bool_ find_cut; /* Run past known corners */
+ bool_ find_examine; /* Run into potential corners */
+ bool_ disturb_move; /* Disturb whenever any monster moves */
+ bool_ disturb_near; /* Disturb whenever viewable monster moves */
+ bool_ disturb_panel; /* Disturb whenever map panel changes */
+ bool_ disturb_detect; /* Disturb whenever leaving trap-detected area */
+ bool_ disturb_state; /* Disturn whenever player state changes */
+ bool_ disturb_minor; /* Disturb whenever boring things happen */
+ bool_ disturb_other; /* Disturb whenever various things happen */
+ bool_ last_words; /* Get last words upon dying */
+ bool_ small_levels; /* Allow unusually small dungeon levels */
+ bool_ empty_levels; /* Allow empty 'arena' levels */
+ bool_ confirm_stairs; /* Prompt before staircases... */
+ bool_ wear_confirm; /* Confirm before putting on known cursed items */
+ bool_ disturb_pets; /* Pets moving nearby disturb us */
+
+ //
+ // Option Set 3 -- Game-Play
+ //
+ bool_ auto_scum; /* Auto-scum for good levels */
+ bool_ view_perma_grids; /* Map remembers all perma-lit grids */
+ bool_ view_torch_grids; /* Map remembers all torch-lit grids */
+ bool_ dungeon_align; /* Generate dungeons with aligned rooms */
+ bool_ dungeon_stair; /* Generate dungeons with connected stairs */
+ bool_ flow_by_sound; /* Monsters track new player location */
+ bool_ smart_learn; /* Monsters learn from their mistakes */
+
+ //
+ // Option Set 4 -- Efficiency
+ //
+ bool_ view_reduce_lite; /* Reduce lite-radius when running */
+ bool_ avoid_abort; /* Avoid checking for user abort */
+ bool_ avoid_shimmer; /* Avoid processing extra shimmering */
+ bool_ avoid_other; /* Avoid processing special colors */
+ bool_ flush_failure; /* Flush input on any failure */
+ bool_ flush_disturb; /* Flush input on disturbance */
+ bool_ flush_command; /* Flush input before every command */
+ bool_ fresh_before; /* Flush output before normal commands */
+ bool_ fresh_after; /* Flush output after normal commands */
+ bool_ fresh_message; /* Flush output after all messages */
+ bool_ hilite_player; /* Hilite the player with the cursor */
+ bool_ view_yellow_lite; /* Use special colors for torch-lit grids */
+ bool_ view_bright_lite; /* Use special colors for 'viewable' grids */
+ bool_ view_granite_lite; /* Use special colors for wall grids (slow) */
+ bool_ view_special_lite; /* Use special colors for floor grids (slow) */
+ bool_ center_player; /* Center view on player */
+
+ //
+ // Option Set 5 - ToME options
+ //
+ bool_ linear_stats;
+ bool_ player_char_health; /* Display the player as a special symbol when in bad health ? */
+ bool_ ingame_help; /* In-game contextual help? */
+ bool_ auto_more; /* Auto more */
+
+ //
+ // Option Set 6 - Birth options
+ //
+ bool_ always_small_level;
+ bool_ autoroll;
+ bool_ fate_option;
+ bool_ ironman_rooms;
+ bool_ joke_monsters;
+ bool_ point_based;
+ bool_ preserve;
+ bool_ no_selling;
+
+ //
+ // Other options
+ //
+
+ bool_ cheat_peek; /* Peek into object creation */
+ bool_ cheat_hear; /* Peek into monster creation */
+ bool_ cheat_room; /* Peek into dungeon creation */
+ bool_ cheat_xtra; /* Peek into something else */
+ bool_ cheat_live; /* Allow player to avoid death */
+
+ byte hitpoint_warn; /* Hitpoint warning (0 to 9) */
+
+ byte delay_factor; /* Delay factor (0 to 9) */
+
+ s16b autosave_freq; /* Autosave frequency */
+ bool_ autosave_t; /* Timed autosave */
+ bool_ autosave_l; /* Autosave before entering new levels */
+
+ /**
+ * Option groups
+ */
+ std::vector<option_type> standard_options = {
+ // User-Interface
+ { &rogue_like_commands, FALSE, 1, 0, "rogue_like_commands", "Rogue-like commands" },
+ { &quick_messages , TRUE , 1, 1, "quick_messages" , "Activate quick messages" },
+ { &carry_query_flag , FALSE, 1, 3, "carry_query_flag" , "Prompt before picking things up" },
+ { &use_old_target , FALSE, 1, 4, "use_old_target" , "Use old target by default" },
+ { &always_pickup , FALSE, 1, 5, "always_pickup" , "Pick things up by default" },
+ { &always_repeat , TRUE , 1, 7, "always_repeat" , "Repeat obvious commands" },
+ { &ring_bell , FALSE, 1, 18, "ring_bell" , "Audible bell (on errors, etc)" },
+ // Disturbance
+ { &find_ignore_stairs , FALSE, 2, 0, "find_ignore_stairs" , "Run past stairs" },
+ { &find_ignore_doors , TRUE , 2, 1, "find_ignore_doors" , "Run through open doors" },
+ { &find_cut , FALSE, 2, 2, "find_cut" , "Run past known corners" },
+ { &find_examine , TRUE , 2, 3, "find_examine" , "Run into potential corners" },
+ { &disturb_move , FALSE, 2, 4, "disturb_move" , "Disturb whenever any monster moves" },
+ { &disturb_near , TRUE , 2, 5, "disturb_near" , "Disturb whenever viewable monster moves" },
+ { &disturb_panel , TRUE , 2, 6, "disturb_panel" , "Disturb whenever map panel changes" },
+ { &disturb_detect , TRUE , 2, 21, "disturb_detect" , "Disturb whenever leaving trap-detected area" },
+ { &disturb_state , TRUE , 2, 7, "disturb_state" , "Disturb whenever player state changes" },
+ { &disturb_minor , TRUE , 2, 8, "disturb_minor" , "Disturb whenever boring things happen" },
+ { &disturb_other , FALSE, 2, 9, "disturb_other" , "Disturb whenever random things happen" },
+ { &last_words , TRUE , 2, 12, "last_words" , "Get last words when the character dies" },
+ { &wear_confirm , TRUE , 2, 15, "confirm_wear" , "Confirm to wear/wield known cursed items" },
+ { &confirm_stairs , FALSE, 2, 16, "confirm_stairs" , "Prompt before exiting a dungeon level" },
+ { &disturb_pets , FALSE, 2, 17, "disturb_pets" , "Disturb when visible pets move" },
+ // Game-Play
+ { &auto_scum , TRUE , 3, 1, "auto_scum" , "Auto-scum for good levels" },
+ { &view_perma_grids , TRUE , 3, 6, "view_perma_grids" , "Map remembers all perma-lit grids" },
+ { &view_torch_grids , FALSE, 3, 7, "view_torch_grids" , "Map remembers all torch-lit grids" },
+ { &dungeon_align , TRUE , 3, 8, "dungeon_align" , "Generate dungeons with aligned rooms" },
+ { &dungeon_stair , TRUE , 3, 9, "dungeon_stair" , "Generate dungeons with connected stairs" },
+ { &flow_by_sound , FALSE, 3, 10, "flow_by_sound" , "Monsters chase current location (v.slow)" },
+ { &smart_learn , FALSE, 3, 14, "smart_learn" , "Monsters learn from their mistakes" },
+ { &small_levels , TRUE , 3, 17, "small_levels" , "Allow unusually small dungeon levels" },
+ { &empty_levels , TRUE , 3, 18, "empty_levels" , "Allow empty 'arena' levels" },
+ // Efficiency
+ { &view_reduce_lite , FALSE, 4, 0, "view_reduce_lite" , "Reduce lite-radius when running" },
+ { &avoid_abort , FALSE, 4, 2, "avoid_abort" , "Avoid checking for user abort" },
+ { &avoid_shimmer , FALSE, 4, 17, "avoid_shimmer" , "Avoid extra shimmering (fast)" },
+ { &avoid_other , FALSE, 4, 3, "avoid_other" , "Avoid processing special colors (fast)" },
+ { &flush_failure , TRUE , 4, 4, "flush_failure" , "Flush input on various failures" },
+ { &flush_disturb , FALSE, 4, 5, "flush_disturb" , "Flush input whenever disturbed" },
+ { &flush_command , FALSE, 4, 6, "flush_command" , "Flush input before every command" },
+ { &fresh_before , TRUE , 4, 7, "fresh_before" , "Flush output before every command" },
+ { &fresh_after , FALSE, 4, 8, "fresh_after" , "Flush output after every command" },
+ { &fresh_message , FALSE, 4, 9, "fresh_message" , "Flush output after every message" },
+ { &hilite_player , FALSE, 4, 11, "hilite_player" , "Hilite the player with the cursor" },
+ { &view_yellow_lite , FALSE, 4, 12, "view_yellow_lite" , "Use special colors for torch-lit grids" },
+ { &view_bright_lite , FALSE, 4, 13, "view_bright_lite" , "Use special colors for 'viewable' grids" },
+ { &view_granite_lite , FALSE, 4, 14, "view_granite_lite" , "Use special colors for wall grids (slow)" },
+ { &view_special_lite , FALSE, 4, 15, "view_special_lite" , "Use special colors for floor grids (slow)" },
+ { &center_player , FALSE, 4, 16, "center_player" , "Center the view on the player (very slow)" },
+ // ToME options
+ { &ingame_help , TRUE , 5, 1, "ingame_help" , "Ingame contextual help" },
+ { &auto_more , FALSE, 5, 4, "auto_more" , "Automatically clear '-more-' prompts" },
+ { &player_char_health , TRUE , 5, 6, "player_char_health" , "Player char represent his/her health" },
+ { &linear_stats , TRUE , 5, 7, "linear_stats" , "Stats are represented in a linear way" },
+ // Birth Options
+ { &preserve , TRUE , 6, 2, "preserve" , "Preserve artifacts" },
+ { &autoroll , TRUE , 6, 3, "autoroll" , "Specify 'minimal' stats" },
+ { &point_based , FALSE, 6, 17, "point_based" , "Generate character using a point system" },
+ { &ironman_rooms , FALSE, 6, 6, "ironman_rooms" , "Always generate very unusual rooms" },
+ { &joke_monsters , FALSE, 6, 14, "joke_monsters" , "Allow use of some 'joke' monsters" },
+ { &always_small_level , FALSE, 6, 16, "always_small_level" , "Always make small levels" },
+ { &fate_option , TRUE , 6, 18, "fate_option" , "You can receive fates, good or bad" },
+ { &no_selling , FALSE, 6, 20, "no_selling" , "Items always sell for 0 gold" },
+ };
+
+ /*
+ * Cheating options
+ */
+ std::vector<option_type> cheat_options = {
+ { &cheat_peek, FALSE, 0, 0, "cheat_peek", "Peek into object creation" },
+ { &cheat_hear, FALSE, 0, 1, "cheat_hear", "Peek into monster creation" },
+ { &cheat_room, FALSE, 0, 2, "cheat_room", "Peek into dungeon creation" },
+ { &cheat_xtra, FALSE, 0, 3, "cheat_xtra", "Peek into something else" },
+ { &cheat_live, FALSE, 0, 5, "cheat_live", "Allow player to avoid death" },
+ };
+
+ /**
+ * Autosave boolean options
+ */
+ std::vector<option_type> autosave_options {
+ { &autosave_l, FALSE, 0, 6, "autosave_l", "Autosave when entering new levels" },
+ { &autosave_t, FALSE, 0, 7, "autosave_t", "Timed autosave" }
+ };
+
+ /*
+ * Reset cheat options
+ */
+ void reset_cheat_options();
+
+ /**
+ * Convert delay_factor to milliseconds
+ */
+ int delay_factor_ms() const
+ {
+ return delay_factor * delay_factor * delay_factor;
+ }
+
+};
diff --git a/src/q_ultrag.cc b/src/q_ultrag.cc
index fcee52a2..a5b56f3f 100644
--- a/src/q_ultrag.cc
+++ b/src/q_ultrag.cc
@@ -29,14 +29,14 @@ static bool_ quest_ultra_good_move_hook(void *, void *in_, void *)
if (cquest.status == QUEST_STATUS_UNTAKEN)
{
- bool_ old_quick_messages = quick_messages;
-
if (quest[QUEST_MORGOTH].status < QUEST_STATUS_FINISHED) return (FALSE);
/* The mirror of Galadriel */
if ((c_ptr->feat != FEAT_SHOP) || (c_ptr->special != 23)) return (FALSE);
- quick_messages = FALSE;
+ auto old_quick_messages = options->quick_messages;
+ options->quick_messages = FALSE;
+
cmsg_print(TERM_L_BLUE, "You meet Galadriel.");
cmsg_print(TERM_YELLOW, "'I still cannot believe this is all over.'");
cmsg_print(TERM_YELLOW, "'Morgoth's reign of terror is over at last!'");
@@ -82,7 +82,8 @@ static bool_ quest_ultra_good_move_hook(void *, void *in_, void *)
cquest.status = QUEST_STATUS_TAKEN;
cquest.init(QUEST_ULTRA_GOOD);
}
- quick_messages = old_quick_messages;
+
+ options->quick_messages = old_quick_messages;
return TRUE;
}
diff --git a/src/randart.cc b/src/randart.cc
index e22f1c93..f7ea95f3 100644
--- a/src/randart.cc
+++ b/src/randart.cc
@@ -341,7 +341,10 @@ bool_ create_artifact(object_type *o_ptr, bool_ a_scroll, bool_ get_name)
TR_IGNORE_COLD;
total_flags = flag_cost(o_ptr, o_ptr->pval);
- if (cheat_peek) msg_format("%ld", total_flags);
+ if (options->cheat_peek)
+ {
+ msg_format("%ld", total_flags);
+ }
if (a_cursed) curse_artifact(o_ptr);
diff --git a/src/spells1.cc b/src/spells1.cc
index 93602d13..7cedf83b 100644
--- a/src/spells1.cc
+++ b/src/spells1.cc
@@ -1237,7 +1237,7 @@ void take_hit(int damage, cptr hit_from)
char death_message[80];
- int warning = (p_ptr->mhp * hitpoint_warn / 10);
+ int warning = (p_ptr->mhp * options->hitpoint_warn / 10);
int percent;
/* Paranoia */
@@ -1325,7 +1325,7 @@ void take_hit(int damage, cptr hit_from)
if (((!has_ability(AB_UNDEAD_FORM)) || ((p_ptr->necro_extra & CLASS_UNDEAD))))
{
/* Hack -- Note death */
- if (!last_words)
+ if (!options->last_words)
{
cmsg_print(TERM_RED, "You die.");
msg_print(NULL);
@@ -1461,8 +1461,10 @@ void take_hit(int damage, cptr hit_from)
}
}
- if (player_char_health)
+ if (options->player_char_health)
+ {
lite_spot(p_ptr->py, p_ptr->px);
+ }
}
@@ -1473,7 +1475,7 @@ void take_sanity_hit(int damage, cptr hit_from)
char death_message[80];
- int warning = (p_ptr->msane * hitpoint_warn / 10);
+ int warning = (p_ptr->msane * options->hitpoint_warn / 10);
/* Paranoia */
@@ -1497,7 +1499,7 @@ void take_sanity_hit(int damage, cptr hit_from)
{
/* Hack -- Note death */
cmsg_print(TERM_VIOLET, "You turn into an unthinking vegetable.");
- if (!last_words)
+ if (!options->last_words)
{
cmsg_print(TERM_RED, "You die.");
msg_print(NULL);
@@ -8035,7 +8037,7 @@ bool_ project(int who, int rad, int y, int x, int dam, int typ, int flg)
int y_saver, x_saver; /* For reflecting monsters */
- int msec = delay_factor * delay_factor * delay_factor;
+ auto const msec = options->delay_factor_ms();
/* Assume the player sees nothing */
bool_ notice = FALSE;
@@ -8190,10 +8192,16 @@ bool_ project(int who, int rad, int y, int x, int dam, int typ, int flg)
/* Visual effects */
print_rel(c, a, y, x);
move_cursor_relative(y, x);
- if (fresh_before) Term_fresh();
+ if (options->fresh_before)
+ {
+ Term_fresh();
+ }
sleep_for(milliseconds(msec));
lite_spot(y, x);
- if (fresh_before) Term_fresh();
+ if (options->fresh_before)
+ {
+ Term_fresh();
+ }
/* Display "beam" grids */
if (flg & (PROJECT_BEAM))
@@ -8330,7 +8338,7 @@ bool_ project(int who, int rad, int y, int x, int dam, int typ, int flg)
move_cursor_relative(y2, x2);
/* Flush each "radius" seperately */
- if (fresh_before) Term_fresh();
+ if (options->fresh_before) Term_fresh();
/* Delay (efficiently) */
if (visual || drawn)
@@ -8360,7 +8368,7 @@ bool_ project(int who, int rad, int y, int x, int dam, int typ, int flg)
move_cursor_relative(y2, x2);
/* Flush the explosion */
- if (fresh_before) Term_fresh();
+ if (options->fresh_before) Term_fresh();
}
}
diff --git a/src/spells2.cc b/src/spells2.cc
index 5fd21698..bfd513e6 100644
--- a/src/spells2.cc
+++ b/src/spells2.cc
@@ -3938,7 +3938,7 @@ bool_ genocide_aux(bool_ player_cast, char typ)
{
int i;
bool_ result = FALSE;
- int msec = delay_factor * delay_factor * delay_factor;
+ auto const msec = options->delay_factor_ms();
int dam = 0;
/* Delete the monsters of that "type" */
@@ -4055,13 +4055,11 @@ bool_ mass_genocide(bool_ player_cast)
{
int i;
bool_ result = FALSE;
- int msec = delay_factor * delay_factor * delay_factor;
+ auto const msec = options->delay_factor_ms();
int dam = 0;
- if (dungeon_flags & DF_NO_GENO) return (FALSE);
-
- /* Hack -- when you are fated to die, you cant cheat :) */
- if (dungeon_type == DUNGEON_DEATH)
+ /* Prevented? */
+ if ((dungeon_flags & DF_NO_GENO) || (dungeon_type == DUNGEON_DEATH))
{
msg_print("A mysterious force stops the genocide.");
return FALSE;
diff --git a/src/store.cc b/src/store.cc
index 64b75c3e..dd7aa484 100644
--- a/src/store.cc
+++ b/src/store.cc
@@ -300,7 +300,7 @@ static s32b price_item(object_type *o_ptr, int greed, bool_ flip)
if (st_info[st_ptr->st_idx].flags & STF_ALL_ITEM) price = price / 2;
/* No selling means you get no money */
- if (no_selling) price = 0;
+ if (options->no_selling) price = 0;
}
/* Shop is selling */
@@ -454,7 +454,7 @@ static void mass_produce(object_type *o_ptr)
if (o_ptr->art_name)
{
- if (cheat_peek && discount)
+ if (options->cheat_peek && discount)
{
msg_print("No discount on random artifacts.");
}
@@ -1704,7 +1704,7 @@ static bool_ prompt_yesno(cptr prompt)
}
/* Any other key must be in the allowed set to break the loop. */
- if ((strchr(allowed, key) != NULL) || quick_messages) {
+ if ((strchr(allowed, key) != NULL) || options->quick_messages) {
/* Check for presence in the 'yes' set */
ret = (strchr(yes, key) != NULL);
break;
diff --git a/src/tables.cc b/src/tables.cc
index 509a8ce9..de8215da 100644
--- a/src/tables.cc
+++ b/src/tables.cc
@@ -1238,220 +1238,6 @@ cptr window_flag_desc[32] =
};
-/*
- * Available Options
- *
- * Option Screen Sets:
- *
- * Set 1: User Interface
- * Set 2: Disturbance
- * Set 3: Inventory
- * Set 4: Game Play
- * Set 5: ToME
- * Set 6: Birth
- *
- * Note that bits 28-31 of set 0 are currently unused.
- */
-option_type option_info[] =
-{
- /*** User-Interface ***/
-
- { &rogue_like_commands, FALSE, 1, 0,
- "rogue_like_commands", "Rogue-like commands" },
-
- { &quick_messages, TRUE, 1, 1,
- "quick_messages", "Activate quick messages" },
-
- { &carry_query_flag, FALSE, 1, 3,
- "carry_query_flag", "Prompt before picking things up" },
-
- { &use_old_target, FALSE, 1, 4,
- "use_old_target", "Use old target by default" },
-
- { &always_pickup, FALSE, 1, 5,
- "always_pickup", "Pick things up by default" },
-
- { &always_repeat, TRUE, 1, 7,
- "always_repeat", "Repeat obvious commands" },
-
- { &ring_bell, FALSE, 1, 18,
- "ring_bell", "Audible bell (on errors, etc)" },
- /* Changed to default to FALSE -- it's so extremely annoying!!! -TY */
-
- /*** Disturbance ***/
-
- { &find_ignore_stairs, FALSE, 2, 0,
- "find_ignore_stairs", "Run past stairs" },
-
- { &find_ignore_doors, TRUE, 2, 1,
- "find_ignore_doors", "Run through open doors" },
-
- { &find_cut, FALSE, 2, 2,
- "find_cut", "Run past known corners" },
-
- { &find_examine, TRUE, 2, 3,
- "find_examine", "Run into potential corners" },
-
- { &disturb_move, FALSE, 2, 4,
- "disturb_move", "Disturb whenever any monster moves" },
-
- { &disturb_near, TRUE, 2, 5,
- "disturb_near", "Disturb whenever viewable monster moves" },
-
- { &disturb_panel, TRUE, 2, 6,
- "disturb_panel", "Disturb whenever map panel changes" },
-
- { &disturb_detect, TRUE, 2, 21,
- "disturb_detect", "Disturb whenever leaving trap-detected area" },
-
- { &disturb_state, TRUE, 2, 7,
- "disturb_state", "Disturb whenever player state changes" },
-
- { &disturb_minor, TRUE, 2, 8,
- "disturb_minor", "Disturb whenever boring things happen" },
-
- { &disturb_other, FALSE, 2, 9,
- "disturb_other", "Disturb whenever random things happen" },
-
- { &last_words, TRUE, 2, 12,
- "last_words", "Get last words when the character dies" },
-
- { &wear_confirm, TRUE, 2, 15,
- "confirm_wear", "Confirm to wear/wield known cursed items" },
-
- { &confirm_stairs, FALSE, 2, 16,
- "confirm_stairs", "Prompt before exiting a dungeon level" },
-
- { &disturb_pets, FALSE, 2, 17,
- "disturb_pets", "Disturb when visible pets move" },
-
- /*** Game-Play ***/
-
- { &auto_scum, TRUE, 3, 1,
- "auto_scum", "Auto-scum for good levels" },
-
- { &view_perma_grids, TRUE, 3, 6,
- "view_perma_grids", "Map remembers all perma-lit grids" },
-
- { &view_torch_grids, FALSE, 3, 7,
- "view_torch_grids", "Map remembers all torch-lit grids" },
-
- { &dungeon_align, TRUE, 3, 8,
- "dungeon_align", "Generate dungeons with aligned rooms" },
-
- { &dungeon_stair, TRUE, 3, 9,
- "dungeon_stair", "Generate dungeons with connected stairs" },
-
- { &flow_by_sound, FALSE, 3, 10,
- "flow_by_sound", "Monsters chase current location (v.slow)" },
-
- { &smart_learn, FALSE, 3, 14,
- "smart_learn", "Monsters learn from their mistakes" },
-
- { &small_levels, TRUE, 3, 17,
- "small_levels", "Allow unusually small dungeon levels" },
-
- { &empty_levels, TRUE, 3, 18,
- "empty_levels", "Allow empty 'arena' levels" },
-
- /*** Efficiency ***/
-
- { &view_reduce_lite, FALSE, 4, 0,
- "view_reduce_lite", "Reduce lite-radius when running" },
-
- { &avoid_abort, FALSE, 4, 2,
- "avoid_abort", "Avoid checking for user abort" },
-
- { &avoid_shimmer, FALSE, 4, 17,
- "avoid_shimmer", "Avoid extra shimmering (fast)" },
-
- { &avoid_other, FALSE, 4, 3,
- "avoid_other", "Avoid processing special colors (fast)" },
-
- { &flush_failure, TRUE, 4, 4,
- "flush_failure", "Flush input on various failures" },
-
- { &flush_disturb, FALSE, 4, 5,
- "flush_disturb", "Flush input whenever disturbed" },
-
- { &flush_command, FALSE, 4, 6,
- "flush_command", "Flush input before every command" },
-
- { &fresh_before, TRUE, 4, 7,
- "fresh_before", "Flush output before every command" },
-
- { &fresh_after, FALSE, 4, 8,
- "fresh_after", "Flush output after every command" },
-
- { &fresh_message, FALSE, 4, 9,
- "fresh_message", "Flush output after every message" },
-
- { &hilite_player, FALSE, 4, 11,
- "hilite_player", "Hilite the player with the cursor" },
-
- { &view_yellow_lite, FALSE, 4, 12,
- "view_yellow_lite", "Use special colors for torch-lit grids" },
-
- { &view_bright_lite, FALSE, 4, 13,
- "view_bright_lite", "Use special colors for 'viewable' grids" },
-
- { &view_granite_lite, FALSE, 4, 14,
- "view_granite_lite", "Use special colors for wall grids (slow)" },
-
- { &view_special_lite, FALSE, 4, 15,
- "view_special_lite", "Use special colors for floor grids (slow)" },
-
- { &center_player, FALSE, 4, 16,
- "center_player", "Center the view on the player (very slow)" },
-
- /*** ToME options ***/
-
- { &option_ingame_help, TRUE, 5, 1,
- "ingame_help", "Ingame contextual help" },
-
- { &auto_more, FALSE, 5, 4,
- "auto_more", "Automatically clear '-more-' prompts" },
-
- { &player_char_health, TRUE, 5, 6,
- "player_char_health", "Player char represent his/her health" },
-
- { &linear_stats, TRUE, 5, 7,
- "linear_stats", "Stats are represented in a linear way" },
-
- /*** Birth Options ***/
-
- { &preserve, TRUE, 6, 2,
- "preserve", "Preserve artifacts" },
-
- { &autoroll, TRUE, 6, 3,
- "autoroll", "Specify 'minimal' stats" },
-
- { &point_based, FALSE, 6, 17,
- "point_based", "Generate character using a point system" },
-
- { &ironman_rooms, FALSE, 6, 6,
- "ironman_rooms", "Always generate very unusual rooms" },
-
- { &joke_monsters, FALSE, 6, 14,
- "joke_monsters", "Allow use of some 'joke' monsters" },
-
- { &always_small_level, FALSE, 6, 16,
- "always_small_level", "Always make small levels" },
-
- { &fate_option, TRUE, 6, 18,
- "fate_option", "You can receive fates, good or bad" },
-
- { &no_selling, FALSE, 6, 20,
- "no_selling", "Items always sell for 0 gold" },
-
- /*** End of Table ***/
-
- { NULL, 0, 0, 0,
- NULL, NULL }
-};
-
-
-
/* Names used for random artifact name generation */
cptr artifact_names_list =
"adanedhel\n"
diff --git a/src/tables.hpp b/src/tables.hpp
index aafbb763..ab4fd00c 100644
--- a/src/tables.hpp
+++ b/src/tables.hpp
@@ -54,7 +54,6 @@ extern cptr color_names[16];
extern cptr stat_names[6];
extern cptr stat_names_reduced[6];
extern cptr window_flag_desc[32];
-extern option_type option_info[];
extern martial_arts bear_blows[MAX_BEAR];
extern martial_arts ma_blows[MAX_MA];
extern magic_power mindcraft_powers[MAX_MINDCRAFT_POWERS];
diff --git a/src/util.cc b/src/util.cc
index d1bc6bbd..b393c610 100644
--- a/src/util.cc
+++ b/src/util.cc
@@ -1225,7 +1225,7 @@ void flush(void)
*/
void flush_on_failure()
{
- if (flush_failure)
+ if (options->flush_failure)
{
flush();
}
@@ -1241,7 +1241,7 @@ void bell(void)
Term_fresh();
/* Make a bell noise (if allowed) */
- if (ring_bell)
+ if (options->ring_bell)
{
Term_bell();
}
@@ -1506,7 +1506,7 @@ static char inkey_real(bool_ inkey_scan)
(void)Term_get_cursor(&v);
/* Show the cursor if waiting, except sometimes in "command" mode */
- if (!inkey_scan && (!inkey_flag || hilite_player || character_icky))
+ if (!inkey_scan && (!inkey_flag || options->hilite_player || character_icky))
{
/* Show the cursor */
(void)Term_set_cursor(1);
@@ -1598,7 +1598,7 @@ static char inkey_real(bool_ inkey_scan)
/* Handle "control-right-bracket" */
- if ((ch == 29) || ((!rogue_like_commands) && (ch == KTRL('D'))))
+ if ((ch == 29) || ((!options->rogue_like_commands) && (ch == KTRL('D'))))
{
/* Strip this key */
ch = 0;
@@ -1691,7 +1691,7 @@ static void msg_flush(int x)
while (1)
{
int cmd = inkey();
- if (quick_messages) break;
+ if (options->quick_messages) break;
if ((cmd == ESCAPE) || (cmd == ' ')) break;
if ((cmd == '\n') || (cmd == '\r')) break;
bell();
@@ -1801,7 +1801,7 @@ void cmsg_print(byte color, cptr msg)
if (character_generated) message_add(msg, color);
/* Handle "auto_more" */
- if (auto_more)
+ if (options->auto_more)
{
/* Window stuff */
p_ptr->window |= (PW_MESSAGE);
@@ -1883,7 +1883,7 @@ void cmsg_print(byte color, cptr msg)
p += n + 1;
/* Optional refresh */
- if (fresh_message) Term_fresh();
+ if (options->fresh_message) Term_fresh();
}
/* Hack -- for compatibility and easy sake */
@@ -2546,7 +2546,7 @@ bool_ get_check(cptr prompt)
while (TRUE)
{
i = inkey();
- if (quick_messages) break;
+ if (options->quick_messages) break;
if (i == ESCAPE) break;
if (strchr("YyNn", i)) break;
bell();
@@ -2955,7 +2955,7 @@ void request_command(int shopping)
}
/* Hack -- Auto-repeat certain commands */
- if (always_repeat && (command_arg <= 0))
+ if (options->always_repeat && (command_arg <= 0))
{
/* Hack -- auto repeat certain commands */
if (strchr("TBDoc+", command_cmd))
@@ -3265,7 +3265,10 @@ void get_count(int number, int max)
command_arg = number;
/* Hack -- Optional flush */
- if (flush_command) flush();
+ if (options->flush_command)
+ {
+ flush();
+ }
/* Clear top line */
prt("", 0, 0);
@@ -3626,7 +3629,7 @@ timer_type *new_timer(void (*callback)(), s32b delay)
int get_keymap_mode()
{
- if (rogue_like_commands)
+ if (options->rogue_like_commands)
{
return KEYMAP_MODE_ROGUE;
}
diff --git a/src/variable.cc b/src/variable.cc
index fd8ccd40..9bb78ca9 100644
--- a/src/variable.cc
+++ b/src/variable.cc
@@ -143,6 +143,11 @@ int text_out_indent = 0;
/*
+ * Options
+ */
+struct options *options = nullptr;
+
+/*
* Dungeon variables
*/
diff --git a/src/variable.hpp b/src/variable.hpp
index 854b88c0..e16eae93 100644
--- a/src/variable.hpp
+++ b/src/variable.hpp
@@ -20,6 +20,7 @@
#include "monster_type_fwd.hpp"
#include "object_kind_fwd.hpp"
#include "object_type_fwd.hpp"
+#include "options.hpp"
#include "owner_type_fwd.hpp"
#include "player_class_fwd.hpp"
#include "player_defs.hpp"
@@ -289,3 +290,4 @@ extern hist_type *bg;
extern bool_ arg_wizard;
extern bool_ arg_force_original;
extern bool_ arg_force_roguelike;
+extern struct options *options;
diff --git a/src/wild.cc b/src/wild.cc
index d928b4a3..2d751b17 100644
--- a/src/wild.cc
+++ b/src/wild.cc
@@ -516,10 +516,13 @@ void wilderness_gen()
if (daytime)
{
/* Assume lit */
- c_ptr->info |= (CAVE_GLOW);
+ c_ptr->info |= CAVE_GLOW;
/* Hack -- Memorize lit grids if allowed */
- if (view_perma_grids) c_ptr->info |= (CAVE_MARK);
+ if (options->view_perma_grids)
+ {
+ c_ptr->info |= CAVE_MARK;
+ }
}
else
{
diff --git a/src/xtra1.cc b/src/xtra1.cc
index c7fd9213..072e097a 100644
--- a/src/xtra1.cc
+++ b/src/xtra1.cc
@@ -63,7 +63,7 @@
*/
void cnv_stat(int val, char *out_val)
{
- if (!linear_stats)
+ if (!options->linear_stats)
{
/* Above 18 */
if (val > 18)
@@ -230,7 +230,7 @@ static void prt_sane(void)
{
color = TERM_L_GREEN;
}
- else if (perc > (10 * hitpoint_warn))
+ else if (perc > (10 * options->hitpoint_warn))
{
color = TERM_YELLOW;
}
@@ -419,7 +419,10 @@ static void prt_hp(void)
byte color;
- if (player_char_health) lite_spot(p_ptr->py, p_ptr->px);
+ if (options->player_char_health)
+ {
+ lite_spot(p_ptr->py, p_ptr->px);
+ }
if (p_ptr->necro_extra & CLASS_UNDEAD)
{
@@ -431,7 +434,7 @@ static void prt_hp(void)
{
color = TERM_L_BLUE;
}
- else if (p_ptr->chp > (p_ptr->mhp * hitpoint_warn) / 10)
+ else if (p_ptr->chp > (p_ptr->mhp * options->hitpoint_warn) / 10)
{
color = TERM_VIOLET;
}
@@ -451,7 +454,7 @@ static void prt_hp(void)
{
color = TERM_L_GREEN;
}
- else if (p_ptr->chp > (p_ptr->mhp * hitpoint_warn) / 10)
+ else if (p_ptr->chp > (p_ptr->mhp * options->hitpoint_warn) / 10)
{
color = TERM_YELLOW;
}
@@ -490,7 +493,7 @@ static void prt_mh(void)
{
color = TERM_L_GREEN;
}
- else if (o_ptr->pval2 > (o_ptr->pval3 * hitpoint_warn) / 10)
+ else if (o_ptr->pval2 > (o_ptr->pval3 * options->hitpoint_warn) / 10)
{
color = TERM_YELLOW;
}
@@ -518,7 +521,7 @@ static void prt_sp(void)
{
color = TERM_L_GREEN;
}
- else if (p_ptr->csp > (p_ptr->msp * hitpoint_warn) / 10)
+ else if (p_ptr->csp > (p_ptr->msp * options->hitpoint_warn) / 10)
{
color = TERM_YELLOW;
}
@@ -2013,7 +2016,7 @@ static void calc_torch(void)
/* Reduce lite when running if requested */
- if (running && view_reduce_lite)
+ if (running && options->view_reduce_lite)
{
/* Reduce the lite radius if needed */
if (p_ptr->cur_lite > 1) p_ptr->cur_lite = 1;
diff --git a/src/xtra2.cc b/src/xtra2.cc
index 9581a7ee..ce4c7de0 100644
--- a/src/xtra2.cc
+++ b/src/xtra2.cc
@@ -3370,7 +3370,7 @@ void verify_panel(void)
if (max_pcol_min < 0) max_pcol_min = 0;
/* An option: center on player */
- if (center_player)
+ if (options->center_player)
{
/* Center vertically */
prow_min = y - panel_hgt;
@@ -3444,7 +3444,10 @@ void verify_panel(void)
panel_col_min = pcol_min;
/* Hack -- optional disturb on "panel change" */
- if (disturb_panel && !center_player) disturb(0);
+ if (options->disturb_panel && !options->center_player)
+ {
+ disturb(0);
+ }
/* Recalculate the boundaries */
panel_bounds();
@@ -4733,7 +4736,10 @@ bool_ get_aim_dir(int *dp)
dir = command_dir;
/* Hack -- auto-target if requested */
- if (use_old_target && target_okay()) dir = 5;
+ if (options->use_old_target && target_okay())
+ {
+ dir = 5;
+ }
/* Ask until satisfied */
while (!dir)