comparison arogue5/monsters.c @ 218:56e748983fa8

Advanced Rogue 5: convert to ANSI function declarations. This still leaves over a thousand lines of warning messages, mostly related to the return types of daemons and fuses.
author John "Elwin" Edwards
date Sun, 07 Feb 2016 14:39:21 -0500
parents 0ed67132cf10
children e52a8a7ad4c5
comparison
equal deleted inserted replaced
217:94a0d9dd5ce1 218:56e748983fa8
12 * See the file LICENSE.TXT for full copyright and licensing information. 12 * See the file LICENSE.TXT for full copyright and licensing information.
13 */ 13 */
14 14
15 #include "curses.h" 15 #include "curses.h"
16 #include "rogue.h" 16 #include "rogue.h"
17 #include <stdlib.h>
17 #include <ctype.h> 18 #include <ctype.h>
18 #include <string.h> 19 #include <string.h>
19 20
20 21
21 /* 22 /*
22 * Check_residue takes care of any effect of the monster 23 * Check_residue takes care of any effect of the monster
23 */ 24 */
24 check_residue(tp) 25 void
25 register struct thing *tp; 26 check_residue(struct thing *tp)
26 { 27 {
27 /* 28 /*
28 * Take care of special abilities 29 * Take care of special abilities
29 */ 30 */
30 if (on(*tp, DIDHOLD) && (--hold_count == 0)) turn_off(player, ISHELD); 31 if (on(*tp, DIDHOLD) && (--hold_count == 0)) turn_off(player, ISHELD);
61 } 62 }
62 } 63 }
63 64
64 /* 65 /*
65 * Creat_mons creates the specified monster -- any if 0 66 * Creat_mons creates the specified monster -- any if 0
67 * person: Where to create next to
66 */ 68 */
67 69
68 bool 70 bool
69 creat_mons(person, monster, report) 71 creat_mons(struct thing *person, short monster, bool report)
70 struct thing *person; /* Where to create next to */
71 short monster;
72 bool report;
73 { 72 {
74 struct linked_list *nitem; 73 struct linked_list *nitem;
75 register struct thing *tp; 74 register struct thing *tp;
76 struct room *rp; 75 struct room *rp;
77 coord *mp; 76 coord *mp;
119 * Generate at least 'least' monsters for this single room level. 118 * Generate at least 'least' monsters for this single room level.
120 * 'Treas' indicates whether this is a "treasure" level. 119 * 'Treas' indicates whether this is a "treasure" level.
121 */ 120 */
122 121
123 void 122 void
124 genmonsters(least, treas) 123 genmonsters(int least, bool treas)
125 register int least;
126 bool treas;
127 { 124 {
128 reg int i; 125 reg int i;
129 reg struct room *rp = &rooms[0]; 126 reg struct room *rp = &rooms[0];
130 reg struct linked_list *item; 127 reg struct linked_list *item;
131 reg struct thing *mp; 128 reg struct thing *mp;
164 /* 161 /*
165 * id_monst returns the index of the monster given its letter 162 * id_monst returns the index of the monster given its letter
166 */ 163 */
167 164
168 short 165 short
169 id_monst(monster) 166 id_monst(char monster)
170 register char monster;
171 { 167 {
172 register short result; 168 register short result;
173 169
174 result = NLEVMONS*vlevel; 170 result = NLEVMONS*vlevel;
175 if (result > NUMMONST) result = NUMMONST; 171 if (result > NUMMONST) result = NUMMONST;
185 /* 181 /*
186 * new_monster: 182 * new_monster:
187 * Pick a new monster and add it to the list 183 * Pick a new monster and add it to the list
188 */ 184 */
189 185
190 new_monster(item, type, cp, max_monster) 186 void
191 struct linked_list *item; 187 new_monster(struct linked_list *item, short type, coord *cp, bool max_monster)
192 short type;
193 register coord *cp;
194 bool max_monster;
195 { 188 {
196 register struct thing *tp; 189 register struct thing *tp;
197 register struct monster *mp; 190 register struct monster *mp;
198 register char *ip, *hitp; 191 register char *ip, *hitp;
199 register int i, min_intel, max_intel; 192 register int i, min_intel, max_intel;
377 * Pick a monster to show up. The lower the level, 370 * Pick a monster to show up. The lower the level,
378 * the meaner the monster. 371 * the meaner the monster.
379 */ 372 */
380 373
381 short 374 short
382 randmonster(wander, no_unique) 375 randmonster(bool wander, bool no_unique)
383 register bool wander, no_unique;
384 { 376 {
385 register int d, cur_level, range, i; 377 register int d, cur_level, range, i;
386 378
387 /* 379 /*
388 * Do we want a merchant? Merchant is always in place 'NUMMONST' 380 * Do we want a merchant? Merchant is always in place 'NUMMONST'
416 408
417 /* Sell displays a menu of goods from which the player may choose 409 /* Sell displays a menu of goods from which the player may choose
418 * to purchase something. 410 * to purchase something.
419 */ 411 */
420 412
421 sell(tp) 413 void
422 register struct thing *tp; 414 sell(struct thing *tp)
423 { 415 {
424 register struct linked_list *item; 416 register struct linked_list *item;
425 register struct object *obj; 417 register struct object *obj;
426 register int i, j, min_worth, nitems, goods = 0, chance, which_item; 418 register int i, j, min_worth, nitems, goods = 0, chance, which_item;
427 char buffer[LINELEN]; 419 char buffer[LINELEN];
729 721
730 /* 722 /*
731 * what to do when the hero steps next to a monster 723 * what to do when the hero steps next to a monster
732 */ 724 */
733 struct linked_list * 725 struct linked_list *
734 wake_monster(y, x) 726 wake_monster(int y, int x)
735 int y, x;
736 { 727 {
737 register struct thing *tp; 728 register struct thing *tp;
738 register struct linked_list *it; 729 register struct linked_list *it;
739 register struct room *trp; 730 register struct room *trp;
740 register const char *mname; 731 register const char *mname;
955 /* 946 /*
956 * wanderer: 947 * wanderer:
957 * A wandering monster has awakened and is headed for the player 948 * A wandering monster has awakened and is headed for the player
958 */ 949 */
959 950
960 wanderer() 951 void
952 wanderer(void)
961 { 953 {
962 register int i; 954 register int i;
963 register struct room *hr = roomin(&hero); 955 register struct room *hr = roomin(&hero);
964 register struct linked_list *item; 956 register struct linked_list *item;
965 register struct thing *tp; 957 register struct thing *tp;