]> granicus.if.org Git - nethack/commitdiff
fix B12003 - kicking a box embedded in a wall
authornethack.rankin <nethack.rankin>
Fri, 20 Sep 2002 05:05:46 +0000 (05:05 +0000)
committernethack.rankin <nethack.rankin>
Fri, 20 Sep 2002 05:05:46 +0000 (05:05 +0000)
     Move a block of kicking code so that freeing items stuck inside
solid work takes precedence over breaking open containers.  Now the
box has a chance to fall out like other types of objects (and if it
fails that chance, there's just the normal message about not coming
loose--no attempt to actually kick open the box will occur).

doc/fixes34.1
src/dokick.c

index 840f402c3a53de098ac42e35d87d22a659b85f46..90b768ff77f797be09fd3cf231992352f8a3fc06 100644 (file)
@@ -248,6 +248,7 @@ starved pet raised from dead shouldn't immediately starve again
 skilled spell of detected treasure wasn't acting like blessed potion of
        object detection (from Roderick Schertler)
 fix end of game attribute disclosure for levitation negated by sink
+kicking a box embedded in a wall will knock it free rather than bust it open
 
 
 Platform- and/or Interface-Specific Fixes
index da277b54149e2cb4db8c3e908d5011917861bf7c..51305e83d33ff3a379d8347a376e3173f02f2de8 100644 (file)
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)dokick.c   3.4     2002/07/25      */
+/*     SCCS Id: @(#)dokick.c   3.4     2002/09/18      */
 /* Copyright (c) Izchak Miller, Mike Stephenson, Steve Linhart, 1989. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -406,6 +406,37 @@ xchar x, y;
                                    costly_spot(x, y));
        insider = (*u.ushops && inside_shop(u.ux, u.uy) &&
                                    *in_rooms(x, y, SHOPBASE) == *u.ushops);
+       isgold = (kickobj->oclass == COIN_CLASS);
+
+       if (IS_ROCK(levl[x][y].typ) || closed_door(x, y)) {
+           if ((!martial() && rn2(20) > ACURR(A_DEX)) ||
+                   IS_ROCK(levl[u.ux][u.uy].typ) || closed_door(u.ux, u.uy)) {
+               if (Blind)
+                   pline("It doesn't come loose.");
+               else
+                   pline("%s %sn't come loose.",
+                         The(distant_name(kickobj, xname)),
+                         otense(kickobj, "do"));
+               return (!rn2(3) || martial());
+           }
+           if (Blind)
+               pline("It comes loose.");
+           else
+               pline("%s %s loose.",
+                     The(distant_name(kickobj, xname)),
+                     otense(kickobj, "come"));
+           obj_extract_self(kickobj);
+           newsym(x, y);
+           if (costly && (!costly_spot(u.ux, u.uy) ||
+                   !index(u.urooms, *in_rooms(x, y, SHOPBASE))))
+               addtobill(kickobj, FALSE, FALSE, FALSE);
+           if (!flooreffects(kickobj, u.ux, u.uy, "fall")) {
+               place_object(kickobj, u.ux, u.uy);
+               stackobj(kickobj);
+               newsym(u.ux, u.uy);
+           }
+           return 1;
+       }
 
        /* a box gets a chance of breaking open here */
        if(Is_box(kickobj)) {
@@ -478,35 +509,6 @@ xchar x, y;
        /* fragile objects should not be kicked */
        if (hero_breaks(kickobj, kickobj->ox, kickobj->oy, FALSE)) return 1;
 
-       if (IS_ROCK(levl[x][y].typ) || closed_door(x, y)) {
-               if ((!martial() && rn2(20) > ACURR(A_DEX))
-                                || IS_ROCK(levl[u.ux][u.uy].typ)
-                                || closed_door(u.ux, u.uy)) {
-                       if (Blind) pline("It doesn't come loose.");
-                       else pline("%s %sn't come loose.",
-                               The(distant_name(kickobj, xname)),
-                               otense(kickobj, "do"));
-                       return(!rn2(3) || martial());
-               }
-               if (Blind) pline("It comes loose.");
-               else pline("%s %s loose.",
-                          The(distant_name(kickobj, xname)),
-                          otense(kickobj, "come"));
-               obj_extract_self(kickobj);
-               newsym(x, y);
-               if (costly && (!costly_spot(u.ux, u.uy)
-                              || !index(u.urooms, *in_rooms(x, y, SHOPBASE))))
-                       addtobill(kickobj, FALSE, FALSE, FALSE);
-               if(!flooreffects(kickobj,u.ux,u.uy,"fall")) {
-                   place_object(kickobj, u.ux, u.uy);
-                   stackobj(kickobj);
-                   newsym(u.ux, u.uy);
-               }
-               return(1);
-       }
-
-       isgold = (kickobj->oclass == COIN_CLASS);
-
        /* too heavy to move.  range is calculated as potential distance from
         * player, so range == 2 means the object may move up to one square
         * from its current position