projects
/
open-adventure.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix bug that made YES() case-sensitive.
[open-adventure.git]
/
main.c
diff --git
a/main.c
b/main.c
index 405d9d37fe18280d0efdd996affd6ede7c672442..b97e44c24872de5d95d1d6a3db6ee437b748301b 100644
(file)
--- a/
main.c
+++ b/
main.c
@@
-135,7
+135,7
@@
int main(int argc, char *argv[])
game.loc = LOC_START;
game.limit = 330;
if (!rfp) {
game.loc = LOC_START;
game.limit = 330;
if (!rfp) {
- game.novice = YES(
stdin,
WELCOME_YOU, CAVE_NEARBY, NO_MESSAGE);
+ game.novice = YES(WELCOME_YOU, CAVE_NEARBY, NO_MESSAGE);
if (game.novice)game.limit = 1000;
} else {
restore(rfp);
if (game.novice)game.limit = 1000;
} else {
restore(rfp);
@@
-150,7
+150,7
@@
int main(int argc, char *argv[])
break;
}
/* show score and exit */
break;
}
/* show score and exit */
-
scor
e(quitgame);
+
terminat
e(quitgame);
}
static bool fallback_handler(char *buf)
}
static bool fallback_handler(char *buf)
@@
-251,11
+251,11
@@
static void checkhints(FILE *cmdin)
/* Fall through to hint display */
game.hintlc[hint] = 0;
/* Fall through to hint display */
game.hintlc[hint] = 0;
- if (!YES(
cmdin,
HINTS[hint][3], NO_MESSAGE, OK_MAN))
+ if (!YES(HINTS[hint][3], NO_MESSAGE, OK_MAN))
return;
SETPRM(1, HINTS[hint][2], HINTS[hint][2]);
RSPEAK(HINT_COST);
return;
SETPRM(1, HINTS[hint][2], HINTS[hint][2]);
RSPEAK(HINT_COST);
- game.hinted[hint] = YES(
cmdin,
WANT_HINT, HINTS[hint][4], OK_MAN);
+ game.hinted[hint] = YES(WANT_HINT, HINTS[hint][4], OK_MAN);
if (game.hinted[hint] && game.limit > WARNTIME)
game.limit += WARNTIME * HINTS[hint][2];
}
if (game.hinted[hint] && game.limit > WARNTIME)
game.limit += WARNTIME * HINTS[hint][2];
}
@@
-482,12
+482,11
@@
static void croak(FILE *cmdin)
/* He died during closing time. No resurrection. Tally up a
* death and exit. */
RSPEAK(DEATH_CLOSING);
/* He died during closing time. No resurrection. Tally up a
* death and exit. */
RSPEAK(DEATH_CLOSING);
- score(endgame);
-
+ terminate(endgame);
}
/* FIXME: Arithmetic on message numbers */
}
/* FIXME: Arithmetic on message numbers */
- else if (game.numdie == MAXDIE || !YES(
cmdin,
WATCH_IT + game.numdie * 2, WHICH_WAY + game.numdie * 2, OK_MAN))
-
scor
e(endgame);
+ else if (game.numdie == MAXDIE || !YES(WATCH_IT + game.numdie * 2, WHICH_WAY + game.numdie * 2, OK_MAN))
+
terminat
e(endgame);
else {
game.place[WATER] = game.place[OIL] = NOWHERE;
if (TOTING(LAMP))
else {
game.place[WATER] = game.place[OIL] = NOWHERE;
if (TOTING(LAMP))
@@
-624,6
+623,7
@@
static bool playermove(FILE *cmdin, token_t verb, int motion)
/* else fall through */
} else if (game.prop[motion] != game.newloc / 100 - 3)
break;
/* else fall through */
} else if (game.prop[motion] != game.newloc / 100 - 3)
break;
+ L12:
do {
if (TRAVEL[kk] < 0)BUG(25);
++kk;
do {
if (TRAVEL[kk] < 0)BUG(25);
++kk;
@@
-646,10
+646,10
@@
static bool playermove(FILE *cmdin, token_t verb, int motion)
* actual motion, but can be spotted by "go back". */
/* FIXME: Arithmetic on location numbers */
game.newloc = 99 + 100 - game.loc;
* actual motion, but can be spotted by "go back". */
/* FIXME: Arithmetic on location numbers */
game.newloc = 99 + 100 - game.loc;
- if (game.holdng
== 0 || (game.holdng == 1 && TOTING(EMRALD)))
-
return true
;
-
game.newloc = game.loc
;
- RSPEAK(MUST_DROP);
+ if (game.holdng
> 1 || (game.holdng == 1 && !TOTING(EMRALD))) {
+
game.newloc = game.loc
;
+
RSPEAK(MUST_DROP)
;
+ }
return true;
case 2:
/* Travel 302. Plover transport. Drop the emerald (only use
return true;
case 2:
/* Travel 302. Plover transport. Drop the emerald (only use
@@
-657,13
+657,7
@@
static bool playermove(FILE *cmdin, token_t verb, int motion)
* plover-passage to get it out. Having dropped it, go back and
* pretend he wasn't carrying it after all. */
DROP(EMRALD, game.loc);
* plover-passage to get it out. Having dropped it, go back and
* pretend he wasn't carrying it after all. */
DROP(EMRALD, game.loc);
- do {
- if (TRAVEL[kk] < 0)BUG(25);
- ++kk;
- game.newloc = labs(TRAVEL[kk]) / 1000;
- } while
- (game.newloc == scratchloc);
- continue; /* back to top of do/while loop */
+ goto L12;
case 3:
/* Travel 303. Troll bridge. Must be done only as special
* motion so that dwarves won't wander across and encounter
case 3:
/* Travel 303. Troll bridge. Must be done only as special
* motion so that dwarves won't wander across and encounter
@@
-694,13
+688,12
@@
static bool playermove(FILE *cmdin, token_t verb, int motion)
game.prop[BEAR] = 3;
game.oldlc2 = game.newloc;
croak(cmdin);
game.prop[BEAR] = 3;
game.oldlc2 = game.newloc;
croak(cmdin);
- return false;
}
}
BUG(20);
}
} while
}
}
BUG(20);
}
} while
- (false);
+
(false);
/* FIXME: Arithmetic on location number, becoming a message number */
RSPEAK(game.newloc - 500);
game.newloc = game.loc;
/* FIXME: Arithmetic on location number, becoming a message number */
RSPEAK(game.newloc - 500);
game.newloc = game.loc;
@@
-915,7
+908,7
@@
static bool do_command(FILE *cmdin)
if (OUTSID(game.newloc) && game.newloc != 0 && game.closng) {
RSPEAK(EXIT_CLOSED);
game.newloc = game.loc;
if (OUTSID(game.newloc) && game.newloc != 0 && game.closng) {
RSPEAK(EXIT_CLOSED);
game.newloc = game.loc;
- if (!game.panic)game.clock2 =
15
;
+ if (!game.panic)game.clock2 =
PANICTIME
;
game.panic = true;
}
game.panic = true;
}
@@
-957,7
+950,7
@@
static bool do_command(FILE *cmdin)
msg = arbitrary_messages[PITCH_DARK];
}
if (TOTING(BEAR))RSPEAK(TAME_BEAR);
msg = arbitrary_messages[PITCH_DARK];
}
if (TOTING(BEAR))RSPEAK(TAME_BEAR);
-
new
speak(msg);
+ speak(msg);
if (FORCED(game.loc)) {
if (playermove(cmdin, verb, 1))
return true;
if (FORCED(game.loc)) {
if (playermove(cmdin, verb, 1))
return true;
@@
-1004,7
+997,7
@@
L2607:
game.foobar = (game.foobar > 0 ? -game.foobar : 0);
++game.turns;
if (game.turns == game.thresh) {
game.foobar = (game.foobar > 0 ? -game.foobar : 0);
++game.turns;
if (game.turns == game.thresh) {
-
new
speak(turn_threshold_messages[game.trndex]);
+ speak(turn_threshold_messages[game.trndex]);
game.trnluz = game.trnluz + TRNVAL[game.trndex] / 100000;
++game.trndex;
game.thresh = -1;
game.trnluz = game.trnluz + TRNVAL[game.trndex] / 100000;
++game.trndex;
game.thresh = -1;
@@
-1121,8
+1114,7
@@
Laction:
case GO_DWARFWAKE:
/* Oh dear, he's disturbed the dwarves. */
RSPEAK(DWARVES_AWAKEN);
case GO_DWARFWAKE:
/* Oh dear, he's disturbed the dwarves. */
RSPEAK(DWARVES_AWAKEN);
- score(endgame);
- return true;
+ terminate(endgame);
default:
BUG(99);
}
default:
BUG(99);
}