-/* SCCS Id: @(#)mkobj.c 3.5 2007/02/17 */
+/* SCCS Id: @(#)mkobj.c 3.5 2007/04/04 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
if (otmp->otyp == CORPSE && otmp->on_ice) {
/* Adjust the age; must be same as obj_timer_checks() for off ice*/
age = monstermoves - otmp->age;
- retval = otmp->age + (age / ROT_ICE_ADJUSTMENT);
+ retval += age * (ROT_ICE_ADJUSTMENT-1) / ROT_ICE_ADJUSTMENT;
#ifdef DEBUG_EFFECTS
pline_The("%s age has ice modifications:otmp->age = %ld, returning %ld.",
s_suffix(doname(otmp)),otmp->age, retval);
/* Adjust the time remaining */
tleft *= ROT_ICE_ADJUSTMENT;
restart_timer = TRUE;
- /* Adjust the age; must be same as in obj_ice_age() */
+ /* Adjust the age; time spent off ice needs to be multiplied
+ by the ice adjustment and subtracted from the age so that
+ later calculations behave as if it had been on ice during
+ that time (longwinded way of saying this is the inverse
+ of removing it from the ice and of peeking at its age). */
age = monstermoves - otmp->age;
otmp->age = monstermoves - (age * ROT_ICE_ADJUSTMENT);
}
/* Check for corpses coming off ice */
else if ((force < 0) ||
(otmp->otyp == CORPSE && otmp->on_ice &&
- ((on_floor && !is_ice(x,y)) || !on_floor))) {
+ !((on_floor || buried) && is_ice(x,y)))) {
tleft = stop_timer(action, obj_to_any(otmp));
if (tleft == 0L) {
action = REVIVE_MON;
restart_timer = TRUE;
/* Adjust the age */
age = monstermoves - otmp->age;
- otmp->age = otmp->age + (age / ROT_ICE_ADJUSTMENT);
+ otmp->age += age * (ROT_ICE_ADJUSTMENT-1) / ROT_ICE_ADJUSTMENT;
}
}
/* now re-start the timer with the appropriate modifications */