summaryrefslogtreecommitdiff
path: root/src/variable.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/variable.cc')
-rw-r--r--src/variable.cc448
1 files changed, 16 insertions, 432 deletions
diff --git a/src/variable.cc b/src/variable.cc
index f0d18111..ae40676f 100644
--- a/src/variable.cc
+++ b/src/variable.cc
@@ -11,7 +11,7 @@
#include "cli_comm_fwd.hpp"
#include "player_type.hpp"
-#include "randart_gen_type.hpp"
+#include "skill_modifiers.hpp"
#include "util.hpp"
@@ -23,27 +23,6 @@ char *macro_trigger_name[MAX_MACRO_TRIG];
char *macro_trigger_keycode[2][MAX_MACRO_TRIG];
/*
- * Executable version
- */
-byte version_major;
-byte version_minor;
-byte version_patch;
-
-/*
- * Savefile version
- */
-byte sf_major; /* Savefile's "version_major" */
-byte sf_minor; /* Savefile's "version_minor" */
-byte sf_patch; /* Savefile's "version_patch" */
-
-/*
- * Savefile information
- */
-u32b sf_when; /* Time when savefile created */
-u16b sf_lives; /* Number of past "lives" with this file */
-u16b sf_saves; /* Number of "saves" during this life */
-
-/*
* Run-time aruments
*/
bool_ arg_wizard; /* Command arg -- Request wizard mode */
@@ -61,7 +40,11 @@ bool_ character_loaded; /* The character was loaded from a savefile */
bool_ character_icky; /* The game is in an icky full screen mode */
bool_ character_xtra; /* The game is in an icky startup mode */
-u32b seed_flavor; /* Hack -- consistent object colors */
+seed_t &seed_flavor()
+{
+ static seed_t *instance = new seed_t(seed_t::system());
+ return *instance;
+}
s16b command_cmd; /* Current "Angband Command" */
@@ -162,32 +145,9 @@ int text_out_indent = 0;
/*
- * Software options (set via the '=' command). See "tables.c"
+ * Options
*/
-
-
-
-
-/* Cheating 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_know; /* Know complete monster info */
-bool_ cheat_live; /* Allow player to avoid death */
-
-
-/* Special options */
-
-byte hitpoint_warn; /* Hitpoint warning (0 to 9) */
-
-byte delay_factor; /* Delay factor (0 to 9) */
-
-bool_ autosave_l; /* Autosave before entering new levels */
-bool_ autosave_t; /* Timed autosave */
-s16b autosave_freq; /* Autosave frequency */
-
+struct options *options = nullptr;
/*
* Dungeon variables
@@ -242,26 +202,6 @@ object_type *tracked_object;
/*
- * Current player's character name
- */
-char player_name[32];
-
-/*
- * Stripped version of "player_name"
- */
-char player_base[32];
-
-/*
- * What killed the player
- */
-char died_from[80];
-
-/*
- * Hack -- Textual "history" for the Player
- */
-char history[4][60];
-
-/*
* Buffer to hold the current savefile name
*/
char savefile[1024];
@@ -316,17 +256,10 @@ char *macro__buf;
/*
- * The array of normal options
- */
-u32b option_flag[8];
-u32b option_mask[8];
-
-
-/*
* The array of window options
*/
-u32b window_flag[8];
-u32b window_mask[8];
+u32b window_flag[ANGBAND_TERM_MAX];
+u32b window_mask[ANGBAND_TERM_MAX];
/*
@@ -408,34 +341,6 @@ u16b max_real_towns;
town_type *town_info;
/*
- * The size of "alloc_kind_table" (at most max_k_idx * ALLOCATIONS_MAX)
- */
-s16b alloc_kind_size;
-
-/*
- * The entries in the "kind allocator table"
- */
-alloc_entry *alloc_kind_table;
-
-/*
- * The flag to tell if alloc_kind_table contains valid entries
- * for normal (i.e. kind_is_legal) object allocation
- */
-bool_ alloc_kind_table_valid = FALSE;
-
-
-/*
- * The size of "alloc_race_table" (at most max_r_idx)
- */
-s16b alloc_race_size;
-
-/*
- * The entries in the "race allocator table"
- */
-alloc_entry *alloc_race_table;
-
-
-/*
* Specify attr/char pairs for visual special effects
* Be sure to use "index & 0x7F" to avoid illegal access
*/
@@ -469,124 +374,17 @@ player_type *p_ptr = nullptr;
* Pointer to the player tables
* (sex, race, race mod, class, magic)
*/
-player_sex *sp_ptr;
-player_race *rp_ptr;
-player_race_mod *rmp_ptr;
-player_class *cp_ptr;
-player_spec *spp_ptr;
-
-
-/*
- * Calculated base hp values for player at each level,
- * store them so that drain life + restore life does not
- * affect hit points. Also prevents shameless use of backup
- * savefiles for hitpoint acquirement.
- */
-s16b player_hp[PY_MAX_LEVEL];
-
-/*
- * The vault generation arrays
- */
-vault_type *v_info;
-
-/*
- * The terrain feature arrays
- */
-feature_type *f_info;
-
-/*
- * The object kind arrays
- */
-object_kind *k_info;
-
-/*
- * The artifact arrays
- */
-artifact_type *a_info;
-
-/*
- * The item set arrays
- */
-set_type *set_info;
-
-/*
- * The ego-item arrays
- */
-ego_item_type *e_info;
-
-/*
- * The randart arrays
- */
-randart_part_type *ra_info;
-randart_gen_type ra_gen[30];
-
-/* jk */
-/* the trap-arrays */
-trap_type *t_info;
-
-/*
- * The monster race arrays
- */
-monster_race *r_info;
-
-/*
- * The monster ego race arrays
- */
-monster_ego *re_info;
-
-/*
- * The dungeon types arrays
- */
-dungeon_info_type *d_info;
-
-/*
- * Player abilities arrays
- */
-ability_type *ab_info;
-
-/*
- * Player skills arrays
- */
-skill_type *s_info;
-
-/*
- * Player race arrays
- */
-player_race *race_info;
-
-/*
- * Player mod race arrays
- */
-player_race_mod *race_mod_info;
-
-/*
- * Player class arrays
- */
-player_class *class_info;
-meta_class_type *meta_class_info;
+player_race const *rp_ptr;
+player_race_mod const *rmp_ptr;
+player_class const *cp_ptr;
+player_spec const *spp_ptr;
/*
* The wilderness features arrays
*/
-wilderness_type_info *wf_info;
int wildc2i[256];
/*
- * The store/building types arrays
- */
-store_info_type *st_info;
-
-/*
- * The building actions types arrays
- */
-store_action_type *ba_info;
-
-/*
- * The owner types arrays
- */
-owner_type *ow_info;
-
-/*
* Default texts for feature information.
*/
cptr DEFAULT_FEAT_TEXT = "a wall blocking your way";
@@ -703,102 +501,6 @@ s32b get_level_max_stick = -1;
s32b get_level_use_stick = -1;
/*
- * Maximum size of the wilderness map
- */
-u16b max_wild_x;
-u16b max_wild_y;
-
-/*
- * Wilderness map
- */
-wilderness_map **wild_map;
-
-
-/*
- * Maximum number of skills in s_info.txt
- */
-u16b old_max_s_idx = 0;
-u16b max_s_idx;
-
-/*
- * Maximum number of abilities in ab_info.txt
- */
-u16b max_ab_idx;
-
-/*
- * Maximum number of monsters in r_info.txt
- */
-u16b max_r_idx;
-
-/*
- * Maximum number of ego monsters in re_info.txt
- */
-u16b max_re_idx;
-
-/*
- * Maximum number of items in k_info.txt
- */
-u16b max_k_idx;
-
-/*
- * Maximum number of vaults in v_info.txt
- */
-u16b max_v_idx;
-
-/*
- * Maximum number of terrain features in f_info.txt
- */
-u16b max_f_idx;
-
-/*
- * Maximum number of artifacts in a_info.txt
- */
-u16b max_a_idx;
-
-/*
- * Maximum number of ego-items in e_info.txt
- */
-u16b max_e_idx;
-
-/*
- * Maximum number of randarts in ra_info.txt
- */
-u16b max_ra_idx;
-
-/*
- * Maximum number of dungeon types in d_info.txt
- */
-u16b max_d_idx;
-
-/*
- * Maximum number of stores types in st_info.txt
- */
-u16b max_st_idx;
-
-/*
- * Item sets
- */
-u16b max_set_idx = 1;
-
-/*
- * Maximum number of players info in p_info.txt
- */
-u16b max_rp_idx;
-u16b max_rmp_idx;
-u16b max_c_idx;
-u16b max_mc_idx;
-
-/*
- * Maximum number of actions types in ba_info.txt
- */
-u16b max_ba_idx;
-
-/*
- * Maximum number of owner types in ow_info.txt
- */
-u16b max_ow_idx;
-
-/*
* Maximum number of objects in the level
*/
u16b max_o_idx;
@@ -809,16 +511,6 @@ u16b max_o_idx;
u16b max_m_idx;
/*
- * Maximum number of traps in tr_info.txt
- */
-u16b max_t_idx;
-
-/*
- * Maximum number of wilderness features in wf_info.txt
- */
-u16b max_wf_idx;
-
-/*
* Flags for initialization
*/
int init_flags;
@@ -838,25 +530,11 @@ bool_ carried_monster_hit = FALSE;
/*
* Random artifacts.
*/
-random_artifact random_artifacts[MAX_RANDARTS];
-/* These three used to be constants but now are set by modules */
s32b RANDART_WEAPON;
s32b RANDART_ARMOR;
s32b RANDART_JEWEL;
/*
- * Random spells.
- */
-random_spell random_spells[MAX_SPELLS];
-s16b spell_num;
-
-/*
- * Runecrafter's selfmade spells.
- */
-rune_spell rune_spells[MAX_RUNES];
-s16b rune_num;
-
-/*
* Fate.
*/
fate fates[MAX_FATES];
@@ -879,10 +557,7 @@ s16b *max_dlv;
s16b doppleganger;
/* To allow wilderness encounters */
-bool_ generate_encounter;
-
-/* Special levels */
-bool_ special_lvls;
+bool_ generate_encounter = FALSE;
/*
* Such an ugly hack ...
@@ -902,27 +577,9 @@ s16b plots[MAX_PLOTS];
random_quest random_quests[MAX_RANDOM_QUEST];
/*
- * Special levels
- */
-bool_ *special_lvl[MAX_DUNGEON_DEPTH];
-bool_ generate_special_feeling = FALSE;
-
-/*
* Dungeon flags
*/
-u32b dungeon_flags1;
-u32b dungeon_flags2;
-
-/*
- * The last character displayed
- */
-birther previous_char;
-
-/*
- * Race histories
- */
-hist_type *bg;
-int max_bg_idx;
+DECLARE_FLAG_ZERO_IMPL(dungeon_flag_set, dungeon_flags);
/*
* The spell list of schools
@@ -938,25 +595,12 @@ s32b project_time_effect = 0;
effect_type effects[MAX_EFFECTS];
/*
- * General skills set
- */
-char gen_skill_basem[MAX_SKILLS];
-u32b gen_skill_base[MAX_SKILLS];
-char gen_skill_modm[MAX_SKILLS];
-s16b gen_skill_mod[MAX_SKILLS];
-
-/*
* Table of "cli" macros.
*/
cli_comm *cli_info;
int cli_total = 0;
/*
- * max_bact, only used so that lua scripts can add new bacts without worrying about the numbers
- */
-int max_bact = 127;
-
-/*
* Automatizer enabled status
*/
bool_ automatizer_enabled = FALSE;
@@ -980,19 +624,12 @@ s32b VERSION_PATCH;
/*
* Some module info
*/
-s32b max_plev = 50;
s32b DUNGEON_BASE = 4;
s32b DUNGEON_DEATH = 28;
s32b DUNGEON_ASTRAL = 8;
s32b DUNGEON_ASTRAL_WILD_X = 45;
s32b DUNGEON_ASTRAL_WILD_Y = 19;
-/*
- * Timers
- */
-timer_type *gl_timers = NULL;
-
-
/**
* Get the version string.
*/
@@ -1010,56 +647,3 @@ const char *get_version_string()
}
return version_str;
}
-
-/*
- * A list of tvals and their textual names
- */
-tval_desc tvals[] =
-{
- { TV_SWORD, "Sword" },
- { TV_POLEARM, "Polearm" },
- { TV_HAFTED, "Hafted Weapon" },
- { TV_AXE, "Axe" },
- { TV_BOW, "Bow" },
- { TV_BOOMERANG, "Boomerang" },
- { TV_ARROW, "Arrows" },
- { TV_BOLT, "Bolts" },
- { TV_SHOT, "Shots" },
- { TV_SHIELD, "Shield" },
- { TV_CROWN, "Crown" },
- { TV_HELM, "Helm" },
- { TV_GLOVES, "Gloves" },
- { TV_BOOTS, "Boots" },
- { TV_CLOAK, "Cloak" },
- { TV_DRAG_ARMOR, "Dragon Scale Mail" },
- { TV_HARD_ARMOR, "Hard Armor" },
- { TV_SOFT_ARMOR, "Soft Armor" },
- { TV_RING, "Ring" },
- { TV_AMULET, "Amulet" },
- { TV_LITE, "Lite" },
- { TV_POTION, "Potion" },
- { TV_POTION2, "Potion" },
- { TV_SCROLL, "Scroll" },
- { TV_WAND, "Wand" },
- { TV_STAFF, "Staff" },
- { TV_ROD_MAIN, "Rod" },
- { TV_ROD, "Rod Tip" },
- { TV_BOOK, "Schools Spellbook", },
- { TV_SYMBIOTIC_BOOK, "Symbiotic Spellbook", },
- { TV_DRUID_BOOK, "Elemental Stone" },
- { TV_MUSIC_BOOK, "Music Book" },
- { TV_DAEMON_BOOK, "Daemon Book" },
- { TV_SPIKE, "Spikes" },
- { TV_DIGGING, "Digger" },
- { TV_CHEST, "Chest" },
- { TV_FOOD, "Food" },
- { TV_FLASK, "Flask" },
- { TV_MSTAFF, "Mage Staff" },
- { TV_PARCHMENT, "Parchment" },
- { TV_INSTRUMENT, "Musical Instrument" },
- { TV_RUNE1, "Rune 1" },
- { TV_RUNE2, "Rune 2" },
- { TV_JUNK, "Junk" },
- { TV_TRAPKIT, "Trapping Kit" },
- { 0, NULL }
-};