Moved application settings to settings_t struct
[open-adventure.git] / actions.c
index ae463219171b05ea1525c2ef2a55c4eb2b0baa91..f2ec65adac01a042d5b8b7283d4e89f9bee2ca4f 100644 (file)
--- a/actions.c
+++ b/actions.c
@@ -523,13 +523,14 @@ static int eat(token_t verb, token_t obj)
 static int extinguish(token_t verb, int obj)
 /* Extinguish.  Lamp, urn, dragon/volcano (nice try). */
 {
-    int spk = actions[verb].message;
     if (obj == INTRANSITIVE) {
         if (HERE(LAMP) && game.prop[LAMP] == LAMP_BRIGHT)
             obj = LAMP;
         if (HERE(URN) && game.prop[URN] == URN_LIT)
-            obj = obj * NOBJECTS + URN;
-        if (obj == INTRANSITIVE || obj == 0 || obj > NOBJECTS)
+            obj = URN;
+        if (obj == INTRANSITIVE ||
+            HERE(LAMP) && game.prop[LAMP] == LAMP_BRIGHT &&
+            HERE(URN) && game.prop[URN] == URN_LIT)
             return GO_UNKNOWN;
     }
 
@@ -539,13 +540,16 @@ static int extinguish(token_t verb, int obj)
         } else {
             pspeak(URN, change, URN_DARK);
         }
-        return GO_CLEAROBJ;
+
     } else if (obj == LAMP) {
         state_change(LAMP, LAMP_DARK);
-        spk = DARK(game.loc) ? PITCH_DARK : NO_MESSAGE;
-    } else if (obj == DRAGON || obj == VOLCANO)
-        spk = BEYOND_POWER;
-    rspeak(spk);
+        rspeak(DARK(game.loc) ? PITCH_DARK : NO_MESSAGE);
+    } else if (obj == DRAGON || obj == VOLCANO) {
+        rspeak(BEYOND_POWER);
+
+    } else {
+        rspeak(actions[verb].message);
+    }
     return GO_CLEAROBJ;
 }
 
@@ -737,7 +741,9 @@ static int light(token_t verb, token_t obj)
             obj = LAMP;
         if (HERE(URN) && game.prop[URN] == URN_DARK)
             obj =  URN;
-        if (obj == INTRANSITIVE || obj == 0 || obj > NOBJECTS)
+        if (obj == INTRANSITIVE ||
+            HERE(LAMP) && game.prop[LAMP] == LAMP_DARK && game.limit >= 0 &&
+            HERE(URN) && game.prop[URN] == URN_DARK)
             return GO_UNKNOWN;
     }