struct game_t game;
long LNLENG, LNPOSN, PARMS[MAXPARMS+1];
-char rawbuf[LINESIZE], INLINE[LINESIZE+1], MAP1[129], MAP2[129];
+char rawbuf[LINESIZE], INLINE[LINESIZE+1];
long AMBER, AXE, BACK, BATTER, BEAR, BIRD, BLOOD,
BOTTLE, CAGE, CAVE, CAVITY, CHAIN, CHASM, CHEST,
while ((ch = getopt(argc, argv, "l:o")) != EOF) {
switch (ch) {
- case 'l':
+case 'l':
logfp = fopen(optarg, "w");
if (logfp == NULL)
fprintf(stderr,
set_seed(seedval);
/* Initialize game variables */
- MAP2[1] = 0;
if (!game.setup)
initialise();
attack=0;
stick=0;
for (int i=1; i<=NDWARVES; i++) {
+ int k;
if(game.dloc[i] == 0)
continue;
/* Fill TK array with all the places this dwarf might go. */
* (game.prop=0). */
if(game.loc == game.chloc || game.prop[CHEST] >= 0)
continue;
- K=0;
+ k=0;
for (int j=MINTRS; j<=MAXTRS; j++) {
- /* Pirate won't take pyramid from plover room or dark
- * room (too easy!). */
- if(j == PYRAM && (game.loc == PLAC[PYRAM] || game.loc == PLAC[EMRALD]))
- goto L6020;
+ /* Pirate won't take pyramid from plover room or dark
+ * room (too easy!). */
+ if(j == PYRAM && (game.loc == PLAC[PYRAM] || game.loc == PLAC[EMRALD])) {
+ if(HERE(j))
+ k=1;
+ continue;
+ }
if(TOTING(j)) {
- goto L6021;
+ if(game.place[CHEST] == 0) {
+ /* Install chest only once, to insure it is
+ * the last treasure in the list. */
+ MOVE(CHEST,game.chloc);
+ MOVE(MESSAG,game.chloc2);
+ }
+ RSPEAK(128);
+ for (int j=MINTRS; j<=MAXTRS; j++) {
+ if (!(j == PYRAM && (game.loc == PLAC[PYRAM] || game.loc == PLAC[EMRALD]))) {
+ if(AT(j) && game.fixed[j] == 0)
+ CARRY(j,game.loc);
+ if(TOTING(j))
+ DROP(j,game.chloc);
+ }
+ }
+ game.dloc[PIRATE]=game.chloc;
+ game.odloc[PIRATE]=game.chloc;
+ game.dseen[PIRATE]=false;
+ goto jumpout;
}
- L6020:
if(HERE(j))
- K=1;
+ k=1;
}
/* Force chest placement before player finds last treasure */
- if(game.tally == 1 && K == 0 && game.place[CHEST] == 0 && HERE(LAMP) && game.prop[LAMP] == 1) {
+ if(game.tally == 1 && k == 0 && game.place[CHEST] == 0 && HERE(LAMP) && game.prop[LAMP] == 1) {
RSPEAK(186);
MOVE(CHEST,game.chloc);
MOVE(MESSAG,game.chloc2);
if(game.odloc[PIRATE] != game.dloc[PIRATE] && PCT(20))
RSPEAK(127);
continue;
-
- L6021:
- if(game.place[CHEST] == 0) {
- /* Install chest only once, to insure it is the last treasure in
- * the list. */
- MOVE(CHEST,game.chloc);
- MOVE(MESSAG,game.chloc2);
- }
- RSPEAK(128);
- for (int j=MINTRS; j<=MAXTRS; j++) {
- if (!(j == PYRAM && (game.loc == PLAC[PYRAM] || game.loc == PLAC[EMRALD]))) {
- if(AT(j) && game.fixed[j] == 0)
- CARRY(j,game.loc);
- if(TOTING(j))
- DROP(j,game.chloc);
- }
- }
- game.dloc[PIRATE]=game.chloc;
- game.odloc[PIRATE]=game.chloc;
- game.dseen[PIRATE]=false;
- continue;
}
/* This threatening little dwarf is in the room with him! */
if(randrange(1000) < 95*(game.dflag-2))
++stick;
}
+ jumpout:;
}
/* Now we know what's happening. Let's tell the poor sucker about it.