Fix for issue #21, hopefully

This commit is contained in:
NHOrus 2017-07-02 16:08:57 +03:00 committed by Eric S. Raymond
parent 4c32714997
commit 73af0e3a55
3 changed files with 20 additions and 22 deletions

View file

@ -527,15 +527,19 @@ static int extinguish(token_t verb, int obj)
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] == 2) if (HERE(URN) && game.prop[URN] == URN_LIT)
obj = obj * NOBJECTS + URN; obj = obj * NOBJECTS + URN;
if (obj == INTRANSITIVE || obj == 0 || obj > NOBJECTS) if (obj == INTRANSITIVE || obj == 0 || obj > NOBJECTS)
return GO_UNKNOWN; return GO_UNKNOWN;
} }
if (obj == URN) { if (obj == URN) {
game.prop[URN] = game.prop[URN] / 2; if (game.prop[URN] != URN_EMPTY) {
spk = URN_DARK; state_change(URN, URN_DARK);
} else {
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; spk = DARK(game.loc) ? PITCH_DARK : NO_MESSAGE;
@ -728,32 +732,25 @@ static int inven(void)
static int light(token_t verb, token_t obj) static int light(token_t verb, token_t obj)
/* Light. Applicable only to lamp and urn. */ /* Light. Applicable only to lamp and urn. */
{ {
int spk = actions[verb].message;
if (obj == INTRANSITIVE) { if (obj == INTRANSITIVE) {
if (HERE(LAMP) && game.prop[LAMP] == LAMP_DARK && game.limit >= 0) if (HERE(LAMP) && game.prop[LAMP] == LAMP_DARK && game.limit >= 0)
obj = LAMP; obj = LAMP;
if (HERE(URN) && game.prop[URN] == 1) if (HERE(URN) && game.prop[URN] == URN_DARK)
obj = obj * NOBJECTS + URN; obj = URN;
if (obj == INTRANSITIVE || obj == 0 || obj > NOBJECTS) if (obj == INTRANSITIVE || obj == 0 || obj > NOBJECTS)
return GO_UNKNOWN; return GO_UNKNOWN;
} }
if (obj == URN) { if (obj == URN) {
if (game.prop[URN] == 0) { state_change(URN, game.prop[URN] == URN_EMPTY ? URN_EMPTY : URN_LIT);
rspeak(URN_EMPTY);
} else {
game.prop[URN] = 2;
rspeak(URN_LIT);
}
return GO_CLEAROBJ; return GO_CLEAROBJ;
} else { } else {
if (obj != LAMP) { if (obj != LAMP) {
rspeak(spk); rspeak(actions[verb].message);
return GO_CLEAROBJ; return GO_CLEAROBJ;
} }
spk = LAMP_OUT;
if (game.limit < 0) { if (game.limit < 0) {
rspeak(spk); rspeak(LAMP_OUT);
return GO_CLEAROBJ; return GO_CLEAROBJ;
} }
state_change(LAMP, LAMP_BRIGHT); state_change(LAMP, LAMP_BRIGHT);

View file

@ -2805,7 +2805,6 @@ arbitrary_messages: !!omap
- NOT_LOCKABLE: 'I don''t know how to lock or unlock such a thing.' - NOT_LOCKABLE: 'I don''t know how to lock or unlock such a thing.'
- ALREADY_LOCKED: 'It was already locked.' - ALREADY_LOCKED: 'It was already locked.'
- ALREADY_UNLOCKED: 'It was already unlocked.' - ALREADY_UNLOCKED: 'It was already unlocked.'
- URN_EMPTY: 'The urn is empty and will not light.'
- BEAR_BLOCKS: 'There is no way to get past the bear to unlock the chain, which is\nprobably just as well.' - BEAR_BLOCKS: 'There is no way to get past the bear to unlock the chain, which is\nprobably just as well.'
- NOTHING_HAPPENS: 'Nothing happens.' - NOTHING_HAPPENS: 'Nothing happens.'
- WHERE_QUERY: 'Where?' - WHERE_QUERY: 'Where?'
@ -2952,8 +2951,6 @@ arbitrary_messages: !!omap
- FREE_FLY: 'The bird flies about agitatedly for a moment.' - FREE_FLY: 'The bird flies about agitatedly for a moment.'
- CAGE_FLY: 'The bird flies agitatedly about the cage.' - CAGE_FLY: 'The bird flies agitatedly about the cage.'
- NECKLACE_FLY: 'The bird flies about agitatedly for a moment, then disappears through\nthe crack. It reappears shortly, carrying in its beak a jade\nnecklace, which it drops at your feet.' - NECKLACE_FLY: 'The bird flies about agitatedly for a moment, then disappears through\nthe crack. It reappears shortly, carrying in its beak a jade\nnecklace, which it drops at your feet.'
- URN_LIT: 'The urn is now lit.'
- URN_DARK: 'The urn is now dark.'
- WATER_URN: 'You empty the bottle into the urn, which promptly ejects the water\nwith uncanny accuracy, squirting you directly between the eyes.' - WATER_URN: 'You empty the bottle into the urn, which promptly ejects the water\nwith uncanny accuracy, squirting you directly between the eyes.'
- OIL_URN: 'Your bottle is now empty and the urn is full of oil.' - OIL_URN: 'Your bottle is now empty and the urn is full of oil.'
- FULL_URN: 'The urn is already full of oil.' - FULL_URN: 'The urn is already full of oil.'
@ -3406,9 +3403,13 @@ objects: !!omap
locations: LOC_CLIFF locations: LOC_CLIFF
immovable: true immovable: true
descriptions: descriptions:
- 'A small urn is embedded in the rock.' - [URN_EMPTY, 'A small urn is embedded in the rock.']
- 'A small urn full of oil is embedded in the rock.' - [URN_DARK, 'A small urn full of oil is embedded in the rock.']
- 'A small oil flame extrudes from an urn embedded in the rock.' - [URN_LIT, 'A small oil flame extrudes from an urn embedded in the rock.']
changes:
- 'The urn is empty and will not light.'
- 'The urn is now dark.'
- 'The urn is now lit.'
- CAVITY: - CAVITY:
words: ['cavit'] words: ['cavit']
inventory: '*cavity' inventory: '*cavity'

View file

@ -2048,7 +2048,7 @@ The urn is now dark.
The forest thins out here to reveal a steep cliff. There is no way 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. down, but a small ledge can be seen to the west across the chasm.
A small urn is embedded in the rock. A small urn full of oil is embedded in the rock.
> fly > fly