Mercurial > hg > early-roguelike
comparison rogue4/monsters.c @ 215:1b73a8641b37
rogue4: fix most GCC5 warnings.
Converting all function definitions to ANSI style accounts for most of
the change. This has exposed other problems, such as daemons not
actually being their stated type, that will require more careful
solutions.
author | John "Elwin" Edwards |
---|---|
date | Wed, 27 Jan 2016 19:41:05 -0500 |
parents | 9535a08ddc39 |
children | e52a8a7ad4c5 |
comparison
equal
deleted
inserted
replaced
214:e5a15b09ce1d | 215:1b73a8641b37 |
---|---|
12 | 12 |
13 #include <curses.h> | 13 #include <curses.h> |
14 #include <string.h> | 14 #include <string.h> |
15 #include <ctype.h> | 15 #include <ctype.h> |
16 #include "rogue.h" | 16 #include "rogue.h" |
17 | |
18 int exp_add(THING *tp); | |
17 | 19 |
18 /* | 20 /* |
19 * List of monsters in rough order of vorpalness | 21 * List of monsters in rough order of vorpalness |
20 * | 22 * |
21 * NOTE: This not initialized using strings so that xstr doesn't set up | 23 * NOTE: This not initialized using strings so that xstr doesn't set up |
37 /* | 39 /* |
38 * randmonster: | 40 * randmonster: |
39 * Pick a monster to show up. The lower the level, | 41 * Pick a monster to show up. The lower the level, |
40 * the meaner the monster. | 42 * the meaner the monster. |
41 */ | 43 */ |
42 randmonster(wander) | 44 char |
43 bool wander; | 45 randmonster(bool wander) |
44 { | 46 { |
45 register int d; | 47 register int d; |
46 register char *mons; | 48 register char *mons; |
47 | 49 |
48 mons = wander ? wand_mons : lvl_mons; | 50 mons = wander ? wand_mons : lvl_mons; |
59 | 61 |
60 /* | 62 /* |
61 * new_monster: | 63 * new_monster: |
62 * Pick a new monster and add it to the list | 64 * Pick a new monster and add it to the list |
63 */ | 65 */ |
64 new_monster(tp, type, cp) | 66 void |
65 register THING *tp; | 67 new_monster(THING *tp, char type, coord *cp) |
66 char type; | |
67 register coord *cp; | |
68 { | 68 { |
69 register struct monster *mp; | 69 register struct monster *mp; |
70 register int lev_add; | 70 register int lev_add; |
71 | 71 |
72 if ((lev_add = level - AMULETLEVEL) < 0) | 72 if ((lev_add = level - AMULETLEVEL) < 0) |
107 | 107 |
108 /* | 108 /* |
109 * expadd: | 109 * expadd: |
110 * Experience to add for this monster's level/hit points | 110 * Experience to add for this monster's level/hit points |
111 */ | 111 */ |
112 exp_add(tp) | 112 int |
113 register THING *tp; | 113 exp_add(THING *tp) |
114 { | 114 { |
115 register int mod; | 115 register int mod; |
116 | 116 |
117 if (tp->t_stats.s_lvl == 1) | 117 if (tp->t_stats.s_lvl == 1) |
118 mod = tp->t_stats.s_maxhp / 8; | 118 mod = tp->t_stats.s_maxhp / 8; |
127 | 127 |
128 /* | 128 /* |
129 * wanderer: | 129 * wanderer: |
130 * Create a new wandering monster and aim it at the player | 130 * Create a new wandering monster and aim it at the player |
131 */ | 131 */ |
132 wanderer() | 132 void |
133 wanderer(void) | |
133 { | 134 { |
134 register int i; | 135 register int i; |
135 register struct room *rp; | 136 register struct room *rp; |
136 register THING *tp; | 137 register THING *tp; |
137 coord cp = {0,0}; | 138 coord cp = {0,0}; |
164 /* | 165 /* |
165 * wake_monster: | 166 * wake_monster: |
166 * What to do when the hero steps next to a monster | 167 * What to do when the hero steps next to a monster |
167 */ | 168 */ |
168 THING * | 169 THING * |
169 wake_monster(y, x) | 170 wake_monster(int y, int x) |
170 int y, x; | |
171 { | 171 { |
172 register THING *tp; | 172 register THING *tp; |
173 register struct room *rp; | 173 register struct room *rp; |
174 register char ch; | 174 register char ch; |
175 | 175 |
224 | 224 |
225 /* | 225 /* |
226 * genocide: | 226 * genocide: |
227 * Wipe one monster out of existence (for now...) | 227 * Wipe one monster out of existence (for now...) |
228 */ | 228 */ |
229 genocide() | 229 void |
230 genocide(void) | |
230 { | 231 { |
231 register THING *mp; | 232 register THING *mp; |
232 register char c; | 233 register char c; |
233 register int i; | 234 register int i; |
234 register THING *nmp; | 235 register THING *nmp; |
268 | 269 |
269 /* | 270 /* |
270 * give_pack: | 271 * give_pack: |
271 * Give a pack to a monster if it deserves one | 272 * Give a pack to a monster if it deserves one |
272 */ | 273 */ |
273 give_pack(tp) | 274 void |
274 register THING *tp; | 275 give_pack(THING *tp) |
275 { | 276 { |
276 if (rnd(100) < monsters[tp->t_type-'A'].m_carry) | 277 if (rnd(100) < monsters[tp->t_type-'A'].m_carry) |
277 attach(tp->t_pack, new_thing()); | 278 attach(tp->t_pack, new_thing()); |
278 } | 279 } |