Angband
cave.h
Go to the documentation of this file.
1 
19 #ifndef CAVE_H
20 #define CAVE_H
21 
22 #include "z-type.h"
23 #include "z-bitflag.h"
24 
25 struct player;
26 struct monster;
27 
28 extern const s16b ddd[9];
29 extern const s16b ddx[10];
30 extern const s16b ddy[10];
31 extern const s16b ddx_ddd[9];
32 extern const s16b ddy_ddd[9];
33 
38 enum
39 {
40  #define SQUARE(a,b) SQUARE_##a,
41  #include "list-square-flags.h"
42  #undef SQUARE
44 };
45 
46 #define SQUARE_SIZE FLAG_SIZE(SQUARE_MAX)
47 
48 #define sqinfo_has(f, flag) flag_has_dbg(f, SQUARE_SIZE, flag, #f, #flag)
49 #define sqinfo_next(f, flag) flag_next(f, SQUARE_SIZE, flag)
50 #define sqinfo_is_empty(f) flag_is_empty(f, SQUARE_SIZE)
51 #define sqinfo_is_full(f) flag_is_full(f, SQUARE_SIZE)
52 #define sqinfo_is_inter(f1, f2) flag_is_inter(f1, f2, SQUARE_SIZE)
53 #define sqinfo_is_subset(f1, f2) flag_is_subset(f1, f2, SQUARE_SIZE)
54 #define sqinfo_is_equal(f1, f2) flag_is_equal(f1, f2, SQUARE_SIZE)
55 #define sqinfo_on(f, flag) flag_on_dbg(f, SQUARE_SIZE, flag, #f, #flag)
56 #define sqinfo_off(f, flag) flag_off(f, SQUARE_SIZE, flag)
57 #define sqinfo_wipe(f) flag_wipe(f, SQUARE_SIZE)
58 #define sqinfo_setall(f) flag_setall(f, SQUARE_SIZE)
59 #define sqinfo_negate(f) flag_negate(f, SQUARE_SIZE)
60 #define sqinfo_copy(f1, f2) flag_copy(f1, f2, SQUARE_SIZE)
61 #define sqinfo_union(f1, f2) flag_union(f1, f2, SQUARE_SIZE)
62 #define sqinfo_inter(f1, f2) flag_inter(f1, f2, SQUARE_SIZE)
63 #define sqinfo_diff(f1, f2) flag_diff(f1, f2, SQUARE_SIZE)
64 
65 
69 enum
70 {
71  #define TF(a,b) TF_##a,
72  #include "list-terrain-flags.h"
73  #undef TF
75 };
76 
77 #define TF_SIZE FLAG_SIZE(TF_MAX)
78 
79 #define tf_has(f, flag) flag_has_dbg(f, TF_SIZE, flag, #f, #flag)
80 
87 struct feature {
88  char *name;
89  char *desc;
90  int fidx;
91 
92  struct feature *next;
93 
94  char *mimic;
103  wchar_t d_char;
104 };
105 
106 extern struct feature *f_info;
107 
109 {
110  LIGHTING_LOS = 0, /* line of sight */
111  LIGHTING_TORCH, /* torchlight */
112  LIGHTING_LIT, /* permanently lit (when not in line of sight) */
113  LIGHTING_DARK, /* dark */
115 };
116 
117 struct grid_data {
118  u32b m_idx; /* Monster index */
119  u32b f_idx; /* Feature index */
120  struct object_kind *first_kind; /* The kind of the first item on the grid */
121  struct trap *trap; /* Trap */
122  bool multiple_objects; /* Is there more than one item there? */
123  bool unseen_object; /* Is there an unaware object there? */
124  bool unseen_money; /* Is there some unaware money there? */
125 
126  enum grid_light_level lighting; /* Light level */
127  bool in_view; /* Can the player can currently see the grid? */
128  bool is_player;
130 };
131 
132 struct square {
138  struct object *obj;
139  struct trap *trap;
140 };
141 
142 struct chunk {
143  char *name;
145  int depth;
146 
150  bool good_item;
151 
152  int height;
153  int width;
154 
155  u16b feeling_squares; /* How many feeling squares the player has visited */
157 
158  struct square **squares;
159 
160  struct object **objects;
162 
163  struct monster *monsters;
167 };
168 
169 /*** Feature Indexes (see "lib/gamedata/terrain.txt") ***/
170 
171 /* Nothing */
172 extern int FEAT_NONE;
173 
174 /* Various */
175 extern int FEAT_FLOOR;
176 extern int FEAT_CLOSED;
177 extern int FEAT_OPEN;
178 extern int FEAT_BROKEN;
179 extern int FEAT_LESS;
180 extern int FEAT_MORE;
181 
182 /* Secret door */
183 extern int FEAT_SECRET;
184 
185 /* Rubble */
186 extern int FEAT_RUBBLE;
187 extern int FEAT_PASS_RUBBLE;
188 
189 /* Mineral seams */
190 extern int FEAT_MAGMA;
191 extern int FEAT_QUARTZ;
192 extern int FEAT_MAGMA_K;
193 extern int FEAT_QUARTZ_K;
194 
195 /* Walls */
196 extern int FEAT_GRANITE;
197 extern int FEAT_PERM;
198 extern int FEAT_LAVA;
199 
200 
201 /* Current level */
202 extern struct chunk *cave;
203 /* Stored levels */
204 extern struct chunk **chunk_list;
205 extern u16b chunk_list_max;
206 
207 /* cave-view.c */
208 int distance(int y1, int x1, int y2, int x2);
209 bool los(struct chunk *c, int y1, int x1, int y2, int x2);
210 void update_view(struct chunk *c, struct player *p);
211 bool no_light(void);
212 
213 /* cave-map.c */
214 void map_info(unsigned x, unsigned y, struct grid_data *g);
215 void square_note_spot(struct chunk *c, int y, int x);
216 void square_light_spot(struct chunk *c, int y, int x);
217 void light_room(int y1, int x1, bool light);
218 void wiz_light(struct chunk *c, bool full);
219 void cave_illuminate(struct chunk *c, bool daytime);
220 void cave_update_flow(struct chunk *c);
221 void cave_forget_flow(struct chunk *c);
222 
223 /* cave-square.c */
228 typedef bool (*square_predicate)(struct chunk *c, int y, int x);
229 
230 /* FEATURE PREDICATES */
231 bool feat_is_magma(int feat);
232 bool feat_is_quartz(int feat);
233 bool feat_is_granite(int feat);
234 bool feat_is_treasure(int feat);
235 bool feat_is_wall(int feat);
236 bool feat_is_floor(int feat);
237 bool feat_is_trap_holding(int feat);
238 bool feat_is_object_holding(int feat);
239 bool feat_is_monster_walkable(int feat);
240 bool feat_is_shop(int feat);
241 bool feat_is_passable(int feat);
242 bool feat_is_projectable(int feat);
243 bool feat_is_torch(int feat);
244 bool feat_is_bright(int feat);
245 bool feat_is_fiery(int feat);
246 bool feat_is_no_flow(int feat);
247 bool feat_is_smooth(int feat);
248 
249 /* SQUARE FEATURE PREDICATES */
250 bool square_isfloor(struct chunk *c, int y, int x);
251 bool square_istrappable(struct chunk *c, int y, int x);
252 bool square_isobjectholding(struct chunk *c, int y, int x);
253 bool square_isrock(struct chunk *c, int y, int x);
254 bool square_isgranite(struct chunk *c, int y, int x);
255 bool square_isperm(struct chunk *c, int y, int x);
256 bool square_ismagma(struct chunk *c, int y, int x);
257 bool square_isquartz(struct chunk *c, int y, int x);
258 bool square_ismineral(struct chunk *c, int y, int x);
259 bool square_hasgoldvein(struct chunk *c, int y, int x);
260 bool square_isrubble(struct chunk *c, int y, int x);
261 bool square_issecretdoor(struct chunk *c, int y, int x);
262 bool square_isopendoor(struct chunk *c, int y, int x);
263 bool square_iscloseddoor(struct chunk *c, int y, int x);
264 bool square_islockeddoor(struct chunk *c, int y, int x);
265 bool square_isbrokendoor(struct chunk *c, int y, int x);
266 bool square_isdoor(struct chunk *c, int y, int x);
267 bool square_isstairs(struct chunk *c, int y, int x);
268 bool square_isupstairs(struct chunk *c, int y, int x);
269 bool square_isdownstairs(struct chunk *c, int y, int x);
270 bool square_isshop(struct chunk *c, int y, int x);
271 bool square_isplayer(struct chunk *c, int y, int x);
272 bool square_isknown(struct chunk *c, int y, int x);
273 bool square_isnotknown(struct chunk *c, int y, int x);
274 
275 /* SQUARE INFO PREDICATES */
276 bool square_ismark(struct chunk *c, int y, int x);
277 bool square_isglow(struct chunk *c, int y, int x);
278 bool square_isvault(struct chunk *c, int y, int x);
279 bool square_isroom(struct chunk *c, int y, int x);
280 bool square_isseen(struct chunk *c, int y, int x);
281 bool square_isview(struct chunk *c, int y, int x);
282 bool square_wasseen(struct chunk *c, int y, int x);
283 bool square_isfeel(struct chunk *c, int y, int x);
284 bool square_istrap(struct chunk *c, int y, int x);
285 bool square_isinvis(struct chunk *c, int y, int x);
286 bool square_iswall_inner(struct chunk *c, int y, int x);
287 bool square_iswall_outer(struct chunk *c, int y, int x);
288 bool square_iswall_solid(struct chunk *c, int y, int x);
289 bool square_ismon_restrict(struct chunk *c, int y, int x);
290 bool square_isno_teleport(struct chunk *c, int y, int x);
291 bool square_isno_map(struct chunk *c, int y, int x);
292 bool square_isno_esp(struct chunk *c, int y, int x);
293 bool square_isproject(struct chunk *c, int y, int x);
294 
295 /* SQUARE BEHAVIOR PREDICATES */
296 bool square_isopen(struct chunk *c, int y, int x);
297 bool square_isempty(struct chunk *c, int y, int x);
298 bool square_canputitem(struct chunk *c, int y, int x);
299 bool square_isdiggable(struct chunk *c, int y, int x);
300 bool square_is_monster_walkable(struct chunk *c, int y, int x);
301 bool square_ispassable(struct chunk *c, int y, int x);
302 bool square_isprojectable(struct chunk *c, int y, int x);
303 bool square_iswall(struct chunk *c, int y, int x);
304 bool square_isstrongwall(struct chunk *c, int y, int x);
305 bool square_isbright(struct chunk *c, int y, int x);
306 bool square_isfiery(struct chunk *c, int y, int x);
307 bool square_isnoflow(struct chunk *c, int y, int x);
308 bool square_iswarded(struct chunk *c, int y, int x);
309 bool square_canward(struct chunk *c, int y, int x);
310 bool square_seemslikewall(struct chunk *c, int y, int x);
311 bool square_isinteresting(struct chunk *c, int y, int x);
312 bool square_isplayertrap(struct chunk *c, int y, int x);
313 bool square_isvisibletrap(struct chunk *c, int y, int x);
314 bool square_issecrettrap(struct chunk *c, int y, int x);
315 bool square_isknowntrap(struct chunk *c, int y, int x);
316 bool square_isdisabledtrap(struct chunk *c, int y, int x);
317 bool square_changeable(struct chunk *c, int y, int x);
318 bool square_in_bounds(struct chunk *c, int y, int x);
319 bool square_in_bounds_fully(struct chunk *c, int y, int x);
320 
321 struct feature *square_feat(struct chunk *c, int y, int x);
322 struct monster *square_monster(struct chunk *c, int y, int x);
323 struct object *square_object(struct chunk *c, int y, int x);
324 struct trap *square_trap(struct chunk *c, int y, int x);
325 bool square_holds_object(struct chunk *c, int y, int x, struct object *obj);
326 void square_excise_object(struct chunk *c, int y, int x, struct object *obj);
327 void square_excise_pile(struct chunk *c, int y, int x);
328 void square_sense_pile(struct chunk *c, int y, int x);
329 void square_know_pile(struct chunk *c, int y, int x);
330 
331 void square_set_feat(struct chunk *c, int y, int x, int feat);
332 
333 /* Feature placers */
334 void square_add_trap(struct chunk *c, int y, int x);
335 void square_add_ward(struct chunk *c, int y, int x);
336 void square_add_stairs(struct chunk *c, int y, int x, int depth);
337 void square_add_door(struct chunk *c, int y, int x, bool closed);
338 
339 /* Feature modifiers */
340 void square_open_door(struct chunk *c, int y, int x);
341 void square_close_door(struct chunk *c, int y, int x);
342 void square_smash_door(struct chunk *c, int y, int x);
343 void square_lock_door(struct chunk *c, int y, int x, int power);
344 void square_unlock_door(struct chunk *c, int y, int x);
345 void square_destroy_door(struct chunk *c, int y, int x);
346 void square_show_trap(struct chunk *c, int y, int x, int type);
347 void square_destroy_trap(struct chunk *c, int y, int x);
348 void square_disable_trap(struct chunk *c, int y, int x);
349 void square_tunnel_wall(struct chunk *c, int y, int x);
350 void square_destroy_wall(struct chunk *c, int y, int x);
351 void square_destroy(struct chunk *c, int y, int x);
352 void square_earthquake(struct chunk *c, int y, int x);
353 void square_remove_ward(struct chunk *c, int y, int x);
354 void square_upgrade_mineral(struct chunk *c, int y, int x);
355 void square_destroy_rubble(struct chunk *c, int y, int x);
356 void square_force_floor(struct chunk *c, int y, int x);
357 
358 
359 int square_shopnum(struct chunk *c, int y, int x);
360 int square_digging(struct chunk *c, int y, int x);
361 const char *square_apparent_name(struct chunk *c, struct player *p, int y, int x);
362 
363 void square_memorize(struct chunk *c, int y, int x);
364 void square_forget(struct chunk *c, int y, int x);
365 void square_mark(struct chunk *c, int y, int x);
366 void square_unmark(struct chunk *c, int y, int x);
367 
368 /* cave.c */
369 int lookup_feat(const char *name);
370 void set_terrain(void);
371 struct chunk *cave_new(int height, int width);
372 void cave_free(struct chunk *c);
373 void list_object(struct chunk *c, struct object *obj);
374 void delist_object(struct chunk *c, struct object *obj);
375 void object_lists_check_integrity(struct chunk *c, struct chunk *c_k);
376 void scatter(struct chunk *c, int *yp, int *xp, int y, int x, int d, bool need_los);
377 
378 struct monster *cave_monster(struct chunk *c, int idx);
379 int cave_monster_max(struct chunk *c);
380 int cave_monster_count(struct chunk *c);
381 
382 int count_feats(int *y, int *x, bool (*test)(struct chunk *cave, int y, int x), bool under);
383 
384 void cave_generate(struct chunk **c, struct player *p);
385 bool is_quest(int level);
386 
387 void cave_known(struct player *p);
388 
389 #endif /* !CAVE_H */
uint16_t u16b
Definition: h-basic.h:169
void square_memorize(struct chunk *c, int y, int x)
Definition: cave-square.c:1087
enum grid_light_level lighting
Definition: cave.h:126
bool feat_is_monster_walkable(int feat)
True if a monster can walk through the feature.
Definition: cave-square.c:106
bool square_isrubble(struct chunk *c, int y, int x)
True if the square is rubble.
Definition: cave-square.c:273
struct object ** objects
Definition: cave.h:160
void square_excise_pile(struct chunk *c, int y, int x)
Excise an entire floor pile.
Definition: cave-square.c:831
bool square_isobjectholding(struct chunk *c, int y, int x)
True if the square can hold an object.
Definition: cave-square.c:209
Definition: cave.h:74
bool square_isno_map(struct chunk *c, int y, int x)
True if cave square can't be magically mapped by the player.
Definition: cave-square.c:519
bool square_isdisabledtrap(struct chunk *c, int y, int x)
True if the square is a known, disabled player trap.
Definition: cave-square.c:726
void square_add_ward(struct chunk *c, int y, int x)
Definition: cave-square.c:938
bool square_isdoor(struct chunk *c, int y, int x)
True if the square is a door.
Definition: cave-square.c:321
void square_remove_ward(struct chunk *c, int y, int x)
Definition: cave-square.c:1039
Definition: cave.h:111
void square_destroy(struct chunk *c, int y, int x)
Definition: cave-square.c:1007
bool square_isrock(struct chunk *c, int y, int x)
True if the square is a normal granite rock wall.
Definition: cave-square.c:217
int FEAT_CLOSED
Definition: cave.c:40
An actual trap.
Definition: trap.h:75
Low-level bit vector manipulation.
Use the roguelike command false Show damage player deals to false Always pickup false Show flavors in object false Highlight player with cursor between false Show walls as solid false false Center map false Automatically clear more false Allow mouse clicks to move the true false false false false false Generate a random artifact false Force player false Restrict creation of false Lose artifacts when leaving level
Definition: list-options.h:86
bool square_isproject(struct chunk *c, int y, int x)
True if cave square is marked for projection processing.
Definition: cave-square.c:535
void square_excise_object(struct chunk *c, int y, int x, struct object *obj)
Excise an object from a floor pile, leaving it orphaned.
Definition: cave-square.c:823
Monster information, for a specific monster.
Definition: monster.h:320
void scatter(struct chunk *c, int *yp, int *xp, int y, int x, int d, bool need_los)
Standard "find me a location" function.
Definition: cave.c:284
struct feature * square_feat(struct chunk *c, int y, int x)
OTHER SQUARE FUNCTIONS.
Definition: cave-square.c:775
void square_lock_door(struct chunk *c, int y, int x, int power)
uint32_t u32b
Definition: h-basic.h:172
bool square_isvisibletrap(struct chunk *c, int y, int x)
True if there is a visible trap in this square.
Definition: cave-square.c:702
int mon_current
Definition: cave.h:166
bool square_isstairs(struct chunk *c, int y, int x)
True if square is any stair.
Definition: cave-square.c:330
grid_light_level
Definition: cave.h:108
Information about object kinds, including player knowledge.
Definition: object.h:157
void cave_update_flow(struct chunk *c)
Definition: cave-map.c:605
void square_destroy_wall(struct chunk *c, int y, int x)
Definition: cave-square.c:1002
#define TF_SIZE
Definition: cave.h:77
bool square_issecretdoor(struct chunk *c, int y, int x)
True if the square is a hidden secret door.
Definition: cave-square.c:285
bool square_istrap(struct chunk *c, int y, int x)
True if the square has a known trap.
Definition: cave-square.c:463
bool is_quest(int level)
Check if the given level is a quest level.
Definition: player-quest.c:140
monster race blow effects
int FEAT_GRANITE
Definition: cave.c:52
void map_info(unsigned x, unsigned y, struct grid_data *g)
This function takes a grid location (x, y) and extracts information the player is allowed to know abo...
Definition: cave-map.c:78
bool feat_is_shop(int feat)
True if the feature is a shop entrance.
Definition: cave-square.c:114
special grid flags
void square_tunnel_wall(struct chunk *c, int y, int x)
Definition: cave-square.c:997
s32b created_at
Definition: cave.h:144
int count_feats(int *y, int *x, bool(*test)(struct chunk *cave, int y, int x), bool under)
const s16b ddd[9]
Global array for looping through the "keypad directions".
Definition: cave.c:59
bool square_in_bounds(struct chunk *c, int y, int x)
Definition: cave-square.c:756
bool square_ismon_restrict(struct chunk *c, int y, int x)
True if cave square has monster restrictions (generation)
Definition: cave-square.c:503
void square_add_door(struct chunk *c, int y, int x, bool closed)
Definition: cave-square.c:954
struct object * obj
Definition: cave.h:138
bool square_isplayer(struct chunk *c, int y, int x)
True if the square contains the player.
Definition: cave-square.c:365
bool good_item
Definition: cave.h:150
void square_set_feat(struct chunk *c, int y, int x, int feat)
Set the terrain type for a square.
Definition: cave-square.c:902
u16b feeling_squares
Definition: cave.h:155
struct square ** squares
Definition: cave.h:158
int square_shopnum(struct chunk *c, int y, int x)
Definition: cave-square.c:1068
void cave_generate(struct chunk **c, struct player *p)
Generate a random level.
Definition: generate.c:838
void square_add_stairs(struct chunk *c, int y, int x, int depth)
Definition: cave-square.c:944
bitflag flags[TF_SIZE]
Terrain flags.
Definition: cave.h:100
uint8_t byte
Definition: h-basic.h:167
int FEAT_OPEN
Definition: cave.c:41
bool square_isstrongwall(struct chunk *c, int y, int x)
True if the square is a permanent wall or one of the "stronger" walls.
Definition: cave-square.c:632
byte power
Power for locks, visibility for traps.
Definition: trap.h:84
bool square_islockeddoor(struct chunk *c, int y, int x)
True if the square is a closed, locked door.
Definition: cave-square.c:686
bool square_isdownstairs(struct chunk *c, int y, int x)
True if square is a down stair.
Definition: cave-square.c:348
bool square_isseen(struct chunk *c, int y, int x)
True if the square has been seen by the player.
Definition: cave-square.c:431
int FEAT_MAGMA_K
Definition: cave.c:50
bool square_issecrettrap(struct chunk *c, int y, int x)
True if the square is an unknown player trap (it will appear as a floor tile)
Definition: cave-square.c:710
bool los(struct chunk *c, int y1, int x1, int y2, int x2)
A simple, fast, integer-based line-of-sight algorithm.
Definition: cave-view.c:83
void set_terrain(void)
Set terrain constants to the indices from terrain.txt.
Definition: cave.c:109
void square_show_trap(struct chunk *c, int y, int x, int type)
bool hallucinate
Definition: cave.h:129
void cave_known(struct player *p)
Make map features known, except wall/lava surrounded by wall/lava.
Definition: cave-map.c:721
bool square_isbrokendoor(struct chunk *c, int y, int x)
Definition: cave-square.c:308
void square_light_spot(struct chunk *c, int y, int x)
Tell the UI that a given map location has been updated.
Definition: cave-map.c:239
bool square_changeable(struct chunk *c, int y, int x)
Determine if a given location may be "destroyed".
Definition: cave-square.c:737
int * feat_count
Definition: cave.h:156
Definition: cave.h:142
byte scent
Definition: cave.h:136
int FEAT_SECRET
Definition: cave.c:45
int FEAT_BROKEN
Definition: cave.c:42
struct monster * square_monster(struct chunk *c, int y, int x)
Get a monster on the current level by its position.
Definition: cave-square.c:784
void square_know_pile(struct chunk *c, int y, int x)
Update the player's knowledge of the objects on a grid in the current level.
Definition: cave-square.c:855
bool square_isinvis(struct chunk *c, int y, int x)
True if the square has an unknown trap.
Definition: cave-square.c:471
u32b obj_rating
Definition: cave.h:148
bool feat_is_floor(int feat)
True is the feature is a floor.
Definition: cave-square.c:82
bool feat_is_bright(int feat)
True if the feature is internally lit.
Definition: cave-square.c:146
void list_object(struct chunk *c, struct object *obj)
Enter an object in the list of objects for the current level/chunk.
Definition: cave.c:190
bool square_iswall_outer(struct chunk *c, int y, int x)
True if cave square is an outer wall (generation)
Definition: cave-square.c:487
u16b mon_cnt
Definition: cave.h:165
bool square_in_bounds_fully(struct chunk *c, int y, int x)
Definition: cave-square.c:762
bool square_ismark(struct chunk *c, int y, int x)
SQUARE INFO PREDICATES.
Definition: cave-square.c:397
char * name
Definition: cave.h:143
wchar_t d_char
Default feature character.
Definition: cave.h:103
Object information, for a specific object.
Definition: object.h:393
bool feat_is_passable(int feat)
True if the feature is passable by the player.
Definition: cave-square.c:122
bool square_holds_object(struct chunk *c, int y, int x, struct object *obj)
Return true if the given object is on the floor at this grid.
Definition: cave-square.c:815
bool square_hasgoldvein(struct chunk *c, int y, int x)
Definition: cave-square.c:265
struct monster * cave_monster(struct chunk *c, int idx)
Get a monster on the current level by its index.
Definition: cave.c:319
bool square_isglow(struct chunk *c, int y, int x)
True if the square is lit.
Definition: cave-square.c:405
struct feature * f_info
Definition: cave.c:35
int cave_monster_count(struct chunk *c)
The current number of monsters present on the level.
Definition: cave.c:334
int FEAT_LAVA
Definition: cave.c:54
int FEAT_QUARTZ_K
Definition: cave.c:51
bool square_canward(struct chunk *c, int y, int x)
Definition: cave-square.c:667
bool no_light(void)
Returns true if the player's grid is dark.
Definition: cave-view.c:666
bool square_isnoflow(struct chunk *c, int y, int x)
True if the cave square doesn't allow monster flow information.
Definition: cave-square.c:656
bool square_iswall(struct chunk *c, int y, int x)
True if the square is a wall square (impedes the player).
Definition: cave-square.c:621
u32b m_idx
Definition: cave.h:118
int FEAT_NONE
Definition: cave.c:38
int square_digging(struct chunk *c, int y, int x)
Definition: cave-square.c:1074
int distance(int y1, int x1, int y2, int x2)
Approximate distance between two points.
Definition: cave-view.c:36
bool square_isview(struct chunk *c, int y, int x)
True if the cave square is currently viewable by the player.
Definition: cave-square.c:439
bool feat_is_trap_holding(int feat)
True is the feature can hold a trap.
Definition: cave-square.c:90
void light_room(int y1, int x1, bool light)
Illuminate or darken any room containing the given location.
Definition: cave-map.c:376
bool feat_is_treasure(int feat)
True if the square is a mineral wall with treasure (magma/quartz).
Definition: cave-square.c:66
bool unseen_object
Definition: cave.h:123
void square_add_trap(struct chunk *c, int y, int x)
Definition: cave-square.c:932
bool square_isinteresting(struct chunk *c, int y, int x)
Definition: cave-square.c:677
void square_open_door(struct chunk *c, int y, int x)
Definition: cave-square.c:958
void square_disable_trap(struct chunk *c, int y, int x)
Definition: cave-square.c:991
bool feat_is_no_flow(int feat)
True if the feature doesn't carry monster flow information.
Definition: cave-square.c:162
Definition: cave.h:132
Definition: cave.h:113
s16b mon
Definition: cave.h:137
u32b f_idx
Definition: cave.h:119
void cave_free(struct chunk *c)
Free a chunk.
Definition: cave.c:162
int type
Definition: mon-msg.c:79
int cave_monster_max(struct chunk *c)
The maximum number of monsters allowed in the level.
Definition: cave.c:327
int FEAT_MORE
Definition: cave.c:44
void square_mark(struct chunk *c, int y, int x)
Definition: cave-square.c:1097
bool square_isprojectable(struct chunk *c, int y, int x)
True if any projectable can pass through the square.
Definition: cave-square.c:611
void square_note_spot(struct chunk *c, int y, int x)
Memorize interesting viewable object/features in the given grid.
Definition: cave-map.c:211
bool square_isperm(struct chunk *c, int y, int x)
True if the square is a permanent wall.
Definition: cave-square.c:226
bool square_isknown(struct chunk *c, int y, int x)
True if the the player knows the terrain of the square.
Definition: cave-square.c:372
bool square_istrappable(struct chunk *c, int y, int x)
True if the square can hold a trap.
Definition: cave-square.c:201
struct trap * square_trap(struct chunk *c, int y, int x)
Get the first (and currently only) trap in a position on the current level.
Definition: cave-square.c:806
int FEAT_MAGMA
Definition: cave.c:48
bitflag * info
Definition: cave.h:134
const char ** p[]
Definition: name.c:40
byte bitflag
Definition: z-bitflag.h:27
char * desc
Definition: cave.h:89
const char * square_apparent_name(struct chunk *c, struct player *p, int y, int x)
Definition: cave-square.c:1080
void cave_illuminate(struct chunk *c, bool daytime)
Light or Darken the town.
Definition: cave-map.c:484
void square_destroy_door(struct chunk *c, int y, int x)
Definition: cave-square.c:980
bool square_wasseen(struct chunk *c, int y, int x)
True if the cave square was seen before the current update.
Definition: cave-square.c:447
u16b obj_max
Definition: cave.h:161
const s16b ddx[10]
Global arrays for converting "keypad direction" into "offsets".
Definition: cave.c:65
bool square_isquartz(struct chunk *c, int y, int x)
True if the square is a quartz wall.
Definition: cave-square.c:243
bool feat_is_magma(int feat)
FEATURE PREDICATES.
Definition: cave-square.c:42
bool square_is_monster_walkable(struct chunk *c, int y, int x)
True if a monster can walk through the tile.
Definition: cave-square.c:592
bool square_ismagma(struct chunk *c, int y, int x)
True if the square is a magma wall.
Definition: cave-square.c:235
int16_t s16b
Definition: h-basic.h:170
struct chunk * cave
Definition: cave.c:36
bool(* square_predicate)(struct chunk *c, int y, int x)
square_predicate is a function pointer which tests a given square to see if the predicate in question...
Definition: cave.h:228
bool square_isroom(struct chunk *c, int y, int x)
True if the square is part of a room.
Definition: cave-square.c:423
bool square_isempty(struct chunk *c, int y, int x)
True if the square is empty (an open square without any items).
Definition: cave-square.c:561
bool square_isnotknown(struct chunk *c, int y, int x)
True if the the player's knowledge of the terrain of the square is wrong or missing.
Definition: cave-square.c:381
bool feat_is_quartz(int feat)
True if the square is a quartz wall.
Definition: cave-square.c:50
bool square_isupstairs(struct chunk *c, int y, int x)
True if square is an up stair.
Definition: cave-square.c:339
char * mimic
Name of feature to mimic.
Definition: cave.h:94
Definition: cave.h:112
bool square_iswall_inner(struct chunk *c, int y, int x)
True if cave square is an inner wall (generation)
Definition: cave-square.c:479
bool feat_is_wall(int feat)
True is the feature is a solid wall (not rubble).
Definition: cave-square.c:74
bool feat_is_fiery(int feat)
True if the feature is internally lit.
Definition: cave-square.c:154
Support various data types.
u16b mon_max
Definition: cave.h:164
u32b mon_rating
Definition: cave.h:149
bool multiple_objects
Definition: cave.h:122
struct object * square_object(struct chunk *c, int y, int x)
Get the top object of a pile on the current level by its position.
Definition: cave-square.c:798
const s16b ddy[10]
Definition: cave.c:68
struct feature * next
Definition: cave.h:92
bool square_ismineral(struct chunk *c, int y, int x)
True if the square is a mineral wall (magma/quartz).
Definition: cave-square.c:259
bool in_view
Definition: cave.h:127
const s16b ddy_ddd[9]
Definition: cave.c:80
bool is_player
Definition: cave.h:128
byte feeling
Definition: cave.h:147
void square_smash_door(struct chunk *c, int y, int x)
Definition: cave-square.c:969
char * name
Definition: cave.h:88
bool square_isno_teleport(struct chunk *c, int y, int x)
True if cave square can't be teleported from by the player.
Definition: cave-square.c:511
void square_upgrade_mineral(struct chunk *c, int y, int x)
Add visible treasure to a mineral square.
Definition: cave-square.c:1050
Information about terrain features.
Definition: cave.h:87
bool square_iswarded(struct chunk *c, int y, int x)
Definition: cave-square.c:661
void square_unlock_door(struct chunk *c, int y, int x)
Definition: cave-square.c:975
byte feat
Definition: cave.h:133
bool square_isdiggable(struct chunk *c, int y, int x)
True if the square can be dug: this includes rubble and non-permanent walls.
Definition: cave-square.c:580
struct chunk * cave_new(int height, int width)
Allocate a new chunk of the world.
Definition: cave.c:133
void object_lists_check_integrity(struct chunk *c, struct chunk *c_k)
Check that a pair of object lists are consistent and relate to locations of objects correctly...
Definition: cave.c:251
bool square_isplayertrap(struct chunk *c, int y, int x)
True if there is a player trap (known or unknown) in this square.
Definition: cave-square.c:694
bool square_isbright(struct chunk *c, int y, int x)
True if the cave square is internally lit.
Definition: cave-square.c:640
bool square_canputitem(struct chunk *c, int y, int x)
True if the square is an untrapped floor square without items.
Definition: cave-square.c:569
png_infop png_uint_32 png_uint_32 * height
Definition: libpng12/png.h:2341
u16b chunk_list_max
current max actual chunk index
Definition: gen-chunk.c:36
int fidx
Definition: cave.h:90
Definition: unit-test-types.h:10
Definition: cave.h:119
int FEAT_LESS
Definition: cave.c:43
void square_forget(struct chunk *c, int y, int x)
Definition: cave-square.c:1092
bool square_isvault(struct chunk *c, int y, int x)
True if the square is part of a vault.
Definition: cave-square.c:415
byte noise
Definition: cave.h:135
Definition: cave.h:117
bool unseen_money
Definition: cave.h:124
png_infop png_uint_32 * width
Definition: libpng12/png.h:2341
void square_force_floor(struct chunk *c, int y, int x)
Definition: cave-square.c:1063
void square_earthquake(struct chunk *c, int y, int x)
Definition: cave-square.c:1021
void update_view(struct chunk *c, struct player *p)
Update the player's current view.
Definition: cave-view.c:630
int32_t s32b
Definition: h-basic.h:173
void square_destroy_trap(struct chunk *c, int y, int x)
Definition: cave-square.c:986
Definition: cave.h:114
Definition: cave.h:110
void wiz_light(struct chunk *c, bool full)
Light up the dungeon using "claravoyance".
Definition: cave-map.c:424
bool square_iscloseddoor(struct chunk *c, int y, int x)
True if the square is a closed door (possibly locked or jammed).
Definition: cave-square.c:302
byte shopnum
Which shop does it take you to?
Definition: cave.h:97
Intialize random names
Definition: init.c:658
int FEAT_FLOOR
Definition: cave.c:39
bool square_isopendoor(struct chunk *c, int y, int x)
True if the square is an open door.
Definition: cave-square.c:294
int width
Definition: cave.h:153
byte d_attr
Default feature attribute.
Definition: cave.h:102
Most of the "player" information goes here.
Definition: player.h:454
int lookup_feat(const char *name)
Find a terrain feature index by name.
Definition: cave.c:86
bool feat_is_object_holding(int feat)
True is the feature can hold an object.
Definition: cave-square.c:98
bool square_isno_esp(struct chunk *c, int y, int x)
True if cave square can't be detected by player ESP.
Definition: cave-square.c:527
bool feat_is_smooth(int feat)
True if the feature should have smooth boundaries (for dungeon generation).
Definition: cave-square.c:170
void square_close_door(struct chunk *c, int y, int x)
Definition: cave-square.c:964
struct trap * trap
Definition: cave.h:139
struct object_kind * first_kind
Definition: cave.h:120
bool square_isfeel(struct chunk *c, int y, int x)
True if cave square is a feeling trigger square.
Definition: cave-square.c:455
int depth
Definition: cave.h:145
int FEAT_RUBBLE
Definition: cave.c:46
void square_unmark(struct chunk *c, int y, int x)
Definition: cave-square.c:1101
bool square_seemslikewall(struct chunk *c, int y, int x)
Definition: cave-square.c:672
void square_sense_pile(struct chunk *c, int y, int x)
Sense the existence of objects on a grid in the current level.
Definition: cave-square.c:840
struct trap * trap
Definition: cave.h:121
bool square_isgranite(struct chunk *c, int y, int x)
True if the square is granite.
Definition: cave-square.c:251
int height
Definition: cave.h:152
int FEAT_PERM
Definition: cave.c:53
void delist_object(struct chunk *c, struct object *obj)
Remove an object from the list of objects for the current level/chunk.
Definition: cave.c:235
bool feat_is_granite(int feat)
True if the square is a granite wall.
Definition: cave-square.c:58
bool feat_is_projectable(int feat)
True if any projectable can pass through the feature.
Definition: cave-square.c:130
int FEAT_QUARTZ
Definition: cave.c:49
bool square_isfloor(struct chunk *c, int y, int x)
SQUARE FEATURE PREDICATES.
Definition: cave-square.c:193
struct monster * monsters
Definition: cave.h:163
void cave_forget_flow(struct chunk *c)
Forget the "flow" information ready for a complete update.
Definition: cave-map.c:570
int FEAT_PASS_RUBBLE
Definition: cave.c:47
bool square_isfiery(struct chunk *c, int y, int x)
True if the cave square is fire-based.
Definition: cave-square.c:648
bool square_ispassable(struct chunk *c, int y, int x)
True if the square is passable by the player.
Definition: cave-square.c:601
bool square_iswall_solid(struct chunk *c, int y, int x)
True if cave square is a solid wall (generation)
Definition: cave-square.c:495
bool square_isshop(struct chunk *c, int y, int x)
True if the square is a shop entrance.
Definition: cave-square.c:357
bool feat_is_torch(int feat)
True if the feature can be lit by light sources.
Definition: cave-square.c:138
byte priority
Display priority.
Definition: cave.h:95
const s16b ddx_ddd[9]
Global arrays for optimizing "ddx[ddd[i]]" and "ddy[ddd[i]]".
Definition: cave.c:77
struct chunk ** chunk_list
list of pointers to saved chunks
Definition: gen-chunk.c:35
void square_destroy_rubble(struct chunk *c, int y, int x)
Definition: cave-square.c:1058
bool square_isknowntrap(struct chunk *c, int y, int x)
True if the square is a known player trap.
Definition: cave-square.c:718
bool square_isopen(struct chunk *c, int y, int x)
SQUARE BEHAVIOR PREDICATES.
Definition: cave-square.c:554
byte dig
How hard is it to dig through?
Definition: cave.h:98