Prevent pack corruption

This commit is contained in:
jl777
2019-03-06 03:17:32 -11:00
parent 53b12740a3
commit 25e1e4c703
4 changed files with 24 additions and 24 deletions

View File

@@ -308,6 +308,7 @@ attack(struct rogue_state *rs,THING *mp)
mp=NULL; mp=NULL;
leave_pack(rs,steal, FALSE, FALSE); leave_pack(rs,steal, FALSE, FALSE);
msg(rs,"she stole %s!", inv_name(steal, TRUE)); msg(rs,"she stole %s!", inv_name(steal, TRUE));
if ( steal->o_count <= 0 )
discard(steal); discard(steal);
} }
} }
@@ -600,8 +601,7 @@ remove_mon(struct rogue_state *rs,coord *mp, THING *tp, bool waskill)
detach(tp->t_pack, obj); detach(tp->t_pack, obj);
if (waskill) if (waskill)
fall(rs,obj, FALSE); fall(rs,obj, FALSE);
else if ( obj->o_count <= 0 ) else discard(obj);
discard(obj);
} }
moat(mp->y, mp->x) = NULL; moat(mp->y, mp->x) = NULL;
mvaddch(mp->y, mp->x, tp->t_oldch); mvaddch(mp->y, mp->x, tp->t_oldch);