From f52e9865f283378359191d5ea186206d60129921 Mon Sep 17 00:00:00 2001 From: PatR Date: Sat, 6 Apr 2019 12:57:29 -0700 Subject: [PATCH] fix #H8481 - placing monster at <0,0> mon_arrive() -> m_into_limbo() -> migrate_to_level() -> wormgone() followed by place_monster() "for relmon". relmon() was changed (last November, cc5bb44a9a757fe00800c90cb3a648b009af155d) to not require the monster be on the map, so just get rid of the place_monster() that was trying to put the "gone" long worm at <0,0>. Also, another m_into_limbo() bit: make mdrop_special_objs() check the location and send any dropped items to random locations if the monster dropping things isn't on the map, instead of placing them at <0,0>. --- doc/fixes36.2 | 5 ++++- src/dog.c | 10 +++------- src/mon.c | 6 +++--- src/steal.c | 14 ++++++++++++-- 4 files changed, 22 insertions(+), 13 deletions(-) diff --git a/doc/fixes36.2 b/doc/fixes36.2 index 68709069d..f34840d67 100644 --- a/doc/fixes36.2 +++ b/doc/fixes36.2 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.298 $ $NHDT-Date: 1554425733 2019/04/05 00:55:33 $ +$NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.299 $ $NHDT-Date: 1554580624 2019/04/06 19:57:04 $ This fixes36.2 file is here to capture information about updates in the 3.6.x lineage following the release of 3.6.1 in April 2018. Please note, however, @@ -406,6 +406,9 @@ shorten the getpos prompt for teleport destination so that it won't yield a once a status highlight for a temporary rule ('up', 'down', 'changed') timed out, further spurious status updates (evaluating all fields) would occur every 'statushilites' turns even if no fields had changed +if a migrating long worm couldn't be placed, or some other monster was given + an existing long worm's place and it couldn't be put somewhere else, + a "trying to place monster at <0,0>" warning would occur Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository diff --git a/src/dog.c b/src/dog.c index 93a33716e..b5913de35 100644 --- a/src/dog.c +++ b/src/dog.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 dog.c $NHDT-Date: 1543052701 2018/11/24 09:45:01 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.84 $ */ +/* NetHack 3.6 dog.c $NHDT-Date: 1554580624 2019/04/06 19:57:04 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.85 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2011. */ /* NetHack may be freely redistributed. See license for details. */ @@ -7,11 +7,6 @@ STATIC_DCL int NDECL(pet_type); -/* cloned from mon.c; used here if mon_arrive() can't place mon */ -#define LEVEL_SPECIFIC_NOCORPSE(mdat) \ - (Is_rogue_level(&u.uz) \ - || (level.flags.graveyard && is_undead(mdat) && rn2(3))) - void newedog(mtmp) struct monst *mtmp; @@ -697,7 +692,8 @@ coord *cc; /* optional destination coordinates */ /* **** NOTE: worm is truncated to # segs = max wormno size **** */ num_segs = min(cnt, MAX_NUM_WORMS - 1); /* used below */ wormgone(mtmp); /* destroys tail and takes head off map */ - place_monster(mtmp, mtmp->mx, mtmp->my); /* put head back for relmon */ + /* there used to be a place_monster() here for the relmon() below, + but it doesn't require the monster to be on the map anymore */ } /* set minvent's obj->no_charge to 0 */ diff --git a/src/mon.c b/src/mon.c index 8bd12f066..d0a422f60 100644 --- a/src/mon.c +++ b/src/mon.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 mon.c $NHDT-Date: 1550524562 2019/02/18 21:16:02 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.279 $ */ +/* NetHack 3.6 mon.c $NHDT-Date: 1554580625 2019/04/06 19:57:05 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.280 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Derek S. Ray, 2015. */ /* NetHack may be freely redistributed. See license for details. */ @@ -2649,7 +2649,7 @@ boolean move_other; /* make sure mtmp gets to x, y! so move m_at(x, y) */ xchar newx, newy; coord mm; - if (mtmp->mx == x && mtmp->my == y && m_at(x,y) == mtmp) + if (mtmp->mx == x && mtmp->my == y && m_at(x, y) == mtmp) return TRUE; if (move_other && (othermon = m_at(x, y)) != 0) { @@ -2668,7 +2668,7 @@ boolean move_other; /* make sure mtmp gets to x, y! so move m_at(x, y) */ */ if (!enexto(&mm, newx, newy, mtmp->data)) return FALSE; - if (!isok(mm.x,mm.y)) + if (!isok(mm.x, mm.y)) return FALSE; newx = mm.x; newy = mm.y; diff --git a/src/steal.c b/src/steal.c index 2f746ce6e..c9f6db37e 100644 --- a/src/steal.c +++ b/src/steal.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 steal.c $NHDT-Date: 1496614914 2017/06/04 22:21:54 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.69 $ */ +/* NetHack 3.6 steal.c $NHDT-Date: 1554580626 2019/04/06 19:57:06 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.72 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -693,7 +693,17 @@ struct monst *mon; for the other roles are not */ if (obj_resists(obj, 0, 0) || is_quest_artifact(obj)) { obj_extract_self(obj); - mdrop_obj(mon, obj, FALSE); + if (mon->mx) { + mdrop_obj(mon, obj, FALSE); + } else { /* migrating monster not on map */ + if (obj->owornmask) { + mon->misc_worn_check &= ~obj->owornmask; + if (obj->owornmask & W_WEP) + setmnotwielded(mon, obj); + obj->owornmask = 0L; + } + rloco(obj); + } } } }