container groundwork

Move a couple of instances of container contents manipulation into
their own routines.  Behavior for items disappearing from cursed bags of
holding isn't quite identical but is effectively the same.  I think its
use of stolen_value (or simply the behavior of the latter) is buggy, but
I haven't tried to fix that.  (Cursed bag of holding destroying a player
owned bag containing shopped owned items definitely doesn't work well.)
This commit is contained in:
nethack.rankin
2003-04-03 09:28:28 +00:00
parent 02fba50b34
commit 9ee9c9f8b3
4 changed files with 59 additions and 40 deletions

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)apply.c 3.4 2003/02/13 */
/* SCCS Id: @(#)apply.c 3.4 2003/03/29 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -2780,18 +2780,7 @@ doapply()
res = use_container(obj, 1);
break;
case BAG_OF_TRICKS:
if(obj->spe > 0) {
register int cnt = 1;
check_unpaid(obj);
obj->spe--;
if(!rn2(23)) cnt += rn2(7) + 1;
while(cnt--)
(void) makemon((struct permonst *) 0,
u.ux, u.uy, NO_MM_FLAGS);
makeknown(BAG_OF_TRICKS);
} else
pline(nothing_happens);
bagotricks(obj);
break;
case CAN_OF_GREASE:
use_grease(obj);