CSUPPRESSIONS = --suppress=missingIncludeSystem --suppress=invalidscanf
cppcheck:
- @-cppcheck -I. --quiet --template gcc -UPROP_SET_SEEN --enable=all $(CSUPPRESSIONS) *.[ch]
+ @-cppcheck -I. --quiet --template gcc -UOBJECT_SET_SEEN --enable=all $(CSUPPRESSIONS) *.[ch]
pylint:
@-pylint --score=n *.py */*.py
static void blast(void) {
/* Blast. No effect unless you've got dynamite, which is a neat trick!
*/
- if (PROP_IS_NOTFOUND(ROD2) || !game.closed) {
+ if (OBJECT_IS_NOTFOUND(ROD2) || !game.closed) {
rspeak(REQUIRES_DYNAMITE);
} else {
if (HERE(ROD2)) {
}
if (obj == BIRD && game.objects[BIRD].prop != BIRD_CAGED &&
- !PROP_IS_STASHED(BIRD)) {
+ !OBJECT_IS_STASHED(BIRD)) {
if (game.objects[BIRD].prop == BIRD_FOREST_UNCAGED) {
DESTROY(BIRD);
rspeak(BIRD_CRAP);
}
if ((obj == BIRD || obj == CAGE) &&
(game.objects[BIRD].prop == BIRD_CAGED ||
- PROP_STASHED(BIRD) == BIRD_CAGED)) {
+ OBJECT_STASHED(BIRD) == BIRD_CAGED)) {
/* expression maps BIRD to CAGE and CAGE to BIRD */
carry(BIRD + CAGE - obj, game.loc);
}
game.objects[LIQUID()].place = CARRIED;
}
- if (GSTONE(obj) && !PROP_IS_FOUND(obj)) {
- PROP_SET_FOUND(obj);
+ if (GSTONE(obj) && !OBJECT_IS_FOUND(obj)) {
+ OBJECT_SET_FOUND(obj);
game.objects[CAVITY].prop = CAVITY_EMPTY;
}
rspeak(OK_MAN);
}
for (obj_t i = 1; i <= NOBJECTS; i++) {
if (!HERE(i) || objects[i].sounds[0] == NULL ||
- PROP_IS_STASHED_OR_UNSEEN(i)) {
+ OBJECT_IS_STASHED_OR_UNSEEN(i)) {
continue;
}
int mi = game.objects[i].prop;
command.obj = NO_OBJECT;
for (int i = 1; i <= NOBJECTS; i++) {
if (HERE(i) && objects[i].texts[0] != NULL &&
- !PROP_IS_STASHED(i)) {
+ !OBJECT_IS_STASHED(i)) {
command.obj = command.obj * NOBJECTS + i;
}
}
1); // Not really a sound, but oh well.
}
} else if (objects[command.obj].texts[0] == NULL ||
- PROP_IS_NOTFOUND(command.obj)) {
+ OBJECT_IS_NOTFOUND(command.obj)) {
speak(actions[command.verb].message);
} else {
pspeak(command.obj, study, true,
}
if (game.objects[BIRD].prop == BIRD_UNCAGED &&
- game.loc == game.objects[STEPS].place && PROP_IS_NOTFOUND(JADE)) {
+ game.loc == game.objects[STEPS].place && OBJECT_IS_NOTFOUND(JADE)) {
drop(JADE, game.loc);
- PROP_SET_FOUND(JADE);
+ OBJECT_SET_FOUND(JADE);
--game.tally;
rspeak(NECKLACE_FLY);
return GO_CLEAROBJ;
* STATE_NOTFOUND is only set on treasures. Non-treasures start the
* game in STATE_FOUND.
*
- * PROP_STASHED is supposed to map a state property value to a
+ * OBJECT_STASHED is supposed to map a state property value to a
* negative range, where the object cannot be picked up but the value
* can be recovered later. Various objects get this property when
* the cave starts to close. Only seems to be significant for the bird
* those tests is difficult to read.
*/
#define PROP_STASHIFY(n) (-1 - (n))
-#define PROP_IS_STASHED(obj) (game.objects[obj].prop < STATE_NOTFOUND)
-#define PROP_IS_NOTFOUND(obj) (game.objects[obj].prop == STATE_NOTFOUND)
-#define PROP_IS_FOUND(obj) (game.objects[obj].prop == STATE_FOUND)
-#define PROP_IS_STASHED_OR_UNSEEN(obj) (game.objects[obj].prop < 0)
-#define PROP_SET_FOUND(obj) (game.objects[obj].prop = STATE_FOUND)
-#define PROP_SET_NOT_FOUND(obj) (game.objects[obj].prop = STATE_NOTFOUND)
-#define PROP_IS_NOTFOUND2(g, o) (g.objects[o].prop == STATE_NOTFOUND)
#define PROP_IS_INVALID(val) (val < -MAX_STATE - 1 || val > MAX_STATE)
+#define OBJECT_IS_STASHED(obj) (game.objects[obj].prop < STATE_NOTFOUND)
+#define OBJECT_IS_NOTFOUND(obj) (game.objects[obj].prop == STATE_NOTFOUND)
+#define OBJECT_IS_FOUND(obj) (game.objects[obj].prop == STATE_FOUND)
+#define OBJECT_IS_STASHED_OR_UNSEEN(obj) (game.objects[obj].prop < 0)
+#define OBJECT_SET_FOUND(obj) (game.objects[obj].prop = STATE_FOUND)
+#define OBJECT_SET_NOT_FOUND(obj) (game.objects[obj].prop = STATE_NOTFOUND)
+#define OBJECT_IS_NOTFOUND2(g, o) (g.objects[o].prop == STATE_NOTFOUND)
#else
/* (ESR) Only the boldest of adventurers will explore here. This
* alternate set of definitions for the macros above was an attempt to
* telling whether or not the player has seen the object.
*
* What's broken when you try to use thus is
- * PROP_IS_STASHED_OR_UNSEEN. The symptom is game.tally getting
+ * OBJECT_IS_STASHED_OR_UNSEEN. The symptom is game.tally getting
* decremented on non-treasures.
*/
#define PROP_STASHIFY(n) (-(n))
-#define PROP_IS_STASHED(obj) (game.objects[obj].prop < 0)
-#define PROP_IS_NOTFOUND(obj) (!game.objects[obj].found)
-#define PROP_IS_FOUND(obj) \
+#define PROP_IS_INVALID(val) (val < -MAX_STATE || val > MAX_STATE)
+#define OBJECT_IS_STASHED(obj) (game.objects[obj].prop < 0)
+#define OBJECT_IS_NOTFOUND(obj) (!game.objects[obj].found)
+#define OBJECT_IS_FOUND(obj) \
(game.objects[obj].found && game.objects[obj].prop == 0)
-#define PROP_IS_STASHED_OR_UNSEEN(obj) \
+#define OBJECT_IS_STASHED_OR_UNSEEN(obj) \
(!game.objects[obj].found || game.objects[obj].prop < 0)
-#define PROP_SET_FOUND(obj) \
+#define OBJECT_SET_FOUND(obj) \
do { \
game.objects[obj].found = true; \
game.objects[obj].prop = STATE_FOUND; \
} while (0)
-#define PROP_SET_NOT_FOUND(obj) game.objects[obj].found = false
-#define PROP_IS_NOTFOUND2(g, o) (!g.objects[o].found)
-#define PROP_IS_INVALID(val) (val < -MAX_STATE || val > MAX_STATE)
-#define PROP_SET_SEEN(obj) game.objects[object].found = true
+#define OBJECT_SET_NOT_FOUND(obj) game.objects[obj].found = false
+#define OBJECT_IS_NOTFOUND2(g, o) (!g.objects[o].found)
+#define OBJECT_SET_SEEN(obj) game.objects[object].found = true
#endif
-#define PROP_STASHED(obj) PROP_STASHIFY(game.objects[obj].prop)
+#define OBJECT_STASHED(obj) PROP_STASHIFY(game.objects[obj].prop)
#define PROMPT "> "
if (objects[object].is_treasure) {
++game.tally;
if (objects[object].inventory != NULL) {
- PROP_SET_NOT_FOUND(object);
+ OBJECT_SET_NOT_FOUND(object);
}
} else {
- PROP_SET_FOUND(object);
+ OBJECT_SET_FOUND(object);
}
}
game.conds = setbit(COND_HBASE);
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;
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;
* 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;
}
* 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);
}
}
}
/* put() is the same as move(), except it returns a value used to set
* up the negated game.prop values for the repository objects. */
move(object, where);
- /* (ESR) Read this in combination with the macro defintions in advebt.h.
+ /* (ESR) Read this in combination with the macro defintions in advent.h.
*/
game.objects[object].prop = PROP_STASHIFY(pval);
-#ifdef PROP_SET_SEEN
- PROP_SET_SEEN(object);
+#ifdef OBJECT_SET_SEEN
+ OBJECT_SET_SEEN(object);
#endif
}
int temp_tally = 0;
for (int treasure = 1; treasure <= NOBJECTS; treasure++) {
if (objects[treasure].is_treasure) {
- if (PROP_IS_NOTFOUND2(valgame, treasure)) {
+ if (OBJECT_IS_NOTFOUND2(valgame, treasure)) {
++temp_tally;
}
}
if (i > CHEST) {
k = 16;
}
- if (!PROP_IS_STASHED(i) && !PROP_IS_NOTFOUND(i)) {
+ if (!OBJECT_IS_STASHED(i) && !OBJECT_IS_NOTFOUND(i)) {
score += 2;
}
if (game.objects[i].place == LOC_BUILDING &&
- PROP_IS_FOUND(i)) {
+ OBJECT_IS_FOUND(i)) {
score += k - 2;
}
mxscor += k;