Fix one more batch of compiler warnings.

A few of these were potential bugs.
This commit is contained in:
John "Elwin" Edwards 2021-05-04 21:03:47 -04:00
parent 3dfd8fd09b
commit 06cad9ee1e
14 changed files with 30 additions and 27 deletions

View file

@ -24,7 +24,7 @@
* Pick a monster to show up. The lower the level,
* the meaner the monster.
*/
char
int
rnd_mon(bool wander, bool baddie)
{
/* baddie; TRUE when from a polymorph stick */
@ -85,7 +85,7 @@ lev_mon(void)
* Pick a new monster and add it to the list
*/
struct linked_list *
new_monster(char type, struct coord *cp, bool treas)
new_monster(int indx, struct coord *cp, bool treas)
{
reg struct linked_list *item;
reg struct thing *tp;
@ -97,9 +97,9 @@ new_monster(char type, struct coord *cp, bool treas)
attach(mlist, item);
tp = THINGPTR(item);
st = &tp->t_stats;
mp = &monsters[type]; /* point to this monsters structure */
mp = &monsters[indx]; /* point to this monsters structure */
tp->t_type = mp->m_show;
tp->t_indx = type;
tp->t_indx = indx;
tp->t_pos = *cp;
tp->t_room = roomin(cp);
tp->t_oldch = mvwinch(cw, cp->y, cp->x) & A_CHARTEXT;

View file

@ -154,7 +154,7 @@ void msg(char *fmt, ...);
char *new(int size);
struct linked_list *new_item(int size);
void new_level(int ltype);
struct linked_list *new_monster(char type, struct coord *cp, bool treas);
struct linked_list *new_monster(int indx, struct coord *cp, bool treas);
struct linked_list *new_thing(bool treas, int type, int which);
void nohaste(int fromfuse);
void noteth(int fromfuse);
@ -193,7 +193,7 @@ void ring_on(void);
void ringabil(void);
int ringex(int rtype);
int rnd(int range);
char rnd_mon(bool wander, bool baddie);
int rnd_mon(bool wander, bool baddie);
struct coord *rnd_pos(struct room *rp);
int rnd_room(void);
struct coord *rndmove(struct thing *who);

View file

@ -230,19 +230,20 @@ do_zap(bool gotdir)
tp = THINGPTR(item);
omonst = tp->t_indx;
if (wh == WS_POLYM && !curse) {
int newmonst;
detach(mlist, item);
discard(item);
oldch = tp->t_oldch;
delta.y = y;
delta.x = x;
monster = rnd_mon(FALSE, TRUE);
item = new_monster(monster, &delta, FALSE);
newmonst = rnd_mon(FALSE, TRUE);
item = new_monster(newmonst, &delta, FALSE);
if (!(tp->t_flags & ISRUN))
runto(&delta, &hero);
if (isalpha(mvwinch(cw, y, x)))
mvwaddch(cw, y, x, monsters[monster].m_show);
mvwaddch(cw, y, x, monsters[newmonst].m_show);
tp->t_oldch = oldch;
ws_know[WS_POLYM] |= (monster != omonst);
ws_know[WS_POLYM] |= (newmonst != omonst);
}
else if (wh == WS_MINVIS && !bless) {
tp->t_flags |= ISINVIS;