From: Eric S. Raymond Date: Mon, 23 Sep 2024 03:09:16 +0000 (-0400) Subject: Confine uses of PROP_STASHIFY() to advent.h X-Git-Tag: 1.20~7 X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=9a6e4406f55df92d448fcad0b54aff1902787e11;p=open-adventure.git Confine uses of PROP_STASHIFY() to advent.h Now it shouyld be possible to manipulate a stashed flag by only changing macros. --- diff --git a/actions.c b/actions.c index 107b298..6f93eb0 100644 --- a/actions.c +++ b/actions.c @@ -406,8 +406,7 @@ static phase_codes_t vcarry(verb_t verb, obj_t obj) { game.objects[BIRD].prop = BIRD_CAGED; } if ((obj == BIRD || obj == CAGE) && - (game.objects[BIRD].prop == BIRD_CAGED || - PROP_STASHIFY(game.objects[BIRD].prop) == BIRD_CAGED)) { + OBJECT_STATE_EQUALS(BIRD, BIRD_CAGED)) { /* expression maps BIRD to CAGE and CAGE to BIRD */ carry(BIRD + CAGE - obj, game.loc); } diff --git a/advent.h b/advent.h index d1504f0..6686dfc 100644 --- a/advent.h +++ b/advent.h @@ -77,6 +77,7 @@ #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) +#define OBJECT_STATE_EQUALS(obj, pval) ((game.objects[obj].prop == pval) || (game.objects[obj].prop == PROP_STASHIFY(pval))) #else /* (ESR) Only the boldest of adventurers will explore here. This * alternate set of definitions for the macros above was an attempt to