Apply the new ground_level method.
[crawl.git] / crawl-ref / source / options.h
blobb51dd0813da5a59e88f8f57efe934163b0478447
1 #ifndef OPTIONS_H
2 #define OPTIONS_H
4 #include "feature.h"
5 #include "pattern.h"
6 #include "newgame_def.h"
8 class InitLineInput;
9 struct game_options
11 public:
12 game_options();
13 void reset_options();
15 void read_option_line(const std::string &s, bool runscripts = false);
16 void read_options(InitLineInput &, bool runscripts,
17 bool clear_aliases = true);
19 void include(const std::string &file, bool resolve, bool runscript);
20 void report_error(const std::string &error);
22 std::string resolve_include(const std::string &file,
23 const char *type = "");
25 bool was_included(const std::string &file) const;
27 static std::string resolve_include(
28 std::string including_file,
29 std::string included_file,
30 const std::vector<std::string> *rcdirs = NULL)
31 throw (std::string);
33 public:
34 std::string filename; // The name of the file containing options.
35 std::string basefilename; // Base (pathless) file name
36 int line_num; // Current line number being processed.
38 // View options
39 std::vector<feature_override> feature_overrides;
40 std::vector<mon_display> mon_glyph_overrides;
41 unsigned cset_override[NUM_CSET][NUM_DCHAR_TYPES];
43 std::string save_dir; // Directory where saves and bones go.
44 std::string macro_dir; // Directory containing macro.txt
45 std::string morgue_dir; // Directory where character dumps and morgue
46 // dumps are saved. Overrides crawl_dir.
47 std::string shared_dir; // Directory where the logfile, scores and bones
48 // are stored. On a multi-user system, this dir
49 // should be accessible by different people.
50 std::vector<std::string> additional_macro_files;
52 uint32_t seed; // Non-random games.
54 #ifdef DGL_SIMPLE_MESSAGING
55 bool messaging; // Check for messages.
56 #endif
58 bool suppress_startup_errors;
60 bool mouse_input;
62 int view_max_width;
63 int view_max_height;
64 int mlist_min_height;
65 int msg_min_height;
66 int msg_max_height;
67 bool mlist_allow_alternate_layout;
68 bool messages_at_top;
69 bool mlist_targeting;
70 bool classic_hud;
71 bool msg_condense_repeats;
72 bool msg_condense_short;
74 // The view lock variables force centering the viewport around the PC @
75 // at all times (the default). If view locking is not enabled, the viewport
76 // scrolls only when the PC hits the edge of it.
77 bool view_lock_x;
78 bool view_lock_y;
80 // For an unlocked viewport, this will center the viewport when scrolling.
81 bool center_on_scroll;
83 // If symmetric_scroll is set, for diagonal moves, if the view
84 // scrolls at all, it'll scroll diagonally.
85 bool symmetric_scroll;
87 // How far from the viewport edge is scrolling forced.
88 int scroll_margin_x;
89 int scroll_margin_y;
91 bool verbose_monster_pane;
93 int autopickup_on;
94 int default_friendly_pickup;
96 bool show_gold_turns; // Show gold and turns in HUD.
97 bool show_real_turns; // Show real turns instead of actions.
98 bool show_beam; // Show targeting beam by default.
100 uint32_t autopickups; // items to autopickup
101 bool show_inventory_weights; // show weights in inventory listings
102 bool colour_map; // add colour to the map
103 bool clean_map; // remove unseen clouds/monsters
104 bool show_uncursed; // label known uncursed items as "uncursed"
105 bool easy_open; // open doors with movement
106 bool easy_unequip; // allow auto-removing of armour / jewellery
107 bool equip_unequip; // Make 'W' = 'T', and 'P' = 'R'.
108 bool easy_butcher; // autoswap to butchering tool
109 bool always_confirm_butcher; // even if only one corpse
110 bool chunks_autopickup; // Autopickup chunks after butchering
111 bool prompt_for_swap; // Prompt to switch back from butchering
112 // tool if hostile monsters are around.
113 bool list_rotten; // list slots for rotting corpses/chunks
114 bool prefer_safe_chunks; // prefer clean chunks to contaminated ones
115 bool easy_eat_chunks; // make 'e' auto-eat the oldest safe chunk
116 bool easy_eat_gourmand; // with easy_eat_chunks, and wearing a
117 // "OfGourmand, auto-eat contaminated
118 // chunks if no safe ones are present
119 bool easy_eat_contaminated; // like easy_eat_gourmand, but
120 // always active.
121 bool default_target; // start targeting on a real target
122 bool autopickup_no_burden; // don't autopickup if it changes burden
124 bool note_all_skill_levels; // take note for all skill levels (1-27)
125 bool note_skill_max; // take note when skills reach new max
126 bool note_all_spells; // take note when learning any spell
127 std::string user_note_prefix; // Prefix for user notes
128 int note_hp_percent; // percentage hp for notetaking
129 bool note_xom_effects; // take note of all Xom effects
130 int ood_interesting; // how many levels OOD is noteworthy?
131 int rare_interesting; // what monster rarity is noteworthy?
132 confirm_level_type easy_confirm; // make yesno() confirming easier
133 bool easy_quit_item_prompts; // make item prompts quitable on space
134 confirm_prompt_type allow_self_target; // yes, no, prompt
136 int colour[16]; // macro fg colours to other colours
137 int background_colour; // select default background colour
138 msg_colour_type channels[NUM_MESSAGE_CHANNELS]; // msg channel colouring
139 bool darken_beyond_range; // for whether targeting is out of range
141 int hp_warning; // percentage hp for danger warning
142 int magic_point_warning; // percentage mp for danger warning
143 bool clear_messages; // clear messages each turn
144 bool show_more; // Show message-full more prompts.
145 bool small_more; // Show one-char more prompts.
146 unsigned friend_brand; // Attribute for branding friendly monsters
147 unsigned neutral_brand; // Attribute for branding neutral monsters
148 bool no_dark_brand; // Attribute for branding friendly monsters
149 bool macro_meta_entry; // Allow user to use numeric sequences when
150 // creating macros
152 int fire_items_start; // index of first item for fire command
153 std::vector<unsigned> fire_order; // missile search order for 'f' command
155 bool auto_list; // automatically jump to appropriate item lists
157 bool flush_input[NUM_FLUSH_REASONS]; // when to flush input buff
159 char_set_type char_set;
160 FixedVector<unsigned, NUM_DCHAR_TYPES> char_table;
162 int num_colours; // used for setting up curses colour table (8 or 16)
164 std::string pizza;
166 #ifdef WIZARD
167 int wiz_mode; // no, never, start in wiz mode
168 std::vector<std::string> terp_files; // Lua files to load for luaterp
169 #endif
171 // internal use only:
172 int sc_entries; // # of score entries
173 int sc_format; // Format for score entries
175 std::vector<std::pair<int, int> > hp_colour;
176 std::vector<std::pair<int, int> > mp_colour;
177 std::vector<std::pair<int, int> > stat_colour;
179 std::string map_file_name; // name of mapping file to use
180 std::vector<std::pair<text_pattern, bool> > force_autopickup;
181 std::vector<text_pattern> note_monsters; // Interesting monsters
182 std::vector<text_pattern> note_messages; // Interesting messages
183 std::vector<std::pair<text_pattern, std::string> > autoinscriptions;
184 std::vector<text_pattern> note_items; // Objects to note
185 std::vector<int> note_skill_levels; // Skill levels to note
187 bool autoinscribe_artefacts; // Auto-inscribe identified artefacts.
188 bool autoinscribe_cursed; // Auto-inscribe previosly cursed items.
190 bool pickup_thrown; // Pickup thrown missiles
191 bool pickup_dropped; // Pickup dropped objects
192 int travel_delay; // How long to pause between travel moves
193 int explore_delay; // How long to pause between explore moves
195 int arena_delay;
196 bool arena_dump_msgs;
197 bool arena_dump_msgs_all;
198 bool arena_list_eq;
200 std::vector<message_filter> force_more_message;
202 int stash_tracking; // How stashes are tracked
204 int tc_reachable; // Colour for squares that are reachable
205 int tc_excluded; // Colour for excluded squares.
206 int tc_exclude_circle; // Colour for squares in the exclusion radius
207 int tc_dangerous; // Colour for trapped squares, deep water, lava.
208 int tc_disconnected;// Areas that are completely disconnected.
209 std::vector<text_pattern> auto_exclude; // Automatically set an exclusion
210 // around certain monsters.
212 int travel_stair_cost;
214 bool show_waypoints;
216 bool classic_item_colours; // Use old-style item colours
217 bool item_colour; // Colour items on level map
219 unsigned evil_colour; // Colour for things player's god dissapproves
221 unsigned detected_monster_colour; // Colour of detected monsters
222 unsigned detected_item_colour; // Colour of detected items
223 unsigned status_caption_colour; // Colour of captions in HUD.
225 unsigned heap_brand; // Highlight heaps of items
226 unsigned stab_brand; // Highlight monsters that are stabbable
227 unsigned may_stab_brand; // Highlight potential stab candidates
228 unsigned feature_item_brand; // Highlight features covered by items.
229 unsigned trap_item_brand; // Highlight traps covered by items.
231 bool trap_prompt; // Prompt when stepping on mechnical traps
232 // without enough hp (using trapwalk.lua)
234 // What is the minimum number of items in a stack for which
235 // you show summary (one-line) information
236 int item_stack_summary_minimum;
238 int explore_stop; // Stop exploring if a previously unseen
239 // item comes into view
241 int explore_stop_prompt;
243 // Don't stop greedy explore when picking up an item which matches
244 // any of these patterns.
245 std::vector<text_pattern> explore_stop_pickup_ignore;
247 bool explore_greedy; // Explore goes after items as well.
249 // How much more eager greedy-explore is for items than to explore.
250 int explore_item_greed;
252 // Some experimental improvements to explore
253 bool explore_improved;
255 std::vector<sound_mapping> sound_mappings;
256 std::vector<colour_mapping> menu_colour_mappings;
257 std::vector<message_colour_mapping> message_colour_mappings;
259 bool menu_colour_prefix_class; // Prefix item class to string
260 bool menu_colour_shops; // Use menu colours in shops?
262 std::vector<menu_sort_condition> sort_menus;
264 int dump_kill_places; // How to dump place information for kills.
265 int dump_message_count; // How many old messages to dump
267 int dump_item_origins; // Show where items came from?
268 int dump_item_origin_price;
269 bool dump_book_spells;
271 // Order of sections in the character dump.
272 std::vector<std::string> dump_order;
274 bool level_map_title; // Show title in level map
275 bool target_unshifted_dirs; // Unshifted keys target if cursor is
276 // on player.
278 int drop_mode; // Controls whether single or multidrop
279 // is the default.
280 int pickup_mode; // -1 for single, 0 for menu,
281 // X for 'if at least X items present'
283 bool easy_exit_menu; // Menus are easier to get out of
285 int assign_item_slot; // How free slots are assigned
287 bool restart_after_game; // If true, Crawl will not close on game-end
289 std::vector<text_pattern> drop_filter;
291 FixedArray<bool, NUM_DELAYS, NUM_AINTERRUPTS> activity_interrupts;
293 // Previous startup options
294 bool remember_name; // Remember and reprompt with last name
296 bool dos_use_background_intensity;
298 bool use_fake_cursor; // Draw a fake cursor instead of relying
299 // on the term's own cursor.
300 bool use_fake_player_cursor;
302 bool show_player_species;
304 int level_map_cursor_step; // The cursor increment in the level
305 // map.
307 // If the player prefers to merge kill records, this option can do that.
308 int kill_map[KC_NCATEGORIES];
310 bool rest_wait_both; // Stop resting only when both HP and MP are
311 // fully restored.
313 #ifdef WIZARD
314 // Parameters for fight simulations.
315 int fsim_rounds;
316 int fsim_str, fsim_int, fsim_dex;
317 int fsim_xl;
318 std::string fsim_mons;
319 std::vector<std::string> fsim_kit;
320 #endif // WIZARD
322 #ifdef USE_TILE
323 char tile_show_items[20]; // show which item types in tile inventory
324 bool tile_skip_title; // wait for a key at title screen?
325 bool tile_menu_icons; // display icons in menus?
326 // minimap colours
327 char tile_player_col;
328 char tile_monster_col;
329 char tile_neutral_col;
330 char tile_peaceful_col;
331 char tile_friendly_col;
332 char tile_plant_col;
333 char tile_item_col;
334 char tile_unseen_col;
335 char tile_floor_col;
336 char tile_wall_col;
337 char tile_mapped_wall_col;
338 char tile_door_col;
339 char tile_downstairs_col;
340 char tile_upstairs_col;
341 char tile_feature_col;
342 char tile_trap_col;
343 char tile_water_col;
344 char tile_lava_col;
345 char tile_excluded_col;
346 char tile_excl_centre_col;
347 char tile_window_col;
348 // font settings
349 std::string tile_font_crt_file;
350 int tile_font_crt_size;
351 std::string tile_font_msg_file;
352 int tile_font_msg_size;
353 std::string tile_font_stat_file;
354 int tile_font_stat_size;
355 std::string tile_font_lbl_file;
356 int tile_font_lbl_size;
357 std::string tile_font_tip_file;
358 int tile_font_tip_size;
359 // window settings
360 screen_mode tile_full_screen;
361 int tile_window_width;
362 int tile_window_height;
363 int tile_map_pixels;
364 bool tile_force_overlay;
365 // display settings
366 int tile_update_rate;
367 int tile_runrest_rate;
368 int tile_key_repeat_delay;
369 int tile_tooltip_ms;
370 tag_pref tile_tag_pref;
372 bool tile_show_minihealthbar;
373 bool tile_show_minimagicbar;
374 bool tile_show_demon_tier;
375 bool tile_force_regenerate_levels;
376 std::vector<std::string> tile_layout_priority;
377 #endif
379 typedef std::map<std::string, std::string> opt_map;
380 opt_map named_options; // All options not caught above are
381 // recorded here.
383 newgame_def game; // Choices for new game.
385 private:
386 typedef std::map<std::string, std::string> string_map;
387 string_map aliases;
388 string_map variables;
389 std::set<std::string> constants; // Variables that can't be changed
390 std::set<std::string> included; // Files we've included already.
392 public:
393 // Convenience accessors for the second-class options in named_options.
394 int o_int(const char *name, int def = 0) const;
395 bool o_bool(const char *name, bool def = false) const;
396 std::string o_str(const char *name, const char *def = NULL) const;
397 int o_colour(const char *name, int def = LIGHTGREY) const;
399 // Fix option values if necessary, specifically file paths.
400 void fixup_options();
402 private:
403 std::string unalias(const std::string &key) const;
404 std::string expand_vars(const std::string &field) const;
405 void add_alias(const std::string &alias, const std::string &name);
407 void clear_feature_overrides();
408 void clear_cset_overrides();
409 void add_cset_override(char_set_type set, const std::string &overrides);
410 void add_cset_override(char_set_type set, dungeon_char_type dc,
411 unsigned symbol);
412 void add_feature_override(const std::string &);
414 void add_message_colour_mappings(const std::string &);
415 void add_message_colour_mapping(const std::string &);
416 message_filter parse_message_filter(const std::string &s);
418 void set_default_activity_interrupts();
419 void clear_activity_interrupts(FixedVector<bool, NUM_AINTERRUPTS> &eints);
420 void set_activity_interrupt(
421 FixedVector<bool, NUM_AINTERRUPTS> &eints,
422 const std::string &interrupt);
423 void set_activity_interrupt(const std::string &activity_name,
424 const std::string &interrupt_names,
425 bool append_interrupts,
426 bool remove_interrupts);
427 void set_fire_order(const std::string &full, bool add);
428 void add_fire_order_slot(const std::string &s);
429 void set_menu_sort(std::string field);
430 void new_dump_fields(const std::string &text, bool add = true);
431 void do_kill_map(const std::string &from, const std::string &to);
432 int read_explore_stop_conditions(const std::string &) const;
434 void split_parse(const std::string &s, const std::string &separator,
435 void (game_options::*add)(const std::string &));
436 void add_mon_glyph_override(monster_type mtype, mon_display &mdisp);
437 void add_mon_glyph_overrides(const std::string &mons, mon_display &mdisp);
438 void add_mon_glyph_override(const std::string &);
439 mon_display parse_mon_glyph(const std::string &s) const;
440 void set_option_fragment(const std::string &s);
442 static const std::string interrupt_prefix;
445 #ifdef DEBUG_GLOBALS
446 #define Options (*real_Options)
447 #endif
448 extern game_options Options;
450 #endif