Angband
trap.h
Go to the documentation of this file.
1 
6 #ifndef TRAP_H
7 #define TRAP_H
8 
9 /*** Trap flags ***/
10 
11 enum
12 {
13  #define TRF(a,b) TRF_##a,
14  #include "list-trap-flags.h"
15  #undef TRF
16  TRF_MAX
17 };
18 
19 #define TRF_SIZE FLAG_SIZE(TRF_MAX)
20 
21 #define trf_has(f, flag) flag_has_dbg(f, TRF_SIZE, flag, #f, #flag)
22 #define trf_next(f, flag) flag_next(f, TRF_SIZE, flag)
23 #define trf_is_empty(f) flag_is_empty(f, TRF_SIZE)
24 #define trf_is_full(f) flag_is_full(f, TRF_SIZE)
25 #define trf_is_inter(f1, f2) flag_is_inter(f1, f2, TRF_SIZE)
26 #define trf_is_subset(f1, f2) flag_is_subset(f1, f2, TRF_SIZE)
27 #define trf_is_equal(f1, f2) flag_is_equal(f1, f2, TRF_SIZE)
28 #define trf_on(f, flag) flag_on_dbg(f, TRF_SIZE, flag, #f, #flag)
29 #define trf_off(f, flag) flag_off(f, TRF_SIZE, flag)
30 #define trf_wipe(f) flag_wipe(f, TRF_SIZE)
31 #define trf_setall(f) flag_setall(f, TRF_SIZE)
32 #define trf_negate(f) flag_negate(f, TRF_SIZE)
33 #define trf_copy(f1, f2) flag_copy(f1, f2, TRF_SIZE)
34 #define trf_union(f1, f2) flag_union(f1, f2, TRF_SIZE)
35 #define trf_comp_union(f1, f2) flag_comp_union(f1, f2, TRF_SIZE)
36 #define trf_inter(f1, f2) flag_inter(f1, f2, TRF_SIZE)
37 #define trf_diff(f1, f2) flag_diff(f1, f2, TRF_SIZE)
38 
39 
43 struct trap_kind
44 {
45  char *name;
46  char *text;
47  char *desc;
49  struct trap_kind *next;
50  int tidx;
53  wchar_t d_char;
55  int rarity;
56  int min_depth;
57  int max_num;
61  struct effect *effect;
62 };
63 
65 
69 struct trap
70 {
72  struct trap_kind *kind;
73  struct trap *next;
75  byte fy;
77 
81 };
82 
83 struct trap_kind *lookup_trap(const char *desc);
84 bool square_trap_specific(struct chunk *c, int y, int x, int t_idx);
85 bool square_trap_flag(struct chunk *c, int y, int x, int flag);
86 bool square_reveal_trap(struct chunk *c, int y, int x, int chance, bool domsg);
87 bool trap_check_hit(int power);
88 void hit_trap(int y, int x);
89 void place_trap(struct chunk *c, int y, int x, int t_idx, int trap_level);
90 void square_free_trap(struct chunk *c, int y, int x);
91 void wipe_trap_list(struct chunk *c);
92 bool square_remove_trap(struct chunk *c, int y, int x, bool domsg, int t_idx);
93 void square_set_door_lock(struct chunk *c, int y, int x, int power);
94 int square_door_power(struct chunk *c, int y, int x);
95 
96 #endif /* !TRAP_H */