]> granicus.if.org Git - nethack/commitdiff
shop repair messages
authornethack.rankin <nethack.rankin>
Thu, 24 Jun 2004 03:13:26 +0000 (03:13 +0000)
committernethack.rankin <nethack.rankin>
Thu, 24 Jun 2004 03:13:26 +0000 (03:13 +0000)
     Fix the situation <Someone> reported where a shopkeeper removing a trap
from the shop doorway yielded "you see the shop door reappear" instead of
reporting about the trap.  It made sense if the door had been destroyed
but not when intact.

     For trunk only, try to fix up the shop repair message situation when
multiple repairs occur at the same time.  Some things were being treated
as mutually exclusive when they aren't.  This part needs more testing,
probably using a debugger to force multiple pending repairs to all occur
on the same turn.  At any rate, using wizard mode and hoping for some
simultaneous activity was ineffective.

doc/fixes34.4
doc/fixes35.0
src/shk.c

index db8d70ed385956f804faf22f7f8c0f5ef872e041..16a0a10cf43401e2fa5b9c429e675fd14cf2797a 100644 (file)
@@ -39,6 +39,8 @@ abandon the specialized djinn and ghost counters used for potion tuning and
        use the mvitals[].born field instead
 if you were Poison_resistant, only a *blessed* potion of sickness caused
        loss of hitpoints
+shopkeeper removal of trap from shop doorway yields an open door instead of
+       a closed one if an intact open door is present
 
 
 Platform- and/or Interface-Specific Fixes
index 2cfc8611a70d586221074bc1a7ec1dec1928b0fc..f99462149dfbd9888e0a861dfc2de113debad8db 100644 (file)
@@ -71,6 +71,7 @@ mimic that ends up on the rogue level should not mimic a closed door
 polymorphed or shapechanged monster sometimes got erroneous hit points
 mimic should not mimic a boulder while on a pit or hole location
 reviving invisible troll could appear visible until it moves
+adjust some of the shop repair messages
 
 
 Platform- and/or Interface-Specific Fixes
index 4673e057e53e14c3a4816a5c6f85f054496617e9..b23226f8b40a031e0631be2100ab63810c905a39 100644 (file)
--- a/src/shk.c
+++ b/src/shk.c
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)shk.c      3.4     2003/12/04      */
+/*     SCCS Id: @(#)shk.c      3.4     2004/06/23      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -2915,14 +2915,15 @@ long cost;
 STATIC_OVL
 void
 remove_damage(shkp, croaked)
-register struct monst *shkp;
-register boolean croaked;
+struct monst *shkp;
+boolean croaked;
 {
-       register struct damage *tmp_dam, *tmp2_dam;
-       register boolean did_repair = FALSE, saw_door = FALSE;
-       register boolean saw_floor = FALSE, stop_picking = FALSE;
-       register boolean saw_untrap = FALSE;
-       uchar saw_walls = 0;
+       struct damage *tmp_dam, *tmp2_dam;
+       boolean did_repair = FALSE, saw_door = FALSE,
+               saw_floor = FALSE, stop_picking = FALSE,
+               doorway_trap = FALSE;
+       int saw_walls = 0, saw_untrap = 0;
+       char trapmsg[BUFSZ];
 
        tmp_dam = level.damagelist;
        tmp2_dam = 0;
@@ -2930,10 +2931,13 @@ register boolean croaked;
            register xchar x = tmp_dam->place.x, y = tmp_dam->place.y;
            char shops[5];
            int disposition;
+           unsigned old_doormask = 0;
 
            disposition = 0;
            Strcpy(shops, in_rooms(x, y, SHOPBASE));
            if (index(shops, ESHK(shkp)->shoproom)) {
+               if (IS_DOOR(levl[x][y].typ)) old_doormask = levl[x][y].doormask;
+
                if (croaked)
                    disposition = (shops[1])? 0 : 1;
                else if (stop_picking)
@@ -2957,14 +2961,18 @@ register boolean croaked;
            if (disposition > 1) {
                did_repair = TRUE;
                if (cansee(x, y)) {
-                   if (IS_WALL(levl[x][y].typ))
+                   if (IS_WALL(levl[x][y].typ)) {
                        saw_walls++;
-                   else if (IS_DOOR(levl[x][y].typ))
+                   } else if (IS_DOOR(levl[x][y].typ) &&
+                           /* an existing door here implies trap removal */
+                           !(old_doormask & (D_ISOPEN|D_CLOSED))) {
                        saw_door = TRUE;
-                   else if (disposition == 3)          /* untrapped */
-                       saw_untrap = TRUE;
-                   else
+                   } else if (disposition == 3) {      /* untrapped */
+                       saw_untrap++;
+                       if (IS_DOOR(levl[x][y].typ)) doorway_trap = TRUE;
+                   } else {
                        saw_floor = TRUE;
+                   }
                }
            }
 
@@ -2979,22 +2987,41 @@ register boolean croaked;
        }
        if (!did_repair)
            return;
+
+       if (saw_untrap) {
+           Sprintf(trapmsg, "%s trap%s",
+                   (saw_untrap > 3) ? "several" :
+                       (saw_untrap > 1) ? "some" : "a",
+                   plur(saw_untrap));
+           Sprintf(eos(trapmsg), " %s", vtense(trapmsg, "are"));
+           Sprintf(eos(trapmsg), " removed from the %s",
+                   (doorway_trap && saw_untrap == 1) ? "doorway" : "floor");
+       } else
+          trapmsg[0] = '\0';   /* not just lint suppression... */
+
        if (saw_walls) {
-           pline("Suddenly, %s section%s of wall close%s up!",
+           char wallbuf[BUFSZ];
+
+           Sprintf(wallbuf, "section%s", plur(saw_walls));
+           pline("Suddenly, %s %s of wall %s up!",
                  (saw_walls == 1) ? "a" : (saw_walls <= 3) ?
                                                  "some" : "several",
-                 (saw_walls == 1) ? "" : "s", (saw_walls == 1) ? "s" : "");
+                 wallbuf, vtense(wallbuf, "close"));
+
            if (saw_door)
                pline_The("shop door reappears!");
            if (saw_floor)
                pline_The("floor is repaired!");
+           if (saw_untrap)
+               pline("%s!", upstart(trapmsg));
        } else {
-           if (saw_door)
-               pline("Suddenly, the shop door reappears!");
-           else if (saw_floor)
-               pline("Suddenly, the floor damage is gone!");
-           else if (saw_untrap)
-               pline("Suddenly, the trap is removed from the floor!");
+           if (saw_door || saw_floor || saw_untrap)
+               pline("Suddenly, %s%s%s%s%s!",
+                     saw_door ? "the shop door reappears" : "",
+                     (saw_door && saw_floor) ? " and " : "",
+                     saw_floor ? "the floor damage is gone" : "",
+                     ((saw_door || saw_floor) && *trapmsg) ? " and " : "",
+                     trapmsg);
            else if (inside_shop(u.ux, u.uy) == ESHK(shkp)->shoproom)
                You_feel("more claustrophobic than before.");
            else if (!Deaf && !rn2(10))
@@ -3048,8 +3075,9 @@ boolean catchup;  /* restoring a level */
                (void) mpickobj(shkp, otmp);
            }
            deltrap(ttmp);
-           if(IS_DOOR(tmp_dam->typ)) {
-               levl[x][y].doormask = D_CLOSED; /* arbitrary */
+           if (IS_DOOR(tmp_dam->typ) &&
+                   !(levl[x][y].doormask & D_ISOPEN)) {
+               levl[x][y].doormask = D_CLOSED;
                block_point(x, y);
            } else if (IS_WALL(tmp_dam->typ)) {
                levl[x][y].typ = tmp_dam->typ;