fix #K1139 - corpse removed from ice box by monst
Rot and revive timers are turned off when a corpse gets put inside an ice box. They get turned back on when taken out of the ice box by the hero but were being left off if taken out by a monster. That resulted in corpses of arbitrary type behaving like lizard corpses and never rotting away. This fixes that. It also changes troll corpse behavior. Once put in an ice box, a troll corpse will not get a new revive timer when taken out, just an ordinary rot timer.
This commit is contained in:
+2
-1
@@ -1,4 +1,4 @@
|
|||||||
$NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.225 $ $NHDT-Date: 1590613502 2020/05/27 21:05:02 $
|
$NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.226 $ $NHDT-Date: 1590870784 2020/05/30 20:33:04 $
|
||||||
|
|
||||||
General Fixes and Modified Features
|
General Fixes and Modified Features
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
@@ -250,6 +250,7 @@ after the wish parsing change, wishing for "<something of monster>" or for
|
|||||||
fix new "objects[0] class #1 not in order!" panic if plain 'char' is unsigned
|
fix new "objects[0] class #1 not in order!" panic if plain 'char' is unsigned
|
||||||
only generate shop items on solid floor squares
|
only generate shop items on solid floor squares
|
||||||
avoid gcc 10 warning by removing duplicate definition of 'head_engr'
|
avoid gcc 10 warning by removing duplicate definition of 'head_engr'
|
||||||
|
if a monster removed a corpse from an ice box, the corpse would never rot away
|
||||||
|
|
||||||
tty: redraw unexplored locations as S_unexplored rather than <space> after
|
tty: redraw unexplored locations as S_unexplored rather than <space> after
|
||||||
map has been partially overwritten by popup menu or text display
|
map has been partially overwritten by popup menu or text display
|
||||||
|
|||||||
+2
-1
@@ -1,4 +1,4 @@
|
|||||||
/* NetHack 3.6 extern.h $NHDT-Date: 1590263447 2020/05/23 19:50:47 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.843 $ */
|
/* NetHack 3.6 extern.h $NHDT-Date: 1590870784 2020/05/30 20:33:04 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.844 $ */
|
||||||
/* Copyright (c) Steve Creps, 1988. */
|
/* Copyright (c) Steve Creps, 1988. */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
|
|
||||||
@@ -1981,6 +1981,7 @@ E boolean FDECL(allow_all, (struct obj *));
|
|||||||
E boolean FDECL(allow_category, (struct obj *));
|
E boolean FDECL(allow_category, (struct obj *));
|
||||||
E boolean FDECL(is_worn_by_type, (struct obj *));
|
E boolean FDECL(is_worn_by_type, (struct obj *));
|
||||||
E int FDECL(ck_bag, (struct obj *));
|
E int FDECL(ck_bag, (struct obj *));
|
||||||
|
E void FDECL(removed_from_icebox, (struct obj *));
|
||||||
#ifdef USE_TRAMPOLI
|
#ifdef USE_TRAMPOLI
|
||||||
E int FDECL(in_container, (struct obj *));
|
E int FDECL(in_container, (struct obj *));
|
||||||
E int FDECL(out_container, (struct obj *));
|
E int FDECL(out_container, (struct obj *));
|
||||||
|
|||||||
+2
-2
@@ -1,4 +1,4 @@
|
|||||||
/* NetHack 3.6 obj.h $NHDT-Date: 1580036271 2020/01/26 10:57:51 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.66 $ */
|
/* NetHack 3.6 obj.h $NHDT-Date: 1590870784 2020/05/30 20:33:04 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.69 $ */
|
||||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||||
/*-Copyright (c) Michael Allison, 2006. */
|
/*-Copyright (c) Michael Allison, 2006. */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
@@ -86,7 +86,7 @@ struct obj {
|
|||||||
#define MAX_ERODE 3
|
#define MAX_ERODE 3
|
||||||
#define orotten oeroded /* rotten food */
|
#define orotten oeroded /* rotten food */
|
||||||
#define odiluted oeroded /* diluted potions */
|
#define odiluted oeroded /* diluted potions */
|
||||||
#define norevive oeroded2
|
#define norevive oeroded2 /* frozen corpse */
|
||||||
Bitfield(oerodeproof, 1); /* erodeproof weapon/armor */
|
Bitfield(oerodeproof, 1); /* erodeproof weapon/armor */
|
||||||
Bitfield(olocked, 1); /* object is locked */
|
Bitfield(olocked, 1); /* object is locked */
|
||||||
Bitfield(obroken, 1); /* lock has been broken */
|
Bitfield(obroken, 1); /* lock has been broken */
|
||||||
|
|||||||
+8
-4
@@ -1,4 +1,4 @@
|
|||||||
/* NetHack 3.6 mkobj.c $NHDT-Date: 1585361051 2020/03/28 02:04:11 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.176 $ */
|
/* NetHack 3.6 mkobj.c $NHDT-Date: 1590870787 2020/05/30 20:33:07 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.179 $ */
|
||||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||||
/*-Copyright (c) Derek S. Ray, 2015. */
|
/*-Copyright (c) Derek S. Ray, 2015. */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
@@ -1148,6 +1148,11 @@ struct obj *body;
|
|||||||
long corpse_age; /* age of corpse */
|
long corpse_age; /* age of corpse */
|
||||||
int rot_adjust;
|
int rot_adjust;
|
||||||
short action;
|
short action;
|
||||||
|
boolean no_revival;
|
||||||
|
|
||||||
|
/* if a troll corpse was frozen, it won't get a revive timer */
|
||||||
|
no_revival = (body->norevive != 0);
|
||||||
|
body->norevive = 0; /* always clear corpse's 'frozen' flag */
|
||||||
|
|
||||||
/* lizards and lichen don't rot or revive */
|
/* lizards and lichen don't rot or revive */
|
||||||
if (body->corpsenm == PM_LIZARD || body->corpsenm == PM_LICHEN)
|
if (body->corpsenm == PM_LIZARD || body->corpsenm == PM_LICHEN)
|
||||||
@@ -1172,8 +1177,9 @@ struct obj *body;
|
|||||||
if (!rn2(3))
|
if (!rn2(3))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
} else if (mons[body->corpsenm].mlet == S_TROLL && !body->norevive) {
|
} else if (mons[body->corpsenm].mlet == S_TROLL && !no_revival) {
|
||||||
long age;
|
long age;
|
||||||
|
|
||||||
for (age = 2; age <= TAINT_AGE; age++)
|
for (age = 2; age <= TAINT_AGE; age++)
|
||||||
if (!rn2(TROLL_REVIVE_CHANCE)) { /* troll revives */
|
if (!rn2(TROLL_REVIVE_CHANCE)) { /* troll revives */
|
||||||
action = REVIVE_MON;
|
action = REVIVE_MON;
|
||||||
@@ -1182,8 +1188,6 @@ struct obj *body;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (body->norevive)
|
|
||||||
body->norevive = 0;
|
|
||||||
(void) start_timer(when, TIMER_OBJECT, action, obj_to_any(body));
|
(void) start_timer(when, TIMER_OBJECT, action, obj_to_any(body));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
-1
@@ -1,4 +1,4 @@
|
|||||||
/* NetHack 3.6 muse.c $NHDT-Date: 1581726278 2020/02/15 00:24:38 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.120 $ */
|
/* NetHack 3.6 muse.c $NHDT-Date: 1590870788 2020/05/30 20:33:08 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.127 $ */
|
||||||
/* Copyright (C) 1990 by Ken Arromdee */
|
/* Copyright (C) 1990 by Ken Arromdee */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
|
|
||||||
@@ -1958,6 +1958,8 @@ boolean vismon;
|
|||||||
pline("%s removes %s.", upstart(mpronounbuf),
|
pline("%s removes %s.", upstart(mpronounbuf),
|
||||||
doname(xobj));
|
doname(xobj));
|
||||||
}
|
}
|
||||||
|
if (container->otyp == ICE_BOX)
|
||||||
|
removed_from_icebox(xobj); /* resume rotting for corpse */
|
||||||
/* obj_extract_self(xobj); -- already done above */
|
/* obj_extract_self(xobj); -- already done above */
|
||||||
(void) mpickobj(mon, xobj);
|
(void) mpickobj(mon, xobj);
|
||||||
res = 2;
|
res = 2;
|
||||||
|
|||||||
+7
-9
@@ -1,4 +1,4 @@
|
|||||||
/* NetHack 3.6 pickup.c $NHDT-Date: 1583515468 2020/03/06 17:24:28 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.263 $ */
|
/* NetHack 3.6 pickup.c $NHDT-Date: 1590870789 2020/05/30 20:33:09 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.269 $ */
|
||||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||||
/*-Copyright (c) Robert Patrick Rankin, 2012. */
|
/*-Copyright (c) Robert Patrick Rankin, 2012. */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
@@ -36,7 +36,6 @@ static void FDECL(do_boh_explosion, (struct obj *, BOOLEAN_P));
|
|||||||
static long FDECL(boh_loss, (struct obj *, int));
|
static long FDECL(boh_loss, (struct obj *, int));
|
||||||
static int FDECL(in_container, (struct obj *));
|
static int FDECL(in_container, (struct obj *));
|
||||||
static int FDECL(out_container, (struct obj *));
|
static int FDECL(out_container, (struct obj *));
|
||||||
static void FDECL(removed_from_icebox, (struct obj *));
|
|
||||||
static long FDECL(mbag_item_gone, (int, struct obj *, BOOLEAN_P));
|
static long FDECL(mbag_item_gone, (int, struct obj *, BOOLEAN_P));
|
||||||
static void FDECL(explain_container_prompt, (BOOLEAN_P));
|
static void FDECL(explain_container_prompt, (BOOLEAN_P));
|
||||||
static int FDECL(traditional_loot, (BOOLEAN_P));
|
static int FDECL(traditional_loot, (BOOLEAN_P));
|
||||||
@@ -2353,12 +2352,8 @@ register struct obj *obj;
|
|||||||
obj->age = g.monstermoves - obj->age; /* actual age */
|
obj->age = g.monstermoves - obj->age; /* actual age */
|
||||||
/* stop any corpse timeouts when frozen */
|
/* stop any corpse timeouts when frozen */
|
||||||
if (obj->otyp == CORPSE && obj->timed) {
|
if (obj->otyp == CORPSE && obj->timed) {
|
||||||
long rot_alarm = stop_timer(ROT_CORPSE, obj_to_any(obj));
|
(void) stop_timer(ROT_CORPSE, obj_to_any(obj));
|
||||||
|
|
||||||
(void) stop_timer(REVIVE_MON, obj_to_any(obj));
|
(void) stop_timer(REVIVE_MON, obj_to_any(obj));
|
||||||
/* mark a non-reviving corpse as such */
|
|
||||||
if (rot_alarm)
|
|
||||||
obj->norevive = 1;
|
|
||||||
}
|
}
|
||||||
} else if (Is_mbag(g.current_container) && mbag_explodes(obj, 0)) {
|
} else if (Is_mbag(g.current_container) && mbag_explodes(obj, 0)) {
|
||||||
/* explicitly mention what item is triggering the explosion */
|
/* explicitly mention what item is triggering the explosion */
|
||||||
@@ -2487,14 +2482,17 @@ register struct obj *obj;
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* taking a corpse out of an ice box needs a couple of adjustments */
|
/* taking a corpse out of an ice box needs a couple of adjustments */
|
||||||
static void
|
void
|
||||||
removed_from_icebox(obj)
|
removed_from_icebox(obj)
|
||||||
struct obj *obj;
|
struct obj *obj;
|
||||||
{
|
{
|
||||||
if (!age_is_relative(obj)) {
|
if (!age_is_relative(obj)) {
|
||||||
obj->age = g.monstermoves - obj->age; /* actual age */
|
obj->age = g.monstermoves - obj->age; /* actual age */
|
||||||
if (obj->otyp == CORPSE)
|
if (obj->otyp == CORPSE) {
|
||||||
|
/* start a rot-away timer but not a troll's revive timer */
|
||||||
|
obj->norevive = 1;
|
||||||
start_corpse_timeout(obj);
|
start_corpse_timeout(obj);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user