Introduce OBJECT_STASHIFY.
authorEric S. Raymond <esr@thyrsus.com>
Mon, 23 Sep 2024 02:34:07 +0000 (22:34 -0400)
committerEric S. Raymond <esr@thyrsus.com>
Mon, 23 Sep 2024 08:26:59 +0000 (04:26 -0400)
advent.h
main.c
misc.c

index 9841037ae92f7c74ec02e20f42e15957aa054135..d1504f088f471d203603b34d29e117ec749952b7 100644 (file)
--- a/advent.h
+++ b/advent.h
 #define OBJECT_IS_NOTFOUND2(g, o) (!g.objects[o].found)
 #define OBJECT_SET_SEEN(obj) game.objects[object].found = true
 #endif
+#define OBJECT_STASHIFY(obj, pval) game.objects[obj].prop = PROP_STASHIFY(pval)
 
 #define PROMPT "> "
 
diff --git a/main.c b/main.c
index 688cfc74f7a9859e134de35a4e6f074a5e22e84a..14c90654601b58069245ae2507f45835ffbd5b86 100644 (file)
--- a/main.c
+++ b/main.c
@@ -1275,8 +1275,7 @@ static bool do_command(void) {
                                        if (TOTING(i) &&
                                            (OBJECT_IS_NOTFOUND(i) ||
                                             OBJECT_IS_STASHED(i))) {
-                                               game.objects[i].prop =
-                                                   PROP_STASHIFY(game.objects[i].prop);
+                                               OBJECT_STASHIFY(i, game.objects[i].prop);
                                        }
                                }
                        }
diff --git a/misc.c b/misc.c
index 9fddfd5ae17dcff8451f98233ff66c2c4f5d21ba..b28949eccb8f5268eccbff68b8056672925cfa7c 100644 (file)
--- a/misc.c
+++ b/misc.c
@@ -625,7 +625,7 @@ void put(obj_t object, loc_t where, int pval) {
        /* put() is the same as move(), except the object is stashed and
         * can no longer be picked up. */
        move(object, where);
-       game.objects[object].prop = PROP_STASHIFY(pval);
+       OBJECT_STASHIFY(object, pval);
 #ifdef OBJECT_SET_SEEN
        OBJECT_SET_SEEN(object);
 #endif