comparison srogue/monsters.c @ 311:28e22fb35989

Fix one more batch of compiler warnings. A few of these were potential bugs.
author John "Elwin" Edwards
date Tue, 04 May 2021 21:03:47 -0400
parents e52a8a7ad4c5
children
comparison
equal deleted inserted replaced
310:827441d05b3e 311:28e22fb35989
22 /* 22 /*
23 * rnd_mon: 23 * rnd_mon:
24 * Pick a monster to show up. The lower the level, 24 * Pick a monster to show up. The lower the level,
25 * the meaner the monster. 25 * the meaner the monster.
26 */ 26 */
27 char 27 int
28 rnd_mon(bool wander, bool baddie) 28 rnd_mon(bool wander, bool baddie)
29 { 29 {
30 /* baddie; TRUE when from a polymorph stick */ 30 /* baddie; TRUE when from a polymorph stick */
31 reg int i, ok, cnt; 31 reg int i, ok, cnt;
32 32
83 /* 83 /*
84 * new_monster: 84 * new_monster:
85 * Pick a new monster and add it to the list 85 * Pick a new monster and add it to the list
86 */ 86 */
87 struct linked_list * 87 struct linked_list *
88 new_monster(char type, struct coord *cp, bool treas) 88 new_monster(int indx, struct coord *cp, bool treas)
89 { 89 {
90 reg struct linked_list *item; 90 reg struct linked_list *item;
91 reg struct thing *tp; 91 reg struct thing *tp;
92 reg struct monster *mp; 92 reg struct monster *mp;
93 reg struct stats *st; 93 reg struct stats *st;
95 95
96 item = new_item(sizeof(struct thing)); 96 item = new_item(sizeof(struct thing));
97 attach(mlist, item); 97 attach(mlist, item);
98 tp = THINGPTR(item); 98 tp = THINGPTR(item);
99 st = &tp->t_stats; 99 st = &tp->t_stats;
100 mp = &monsters[type]; /* point to this monsters structure */ 100 mp = &monsters[indx]; /* point to this monsters structure */
101 tp->t_type = mp->m_show; 101 tp->t_type = mp->m_show;
102 tp->t_indx = type; 102 tp->t_indx = indx;
103 tp->t_pos = *cp; 103 tp->t_pos = *cp;
104 tp->t_room = roomin(cp); 104 tp->t_room = roomin(cp);
105 tp->t_oldch = mvwinch(cw, cp->y, cp->x) & A_CHARTEXT; 105 tp->t_oldch = mvwinch(cw, cp->y, cp->x) & A_CHARTEXT;
106 tp->t_nomove = 0; 106 tp->t_nomove = 0;
107 tp->t_nocmd = 0; 107 tp->t_nocmd = 0;