X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=actions.c;h=ad09b4a254f0b584cdbbdef5124aa53eb91705f0;hb=589a1c92adc3d9acfc7244cc93c3a3801dfb18a4;hp=b866007c00cc59ebcf447e6f81e729529c5c8a95;hpb=4f08537e2d1c8c361d08e07a2d67cd3f53e03f40;p=open-adventure.git diff --git a/actions.c b/actions.c index b866007..ad09b4a 100644 --- a/actions.c +++ b/actions.c @@ -523,25 +523,33 @@ 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] == 2) - obj = obj * NOBJECTS + URN; - if (obj == INTRANSITIVE || obj == 0 || obj > NOBJECTS) + if (HERE(URN) && game.prop[URN] == URN_LIT) + obj = URN; + if (obj == INTRANSITIVE || + HERE(LAMP) && game.prop[LAMP] == LAMP_BRIGHT && + HERE(URN) && game.prop[URN] == URN_LIT) return GO_UNKNOWN; } if (obj == URN) { - game.prop[URN] = game.prop[URN] / 2; - spk = URN_DARK; + if (game.prop[URN] != URN_EMPTY) { + state_change(URN, URN_DARK); + } else { + pspeak(URN, change, URN_DARK); + } + } 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; } @@ -728,32 +736,27 @@ static int inven(void) static int light(token_t verb, token_t obj) /* Light. Applicable only to lamp and urn. */ { - int spk = actions[verb].message; if (obj == INTRANSITIVE) { if (HERE(LAMP) && game.prop[LAMP] == LAMP_DARK && game.limit >= 0) obj = LAMP; - if (HERE(URN) && game.prop[URN] == 1) - obj = obj * NOBJECTS + URN; - if (obj == INTRANSITIVE || obj == 0 || obj > NOBJECTS) + if (HERE(URN) && game.prop[URN] == URN_DARK) + obj = URN; + if (obj == INTRANSITIVE || + HERE(LAMP) && game.prop[LAMP] == LAMP_DARK && game.limit >= 0 && + HERE(URN) && game.prop[URN] == URN_DARK) return GO_UNKNOWN; } if (obj == URN) { - if (game.prop[URN] == 0) { - rspeak(URN_EMPTY); - } else { - game.prop[URN] = 2; - rspeak(URN_LIT); - } + state_change(URN, game.prop[URN] == URN_EMPTY ? URN_EMPTY : URN_LIT); return GO_CLEAROBJ; } else { if (obj != LAMP) { - rspeak(spk); + rspeak(actions[verb].message); return GO_CLEAROBJ; } - spk = LAMP_OUT; if (game.limit < 0) { - rspeak(spk); + rspeak(LAMP_OUT); return GO_CLEAROBJ; } state_change(LAMP, LAMP_BRIGHT); @@ -808,8 +811,6 @@ static int lock(token_t verb, token_t obj) obj = DOOR; if (AT(GRATE)) obj = GRATE; - if (obj != 0 && HERE(CHAIN)) - return GO_UNKNOWN; if (HERE(CHAIN)) obj = CHAIN; if (obj == 0 || obj == INTRANSITIVE) { @@ -888,7 +889,7 @@ static int pour(token_t verb, token_t obj) game.prop[PLANT2] = game.prop[PLANT]; return GO_MOVE; } else { - state_change(DOOR, (obj == OIL) ? DOOR_UNRUSTED: DOOR_RUSTED); + state_change(DOOR, (obj == OIL) ? DOOR_UNRUSTED : DOOR_RUSTED); return GO_CLEAROBJ; } }