Apply the new ground_level method.
[crawl.git] / crawl-ref / source / terrain.h
blobf894085996059b47e37f23ffae1bcaef888441e5
1 /*
2 * File: terrain.h
3 * Summary: Terrain related functions.
4 * Written by: Linley Henzell
5 */
7 #ifndef TERRAIN_H
8 #define TERRAIN_H
10 #include "enum.h"
11 #include <memory>
13 class actor;
14 struct coord_def;
16 typedef FixedArray<bool, GXM, GYM> map_mask_boolean;
18 // Precomputes slime wall neighbours for all squares on the map. Handy if
19 // you need to make a lot of slime wall checks (such as for travel).
20 class unwind_slime_wall_precomputer
22 public:
23 unwind_slime_wall_precomputer(bool docompute = true);
24 ~unwind_slime_wall_precomputer();
25 private:
26 bool did_compute_mask;
29 actor* actor_at(const coord_def& c);
31 int count_neighbours_with_func (const coord_def& c, bool (*checker)(dungeon_feature_type));
32 bool feat_is_test (dungeon_feature_type feat, bool (*checker)(dungeon_feature_type));
33 bool feat_is_test (const coord_def& c, bool (*checker)(dungeon_feature_type));
35 bool fall_into_a_pool(const coord_def& entry, bool allow_shift,
36 dungeon_feature_type terrain);
38 bool cell_is_solid(int x, int y);
39 bool cell_is_solid(const coord_def &c);
41 bool feat_is_malign_gateway_suitable (dungeon_feature_type feat);
42 bool feat_is_wall(dungeon_feature_type feat);
43 bool feat_is_opaque(dungeon_feature_type feat);
44 bool feat_is_solid(dungeon_feature_type feat);
45 bool feat_is_floor(dungeon_feature_type feat);
46 bool feat_has_solid_floor(dungeon_feature_type feat);
47 bool feat_is_door(dungeon_feature_type feat);
48 bool feat_is_closed_door(dungeon_feature_type feat);
49 bool feat_is_secret_door(dungeon_feature_type feat);
50 bool feat_is_statue_or_idol(dungeon_feature_type feat);
51 bool feat_is_rock(dungeon_feature_type feat);
52 bool feat_is_permarock(dungeon_feature_type feat);
53 bool feat_is_stone_stair(dungeon_feature_type feat);
54 bool feat_is_staircase(dungeon_feature_type feat);
55 bool feat_is_escape_hatch(dungeon_feature_type feat);
56 bool feat_is_trap(dungeon_feature_type feat, bool undiscovered_too = false);
57 command_type feat_stair_direction(dungeon_feature_type feat);
58 bool feat_sealable_portal(dungeon_feature_type feat);
59 bool feat_is_portal(dungeon_feature_type feat);
60 bool feat_is_tree(dungeon_feature_type feat);
62 bool feat_is_stair(dungeon_feature_type feat);
63 bool feat_is_travelable_stair(dungeon_feature_type feat);
64 bool feat_is_escape_hatch(dungeon_feature_type feat);
65 bool feat_is_gate(dungeon_feature_type feat);
67 std::string feat_preposition(dungeon_feature_type feat, bool active = false,
68 const actor* who = NULL);
69 std::string stair_climb_verb(dungeon_feature_type feat);
71 bool feat_is_water(dungeon_feature_type feat);
72 bool feat_is_watery(dungeon_feature_type feat);
73 god_type feat_altar_god(dungeon_feature_type feat);
74 dungeon_feature_type altar_for_god(god_type god);
75 bool feat_is_altar(dungeon_feature_type feat);
76 bool feat_is_player_altar(dungeon_feature_type grid);
78 bool feat_is_branch_stairs(dungeon_feature_type feat);
79 bool feat_is_bidirectional_portal(dungeon_feature_type feat);
80 void find_connected_identical(const coord_def& d, dungeon_feature_type ft,
81 std::set<coord_def>& out);
82 std::set<coord_def> connected_doors(const coord_def& d);
84 bool slime_wall_neighbour(const coord_def& c);
86 void get_door_description(int door_size, const char** adjective,
87 const char** noun);
88 // Returns info about the grid a secret door is mimicing. Returns true
89 // if it finds a grid position to mimic, which will be stored in gc.
90 // feat will always be set, even if no square to mimic is found.
91 bool find_secret_door_info(const coord_def &where,
92 dungeon_feature_type *feat,
93 coord_def *gc);
94 dungeon_feature_type grid_secret_door_appearance(const coord_def &where);
95 dungeon_feature_type grid_appearance(const coord_def &gc);
96 bool feat_destroys_item(dungeon_feature_type feat, const item_def &item, bool noisy = false);
97 bool feat_virtually_destroys_item(dungeon_feature_type feat, const item_def &item, bool noisy = false);
99 // Terrain changed under 'pos', perform necessary effects.
100 void dungeon_terrain_changed(const coord_def &pos,
101 dungeon_feature_type feat = DNGN_UNSEEN,
102 bool affect_player = true,
103 bool preserve_features = false,
104 bool preserve_items = false);
106 // Moves everything on the level at src to dst.
107 void dgn_move_entities_at(coord_def src,
108 coord_def dst,
109 bool move_player,
110 bool move_monster,
111 bool move_items);
113 bool swap_features(const coord_def &pos1, const coord_def &pos2,
114 bool swap_everything = false, bool announce = true);
116 bool slide_feature_over(const coord_def &src,
117 coord_def prefered_dest = coord_def(-1, -1),
118 bool announce = true);
120 bool is_critical_feature(dungeon_feature_type feat);
122 void init_feat_desc_cache();
123 dungeon_feature_type feat_by_desc(std::string desc);
125 dungeon_feature_type dungeon_feature_by_name(const std::string &name);
126 std::vector<std::string> dungeon_feature_matches(const std::string &name);
127 const char *dungeon_feature_name(dungeon_feature_type rfeat);
128 void nuke_wall(const coord_def& p);
130 #endif