/* Options. */
#ifndef ADVENT_NOSAVE
- char* opts = "l:or:s";
- char* usage = "Usage: %s [-l logfilename] [-o] [-r restorefilename] [-s] \n";
+ const char* opts = "l:or:s";
+ const char* usage = "Usage: %s [-l logfilename] [-o] [-r restorefilename] [-s] \n";
#else
- char* opts = "l:os";
- char* usage = "Usage: %s [-l logfilename] [-o] [-s] \n";
+ const char* opts = "l:os";
+ const char* usage = "Usage: %s [-l logfilename] [-o] [-s] \n";
#endif
while ((ch = getopt(argc, argv, opts)) != EOF) {
switch (ch) {
linenoiseHistorySetMaxLen(350);
- /* Logical variables:
- *
- * game.closed says whether we're all the way closed
- * game.closng says whether it's closing time yet
- * game.clshnt says whether he's read the clue in the endgame
- * game.lmwarn says whether he's been warned about lamp going dim
- * game.novice says whether he asked for instructions at start-up
- * game.panic says whether he's found out he's trapped in the cave
- * game.wzdark says whether the loc he's leaving was dark */
-
/* Initialize our LCG PRNG with parameters tested against
* Knuth vol. 2. by the original authors */
game.lcg_a = 1093;
game.zzword = RNDVOC(3, 0);
game.newloc = LOC_START;
game.loc = LOC_START;
- game.limit = 330;
+ game.limit = GAMELIMIT;
if (!rfp) {
game.novice = YES(arbitrary_messages[WELCOME_YOU], arbitrary_messages[CAVE_NEARBY], arbitrary_messages[NO_MESSAGE]);
- if (game.novice)game.limit = 1000;
+ if (game.novice)
+ game.limit = NOVICELIMIT;
} else {
restore(rfp);
}
/* The pirate's spotted him. He leaves him alone once we've
* found chest. K counts if a treasure is here. If not, and
* tally=1 for an unseen chest, let the pirate be spotted. Note
- * that game.place[CHEST] = NOWHERE might mean that he's thrown
+ * that game.place[CHEST] = LOC_NOWHERE might mean that he's thrown
* it to the troll, but in that case he's seen the chest
* (game.prop=0). */
if (game.loc == game.chloc || game.prop[CHEST] >= 0)
}
}
/* Force chest placement before player finds last treasure */
- if (game.tally == 1 && snarfed == 0 && game.place[CHEST] == NOWHERE && HERE(LAMP) && game.prop[LAMP] == 1) {
+ if (game.tally == 1 && snarfed == 0 && game.place[CHEST] == LOC_NOWHERE && HERE(LAMP) && game.prop[LAMP] == 1) {
RSPEAK(PIRATE_SPOTTED);
movechest = true;
}
} else if (game.numdie == maximum_deaths || !YES(query, yes_response, arbitrary_messages[OK_MAN]))
terminate(endgame);
else {
- game.place[WATER] = game.place[OIL] = NOWHERE;
+ game.place[WATER] = game.place[OIL] = LOC_NOWHERE;
if (TOTING(LAMP))
game.prop[LAMP] = 0;
for (int j = 1; j <= NOBJECTS; j++) {
if (!game.lmwarn && HERE(LAMP)) {
game.lmwarn = true;
int spk = GET_BATTERIES;
- if (game.place[BATTERY] == NOWHERE)spk = LAMP_DIM;
+ if (game.place[BATTERY] == LOC_NOWHERE)spk = LAMP_DIM;
if (game.prop[BATTERY] == 1)spk = MISSING_BATTERYIES;
RSPEAK(spk);
}