]> granicus.if.org Git - nethack/commitdiff
more wielded/quivered iron ball
authornethack.rankin <nethack.rankin>
Sat, 30 Mar 2002 09:50:59 +0000 (09:50 +0000)
committernethack.rankin <nethack.rankin>
Sat, 30 Mar 2002 09:50:59 +0000 (09:50 +0000)
     There was at least one more special case aside from throwing
(jetisoning items to reduce weight after falling in water) which
have needed the same extra code.  This is a more general fix.

include/extern.h
src/dothrow.c
src/mhitu.c
src/shk.c
src/steal.c
src/trap.c
src/zap.c

index 8ea32912444d55779db23231fc4a262413118f08..7a1b3801036d831260a5b2b4ed465077fada269d 100644 (file)
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)extern.h   3.4     2002/03/09      */
+/*     SCCS Id: @(#)extern.h   3.4     2002/03/29      */
 /* Copyright (c) Steve Creps, 1988.                              */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -1844,7 +1844,7 @@ E long FDECL(somegold, (long));
 E long NDECL(somegold);
 #endif
 E void FDECL(stealgold, (struct monst *));
-E void FDECL(remove_worn_item, (struct obj *));
+E void FDECL(remove_worn_item, (struct obj *,BOOLEAN_P));
 E int FDECL(steal, (struct monst *, char *));
 E int FDECL(mpickobj, (struct monst *,struct obj *));
 E void FDECL(stealamulet, (struct monst *));
index 4d528035bcce75ed858375ec59bda63302e6e42e..8cc555036c23d328f9b3af2fcc2439565789a09e 100644 (file)
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)dothrow.c  3.4     2002/02/21      */
+/*     SCCS Id: @(#)dothrow.c  3.4     2002/03/29      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -167,13 +167,8 @@ int shotlimit;
                otmp = splitobj(obj, 1L);
            } else {
                otmp = obj;
-               if (otmp->owornmask && otmp != uball)
-                   remove_worn_item(otmp);
-               else if ((obj->owornmask & (W_WEP|W_SWAPWEP|W_QUIVER)) != 0) {
-                   /* wielded ball, special case */
-                   setworn((struct obj *)0,
-                           (obj->owornmask & (W_WEP|W_SWAPWEP|W_QUIVER)));
-               }
+               if (otmp->owornmask)
+                   remove_worn_item(otmp, FALSE);
            }
            freeinv(otmp);
            throwit(otmp, wep_mask, twoweap);
index a70add9600b80fda08848e21892e33ebf571daf8..b563f2c5ad1f0f856433b159440736722c780a27 100644 (file)
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)mhitu.c    3.4     2002/02/17      */
+/*     SCCS Id: @(#)mhitu.c    3.4     2002/03/29      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -2350,7 +2350,7 @@ const char *str;
                        /* obj == uarmh */
                        hairbuf);
        }
-       remove_worn_item(obj);
+       remove_worn_item(obj, TRUE);
 }
 #endif  /* SEDUCE */
 
index 4c9b3b75ea5ed79e897a0f0765850eb4cae1ee3e..e7c5f17e143891bb6354ceee2e24ccc084fb9e5c 100644 (file)
--- a/src/shk.c
+++ b/src/shk.c
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)shk.c      3.4     2002/01/19      */
+/*     SCCS Id: @(#)shk.c      3.4     2002/03/29      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -103,8 +103,10 @@ long amount;
        return 0L;
     }
 
-    if (ygold->quan > amount) ygold = splitobj(ygold, amount);
-    else if (ygold->owornmask) remove_worn_item(ygold);                /* quiver */
+    if (ygold->quan > amount)
+       ygold = splitobj(ygold, amount);
+    else if (ygold->owornmask)
+       remove_worn_item(ygold, FALSE);         /* quiver */
     freeinv(ygold);
     add_to_minv(mon, ygold);
     flags.botl = 1;
index dcff3a41c459ebca646e820ab38c46b446a11bc9..482699d7d310147893bb82b0da3630bcb0ae2bbf 100644 (file)
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)steal.c    3.4     2002/01/04      */
+/*     SCCS Id: @(#)steal.c    3.4     2002/03/29      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -172,8 +172,9 @@ botm:   stealoid = 0;
 /* An object you're wearing has been taken off by a monster (theft or
    seduction).  Also used if a worn item gets transformed (stone to flesh). */
 void
-remove_worn_item(obj)
+remove_worn_item(obj, unchain_ball)
 struct obj *obj;
+boolean unchain_ball;  /* whether to unpunish or just unwield */
 {
        if (donning(obj))
            cancel_don();
@@ -198,19 +199,21 @@ struct obj *obj;
            Ring_gone(obj);
        } else if (obj->owornmask & W_TOOL) {
            Blindf_off(obj);
-       } else if (obj->owornmask & (W_BALL|W_CHAIN)) {
-           unpunish();
        } else if (obj->owornmask & (W_WEP|W_SWAPWEP|W_QUIVER)) {
            if (obj == uwep)
                uwepgone();
-           else if (obj == uswapwep)
+           if (obj == uswapwep)
                uswapwepgone();
-           else if (obj == uquiver)
+           if (obj == uquiver)
                uqwepgone();
        }
 
-       /* catchall */
-       if (obj->owornmask) setnotworn(obj);
+       if (obj->owornmask & (W_BALL|W_CHAIN)) {
+           if (unchain_ball) unpunish();
+       } else if (obj->owornmask) {
+           /* catchall */
+           setnotworn(obj);
+       }
 }
 
 /* Returns 1 when something was stolen (or at least, when N should flee now)
@@ -333,19 +336,19 @@ gotobj:
                case AMULET_CLASS:
                case RING_CLASS:
                case FOOD_CLASS: /* meat ring */
-                   remove_worn_item(otmp);
+                   remove_worn_item(otmp, TRUE);
                    break;
                case ARMOR_CLASS:
                    armordelay = objects[otmp->otyp].oc_delay;
                    /* Stop putting on armor which has been stolen. */
                    if (donning(otmp)) {
-                       remove_worn_item(otmp);
+                       remove_worn_item(otmp, TRUE);
                        break;
                    } else if (monkey_business) {
                        /* animals usually don't have enough patience
                           to take off items which require extra time */
                        if (armordelay >= 1 && rn2(10)) goto cant_take;
-                       remove_worn_item(otmp);
+                       remove_worn_item(otmp, TRUE);
                        break;
                    } else {
                        int curssv = otmp->cursed;
@@ -370,7 +373,7 @@ gotobj:
                        named++;
                        /* the following is to set multi for later on */
                        nomul(-armordelay);
-                       remove_worn_item(otmp);
+                       remove_worn_item(otmp, TRUE);
                        otmp->cursed = curssv;
                        if(multi < 0){
                                /*
@@ -391,7 +394,7 @@ gotobj:
                }
        }
        else if (otmp->owornmask)
-           remove_worn_item(otmp);
+           remove_worn_item(otmp, TRUE);
 
        /* do this before removing it from inventory */
        if (objnambuf) Strcpy(objnambuf, yname(otmp));
@@ -487,7 +490,7 @@ struct monst *mtmp;
 
     if (otmp) { /* we have something to snatch */
        if (otmp->owornmask)
-           remove_worn_item(otmp);
+           remove_worn_item(otmp, TRUE);
        freeinv(otmp);
        /* mpickobj wont merge otmp because none of the above things
           to steal are mergable */
index be96ae52e823b3c3de7af9e7b3d69aadce2f050c..6a37d7e93d386616a2ffc9b05c14d907b931474f 100644 (file)
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)trap.c     3.4     2001/09/06      */
+/*     SCCS Id: @(#)trap.c     3.4     20021/03/29     */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -2524,7 +2524,7 @@ boolean *lostsome;
 #else
                if (!otmp) return (FALSE); /* nothing to drop! */       
 #endif
-               if (otmp->owornmask && otmp != uball) remove_worn_item(otmp);
+               if (otmp->owornmask) remove_worn_item(otmp, FALSE);
                *lostsome = TRUE;
                dropx(otmp);
                invc--;
index 318e77f6665c96154b5e160f87cd94ee3fa51e32..62ba27b0cb3f8dcea4a6bb03882fe15f4f22f935 100644 (file)
--- a/src/zap.c
+++ b/src/zap.c
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)zap.c      3.4     2002/02/07      */
+/*     SCCS Id: @(#)zap.c      3.4     2002/03/29      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -1343,7 +1343,7 @@ poly_obj(obj, id)
        /* for now, take off worn items being polymorphed */
        if (obj_location == OBJ_INVENT) {
            if (id == STRANGE_OBJECT)
-               remove_worn_item(obj);
+               remove_worn_item(obj, TRUE);
            else {
                /* This is called only for stone to flesh.  It's a lot simpler
                 * than it otherwise might be.  We don't need to check for
@@ -1351,7 +1351,7 @@ poly_obj(obj, id)
                 * any) and only three worn masks are possible.
                 */
                otmp->owornmask = obj->owornmask;
-               remove_worn_item(obj);
+               remove_worn_item(obj, TRUE);
                setworn(otmp, otmp->owornmask);
                if (otmp->owornmask & LEFT_RING)
                    uleft = otmp;