Fixed regression in #21 Cleaned up logic of light/extinguish

This commit is contained in:
NHOrus 2017-07-02 16:27:20 +03:00 committed by Eric S. Raymond
parent 73af0e3a55
commit e91742e1b9
3 changed files with 25 additions and 23 deletions

View file

@ -523,13 +523,12 @@ static int eat(token_t verb, token_t obj)
static int extinguish(token_t verb, int obj) static int extinguish(token_t verb, int obj)
/* Extinguish. Lamp, urn, dragon/volcano (nice try). */ /* Extinguish. Lamp, urn, dragon/volcano (nice try). */
{ {
int spk = actions[verb].message;
if (obj == INTRANSITIVE) { if (obj == INTRANSITIVE) {
if (HERE(LAMP) && game.prop[LAMP] == LAMP_BRIGHT) if (HERE(LAMP) && game.prop[LAMP] == LAMP_BRIGHT)
obj = LAMP; obj = LAMP;
if (HERE(URN) && game.prop[URN] == URN_LIT) if (HERE(URN) && game.prop[URN] == URN_LIT)
obj = obj * NOBJECTS + URN; obj = URN;
if (obj == INTRANSITIVE || obj == 0 || obj > NOBJECTS) if (obj == INTRANSITIVE)
return GO_UNKNOWN; return GO_UNKNOWN;
} }
@ -539,13 +538,16 @@ static int extinguish(token_t verb, int obj)
} else { } else {
pspeak(URN, change, URN_DARK); pspeak(URN, change, URN_DARK);
} }
return GO_CLEAROBJ;
} else if (obj == LAMP) { } else if (obj == LAMP) {
state_change(LAMP, LAMP_DARK); state_change(LAMP, LAMP_DARK);
spk = DARK(game.loc) ? PITCH_DARK : NO_MESSAGE; rspeak(DARK(game.loc) ? PITCH_DARK : NO_MESSAGE);
} else if (obj == DRAGON || obj == VOLCANO) } else if (obj == DRAGON || obj == VOLCANO) {
spk = BEYOND_POWER; rspeak(BEYOND_POWER);
rspeak(spk);
} else {
rspeak(actions[verb].message);
}
return GO_CLEAROBJ; return GO_CLEAROBJ;
} }

View file

@ -2013,20 +2013,6 @@ A small oil flame extrudes from an urn embedded in the rock.
> extinguish > extinguish
I'm afraid I don't understand.
> look
Sorry, but I am not allowed to give more detail. I will repeat the
long description of your location.
The forest thins out here to reveal a steep cliff. There is no way
down, but a small ledge can be seen to the west across the chasm.
A small oil flame extrudes from an urn embedded in the rock.
> extinguish urn
The urn is now dark. The urn is now dark.
> look > look
@ -2039,6 +2025,20 @@ down, but a small ledge can be seen to the west across the chasm.
A small urn full of oil is embedded in the rock. A small urn full of oil is embedded in the rock.
> light
The urn is now lit.
> look
Sorry, but I am not allowed to give more detail. I will repeat the
long description of your location.
The forest thins out here to reveal a steep cliff. There is no way
down, but a small ledge can be seen to the west across the chasm.
A small oil flame extrudes from an urn embedded in the rock.
> extinguish urn > extinguish urn
The urn is now dark. The urn is now dark.

View file

@ -344,7 +344,7 @@ read urn
look look
extinguish extinguish
look look
extinguish urn light
look look
extinguish urn extinguish urn
look look