00001 #ifndef OPTIONS_H
00002 #define OPTIONS_H
00003
00004 #include "feature.h"
00005 #include "pattern.h"
00006 #include "newgame_def.h"
00007
00008 class InitLineInput;
00009 struct game_options
00010 {
00011 public:
00012 game_options();
00013 void reset_options();
00014
00015 void read_option_line(const std::string &s, bool runscripts = false);
00016 void read_options(InitLineInput &, bool runscripts,
00017 bool clear_aliases = true);
00018
00019 void include(const std::string &file, bool resolve, bool runscript);
00020 void report_error(const std::string &error);
00021
00022 std::string resolve_include(const std::string &file,
00023 const char *type = "");
00024
00025 bool was_included(const std::string &file) const;
00026
00027 static std::string resolve_include(
00028 std::string including_file,
00029 std::string included_file,
00030 const std::vector<std::string> *rcdirs = NULL)
00031 throw (std::string);
00032
00033 public:
00034 std::string filename;
00035 std::string basefilename;
00036 int line_num;
00037
00038
00039 std::vector<feature_override> feature_overrides;
00040 std::vector<mon_display> mon_glyph_overrides;
00041 unsigned cset_override[NUM_CSET][NUM_DCHAR_TYPES];
00042
00043 std::string save_dir;
00044 std::string macro_dir;
00045 std::string morgue_dir;
00046
00047 std::string shared_dir;
00048
00049
00050 std::vector<std::string> additional_macro_files;
00051
00052 uint32_t seed;
00053
00054 #ifdef DGL_SIMPLE_MESSAGING
00055 bool messaging;
00056 #endif
00057
00058 bool suppress_startup_errors;
00059
00060 bool mouse_input;
00061
00062 int view_max_width;
00063 int view_max_height;
00064 int mlist_min_height;
00065 int msg_min_height;
00066 int msg_max_height;
00067 bool mlist_allow_alternate_layout;
00068 bool messages_at_top;
00069 bool mlist_targeting;
00070 bool classic_hud;
00071 bool msg_condense_repeats;
00072 bool msg_condense_short;
00073
00074
00075
00076
00077 bool view_lock_x;
00078 bool view_lock_y;
00079
00080
00081 bool center_on_scroll;
00082
00083
00084
00085 bool symmetric_scroll;
00086
00087
00088 int scroll_margin_x;
00089 int scroll_margin_y;
00090
00091 bool verbose_monster_pane;
00092
00093 int autopickup_on;
00094 int default_friendly_pickup;
00095
00096 bool show_gold_turns;
00097 bool show_real_turns;
00098 bool show_beam;
00099
00100 uint32_t autopickups;
00101 bool show_inventory_weights;
00102 bool colour_map;
00103 bool clean_map;
00104 bool show_uncursed;
00105 bool easy_open;
00106 bool easy_unequip;
00107 bool equip_unequip;
00108 bool easy_butcher;
00109 bool always_confirm_butcher;
00110 bool chunks_autopickup;
00111 bool prompt_for_swap;
00112
00113 bool list_rotten;
00114 bool prefer_safe_chunks;
00115 bool easy_eat_chunks;
00116 bool easy_eat_gourmand;
00117
00118
00119 bool easy_eat_contaminated;
00120
00121 bool default_target;
00122 bool autopickup_no_burden;
00123
00124 bool note_all_skill_levels;
00125 bool note_skill_max;
00126 bool note_all_spells;
00127 std::string user_note_prefix;
00128 int note_hp_percent;
00129 bool note_xom_effects;
00130 int ood_interesting;
00131 int rare_interesting;
00132 confirm_level_type easy_confirm;
00133 bool easy_quit_item_prompts;
00134 confirm_prompt_type allow_self_target;
00135
00136 int colour[16];
00137 int background_colour;
00138 msg_colour_type channels[NUM_MESSAGE_CHANNELS];
00139 bool darken_beyond_range;
00140
00141 int hp_warning;
00142 int magic_point_warning;
00143 bool clear_messages;
00144 bool show_more;
00145 bool small_more;
00146 unsigned friend_brand;
00147 unsigned neutral_brand;
00148 bool no_dark_brand;
00149 bool macro_meta_entry;
00150
00151
00152 int fire_items_start;
00153 std::vector<unsigned> fire_order;
00154
00155 bool auto_list;
00156
00157 bool flush_input[NUM_FLUSH_REASONS];
00158
00159 char_set_type char_set;
00160 FixedVector<unsigned, NUM_DCHAR_TYPES> char_table;
00161
00162 int num_colours;
00163
00164 std::string pizza;
00165
00166 #ifdef WIZARD
00167 int wiz_mode;
00168 std::vector<std::string> terp_files;
00169 #endif
00170
00171
00172 int sc_entries;
00173 int sc_format;
00174
00175 std::vector<std::pair<int, int> > hp_colour;
00176 std::vector<std::pair<int, int> > mp_colour;
00177 std::vector<std::pair<int, int> > stat_colour;
00178
00179 std::string map_file_name;
00180 std::vector<std::pair<text_pattern, bool> > force_autopickup;
00181 std::vector<text_pattern> note_monsters;
00182 std::vector<text_pattern> note_messages;
00183 std::vector<std::pair<text_pattern, std::string> > autoinscriptions;
00184 std::vector<text_pattern> note_items;
00185 std::vector<int> note_skill_levels;
00186
00187 bool autoinscribe_artefacts;
00188 bool autoinscribe_cursed;
00189
00190 bool pickup_thrown;
00191 bool pickup_dropped;
00192 int travel_delay;
00193 int explore_delay;
00194
00195 int arena_delay;
00196 bool arena_dump_msgs;
00197 bool arena_dump_msgs_all;
00198 bool arena_list_eq;
00199
00200 std::vector<message_filter> force_more_message;
00201
00202 int stash_tracking;
00203
00204 int tc_reachable;
00205 int tc_excluded;
00206 int tc_exclude_circle;
00207 int tc_dangerous;
00208 int tc_disconnected;
00209 std::vector<text_pattern> auto_exclude;
00210
00211
00212 int travel_stair_cost;
00213
00214 bool show_waypoints;
00215
00216 bool classic_item_colours;
00217 bool item_colour;
00218
00219 unsigned evil_colour;
00220
00221 unsigned detected_monster_colour;
00222 unsigned detected_item_colour;
00223 unsigned status_caption_colour;
00224
00225 unsigned heap_brand;
00226 unsigned stab_brand;
00227 unsigned may_stab_brand;
00228 unsigned feature_item_brand;
00229 unsigned trap_item_brand;
00230
00231 bool trap_prompt;
00232
00233
00234
00235
00236 int item_stack_summary_minimum;
00237
00238 int explore_stop;
00239
00240
00241 int explore_stop_prompt;
00242
00243
00244
00245 std::vector<text_pattern> explore_stop_pickup_ignore;
00246
00247 bool explore_greedy;
00248
00249
00250 int explore_item_greed;
00251
00252
00253 bool explore_improved;
00254
00255 std::vector<sound_mapping> sound_mappings;
00256 std::vector<colour_mapping> menu_colour_mappings;
00257 std::vector<message_colour_mapping> message_colour_mappings;
00258
00259 bool menu_colour_prefix_class;
00260 bool menu_colour_shops;
00261
00262 std::vector<menu_sort_condition> sort_menus;
00263
00264 int dump_kill_places;
00265 int dump_message_count;
00266
00267 int dump_item_origins;
00268 int dump_item_origin_price;
00269 bool dump_book_spells;
00270
00271
00272 std::vector<std::string> dump_order;
00273
00274 bool level_map_title;
00275 bool target_unshifted_dirs;
00276
00277
00278 int drop_mode;
00279
00280 int pickup_mode;
00281
00282
00283 bool easy_exit_menu;
00284
00285 int assign_item_slot;
00286
00287 bool restart_after_game;
00288
00289 std::vector<text_pattern> drop_filter;
00290
00291 FixedArray<bool, NUM_DELAYS, NUM_AINTERRUPTS> activity_interrupts;
00292
00293
00294 bool remember_name;
00295
00296 bool dos_use_background_intensity;
00297
00298 bool use_fake_cursor;
00299
00300 bool use_fake_player_cursor;
00301
00302 bool show_player_species;
00303
00304 int level_map_cursor_step;
00305
00306
00307
00308 int kill_map[KC_NCATEGORIES];
00309
00310 bool rest_wait_both;
00311
00312
00313 #ifdef WIZARD
00314
00315 int fsim_rounds;
00316 int fsim_str, fsim_int, fsim_dex;
00317 int fsim_xl;
00318 std::string fsim_mons;
00319 std::vector<std::string> fsim_kit;
00320 #endif // WIZARD
00321
00322 #ifdef USE_TILE
00323 char tile_show_items[20];
00324 bool tile_skip_title;
00325 bool tile_menu_icons;
00326
00327 char tile_player_col;
00328 char tile_monster_col;
00329 char tile_neutral_col;
00330 char tile_peaceful_col;
00331 char tile_friendly_col;
00332 char tile_plant_col;
00333 char tile_item_col;
00334 char tile_unseen_col;
00335 char tile_floor_col;
00336 char tile_wall_col;
00337 char tile_mapped_wall_col;
00338 char tile_door_col;
00339 char tile_downstairs_col;
00340 char tile_upstairs_col;
00341 char tile_feature_col;
00342 char tile_trap_col;
00343 char tile_water_col;
00344 char tile_lava_col;
00345 char tile_excluded_col;
00346 char tile_excl_centre_col;
00347 char tile_window_col;
00348
00349 std::string tile_font_crt_file;
00350 int tile_font_crt_size;
00351 std::string tile_font_msg_file;
00352 int tile_font_msg_size;
00353 std::string tile_font_stat_file;
00354 int tile_font_stat_size;
00355 std::string tile_font_lbl_file;
00356 int tile_font_lbl_size;
00357 std::string tile_font_tip_file;
00358 int tile_font_tip_size;
00359
00360 screen_mode tile_full_screen;
00361 int tile_window_width;
00362 int tile_window_height;
00363 int tile_map_pixels;
00364 bool tile_force_overlay;
00365
00366 int tile_update_rate;
00367 int tile_runrest_rate;
00368 int tile_key_repeat_delay;
00369 int tile_tooltip_ms;
00370 tag_pref tile_tag_pref;
00371
00372 bool tile_show_minihealthbar;
00373 bool tile_show_minimagicbar;
00374 bool tile_show_demon_tier;
00375 bool tile_force_regenerate_levels;
00376 std::vector<std::string> tile_layout_priority;
00377 #endif
00378
00379 typedef std::map<std::string, std::string> opt_map;
00380 opt_map named_options;
00381
00382
00383 newgame_def game;
00384
00385 private:
00386 typedef std::map<std::string, std::string> string_map;
00387 string_map aliases;
00388 string_map variables;
00389 std::set<std::string> constants;
00390 std::set<std::string> included;
00391
00392 public:
00393
00394 int o_int(const char *name, int def = 0) const;
00395 bool o_bool(const char *name, bool def = false) const;
00396 std::string o_str(const char *name, const char *def = NULL) const;
00397 int o_colour(const char *name, int def = LIGHTGREY) const;
00398
00399
00400 void fixup_options();
00401
00402 private:
00403 std::string unalias(const std::string &key) const;
00404 std::string expand_vars(const std::string &field) const;
00405 void add_alias(const std::string &alias, const std::string &name);
00406
00407 void clear_feature_overrides();
00408 void clear_cset_overrides();
00409 void add_cset_override(char_set_type set, const std::string &overrides);
00410 void add_cset_override(char_set_type set, dungeon_char_type dc,
00411 unsigned symbol);
00412 void add_feature_override(const std::string &);
00413
00414 void add_message_colour_mappings(const std::string &);
00415 void add_message_colour_mapping(const std::string &);
00416 message_filter parse_message_filter(const std::string &s);
00417
00418 void set_default_activity_interrupts();
00419 void clear_activity_interrupts(FixedVector<bool, NUM_AINTERRUPTS> &eints);
00420 void set_activity_interrupt(
00421 FixedVector<bool, NUM_AINTERRUPTS> &eints,
00422 const std::string &interrupt);
00423 void set_activity_interrupt(const std::string &activity_name,
00424 const std::string &interrupt_names,
00425 bool append_interrupts,
00426 bool remove_interrupts);
00427 void set_fire_order(const std::string &full, bool add);
00428 void add_fire_order_slot(const std::string &s);
00429 void set_menu_sort(std::string field);
00430 void new_dump_fields(const std::string &text, bool add = true);
00431 void do_kill_map(const std::string &from, const std::string &to);
00432 int read_explore_stop_conditions(const std::string &) const;
00433
00434 void split_parse(const std::string &s, const std::string &separator,
00435 void (game_options::*add)(const std::string &));
00436 void add_mon_glyph_override(monster_type mtype, mon_display &mdisp);
00437 void add_mon_glyph_overrides(const std::string &mons, mon_display &mdisp);
00438 void add_mon_glyph_override(const std::string &);
00439 mon_display parse_mon_glyph(const std::string &s) const;
00440 void set_option_fragment(const std::string &s);
00441
00442 static const std::string interrupt_prefix;
00443 };
00444
00445 #ifdef DEBUG_GLOBALS
00446 #define Options (*real_Options)
00447 #endif
00448 extern game_options Options;
00449
00450 #endif