Skip to content

Commit

Permalink
shop repair messages
Browse files Browse the repository at this point in the history
     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.
  • Loading branch information
nethack.rankin committed Jun 24, 2004
1 parent 9b3521e commit a0fa995
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 23 deletions.
2 changes: 2 additions & 0 deletions doc/fixes34.4
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions doc/fixes35.0
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
74 changes: 51 additions & 23 deletions src/shk.c
Original file line number Diff line number Diff line change
@@ -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. */

Expand Down Expand Up @@ -2915,25 +2915,29 @@ 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;
while (tmp_dam) {
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)
Expand All @@ -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;
}
}
}

Expand All @@ -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))
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit a0fa995

Please sign in to comment.