From 12b2ff74f6bbca81dc04e359f2209fe3a442e0df Mon Sep 17 00:00:00 2001 From: Aaron Traas Date: Mon, 10 Jul 2017 17:43:59 -0400 Subject: [PATCH] Cleanups and clarifications in do_command() --- main.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/main.c b/main.c index c53939c..5a9c7c3 100644 --- a/main.c +++ b/main.c @@ -788,6 +788,15 @@ static bool closecheck(void) * problems arise from the use of negative prop numbers to suppress * the object descriptions until he's actually moved the objects. */ { + /* If a turn threshold has been met, apply penalties and tell + * the player about it. */ + for (int i = 0; i < NTHRESHOLDS; ++i) { + if (game.turns == turn_thresholds[i].threshold + 1) { + game.trnluz += turn_thresholds[i].point_loss; + speak(turn_thresholds[i].message); + } + } + /* Don't tick game.clock1 unless well into cave (and not at Y2). */ if (game.tally == 0 && INDEEP(game.loc) && game.loc != LOC_Y2) --game.clock1; @@ -1097,18 +1106,9 @@ Lclearobj: if(!get_command_input(&command)) return false; -Lthreshold: +Lclosecheck: ++game.turns; - /* If a turn threshold has been met, apply penalties and tell - * the player about it. */ - for (int i = 0; i < NTHRESHOLDS; ++i) { - if (game.turns == turn_thresholds[i].threshold + 1) { - game.trnluz += turn_thresholds[i].point_loss; - speak(turn_thresholds[i].message); - } - } - if (closecheck()) { if (game.closed) return true; @@ -1117,11 +1117,11 @@ Lthreshold: if (command.id1 == ENTER && (command.id2 == STREAM || command.id2 == PROMOTE_WORD(WATER))) { - if (LIQLOC(game.loc) == WATER) { + if (LIQLOC(game.loc) == WATER) rspeak(FEET_WET); - } else { + else rspeak(WHERE_QUERY); - } + goto Lclearobj; } if (command.id1 == ENTER && command.id2 != WORD_NOT_FOUND && command.id2 != WORD_EMPTY) { @@ -1185,7 +1185,7 @@ Lookup: case GO_TOP: continue; /* back to top of main interpreter loop */ case GO_CHECKFOO: - goto Lthreshold; + goto Lclosecheck; case GO_LOOKUP: goto Lookup; case GO_WORD2: -- 2.31.1