Code cleanup
[crawl.git] / crawl-ref / source / env.h
blob5b50923db08874ef84c5ccb866ba32b4f5806d9b
1 #ifndef ENV_H
2 #define ENV_H
4 #include "map_knowledge.h"
5 #include "monster.h"
6 #include "show.h"
7 #include "trap_def.h"
8 #include <set>
10 typedef FixedArray<short, GXM, GYM> grid_heightmap;
11 typedef uint32_t terrain_property_t;
13 typedef std::set<std::string> string_set;
15 struct vault_placement;
16 typedef std::vector<vault_placement*> vault_placement_refv;
18 struct crawl_environment
20 uint8_t rock_colour;
21 uint8_t floor_colour;
23 FixedVector< item_def, MAX_ITEMS > item; // item list
24 FixedVector< monster, MAX_MONSTERS+1 > mons; // monster list, plus anon
26 feature_grid grid; // terrain grid
27 FixedArray<terrain_property_t, GXM, GYM> pgrid; // terrain properties
28 FixedArray< unsigned short, GXM, GYM > mgrid; // monster grid
29 FixedArray< int, GXM, GYM > igrid; // item grid
30 FixedArray< unsigned short, GXM, GYM > cgrid; // cloud grid
31 FixedArray< unsigned short, GXM, GYM > grid_colours; // colour overrides
32 FixedArray< unsigned short, GXM, GYM > tgrid; // traps, shops
34 map_mask level_map_mask;
35 map_mask level_map_ids;
37 string_set level_uniq_maps;
38 string_set level_uniq_map_tags;
39 string_set level_layout_types;
41 std::string level_build_method;
43 vault_placement_refv level_vaults;
45 std::auto_ptr<grid_heightmap> heightmap;
47 // Player-remembered terrain and LOS
48 FixedArray< map_cell, GXM, GYM > map_knowledge;
49 // Previous map knowledge (last step)
50 FixedArray< map_cell, GXM, GYM > map_shadow;
51 std::set<coord_def> visible;
53 #ifdef USE_TILE
54 // indexed by grid coords
55 FixedArray<tile_fg_store, GXM, GYM> tile_bk_fg;
56 FixedArray<tileidx_t, GXM, GYM> tile_bk_bg;
57 FixedArray<tile_flavour, GXM, GYM> tile_flv;
58 // indexed by (show-1) coords
59 FixedArray<tileidx_t, ENV_SHOW_DIAMETER, ENV_SHOW_DIAMETER> tile_fg;
60 FixedArray<tileidx_t, ENV_SHOW_DIAMETER, ENV_SHOW_DIAMETER> tile_bg;
61 tile_flavour tile_default;
62 std::vector<std::string> tile_names;
63 #endif
65 FixedVector< cloud_struct, MAX_CLOUDS > cloud; // cloud list
66 short cloud_no;
68 FixedVector< shop_struct, MAX_SHOPS > shop; // shop list
69 FixedVector< trap_def, MAX_TRAPS > trap; // trap list
71 FixedVector< monster_type, MAX_MONS_ALLOC > mons_alloc;
72 map_markers markers;
74 // Place to associate arbitrary data with a particular level.
75 // Sort of like player::attribute
76 CrawlHashTable properties;
78 // Rate at which random monsters spawn, with lower numbers making
79 // them spawn more often (5 or less causes one to spawn about every
80 // 5 turns). Set to 0 to stop random generation.
81 int spawn_random_rate;
83 // Time when level was saved (hence we write out you.elapsed_time
84 // (but load it back to env.elapsed_time); used during level load
85 int elapsed_time;
87 // Which point did the player leave the level from?
88 coord_def old_player_pos;
90 // Number of turns the player has spent on this level.
91 int turns_on_level;
93 // Flags for things like preventing teleport control; see
94 // level_flag_type in enum.h
95 uint32_t level_flags;
97 // Index into the delayed actions array.
98 unsigned int dactions_done;
100 coord_def sanctuary_pos;
101 int sanctuary_time;
102 int forest_awoken_until;
103 int density;
105 // Temp stuff.
106 std::vector<final_effect> final_effects;
109 #ifdef DEBUG_GLOBALS
110 #define env (*real_env)
111 #endif
112 extern struct crawl_environment env;
114 #endif