X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=actions.c;h=f2ec65adac01a042d5b8b7283d4e89f9bee2ca4f;hb=7eaefce61d74fbc73daabd3f42f048038366b5ad;hp=409e58e110eaaceb23718318dab19583f7dc7692;hpb=a5478639b6ea18b84fcd2eac15b82a0f5dff20d4;p=open-adventure.git diff --git a/actions.c b/actions.c index 409e58e..f2ec65a 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);