]> granicus.if.org Git - nethack/commitdiff
more shop wall repair
authorPatR <rankin@nethack.org>
Sun, 24 Apr 2022 21:22:05 +0000 (14:22 -0700)
committerPatR <rankin@nethack.org>
Sun, 24 Apr 2022 21:22:05 +0000 (14:22 -0700)
Commit 593c3532fcecd7cabd164ff49a64d414761ad800 took the 'catchup'
argument away from repair_damage() and calculated it in the routine.
Commit 699a25c00b2534383b4ee947b74497203b8c539d put the argument
back but neglected to remove calculating and assigning it, making
the passed value be ignored.  Take that away, finishing 699a25c00b.

That affected shop repair messages but wasn't enough to prevent a
shop wall repair display glitch.  This seems to make things work
properly but is little iffy.

doc/fixes3-7-0.txt
src/shk.c

index 789e17de41defed40caa4b597e0b965be1f89c4d..5b31b29d7d0193c6f7ef91a12769ff14decddfa4 100644 (file)
@@ -877,6 +877,9 @@ restoring while attached ball or chain is on floor in a breach of a shop wall
        might trigger an impossible about being positioned too far from hero
 don't try to catch up for lost time for shop damage repair in restdamage()
        called from getlev(); let normal shopkeeper movement take care of it
+shop wall repair that was delayed because the hero or a monster was an
+       obstacle in the gap at repair time might not be displayed as wall
+       once the obstacle moved and the repair eventually took place
 putting objects into a container with menustyle=traditional and then taking
        them back out with #tip would result in complaints about obj bypass
        bit being set if sanity_check was On
index 2f80059ce8e01f8bdb6c327d6ccb0c9cd501e486..e72ebe8408d7864cf46a48fd2c3ececf56dc9f65 100644 (file)
--- a/src/shk.c
+++ b/src/shk.c
@@ -3690,7 +3690,11 @@ litter_getpos(int *k, xchar x, xchar y, struct monst *shkp)
 }
 
 static void
-litter_scatter(xchar *litter, int k, xchar x, xchar y, struct monst *shkp)
+litter_scatter(
+    xchar *litter,
+    int k,
+    xchar x, xchar y,
+    struct monst *shkp)
 {
     struct obj *otmp;
 
@@ -3778,17 +3782,16 @@ repair_damage(
     struct obj *otmp;
     struct trap *ttmp;
     int k, disposition = 1;
-    boolean stop_picking = FALSE;
+    boolean seeit, stop_picking = FALSE;
 
     if (!repairable_damage(tmp_dam, shkp))
         return 0;
 
-    catchup = g.moves > tmp_dam->when + REPAIR_DELAY;
     x = tmp_dam->place.x;
     y = tmp_dam->place.y;
+    seeit = cansee(x, y);
 
     ttmp = t_at(x, y);
-
     if (ttmp) {
         switch (ttmp->ttyp) {
         case LANDMINE:
@@ -3818,7 +3821,7 @@ repair_damage(
             break;
         }
         deltrap(ttmp);
-        if (cansee(x, y))
+        if (seeit)
             newsym(x, y);
         if (!catchup)
             disposition = 3;
@@ -3845,11 +3848,18 @@ repair_damage(
     litter = litter_getpos(&k, x, y, shkp);
     litter_scatter(litter, k, x, y, shkp);
 
+    /* needed if hero has line-of-sight to the former gap from outside
+       the shop but is farther than one step away; once the light inside
+       the shop is blocked, the other newsym() below won't redraw the
+       spot showing its repaired wall */
+    if (seeit)
+        newsym(x, y);
+    block_point(x, y);
+
     if (catchup)
         return 1; /* repair occurred while off level so no messages */
 
-    block_point(x, y);
-    if (cansee(x, y)) {
+    if (seeit) {
         if (IS_WALL(tmp_dam->typ)) {
             /* player sees actual repair process, so KNOWS it's a wall */
             levl[x][y].seenv = SVALL;