{
if (autosave_fp != NULL) {
rewind(autosave_fp);
- savefile(autosave_fp, /* version (auto): */0);
+ savefile(autosave_fp);
fflush(autosave_fp);
}
}
game.hintlc[hint] = 0;
return;
case 3: /* maze */
- if (game.atloc[game.loc] == NO_OBJECT &&
- game.atloc[game.oldloc] == NO_OBJECT &&
- game.atloc[game.oldlc2] == NO_OBJECT &&
+ if (game.locs[game.loc].atloc == NO_OBJECT &&
+ game.locs[game.oldloc].atloc == NO_OBJECT &&
+ game.locs[game.oldlc2].atloc == NO_OBJECT &&
game.holdng > 1)
break;
game.hintlc[hint] = 0;
game.hintlc[hint] = 0;
return;
case 7: /* woods */
- if (game.atloc[game.loc] == NO_OBJECT &&
- game.atloc[game.oldloc] == NO_OBJECT &&
- game.atloc[game.oldlc2] == NO_OBJECT)
+ if (game.locs[game.loc].atloc == NO_OBJECT &&
+ game.locs[game.oldloc].atloc == NO_OBJECT &&
+ game.locs[game.oldlc2].atloc == NO_OBJECT)
break;
return;
case 8: /* ogre */
* 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[CHEST] == STATE_FOUND). */
- if (game.loc == game.chloc ||
- game.prop[CHEST] != STATE_NOTFOUND)
+ if (game.loc == game.chloc || game.prop[CHEST] != STATE_NOTFOUND)
return true;
int snarfed = 0;
bool movechest = false, robplayer = false;
game.loc == objects[EMERALD].plac)) {
continue;
}
- if (TOTING(treasure) ||
- HERE(treasure))
+ if (TOTING(treasure) || HERE(treasure))
++snarfed;
if (TOTING(treasure)) {
movechest = true;
if (movechest) {
move(CHEST, game.chloc);
move(MESSAG, game.chloc2);
- game.dloc[PIRATE] = game.chloc;
- game.odloc[PIRATE] = game.chloc;
- game.dseen[PIRATE] = false;
+ game.dwarves[PIRATE].loc = game.chloc;
+ game.dwarves[PIRATE].oldloc = game.chloc;
+ game.dwarves[PIRATE].seen = false;
} else {
/* You might get a hint of the pirate's presence even if the
* chest doesn't move... */
- if (game.odloc[PIRATE] != game.dloc[PIRATE] && PCT(20))
+ if (game.dwarves[PIRATE].oldloc != game.dwarves[PIRATE].loc && PCT(20))
rspeak(PIRATE_RUSTLES);
}
if (robplayer) {
* steal return toll, and dwarves can't meet the bear. Also
* means dwarves won't follow him into dead end in maze, but
* c'est la vie. They'll wait for him outside the dead end. */
- if (game.loc == LOC_NOWHERE ||
- FORCED(game.loc) ||
- CNDBIT(game.newloc, COND_NOARRR))
+ if (game.loc == LOC_NOWHERE || FORCED(game.loc) || CNDBIT(game.newloc, COND_NOARRR))
return true;
/* Dwarf activity level ratchets up */
* replace him with the alternate. */
if (game.dflag == 1) {
if (!INDEEP(game.loc) ||
- (PCT(95) && (!CNDBIT(game.loc, COND_NOBACK) ||
- PCT(85))))
+ (PCT(95) && (!CNDBIT(game.loc, COND_NOBACK) || PCT(85))))
return true;
game.dflag = 2;
for (int i = 1; i <= 2; i++) {
int j = 1 + randrange(NDWARVES - 1);
if (PCT(50))
- game.dloc[j] = 0;
+ game.dwarves[j].loc = 0;
}
/* Alternate initial loc for dwarf, in case one of them
* starts out on top of the adventurer. */
for (int i = 1; i <= NDWARVES - 1; i++) {
- if (game.dloc[i] == game.loc)
- game.dloc[i] = DALTLC; //
- game.odloc[i] = game.dloc[i];
+ if (game.dwarves[i].loc == game.loc)
+ game.dwarves[i].loc = DALTLC; //
+ game.dwarves[i].oldloc = game.dwarves[i].loc;
}
rspeak(DWARF_RAN);
drop(AXE, game.loc);
attack = 0;
stick = 0;
for (int i = 1; i <= NDWARVES; i++) {
- if (game.dloc[i] == 0)
+ if (game.dwarves[i].loc == 0)
continue;
/* Fill tk array with all the places this dwarf might go. */
unsigned int j = 1;
- kk = tkey[game.dloc[i]];
+ kk = tkey[game.dwarves[i].loc];
if (kk != 0)
do {
enum desttype_t desttype = travel[kk].desttype;
continue;
else if (!INDEEP(game.newloc))
continue;
- else if (game.newloc == game.odloc[i])
+ else if (game.newloc == game.dwarves[i].oldloc)
continue;
else if (j > 1 && game.newloc == tk[j - 1])
continue;
else if (j >= DIM(tk) - 1)
/* This can't actually happen. */
continue; // LCOV_EXCL_LINE
- else if (game.newloc == game.dloc[i])
+ else if (game.newloc == game.dwarves[i].loc)
continue;
else if (FORCED(game.newloc))
continue;
tk[j++] = game.newloc;
} while
(!travel[kk++].stop);
- tk[j] = game.odloc[i];
+ tk[j] = game.dwarves[i].oldloc;
if (j >= 2)
--j;
j = 1 + randrange(j);
- game.odloc[i] = game.dloc[i];
- game.dloc[i] = tk[j];
- game.dseen[i] = (game.dseen[i] && INDEEP(game.loc)) ||
- (game.dloc[i] == game.loc ||
- game.odloc[i] == game.loc);
- if (!game.dseen[i])
+ game.dwarves[i].oldloc = game.dwarves[i].loc;
+ game.dwarves[i].loc = tk[j];
+ game.dwarves[i].seen = (game.dwarves[i].seen && INDEEP(game.loc)) ||
+ (game.dwarves[i].loc == game.loc ||
+ game.dwarves[i].oldloc == game.loc);
+ if (!game.dwarves[i].seen)
continue;
- game.dloc[i] = game.loc;
+ game.dwarves[i].loc = game.loc;
if (spotted_by_pirate(i))
continue;
/* This threatening little dwarf is in the room with him! */
++game.dtotal;
- if (game.odloc[i] == game.dloc[i]) {
+ if (game.dwarves[i].oldloc == game.dwarves[i].loc) {
++attack;
- if (game.knfloc >= 0)
+ if (game.knfloc >= LOC_NOWHERE)
game.knfloc = game.loc;
if (randrange(1000) < 95 * (game.dflag - 2))
++stick;
{
const char* msg = locations[game.loc].description.small;
- if (MOD(game.abbrev[game.loc], game.abbnum) == 0 ||
- msg == NO_MESSAGE)
+ if (MOD(game.locs[game.loc].abbrev, game.abbnum) == 0 || msg == NO_MESSAGE)
msg = locations[game.loc].description.big;
if (!FORCED(game.loc) && DARK(game.loc)) {
rspeak(NO_MORE_DETAIL);
++game.detail;
game.wzdark = false;
- game.abbrev[game.loc] = 0;
+ game.locs[game.loc].abbrev = 0;
return;
} else if (motion == CAVE) {
/* Cave. Different messages depending on whether above ground. */
/* Look for a way to fulfil the motion verb passed in - travel_entry indexes
* the beginning of the motion entries for here (game.loc). */
for (;;) {
- if ((travel[travel_entry].motion == HERE) ||
- travel[travel_entry].motion == motion)
+ if ((travel[travel_entry].motion == HERE) || travel[travel_entry].motion == motion)
break;
if (travel[travel_entry].stop) {
/* Couldn't find an entry matching the motion word passed
if (condtype < cond_not) {
/* YAML N and [pct N] conditionals */
if (condtype == cond_goto || condtype == cond_pct) {
- if (condarg1 == 0 ||
- PCT(condarg1))
+ if (condarg1 == 0 || PCT(condarg1))
break;
/* else fall through */
}
/* YAML [with OBJ] clause */
- else if (TOTING(condarg1) ||
- (condtype == cond_with && AT(condarg1)))
+ else if (TOTING(condarg1) || (condtype == cond_with && AT(condarg1)))
break;
/* else fall through to check [not OBJ STATE] */
} else if (game.prop[condarg1] != condarg2)
game.newloc = (game.loc == LOC_PLOVER)
? LOC_ALCOVE
: LOC_PLOVER;
- if (game.holdng > 1 ||
- (game.holdng == 1 && !TOTING(EMERALD))) {
+ if (game.holdng > 1 || (game.holdng == 1 && !TOTING(EMERALD))) {
game.newloc = game.loc;
rspeak(MUST_DROP);
}
game.prop[GRATE] = GRATE_CLOSED;
game.prop[FISSURE] = UNBRIDGED;
for (int i = 1; i <= NDWARVES; i++) {
- game.dseen[i] = false;
- game.dloc[i] = LOC_NOWHERE;
+ game.dwarves[i].seen = false;
+ game.dwarves[i].loc = LOC_NOWHERE;
}
DESTROY(TROLL);
move(TROLL + NOBJECTS, IS_FREE);
* get full score. */
{
if (!DARK(game.loc)) {
- ++game.abbrev[game.loc];
- for (int i = game.atloc[game.loc]; i != 0; i = game.link[i]) {
+ ++game.locs[game.loc].abbrev;
+ for (int i = game.locs[game.loc].atloc; i != 0; i = game.link[i]) {
obj_t obj = i;
if (obj > NOBJECTS)
obj = obj - NOBJECTS;
game.prop[RUG] = RUG_DRAGON;
if (obj == CHAIN)
game.prop[CHAIN] = CHAINING_BEAR;
+ if (obj == EGGS)
+ game.seenbigwords = true;
--game.tally;
/* Note: There used to be a test here to see whether the
* player had blown it so badly that he could never ever see
* place) let him get out (and attacked). */
if (game.newloc != game.loc && !FORCED(game.loc) && !CNDBIT(game.loc, COND_NOARRR)) {
for (size_t i = 1; i <= NDWARVES - 1; i++) {
- if (game.odloc[i] == game.newloc && game.dseen[i]) {
+ if (game.dwarves[i].oldloc == game.newloc && game.dwarves[i].seen) {
game.newloc = game.loc;
rspeak(DWARF_BLOCK);
break;
/* The easiest way to get killed is to fall into a pit in
* pitch darkness. */
- if (!FORCED(game.loc) && DARK(game.loc) && game.wzdark && PCT(35)) { // FIXME: magic number
+ if (!FORCED(game.loc) && DARK(game.loc) && game.wzdark && PCT(PIT_KILL_PROB)) {
rspeak(PIT_FALL);
game.oldlc2 = game.loc;
croak();