From 6202d5971e175445fba455ebaee056ee273cc65d Mon Sep 17 00:00:00 2001 From: "nethack.rankin" Date: Thu, 9 Oct 2008 23:55:43 +0000 Subject: [PATCH] fix #1727 - offering Rider corpses (trunk only) The report that killing a Rider on an altar allowed you to sacrifice its corpse was a wizard mode-only phenomenon in 3.4.3 (because you needed to use an altar at some location other than the Astral Plane, hence also needed to use ^G to get the Rider there), so not really a bug. But a post-3.4.3 change has made it possible to offer corpses from the floor on the astral level, unintentionally making it possible to sacrifice Rider corpses. This makdes #offer check specifically for them and trigger their revival if the attempt is made, same as done by pickup. --- include/extern.h | 1 + src/pickup.c | 28 +++++++++++++++++++--------- src/pray.c | 3 ++- 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/include/extern.h b/include/extern.h index 96d78078a..3123a0009 100644 --- a/include/extern.h +++ b/include/extern.h @@ -1683,6 +1683,7 @@ E int FDECL(collect_obj_classes, E int FDECL(collect_obj_classes, (char *,struct obj *,BOOLEAN_P,BOOLEAN_P,boolean FDECL((*),(OBJ_P)), int *)); #endif +E boolean FDECL(rider_corpse_revival, (struct obj *,BOOLEAN_P)); E void FDECL(add_valid_menu_class, (int)); E boolean FDECL(allow_all, (struct obj *)); E boolean FDECL(allow_category, (struct obj *)); diff --git a/src/pickup.c b/src/pickup.c index 4d6ff2fae..5fa1a1044 100644 --- a/src/pickup.c +++ b/src/pickup.c @@ -1,4 +1,4 @@ -/* SCCS Id: @(#)pickup.c 3.5 2008/03/19 */ +/* SCCS Id: @(#)pickup.c 3.5 2008/10/09 */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -289,6 +289,22 @@ boolean remotely; return TRUE; } +/* attempting to manipulate a Rider's corpse triggers its revival */ +boolean +rider_corpse_revival(obj, remotely) +struct obj *obj; +boolean remotely; +{ + if (!obj || obj->otyp != CORPSE || !is_rider(&mons[obj->corpsenm])) + return FALSE; + + pline("At your %s, the corpse suddenly moves...", + remotely ? "attempted acquisition" : "touch"); + (void)revive_corpse(obj); + exercise(A_WIS, FALSE); + return TRUE; +} + /* look at the objects at our location, unless there are too many of them */ STATIC_OVL void check_here(picked_some) @@ -1353,15 +1369,9 @@ boolean telekinesis; /* not picking it up directly by hand */ return 1; #endif } else if (obj->otyp == CORPSE) { - if (fatal_corpse_mistake(obj, telekinesis)) { + if (fatal_corpse_mistake(obj, telekinesis) || + rider_corpse_revival(obj, telekinesis)) return -1; - } else if (is_rider(&mons[obj->corpsenm])) { - pline("At your %s, the corpse suddenly moves...", - telekinesis ? "attempted acquisition" : "touch"); - (void) revive_corpse(obj); - exercise(A_WIS, FALSE); - return -1; - } } else if (obj->otyp == SCR_SCARE_MONSTER) { if (obj->blessed) obj->blessed = 0; else if (!obj->spe && !obj->cursed) obj->spe = 1; diff --git a/src/pray.c b/src/pray.c index bfd0e3bf8..034efbb4d 100644 --- a/src/pray.c +++ b/src/pray.c @@ -1,4 +1,4 @@ -/* SCCS Id: @(#)pray.c 3.5 2008/01/21 */ +/* SCCS Id: @(#)pray.c 3.5 2008/10/09 */ /* Copyright (c) Benson I. Margulies, Mike Stephenson, Steve Linhart, 1989. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1206,6 +1206,7 @@ dosacrifice() /* you're handling this corpse, even if it was killed upon the altar */ feel_cockatrice(otmp, TRUE); + if (rider_corpse_revival(otmp, FALSE)) return 1; if (otmp->corpsenm == PM_ACID_BLOB || (monstermoves <= peek_at_iced_corpse_age(otmp) + 50)) { -- 2.40.0