X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=actions.c;h=5dfb987a74f8e92ce02edd9ca36bb3defd1591b0;hb=5613b0ce36636d421cfa3002d39aeb0e2f69e389;hp=13fc8c5dfdf7bee165612b5c0e3b5af818b84231;hpb=c7aecb7249930ba3eafccfcd61e5b1af203a8b53;p=open-adventure.git diff --git a/actions.c b/actions.c index 13fc8c5..5dfb987 100644 --- a/actions.c +++ b/actions.c @@ -20,9 +20,6 @@ static int attack(struct command_t *command) vocab_t verb = command->verb; vocab_t obj = command->obj; - if (obj == INTRANSITIVE) { - return GO_UNKNOWN; - } long spk = actions[verb].message; if (obj == NO_OBJECT || obj == INTRANSITIVE) { int changes = 0; @@ -521,23 +518,25 @@ static int eat(token_t verb, token_t obj) /* Eat. Intransitive: assume food if present, else ask what. Transitive: food * ok, some things lose appetite, rest are ridiculous. */ { - int spk = actions[verb].message; if (obj == INTRANSITIVE) { if (!HERE(FOOD)) return GO_UNKNOWN; DESTROY(FOOD); - spk = THANKS_DELICIOUS; - } else { - if (obj == FOOD) { - DESTROY(FOOD); - spk = THANKS_DELICIOUS; - } - if (obj == BIRD || obj == SNAKE || obj == CLAM || obj == OYSTER || obj == - DWARF || obj == DRAGON || obj == TROLL || obj == BEAR || obj == - OGRE) - spk = LOST_APPETITE; + rspeak(THANKS_DELICIOUS); + return GO_CLEAROBJ; } - rspeak(spk); + if (obj == FOOD) { + DESTROY(FOOD); + rspeak(THANKS_DELICIOUS); + return GO_CLEAROBJ; + } + if (obj == BIRD || obj == SNAKE || obj == CLAM || obj == OYSTER || obj == + DWARF || obj == DRAGON || obj == TROLL || obj == BEAR || obj == + OGRE) { + rspeak(LOST_APPETITE); + return GO_CLEAROBJ; + } + rspeak(actions[verb].message); return GO_CLEAROBJ; } @@ -1086,16 +1085,6 @@ static int wake(token_t verb, token_t obj) } } -static token_t birdspeak(void) -{ - switch (game.prop[BIRD]) { - case BIRD_CAGED: - return CAGE_FLY; - default: - return FREE_FLY; - } -} - static int wave(token_t verb, token_t obj) /* Wave. No effect unless waving rod at fissure or at bird. */ { @@ -1114,15 +1103,15 @@ static int wave(token_t verb, token_t obj) return GO_CLEAROBJ; } else { if (game.closed) { - rspeak(birdspeak()); + rspeak((game.prop[BIRD] == BIRD_CAGED) ? CAGE_FLY : FREE_FLY); return GO_DWARFWAKE; } if (game.closng || !AT(FISSURE)) { - rspeak(birdspeak()); + rspeak((game.prop[BIRD] == BIRD_CAGED) ? CAGE_FLY : FREE_FLY); return GO_CLEAROBJ; } if (HERE(BIRD)) - rspeak(birdspeak()); + rspeak((game.prop[BIRD] == BIRD_CAGED) ? CAGE_FLY : FREE_FLY); /* FIXME: Arithemetic on property values */ game.prop[FISSURE] = 1 - game.prop[FISSURE];