From: PatR Date: Thu, 17 Dec 2020 20:21:35 +0000 (-0800) Subject: fix the tail-less long worm placement warning X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=65763f9bec2d679c985fe1122064bc6f7b1f4618;p=nethack 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. --- diff --git a/doc/fixes37.0 b/doc/fixes37.0 index 696c3e1af..b873c0833 100644 --- a/doc/fixes37.0 +++ b/doc/fixes37.0 @@ -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 ----------------------------------- @@ -433,6 +433,8 @@ fix genetic engineers dropping Schroedinger's cat box the checks and handling for fountains, sinks, and drawbridges were being missed during liquid_flow 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 if teleported curses: 'msg_window' option wasn't functional for curses unless the binary also included tty support diff --git a/src/worm.c b/src/worm.c index 9027f925b..9081a9919 100644 --- a/src/worm.c +++ b/src/worm.c @@ -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) Robert Patrick Rankin, 2009. */ /* NetHack may be freely redistributed. See license for details. */ @@ -755,15 +755,17 @@ xchar x, y; return; } if (wtails[wnum] == wheads[wnum]) { - /* single segment, co-located with worm so nothing to place */ - if (curr->wx != worm->mx || curr->wy != worm->my) { + /* single segment, co-located with worm; + 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( - "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); if (m_at(curr->wx, curr->wy) == worm) remove_monster(curr->wx, curr->wy); - curr->wx = worm->mx, curr->wy = worm->my; } + curr->wx = worm->mx, curr->wy = worm->my; return; } /* remove head segment from map in case we end up calling toss_wsegs();