]> granicus.if.org Git - nethack/commitdiff
B20007 age of potion of oil from bones
authornethack.allison <nethack.allison>
Mon, 17 Mar 2003 01:20:41 +0000 (01:20 +0000)
committernethack.allison <nethack.allison>
Mon, 17 Mar 2003 01:20:41 +0000 (01:20 +0000)
First From a bug report.4.1 beta 20.

include/obj.h
src/apply.c
src/light.c
src/pickup.c
src/restore.c

index de0e7489ffd9a1401117e23f3f516576488d44d2..10884317622f9b64e29826b7abda841628b3cb38 100644 (file)
@@ -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 || \
index 2858e088006121fefca00d704bbebee325f6c968..410411edfb402f5b8acff9d8099eeaaa000510ee 100644 (file)
@@ -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)
index 5e7229cdc5faeab0f3cf357b85b05266e1c34ca3..d0029e78f4acab323b96d912c2eff57a12687a62 100644 (file)
@@ -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 */
index ae11c47af3adbd7dbc452f6bd7f5b7af12a51ff9..351b8e8627aef5deb98dc9d073ae61e534d80e53 100644 (file)
@@ -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);
index a9391fda5d26b1da404e6fb6c7ee37038cbc22af..7c927e337e802d6d7d0b46dace076e0b1fbe5bd6 100644 (file)
@@ -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 */