From e217a4b55091bcf1dfcbcac090e850e66fe82bb3 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Tue, 25 Aug 2015 22:50:58 +0200 Subject: [PATCH] age_unit accidentally returned AT_AGE_REMOVE (caused by a recent change to curse_age) --- src/kernel/curse.c | 2 +- src/util/attrib.c | 2 +- src/util/attrib.h | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/kernel/curse.c b/src/kernel/curse.c index afa8ac2c3..828552a3a 100644 --- a/src/kernel/curse.c +++ b/src/kernel/curse.c @@ -131,7 +131,7 @@ int curse_age(attrib * a) else if (c->duration != INT_MAX) { c->duration = _max(0, c->duration - 1); } - return c->duration; + return (c->duration > 0) ? AT_AGE_KEEP : AT_AGE_REMOVE; } void destroy_curse(curse * c) diff --git a/src/util/attrib.c b/src/util/attrib.c index fb50d8dfc..26869cfee 100644 --- a/src/util/attrib.c +++ b/src/util/attrib.c @@ -256,7 +256,7 @@ int a_age(attrib ** p) if (a->type->age) { int result = a->type->age(a); assert(result >= 0 || !"age() returned a negative value"); - if (result == 0) { + if (result == AT_AGE_REMOVE) { a_remove(p, a); continue; } diff --git a/src/util/attrib.h b/src/util/attrib.h index cbba4ebf4..c235fd67a 100644 --- a/src/util/attrib.h +++ b/src/util/attrib.h @@ -90,8 +90,8 @@ extern "C" { #define AT_READ_OK 0 #define AT_READ_FAIL -1 -#define AT_AGE_KEEP 0 /* keep the attribute for another turn */ -#define AT_AGE_REMOVE 1 /* remove the attribute after calling age() */ +#define AT_AGE_REMOVE 0 /* remove the attribute after calling age() */ +#define AT_AGE_KEEP 1 /* keep the attribute for another turn */ #ifdef __cplusplus }