X-Git-Url: https://jxself.org/git/?p=open-adventure.git;a=blobdiff_plain;f=main.c;h=61f75850d6a1ef36f7d9a36d2ddbbcf34a9f85ba;hp=e365e1fc0a6f81dbf0330deeccfe93d390c0c93e;hb=6a90dcd0172c1a4c56d64a2dab9ebf892bc45afc;hpb=50efa22849c73c3b43e5005e6ddafc5f0027464a diff --git a/main.c b/main.c index e365e1f..61f7585 100644 --- a/main.c +++ b/main.c @@ -397,7 +397,7 @@ static bool dwarfmove(void) else if (j > 1 && game.newloc == tk[j - 1]) continue; else if (j >= DIM(tk) - 1) - /* This can't actually happen. */ + /* This can't actually happen. */ continue; // LCOV_EXCL_LINE else if (game.newloc == game.dloc[i]) continue; @@ -487,8 +487,8 @@ static void croak(void) * death and exit. */ rspeak(DEATH_CLOSING); terminate(endgame); - } else if (game.numdie == NDEATHS || - !yes(query, yes_response, arbitrary_messages[OK_MAN])) + } else if ( !yes(query, yes_response, arbitrary_messages[OK_MAN]) + || game.numdie == NDEATHS) terminate(endgame); else { game.place[WATER] = game.place[OIL] = LOC_NOWHERE; @@ -540,40 +540,39 @@ static void playermove( int motion) motion = game.oldlc2; game.oldlc2 = game.oldloc; game.oldloc = game.loc; - int spk = 0; - if (motion == game.loc) - spk = FORGOT_PATH; - if (CNDBIT(game.loc, COND_NOBACK)) - spk = TWIST_TURN; - if (spk == 0) { - int te_tmp = 0; - for (;;) { - enum desttype_t desttype = travel[travel_entry].desttype; - scratchloc = travel[travel_entry].destval; - if (desttype != dest_goto || scratchloc != motion) { - if (desttype == dest_goto) { - if (FORCED(scratchloc) && travel[tkey[scratchloc]].destval == motion) - te_tmp = travel_entry; - } - if (!travel[travel_entry].stop) { - ++travel_entry; /* go to next travel entry for this location */ - continue; - } - /* we've reached the end of travel entries for game.loc */ - travel_entry = te_tmp; - if (travel_entry == 0) { - rspeak(NOT_CONNECTED); - return; - } - } + if (CNDBIT(game.loc, COND_NOBACK)) { + rspeak(TWIST_TURN); + return; + } + if (motion == game.loc) { + rspeak(FORGOT_PATH); + return; + } - motion = travel[travel_entry].motion; - travel_entry = tkey[game.loc]; - break; /* fall through to ordinary travel */ + int te_tmp = 0; + for (;;) { + enum desttype_t desttype = travel[travel_entry].desttype; + scratchloc = travel[travel_entry].destval; + if (desttype != dest_goto || scratchloc != motion) { + if (desttype == dest_goto) { + if (FORCED(scratchloc) && travel[tkey[scratchloc]].destval == motion) + te_tmp = travel_entry; + } + if (!travel[travel_entry].stop) { + ++travel_entry; /* go to next travel entry for this location */ + continue; + } + /* we've reached the end of travel entries for game.loc */ + travel_entry = te_tmp; + if (travel_entry == 0) { + rspeak(NOT_CONNECTED); + return; + } } - } else { - rspeak(spk); - return; + + motion = travel[travel_entry].motion; + travel_entry = tkey[game.loc]; + break; /* fall through to ordinary travel */ } } else if (motion == LOOK) { /* Look. Can't give more detail. Pretend it wasn't dark @@ -1126,7 +1125,7 @@ Lclosecheck: command.id1 = command.id2; command.id2 = WORD_EMPTY; } else { - if (!((command.id1 != WATER && command.id1 != OIL) || (command.id2 != PLANT && command.id2 != DOOR))) { + if (!((command.id1 != WATER && command.id1 != OIL) || (command.id2 != PLANT && command.id2 != DOOR))) { if (AT(command.id2)) command.wd2 = token_to_packed("POUR"); } @@ -1143,9 +1142,9 @@ Lookup: rspeak(GO_UNNEEDED); } packed_to_token(command.wd1, word1); - long defn; - enum wordtype type; - get_vocab_metadata(word1, &defn, &type); + long defn; + enum wordtype type; + get_vocab_metadata(word1, &defn, &type); if (defn == WORD_NOT_FOUND) { if (fallback_handler(command)) continue; @@ -1154,7 +1153,7 @@ Lookup: goto Lclearobj; } switch (type) { - case NO_WORD_TYPE: // FIXME: treating NO_WORD_TYPE as a motion word is confusing + case NO_WORD_TYPE: // FIXME: treating NO_WORD_TYPE as a motion word is confusing case MOTION: playermove(defn); return true;