fix the tail-less long worm placement warning

Hidden tail segment was taken off the map as intended but the
check and warning in place_wormtail_randonly() didn't expect
to see that.  A post-3.6 issue.

Also fix the spelling error in the warning message.
This commit is contained in:
PatR
2020-12-17 12:21:35 -08:00
parent 00c4e832c5
commit 65763f9bec
2 changed files with 10 additions and 6 deletions
+3 -1
View File
@@ -1,4 +1,4 @@
NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.393 $ $NHDT-Date: 1608175317 2020/12/17 03:21:57 $ NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.394 $ $NHDT-Date: 1608236443 2020/12/17 20:20:43 $
General Fixes and Modified Features General Fixes and Modified Features
----------------------------------- -----------------------------------
@@ -433,6 +433,8 @@ fix genetic engineers dropping Schroedinger's cat box
the checks and handling for fountains, sinks, and drawbridges were being the checks and handling for fountains, sinks, and drawbridges were being
missed during liquid_flow missed during liquid_flow
monster movement flags unification allowed displacer beasts to displace Riders monster movement flags unification allowed displacer beasts to displace Riders
a long worm with no visible segments (but one internal segment) might trigger
warning: tail 'segement' at <0,some_y>, worm at <mx,my> if teleported
curses: 'msg_window' option wasn't functional for curses unless the binary curses: 'msg_window' option wasn't functional for curses unless the binary
also included tty support also included tty support
+7 -5
View File
@@ -1,4 +1,4 @@
/* NetHack 3.7 worm.c $NHDT-Date: 1599559380 2020/09/08 10:03:00 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.48 $ */ /* NetHack 3.7 worm.c $NHDT-Date: 1608236444 2020/12/17 20:20:44 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.49 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2009. */ /*-Copyright (c) Robert Patrick Rankin, 2009. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -755,15 +755,17 @@ xchar x, y;
return; return;
} }
if (wtails[wnum] == wheads[wnum]) { if (wtails[wnum] == wheads[wnum]) {
/* single segment, co-located with worm so nothing to place */ /* single segment, co-located with worm;
if (curr->wx != worm->mx || curr->wy != worm->my) { should either have same coordinates or have seg->wx==0
to indicate that it is not currently on the map */
if (curr->wx && (curr->wx != worm->mx || curr->wy != worm->my)) {
impossible( impossible(
"place_worm_tail_randomly: tail segement at <%d,%d>, worm at <%d,%d>", "place_worm_tail_randomly: tail segment at <%d,%d>, worm at <%d,%d>",
curr->wx, curr->wy, worm->mx, worm->my); curr->wx, curr->wy, worm->mx, worm->my);
if (m_at(curr->wx, curr->wy) == worm) if (m_at(curr->wx, curr->wy) == worm)
remove_monster(curr->wx, curr->wy); remove_monster(curr->wx, curr->wy);
curr->wx = worm->mx, curr->wy = worm->my;
} }
curr->wx = worm->mx, curr->wy = worm->my;
return; return;
} }
/* remove head segment from map in case we end up calling toss_wsegs(); /* remove head segment from map in case we end up calling toss_wsegs();