projects
/
open-adventure.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
9056fa7
)
Cleanups and clarifications in do_command()
233/head
author
Aaron Traas
<aaron@traas.org>
Mon, 10 Jul 2017 21:43:59 +0000
(17:43 -0400)
committer
Aaron Traas
<aaron@traas.org>
Mon, 10 Jul 2017 21:43:59 +0000
(17:43 -0400)
main.c
patch
|
blob
|
history
diff --git
a/main.c
b/main.c
index c53939cb5ed673a0ac6a79b206b28ca1f0969da1..5a9c7c396df492eba7f5324333a2bc0e26455fb7 100644
(file)
--- 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. */
{
* 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;
/* 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;
if(!get_command_input(&command))
return false;
-L
threshold
:
+L
closecheck
:
++game.turns;
++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;
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 (command.id1 == ENTER && (command.id2 == STREAM ||
command.id2 == PROMOTE_WORD(WATER))) {
- if (LIQLOC(game.loc) == WATER)
{
+ if (LIQLOC(game.loc) == WATER)
rspeak(FEET_WET);
rspeak(FEET_WET);
- } else {
+ else
rspeak(WHERE_QUERY);
rspeak(WHERE_QUERY);
- }
+
goto Lclearobj;
}
if (command.id1 == ENTER && command.id2 != WORD_NOT_FOUND && command.id2 != WORD_EMPTY) {
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:
case GO_TOP:
continue; /* back to top of main interpreter loop */
case GO_CHECKFOO:
- goto L
threshold
;
+ goto L
closecheck
;
case GO_LOOKUP:
goto Lookup;
case GO_WORD2:
case GO_LOOKUP:
goto Lookup;
case GO_WORD2: