X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=actions.c;h=4a86f019737d8c1fd75c362782e606831adf502e;hb=8fe07c8bf36b1c06e8cf8689c04629df0fe51504;hp=05377ffed9bd8ccfe018adfe735e13b66cdb17be;hpb=25230068fe3afb9d1faa9c606413784294700cef;p=open-adventure.git diff --git a/actions.c b/actions.c index 05377ff..4a86f01 100644 --- a/actions.c +++ b/actions.c @@ -145,10 +145,10 @@ static phase_codes_t attack(command_t command) DESTROY(OGRE); int dwarves = 0; for (int i = 1; i < PIRATE; i++) { - if (game.dloc[i] == game.loc) { + if (game.dwarves[i].loc == game.loc) { ++dwarves; - game.dloc[i] = LOC_LONGWEST; - game.dseen[i] = false; + game.dwarves[i].loc = LOC_LONGWEST; + game.dwarves[i].seen = false; } } rspeak((dwarves > 1) ? @@ -230,8 +230,11 @@ static phase_codes_t bigwords(vocab_t id) return GO_CLEAROBJ; } } else { - /* Magic-word sequebce was started but is incorrect */ - rspeak(START_OVER); + /* Magic-word sequence was started but is incorrect */ + if (settings.oldstyle || game.seenbigwords) + rspeak(START_OVER); + else + rspeak(WELL_POINTLESS); game.foobar = WORD_EMPTY; return GO_CLEAROBJ; } @@ -240,8 +243,7 @@ static phase_codes_t bigwords(vocab_t id) static void blast(void) /* Blast. No effect unless you've got dynamite, which is a neat trick! */ { - if (game.prop[ROD2] == STATE_NOTFOUND || - !game.closed) + if (game.prop[ROD2] == STATE_NOTFOUND || !game.closed) rspeak(REQUIRES_DYNAMITE); else { if (HERE(ROD2)) { @@ -301,11 +303,11 @@ static phase_codes_t vcarry(verb_t verb, obj_t obj) { if (obj == INTRANSITIVE) { /* Carry, no object given yet. OK if only one object present. */ - if (game.atloc[game.loc] == NO_OBJECT || - game.link[game.atloc[game.loc]] != 0 || + if (game.locs[game.loc].atloc == NO_OBJECT || + game.link[game.locs[game.loc].atloc] != 0 || atdwrf(game.loc) > 0) return GO_UNKNOWN; - obj = game.atloc[game.loc]; + obj = game.locs[game.loc].atloc; } if (TOTING(obj)) { @@ -352,10 +354,8 @@ static phase_codes_t vcarry(verb_t verb, obj_t obj) return GO_CLEAROBJ; } - if (obj == WATER || - obj == OIL) { - if (!HERE(BOTTLE) || - LIQUID() != obj) { + if (obj == WATER || obj == OIL) { + if (!HERE(BOTTLE) || LIQUID() != obj) { if (!TOTING(BOTTLE)) { rspeak(NO_CONTAINER); return GO_CLEAROBJ; @@ -391,8 +391,7 @@ static phase_codes_t vcarry(verb_t verb, obj_t obj) } game.prop[BIRD] = BIRD_CAGED; } - if ((obj == BIRD || - obj == CAGE) && + if ((obj == BIRD || obj == CAGE) && (game.prop[BIRD] == BIRD_CAGED || STASHED(BIRD) == BIRD_CAGED)) { /* expression maps BIRD to CAGE and CAGE to BIRD */ carry(BIRD + CAGE - obj, game.loc); @@ -812,10 +811,8 @@ static phase_codes_t find(verb_t verb, obj_t obj) return GO_CLEAROBJ; } - if (AT(obj) || - (LIQUID() == obj && AT(BOTTLE)) || - obj == LIQLOC(game.loc) || - (obj == DWARF && atdwrf(game.loc) > 0)) { + if (AT(obj) || (LIQUID() == obj && AT(BOTTLE)) || + obj == LIQLOC(game.loc) || (obj == DWARF && atdwrf(game.loc) > 0)) { rspeak(YOU_HAVEIT); return GO_CLEAROBJ; } @@ -873,8 +870,7 @@ static phase_codes_t inven(void) { bool empty = true; for (obj_t i = 1; i <= NOBJECTS; i++) { - if (i == BEAR || - !TOTING(i)) + if (i == BEAR || !TOTING(i)) continue; if (empty) { rspeak(NOW_HOLDING); @@ -939,9 +935,7 @@ static phase_codes_t listen(void) soundlatch = true; } for (obj_t i = 1; i <= NOBJECTS; i++) { - if (!HERE(i) || - objects[i].sounds[0] == NULL || - game.prop[i] < 0) + if (!HERE(i) || objects[i].sounds[0] == NULL || game.prop[i] < 0) continue; int mi = game.prop[i]; /* (ESR) Some unpleasant magic on object states here. Ideally @@ -1051,9 +1045,8 @@ static phase_codes_t pour(verb_t verb, obj_t obj) /* Pour. If no object, or object is bottle, assume contents of bottle. * special tests for pouring water or oil on plant or rusty door. */ { - if (obj == BOTTLE || - obj == INTRANSITIVE) - obj = LIQUID(); + if (obj == BOTTLE || obj == INTRANSITIVE) + obj = LIQUID(); if (obj == NO_OBJECT) return GO_UNKNOWN; if (!TOTING(obj)) { @@ -1069,8 +1062,7 @@ static phase_codes_t pour(verb_t verb, obj_t obj) return fill(verb, URN); game.prop[BOTTLE] = EMPTY_BOTTLE; game.place[obj] = LOC_NOWHERE; - if (!(AT(PLANT) || - AT(DOOR))) { + if (!(AT(PLANT) || AT(DOOR))) { rspeak(GROUND_WET); return GO_CLEAROBJ; } @@ -1109,9 +1101,7 @@ static phase_codes_t read(command_t command) if (HERE(i) && objects[i].texts[0] != NULL && game.prop[i] >= 0) command.obj = command.obj * NOBJECTS + i; } - if (command.obj > NOBJECTS || - command.obj == NO_OBJECT || - DARK(game.loc)) + if (command.obj > NOBJECTS || command.obj == NO_OBJECT || DARK(game.loc)) return GO_UNKNOWN; } @@ -1255,8 +1245,8 @@ static phase_codes_t throwit(command_t command) return throw_support(DWARF_DODGES); } else { int i = atdwrf(game.loc); - game.dseen[i] = false; - game.dloc[i] = LOC_NOWHERE; + game.dwarves[i].seen = false; + game.dwarves[i].loc = LOC_NOWHERE; return throw_support((++game.dkill == 1) ? DWARF_SMOKE : KILLED_DWARF); @@ -1267,8 +1257,7 @@ static phase_codes_t throwit(command_t command) static phase_codes_t wake(verb_t verb, obj_t obj) /* Wake. Only use is to disturb the dwarves. */ { - if (obj != DWARF || - !game.closed) { + if (obj != DWARF || !game.closed) { speak(actions[verb].message); return GO_CLEAROBJ; } else { @@ -1298,11 +1287,7 @@ static phase_codes_t waste(verb_t verb, turn_t turns) static phase_codes_t wave(verb_t verb, obj_t obj) /* Wave. No effect unless waving rod at fissure or at bird. */ { - if (obj != ROD || - !TOTING(obj) || - (!HERE(BIRD) && - (game.closng || - !AT(FISSURE)))) { + if (obj != ROD || !TOTING(obj) || (!HERE(BIRD) && (game.closng || !AT(FISSURE)))) { speak(((!TOTING(obj)) && (obj != ROD || !TOTING(ROD2))) ? arbitrary_messages[ARENT_CARRYING] : @@ -1323,8 +1308,7 @@ static phase_codes_t wave(verb_t verb, obj_t obj) FREE_FLY); return GO_DWARFWAKE; } - if (game.closng || - !AT(FISSURE)) { + if (game.closng || !AT(FISSURE)) { rspeak((game.prop[BIRD] == BIRD_CAGED) ? CAGE_FLY : FREE_FLY); @@ -1403,8 +1387,7 @@ phase_codes_t action(command_t command) * will do here. We're preventing interpretation as an intransitive * verb when the word is unknown. */ command.obj = command.word[1].raw[0] != '\0' ? KEYS : NO_OBJECT; - if (command.obj == NO_OBJECT || - command.obj == INTRANSITIVE) { + if (command.obj == NO_OBJECT || command.obj == INTRANSITIVE) { /* Analyse an intransitive verb (ie, no object given yet). */ switch (command.verb) { case CARRY: