// exclude from coverage analysis because it requires interactivity to test
static void sig_handler(int signo) {
if (signo == SIGINT) {
- if (settings.logfp != NULL)
+ if (settings.logfp != NULL) {
fflush(settings.logfp);
+ }
}
#if defined ADVENT_AUTOSAVE
NO_OBJECT &&
game.locs[game.oldlc2].atloc ==
NO_OBJECT &&
- game.holdng > 1)
+ game.holdng > 1) {
break;
+ }
game.hints[hint].lc = 0;
return;
case 4: /* dark */
- if (!PROP_IS_NOTFOUND(EMERALD) &&
- PROP_IS_NOTFOUND(PYRAMID)) {
+ if (!OBJECT_IS_NOTFOUND(EMERALD) &&
+ OBJECT_IS_NOTFOUND(PYRAMID)) {
break;
}
game.hints[hint].lc = 0;
game.locs[game.oldloc].atloc ==
NO_OBJECT &&
game.locs[game.oldlc2].atloc ==
- NO_OBJECT)
+ NO_OBJECT) {
break;
+ }
return;
case 8: /* ogre */
i = atdwrf(game.loc);
return;
case 9: /* jade */
if (game.tally == 1 &&
- PROP_IS_STASHED_OR_UNSEEN(JADE)) {
+ OBJECT_IS_STASHED_OR_UNSEEN(JADE)) {
break;
}
game.hints[hint].lc = 0;
* tally=1 for an unseen chest, let the pirate be spotted. Note
* that game.objexts,place[CHEST] = LOC_NOWHERE might mean that he's
* thrown it to the troll, but in that case he's seen the chest
- * PROP_IS_FOUND(CHEST) == true. */
- if (game.loc == game.chloc || !PROP_IS_NOTFOUND(CHEST)) {
+ * OBJECT_IS_FOUND(CHEST) == true. */
+ if (game.loc == game.chloc || !OBJECT_IS_NOTFOUND(CHEST)) {
return true;
}
int snarfed = 0;
/* Dwarf activity level ratchets up */
if (game.dflag == 0) {
- if (INDEEP(game.loc))
+ if (INDEEP(game.loc)) {
game.dflag = 1;
+ }
return true;
}
/* Fill tk array with all the places this dwarf might go. */
unsigned int j = 1;
kk = tkey[game.dwarves[i].loc];
- if (kk != 0)
+ if (kk != 0) {
do {
enum desttype_t desttype = travel[kk].desttype;
game.newloc = travel[kk].destval;
/* Have we avoided a dwarf encounter? */
- if (desttype != dest_goto)
+ if (desttype != dest_goto) {
continue;
- else if (!INDEEP(game.newloc))
+ } else if (!INDEEP(game.newloc)) {
continue;
- else if (game.newloc == game.dwarves[i].oldloc)
+ } else if (game.newloc ==
+ game.dwarves[i].oldloc) {
continue;
- else if (j > 1 && game.newloc == tk[j - 1])
+ } else if (j > 1 && game.newloc == tk[j - 1]) {
continue;
- else if (j >= DIM(tk) - 1)
+ } else if (j >= DIM(tk) - 1) {
/* This can't actually happen. */
continue; // LCOV_EXCL_LINE
- else if (game.newloc == game.dwarves[i].loc)
+ } else if (game.newloc == game.dwarves[i].loc) {
continue;
- else if (FORCED(game.newloc))
+ } else if (FORCED(game.newloc)) {
continue;
- else if (i == PIRATE &&
- CNDBIT(game.newloc, COND_NOARRR))
+ } else if (i == PIRATE &&
+ CNDBIT(game.newloc, COND_NOARRR)) {
continue;
- else if (travel[kk].nodwarves)
+ } else if (travel[kk].nodwarves) {
continue;
+ }
tk[j++] = game.newloc;
} while (!travel[kk++].stop);
+ }
tk[j] = game.dwarves[i].oldloc;
if (j >= 2) {
--j;
* where he died. */
game.objects[WATER].place = game.objects[OIL].place =
LOC_NOWHERE;
- if (TOTING(LAMP))
+ if (TOTING(LAMP)) {
game.objects[LAMP].prop = LAMP_DARK;
+ }
for (int j = 1; j <= NOBJECTS; j++) {
int i = NOBJECTS + 1 - j;
if (TOTING(i)) {
const char *msg = locations[game.loc].description.small;
if (MOD(game.locs[game.loc].abbrev, game.abbnum) == 0 ||
- msg == NO_MESSAGE)
+ msg == NO_MESSAGE) {
msg = locations[game.loc].description.big;
+ }
if (!FORCED(game.loc) && DARK(game.loc)) {
msg = arbitrary_messages[PITCH_DARK];
speak(msg);
- if (game.loc == LOC_Y2 && PCT(25) && !game.closng)
+ if (game.loc == LOC_Y2 && PCT(25) && !game.closng) {
rspeak(SAYS_PLUGH);
+ }
}
static bool traveleq(int a, int b) {
* forced-motion. te_tmp saves entry -> forced loc -> previous
* loc. */
motion = game.oldloc;
- if (FORCED(motion))
+ if (FORCED(motion)) {
motion = game.oldlc2;
+ }
game.oldlc2 = game.oldloc;
game.oldloc = game.loc;
if (CNDBIT(game.loc, COND_NOBACK)) {
if (desttype == dest_goto) {
if (FORCED(scratchloc) &&
travel[tkey[scratchloc]].destval ==
- motion)
+ motion) {
te_tmp = travel_entry;
+ }
}
if (!travel[travel_entry].stop) {
++travel_entry; /* go to next travel
* indexes the beginning of the motion entries for here (game.loc). */
for (;;) {
if ((travel[travel_entry].motion == HERE) ||
- travel[travel_entry].motion == motion)
+ travel[travel_entry].motion == motion) {
break;
+ }
if (travel[travel_entry].stop) {
/* Couldn't find an entry matching the motion word
* passed in. Various messages depending on word given.
if (condtype == cond_goto ||
condtype == cond_pct) {
if (condarg1 == 0 ||
- PCT(condarg1))
+ PCT(condarg1)) {
break;
+ }
/* else fall through */
}
/* YAML [with OBJ] clause */
else if (TOTING(condarg1) ||
(condtype == cond_with &&
- AT(condarg1)))
+ AT(condarg1))) {
break;
+ }
/* else fall through to check [not OBJ
* STATE] */
} else if (game.objects[condarg1].prop !=
* Skip to next non-matching destination */
int te_tmp = travel_entry;
do {
- if (travel[te_tmp].stop)
+ if (travel[te_tmp].stop) {
BUG(CONDITIONAL_TRAVEL_ENTRY_WITH_NO_ALTERATION); // LCOV_EXCL_LINE
+ }
++te_tmp;
} while (traveleq(travel_entry, te_tmp));
travel_entry = te_tmp;
{
int te_tmp = travel_entry;
do {
- if (travel[te_tmp].stop)
+ if (travel[te_tmp]
+ .stop) {
BUG(CONDITIONAL_TRAVEL_ENTRY_WITH_NO_ALTERATION); // LCOV_EXCL_LINE
+ }
++te_tmp;
} while (traveleq(travel_entry,
te_tmp));
objects[TROLL].fixd -
game.loc;
if (game.objects[TROLL].prop ==
- TROLL_UNPAID)
+ TROLL_UNPAID) {
game.objects[TROLL]
.prop =
TROLL_PAIDONCE;
+ }
if (!TOTING(BEAR)) {
return;
}
game.clock1 = -1;
game.closng = true;
return game.closed;
- } else if (game.clock1 < 0)
+ } else if (game.clock1 < 0) {
--game.clock2;
+ }
if (game.clock2 == 0) {
/* Once he's panicked, and clock2 has run out, we come here
* to set up the storage room. The room has two locs,
* running this code only on objects with the treasure
* property set. Nope. There is mystery here.
*/
- if (PROP_IS_STASHED_OR_UNSEEN(obj)) {
+ if (OBJECT_IS_STASHED_OR_UNSEEN(obj)) {
if (game.closed) {
continue;
}
- PROP_SET_FOUND(obj);
+ OBJECT_SET_FOUND(obj);
if (obj == RUG) {
game.objects[RUG].prop = RUG_DRAGON;
}
/* If no word type is given for the first word, we assume it's a
* motion. */
- if (command->word[0].type == NO_WORD_TYPE)
+ if (command->word[0].type == NO_WORD_TYPE) {
command->word[0].type = MOTION;
+ }
command->state = PREPROCESSED;
return true;
* way objects won't be described until they've
* been picked up and put down separate from
* their respective piles. */
- if ((PROP_IS_NOTFOUND(OYSTER) ||
- PROP_IS_STASHED(OYSTER)) &&
+ if ((OBJECT_IS_NOTFOUND(OYSTER) ||
+ OBJECT_IS_STASHED(OYSTER)) &&
TOTING(OYSTER)) {
pspeak(OYSTER, look, true, 1);
}
for (size_t i = 1; i <= NOBJECTS; i++) {
- if (TOTING(i) && (PROP_IS_NOTFOUND(i) ||
- PROP_IS_STASHED(i)))
+ if (TOTING(i) && (OBJECT_IS_NOTFOUND(i) ||
+ OBJECT_IS_STASHED(i))) {
game.objects[i].prop =
- PROP_STASHED(i);
+ OBJECT_STASHED(i);
+ }
}
}
- /* Check to see if the room is dark. If the knife is
- * here, and it's dark, the knife permanently disappears
- */
+ /* Check to see if the room is dark. */
game.wzdark = DARK(game.loc);
- if (game.knfloc != LOC_NOWHERE &&
+
+ /* If the knife is not here it permanently disappears.
+ * Possibly this should fire if the knife is here but
+ * the room is dark? */
+ if (game.knfloc > LOC_NOWHERE &&
game.knfloc != game.loc) {
game.knfloc = LOC_NOWHERE;
}
game.novice = yes_or_no(arbitrary_messages[WELCOME_YOU],
arbitrary_messages[CAVE_NEARBY],
arbitrary_messages[NO_MESSAGE]);
- if (game.novice)
+ if (game.novice) {
game.limit = NOVICELIMIT;
+ }
#endif
if (settings.logfp) {