From b6b550e1a28818627adc05736b13f3a4d6fa649d Mon Sep 17 00:00:00 2001 From: "nethack.rankin" Date: Sat, 6 Apr 2002 04:22:33 +0000 Subject: [PATCH] fix "couldn't place lregion type 5" Implement a fix for the problem From a bug report: if the destination position on the Plane of Fire has a randomly placed trap on it, you'd get an impossibility warning of "couldn't place lregion type 5" (and then arrive successfully at the target spot anyway). As his investigation indicated, the code to remove such traps wasn't being reached because the `bad_location' check yields true for trapped spots. --- doc/fixes34.1 | 1 + src/mkmaze.c | 21 +++++++++++++-------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/doc/fixes34.1 b/doc/fixes34.1 index dec2cc3bf..76993152f 100644 --- a/doc/fixes34.1 +++ b/doc/fixes34.1 @@ -52,6 +52,7 @@ avoid temporary disappearing Burdened message due to updating status line midway thru in_container don't credit player's wisdom when makelevel creates random Elbereth engravings reduce insect/monster creation from monster spells +avoid "couldn't place lregion type 5" warning when arriving at Plane of Fire Platform- and/or Interface-Specific Fixes diff --git a/src/mkmaze.c b/src/mkmaze.c index ca6dce51f..6ab3a11f8 100644 --- a/src/mkmaze.c +++ b/src/mkmaze.c @@ -1,4 +1,4 @@ -/* SCCS Id: @(#)mkmaze.c 3.4 2002/03/12 */ +/* SCCS Id: @(#)mkmaze.c 3.4 2002/04/04 */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -288,13 +288,18 @@ xchar rtype; boolean oneshot; d_level *lev; { - if (bad_location(x, y, nlx, nly, nhx, nhy)) return FALSE; - if (oneshot) { - /* must make due with the only location possible */ - /* avoid failure due to a misplaced trap */ - /* it might still fail if there's a dungeon feature here */ - struct trap *t = t_at(x,y); - if (t) deltrap(t); + if (bad_location(x, y, nlx, nly, nhx, nhy)) { + if (!oneshot) { + return FALSE; /* caller should try again */ + } else { + /* Must make due with the only location possible; + avoid failure due to a misplaced trap. + It might still fail if there's a dungeon feature here. */ + struct trap *t = t_at(x,y); + + if (t && t->ttyp != MAGIC_PORTAL) deltrap(t); + if (bad_location(x, y, nlx, nly, nhx, nhy)) return FALSE; + } } switch (rtype) { case LR_TELE: