X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=actions.c;h=08a4a7cca527f5380066b50defd361c4f735dc22;hb=ac65f3fd5f9622d4bcab0230a96f23d7658423e0;hp=52c041791f6c67b90574dfb79a86c03268b2f419;hpb=38970a1c98b3b9cd3e74c240e6662f090849758a;p=open-adventure.git diff --git a/actions.c b/actions.c index 52c0417..08a4a7c 100644 --- a/actions.c +++ b/actions.c @@ -700,36 +700,36 @@ static int find(token_t verb, token_t obj) static int fly(token_t verb, token_t obj) /* Fly. Snide remarks unless hovering rug is here. */ { - int spk = actions[verb].message; if (obj == INTRANSITIVE) { - if (game.prop[RUG] != RUG_HOVER) - spk = RUG_NOTHING2; - if (!HERE(RUG)) - spk = FLAP_ARMS; - if (spk == RUG_NOTHING2 || spk == FLAP_ARMS) { - rspeak(spk); + if (!HERE(RUG)) { + rspeak(FLAP_ARMS); + return GO_CLEAROBJ; + } + if (game.prop[RUG] != RUG_HOVER) { + rspeak(RUG_NOTHING2); return GO_CLEAROBJ; } obj = RUG; } if (obj != RUG) { - rspeak(spk); + rspeak(actions[verb].message); return GO_CLEAROBJ; } - spk = RUG_NOTHING1; if (game.prop[RUG] != RUG_HOVER) { - rspeak(spk); + rspeak(RUG_NOTHING1); return GO_CLEAROBJ; } game.oldlc2 = game.oldloc; game.oldloc = game.loc; /* FIXME: Arithmetic on location values */ game.newloc = game.place[RUG] + game.fixed[RUG] - game.loc; - spk = RUG_GOES; - if (game.prop[SAPPH] >= 0) - spk = RUG_RETURNS; - rspeak(spk); + + if (game.prop[SAPPH] >= 0) { + rspeak(RUG_RETURNS); + } else { + rspeak(RUG_GOES); + } return GO_TERMINATE; } @@ -788,15 +788,12 @@ static int light(token_t verb, token_t obj) static int listen(void) /* Listen. Intransitive only. Print stuff based on objsnd/locsnd. */ { - long k; - int spk = ALL_SILENT; - k = locations[game.loc].sound; - if (k != SILENT) { - rspeak(k); - if (locations[game.loc].loud) - return GO_CLEAROBJ; - else - spk = NO_MESSAGE; + long sound = locations[game.loc].sound; + if (sound != SILENT) { + rspeak(sound); + if (!locations[game.loc].loud) + rspeak(NO_MESSAGE); + return GO_CLEAROBJ; } for (int i = 1; i <= NOBJECTS; i++) { if (!HERE(i) || objects[i].sounds[0] == NULL || game.prop[i] < 0) @@ -806,21 +803,20 @@ static int listen(void) mi += 3 * game.blooded; long packed_zzword = token_to_packed(game.zzword); pspeak(i, hear, mi, true, packed_zzword); - spk = NO_MESSAGE; + rspeak(NO_MESSAGE); /* FIXME: Magic number, sensitive to bird state logic */ if (i == BIRD && game.prop[i] == 5) DESTROY(BIRD); + return GO_CLEAROBJ; } - rspeak(spk); + rspeak(ALL_SILENT); return GO_CLEAROBJ; } static int lock(token_t verb, token_t obj) /* Lock, unlock, no object given. Assume various things if present. */ { - int spk = actions[verb].message; if (obj == INTRANSITIVE) { - spk = NOTHING_LOCKED; if (HERE(CLAM)) obj = CLAM; if (HERE(OYSTER)) @@ -832,19 +828,18 @@ static int lock(token_t verb, token_t obj) if (HERE(CHAIN)) obj = CHAIN; if (obj == NO_OBJECT || obj == INTRANSITIVE) { - rspeak(spk); + rspeak(NOTHING_LOCKED); return GO_CLEAROBJ; } } /* Lock, unlock object. Special stuff for opening clam/oyster * and for chain. */ + int spk = actions[verb].message; if (obj == CLAM || obj == OYSTER) return bivalve(verb, obj); if (obj == DOOR) - spk = RUSTY_DOOR; - if (obj == DOOR && game.prop[DOOR] == DOOR_UNRUSTED) - spk = OK_MAN; + spk = (game.prop[DOOR] == DOOR_UNRUSTED) ? OK_MAN : RUSTY_DOOR; if (obj == CAGE) spk = NO_LOCK; if (obj == KEYS)