]> granicus.if.org Git - nethack/commitdiff
inappropriate unblock_point() calls
authornethack.rankin <nethack.rankin>
Tue, 22 Aug 2006 03:03:03 +0000 (03:03 +0000)
committernethack.rankin <nethack.rankin>
Tue, 22 Aug 2006 03:03:03 +0000 (03:03 +0000)
     Mentioned by <Someone>, who suspected that the fix for C343-114 dealt with
this.  When a giant picks up a boulder from a location where more than one
is present, line-of-sight would be inappropriately cleared, as if the
remaining boulders were transparent.  (He said that he got no pickup
message when the giant picked up the boulder.  I do, and have not tried to
figure out whether this is a post-3.4.3 difference.)  Pushing a boulder
onto a landmine had the same bug, although you wouldn't notice unless there
were at least three boulders to be pushed (mysterious ability to push more
than one boulder in a turn strikes again:  first one triggers the trap and
is destroyed, allowing hero to see through any others; second fills in the
resulting pit; third gets moved to the former trap spot and [probably--I
haven't checked] re-blocks vision; fourth, if any, stays put; if only one
or two are present, the change in vision is expected and the fact that it
happens too soon in the two boulder case would probably go unnoticed.
Polymorph of a boulder also opened up vision without checking whether any
others are present.

    An existing, evidently overly optimistic, fixes34.4 entry covers this.

src/hack.c
src/mon.c
src/zap.c

index d9c87000ff868bce607fe5105c6e734888aa7eb9..a689aa9a1c851d4bd8623671b0bed7149091a110 100644 (file)
@@ -173,7 +173,6 @@ moverock()
                    if (rn2(10)) {
                        obj_extract_self(otmp);
                        place_object(otmp, rx, ry);
-                       unblock_point(sx, sy);
                        newsym(sx, sy);
                        pline("KAABLAMM!!!  %s %s land mine.",
                              Tobjnam(otmp, "trigger"),
index 0dc07c45e0ab413488ef13efe271fca664c6132f..c220429c6ab747cfafb32b1a15816796ac8f1a37 100644 (file)
--- a/src/mon.c
+++ b/src/mon.c
@@ -886,10 +886,7 @@ mpickstuff(mtmp, str)
                        pline("%s picks up %s.", Monnam(mtmp),
                              (distu(mtmp->mx, mtmp->my) <= 5) ?
                                doname(otmp) : distant_name(otmp, doname));
-               obj_extract_self(otmp);
-               /* unblock point after extract, before pickup */
-               if (otmp->otyp == BOULDER)
-                   unblock_point(otmp->ox,otmp->oy);   /* vision */
+               obj_extract_self(otmp);         /* remove from floor */
                (void) mpickobj(mtmp, otmp);    /* may merge and free otmp */
                m_dowear(mtmp, FALSE);
                newsym(mtmp->mx, mtmp->my);
index d187e01cb7626f1a267e76a9e2c3c77e1a60c9cf..fc2b73ba2d3ec8fa6a51766e3cd6d0c9b792f87a 100644 (file)
--- a/src/zap.c
+++ b/src/zap.c
@@ -1455,13 +1455,6 @@ poly_obj(obj, id)
        otmp->owornmask = obj->owornmask;
 no_unwear:
 
-       if (obj_location == OBJ_FLOOR && obj->otyp == BOULDER &&
-               otmp->otyp != BOULDER)
-           unblock_point(obj->ox, obj->oy);
-       else if (obj_location == OBJ_FLOOR && obj->otyp != BOULDER &&
-               otmp->otyp == BOULDER)
-           block_point(obj->ox, obj->oy);
-
        /* ** we are now done adjusting the object ** */
 
 
@@ -1477,6 +1470,14 @@ no_unwear:
            freeinv_core(obj);
            addinv_core1(otmp);
            addinv_core2(otmp);
+       } else if (obj_location == OBJ_FLOOR) {
+           ox = otmp->ox,  oy = otmp->oy;      /* set by replace_object() */
+           if (obj->otyp == BOULDER && otmp->otyp != BOULDER &&
+                   !does_block(ox, oy, &levl[ox][oy]))
+               unblock_point(ox, oy);
+           else if (obj->otyp != BOULDER && otmp->otyp == BOULDER)
+                   /* (checking does_block() here would be redundant) */
+               block_point(ox, oy);
        }
 
        if ((!carried(otmp) || obj->unpaid) &&