From 335e868865938136e6e65516920ae93d0be17760 Mon Sep 17 00:00:00 2001 From: PatR Date: Tue, 3 Jul 2018 14:59:34 -0700 Subject: [PATCH] fix github issue #111 - stone-to-flesh of statues Fixes #111 Casting stone-to-flesh at a random statue animates it as a monster (created via direct call to makemon()) at an adjacent or nearby spot if there is already a monster at the statue's spot, but doing so on a statue of a petrified monster (create attempt via montraits() which called makemon() without the ADJACENTOK flag) turned it into a corpse instead. Pass an extra argument to montraits() so that it behaves the same normal statue animation for stone-to-flesh without changing how it behaves when reviving corpses for undead-turning. --- doc/fixes36.2 | 5 ++++- include/extern.h | 2 +- src/trap.c | 2 +- src/zap.c | 8 +++++--- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/doc/fixes36.2 b/doc/fixes36.2 index 23b699ac4..d2cfcdd62 100644 --- a/doc/fixes36.2 +++ b/doc/fixes36.2 @@ -54,7 +54,10 @@ highlighting status conditions would fail to use attributes if a rule with them was followed by another one without (color only or color&normal) when using 'O' to set hilite_status rules, hide the 'score' status field if game has been built without SCORE_ON_BOTL; latent rules for 'score' - can still be set in config file but can't be added or removed via 'O' + can still be set in config file and removed via 'O' but can't be added +make stone-to-flesh behave the same on statues of petrified monsters as it + does on random 'dungeon art' ones (revive at a nearby spot instead of + becoming a corpse when there's already a monster at statue's location) Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository diff --git a/include/extern.h b/include/extern.h index aa990d10b..bd1924a6b 100644 --- a/include/extern.h +++ b/include/extern.h @@ -2860,7 +2860,7 @@ E boolean FDECL(get_obj_location, (struct obj *, xchar *, xchar *, int)); E boolean FDECL(get_mon_location, (struct monst *, xchar *, xchar *, int)); E struct monst *FDECL(get_container_location, (struct obj * obj, int *, int *)); -E struct monst *FDECL(montraits, (struct obj *, coord *)); +E struct monst *FDECL(montraits, (struct obj *, coord *, BOOLEAN_P)); E struct monst *FDECL(revive, (struct obj *, BOOLEAN_P)); E int FDECL(unturn_dead, (struct monst *)); E void FDECL(cancel_item, (struct obj *)); diff --git a/src/trap.c b/src/trap.c index 8f62dcc63..1c106890b 100644 --- a/src/trap.c +++ b/src/trap.c @@ -595,7 +595,7 @@ int *fail_reason; if (use_saved_traits) { /* restore a petrified monster */ cc.x = x, cc.y = y; - mon = montraits(statue, &cc); + mon = montraits(statue, &cc, (cause == ANIMATE_SPELL)); if (mon && mon->mtame && !mon->isminion) wary_dog(mon, TRUE); } else { diff --git a/src/zap.c b/src/zap.c index 1b83a3ad5..966ac914e 100644 --- a/src/zap.c +++ b/src/zap.c @@ -555,9 +555,10 @@ int locflags; /* non-zero means get location even if monster is buried */ /* used by revive() and animate_statue() */ struct monst * -montraits(obj, cc) +montraits(obj, cc, adjacentok) struct obj *obj; coord *cc; +boolean adjacentok; /* False: at obj's spot only, True: nearby is allowed */ { struct monst *mtmp = (struct monst *) 0; struct monst *mtmp2 = (struct monst *) 0; @@ -570,7 +571,8 @@ coord *cc; if (mtmp2->mhpmax <= 0 && !is_rider(mtmp2->data)) return (struct monst *) 0; mtmp = makemon(mtmp2->data, cc->x, cc->y, - NO_MINVENT | MM_NOWAIT | MM_NOCOUNTBIRTH); + (NO_MINVENT | MM_NOWAIT | MM_NOCOUNTBIRTH + | (adjacentok ? MM_ADJACENTOK : 0))); if (!mtmp) return mtmp; @@ -786,7 +788,7 @@ boolean by_hero; } else if (has_omonst(corpse)) { /* use saved traits */ xy.x = x, xy.y = y; - mtmp = montraits(corpse, &xy); + mtmp = montraits(corpse, &xy, FALSE); if (mtmp && mtmp->mtame && !mtmp->isminion) wary_dog(mtmp, TRUE); } else {