This commit is contained in:
jl777
2019-03-06 03:03:46 -11:00
parent 891bfb4b9d
commit ab4fde8764
2 changed files with 33 additions and 28 deletions

View File

@@ -290,8 +290,7 @@ attack(struct rogue_state *rs,THING *mp)
}
when 'N':
{
register THING *obj, *steal;
register int nobj;
THING *obj, *steal; int nobj;
/*
* Nymph's steal a magic item, look through the pack
@@ -594,26 +593,25 @@ void
remove_mon(struct rogue_state *rs,coord *mp, THING *tp, bool waskill)
{
register THING *obj, *nexti;
for (obj = tp->t_pack; obj != NULL; obj = nexti)
{
nexti = next(obj);
obj->o_pos = tp->t_pos;
detach(tp->t_pack, obj);
if (waskill)
fall(rs,obj, FALSE);
else
discard(obj);
nexti = next(obj);
obj->o_pos = tp->t_pos;
detach(tp->t_pack, obj);
if (waskill)
fall(rs,obj, FALSE);
else
discard(obj);
}
moat(mp->y, mp->x) = NULL;
mvaddch(mp->y, mp->x, tp->t_oldch);
detach(mlist, tp);
if (on(*tp, ISTARGET))
{
kamikaze = FALSE;
to_death = FALSE;
if (fight_flush)
flush_type();
kamikaze = FALSE;
to_death = FALSE;
if (fight_flush)
flush_type();
}
discard(tp);
}

View File

@@ -61,6 +61,16 @@ discard(THING *item)
break;
}
}
THING *list = pack;
for (; list != NULL; list = next(list))
{
if ( list == item )
{
fprintf(stderr,"pack item discarded? (%s)\n",inv_name(list,FALSE));
sleep(3);
break;
}
}
#endif
itemcounter--;
free((char *) item);
@@ -89,11 +99,11 @@ void
_detach(THING **list, THING *item)
{
if (*list == item)
*list = next(item);
*list = next(item);
if (prev(item) != NULL)
item->l_prev->l_next = next(item);
item->l_prev->l_next = next(item);
if (next(item) != NULL)
item->l_next->l_prev = prev(item);
item->l_next->l_prev = prev(item);
item->l_next = NULL;
item->l_prev = NULL;
}
@@ -108,14 +118,14 @@ _attach(THING **list, THING *item)
{
if (*list != NULL)
{
item->l_next = *list;
(*list)->l_prev = item;
item->l_prev = NULL;
item->l_next = *list;
(*list)->l_prev = item;
item->l_prev = NULL;
}
else
{
item->l_next = NULL;
item->l_prev = NULL;
item->l_next = NULL;
item->l_prev = NULL;
}
*list = item;
}
@@ -129,17 +139,14 @@ void
_free_list(THING **ptr)
{
THING *item;
while (*ptr != NULL)
{
item = *ptr;
*ptr = next(item);
discard(item);
item = *ptr;
*ptr = next(item);
discard(item);
}
}
/*
* new_item
* Get a new item with a specified size