From 44601d4733307a1451c3b6f8a4baceead202f8a0 Mon Sep 17 00:00:00 2001 From: "nethack.rankin" Date: Tue, 22 Aug 2006 03:03:03 +0000 Subject: [PATCH] inappropriate unblock_point() calls Mentioned by , 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 | 1 - src/mon.c | 5 +---- src/zap.c | 15 ++++++++------- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src/hack.c b/src/hack.c index d9c87000f..a689aa9a1 100644 --- a/src/hack.c +++ b/src/hack.c @@ -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"), diff --git a/src/mon.c b/src/mon.c index 0dc07c45e..c220429c6 100644 --- 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); diff --git a/src/zap.c b/src/zap.c index d187e01cb..fc2b73ba2 100644 --- 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) &&