From 96b149208fb12c98db5489a1c6e3c588d54009b6 Mon Sep 17 00:00:00 2001 From: "nethack.allison" Date: Mon, 17 Mar 2003 01:20:41 +0000 Subject: [PATCH] B20007 age of potion of oil from bones First From a bug report.4.1 beta 20. --- include/obj.h | 16 ++++++++++++++++ src/apply.c | 5 +---- src/light.c | 9 +-------- src/pickup.c | 6 ++---- src/restore.c | 6 +----- 5 files changed, 21 insertions(+), 21 deletions(-) diff --git a/include/obj.h b/include/obj.h index de0e7489f..108843176 100644 --- a/include/obj.h +++ b/include/obj.h @@ -260,6 +260,22 @@ struct obj { otmp->otyp == WAX_CANDLE) #define MAX_OIL_IN_FLASK 400 /* maximum amount of oil in a potion of oil */ +/* MAGIC_LAMP intentionally excluded below */ +/* age field of this is relative age rather than absolute */ +#define age_is_relative(otmp) ((otmp)->otyp == BRASS_LANTERN\ + || (otmp)->otyp == OIL_LAMP\ + || (otmp)->otyp == CANDELABRUM_OF_INVOCATION\ + || (otmp)->otyp == TALLOW_CANDLE\ + || (otmp)->otyp == WAX_CANDLE\ + || (otmp)->otyp == POT_OIL) +/* object can be ignited */ +#define ignitable(otmp) ((otmp)->otyp == BRASS_LANTERN\ + || (otmp)->otyp == OIL_LAMP\ + || (otmp)->otyp == CANDELABRUM_OF_INVOCATION\ + || (otmp)->otyp == TALLOW_CANDLE\ + || (otmp)->otyp == WAX_CANDLE\ + || (otmp)->otyp == POT_OIL) + /* special stones */ #define is_graystone(obj) ((obj)->otyp == LUCKSTONE || \ (obj)->otyp == LOADSTONE || \ diff --git a/src/apply.c b/src/apply.c index 2858e0880..410411edf 100644 --- a/src/apply.c +++ b/src/apply.c @@ -1015,10 +1015,7 @@ struct obj *obj; { xchar x, y; - if (!obj->lamplit && (obj->otyp == CANDELABRUM_OF_INVOCATION || - obj->otyp == WAX_CANDLE || obj->otyp == TALLOW_CANDLE || - obj->otyp == OIL_LAMP || obj->otyp == MAGIC_LAMP || - obj->otyp == BRASS_LANTERN || obj->otyp == POT_OIL)) { + if (!obj->lamplit && (obj->otyp == MAGIC_LAMP || ignitable(obj))) { if ((obj->otyp == MAGIC_LAMP || obj->otyp == CANDELABRUM_OF_INVOCATION) && obj->spe == 0) diff --git a/src/light.c b/src/light.c index 5e7229cdc..d0029e78f 100644 --- a/src/light.c +++ b/src/light.c @@ -485,14 +485,7 @@ obj_is_burning(obj) struct obj *obj; { return (obj->lamplit && - ( obj->otyp == MAGIC_LAMP - || obj->otyp == BRASS_LANTERN - || obj->otyp == OIL_LAMP - || obj->otyp == CANDELABRUM_OF_INVOCATION - || obj->otyp == TALLOW_CANDLE - || obj->otyp == WAX_CANDLE - || obj->otyp == POT_OIL - || artifact_light(obj))); + (obj->otyp == MAGIC_LAMP || ignitable(obj) || artifact_light(obj))); } /* copy the light source(s) attachted to src, and attach it/them to dest */ diff --git a/src/pickup.c b/src/pickup.c index ae11c47af..351b8e862 100644 --- a/src/pickup.c +++ b/src/pickup.c @@ -1772,8 +1772,7 @@ register struct obj *obj; sellobj_state(SELL_NORMAL); } } - if (Icebox && obj->otyp != OIL_LAMP && obj->otyp != BRASS_LANTERN - && !Is_candle(obj)) { + if (Icebox && !age_is_relative(obj)) { obj->age = monstermoves - obj->age; /* actual age */ /* stop any corpse timeouts when frozen */ if (obj->otyp == CORPSE && obj->timed) { @@ -1868,8 +1867,7 @@ register struct obj *obj; obj_extract_self(obj); current_container->owt = weight(current_container); - if (Icebox && obj->otyp != OIL_LAMP && obj->otyp != BRASS_LANTERN - && !Is_candle(obj)) { + if (Icebox && !age_is_relative(obj)) { obj->age = monstermoves - obj->age; /* actual age */ if (obj->otyp == CORPSE) start_corpse_timeout(obj); diff --git a/src/restore.c b/src/restore.c index a9391fda5..7c927e337 100644 --- a/src/restore.c +++ b/src/restore.c @@ -217,11 +217,7 @@ boolean ghostly, frozen; * to new player's clock. Assumption: new player arrived * immediately after old player died. */ - if (ghostly && !frozen - && otmp->otyp != OIL_LAMP - && otmp->otyp != BRASS_LANTERN - && otmp->otyp != CANDELABRUM_OF_INVOCATION - && !Is_candle(otmp)) + if (ghostly && !frozen && !age_is_relative(otmp)) otmp->age = monstermoves - omoves + otmp->age; /* get contents of a container or statue */ -- 2.40.0