From f4df6bd9db137b337eb1122cfe8fad5effdfbaba Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Fri, 25 Aug 2017 21:11:01 +0200 Subject: [PATCH] kill ATF_CURSE flag, compare to at_curse directly. --- src/creport.c | 2 +- src/items.c | 2 +- src/kernel/curse.c | 9 ++++----- src/kernel/curse.h | 3 --- src/report.c | 2 +- src/spells.c | 12 ++++++------ 6 files changed, 13 insertions(+), 17 deletions(-) diff --git a/src/creport.c b/src/creport.c index 57ba12ee0..14f2a6c56 100644 --- a/src/creport.c +++ b/src/creport.c @@ -254,7 +254,7 @@ cr_output_curses(struct stream *out, const faction * viewer, const void *obj, ob } while (a) { - if (fval(a->type, ATF_CURSE)) { + if (a->type == &at_curse) { curse *c = (curse *)a->data.v; message *msg; diff --git a/src/items.c b/src/items.c index dd4abe1ac..8190693b0 100644 --- a/src/items.c +++ b/src/items.c @@ -145,7 +145,7 @@ struct order *ord) while (*ap && force > 0) { curse *c; attrib *a = *ap; - if (!(a->type->flags & ATF_CURSE)) { + if (a->type != &at_curse) { do { ap = &(*ap)->next; } while (*ap && a->type == (*ap)->type); diff --git a/src/kernel/curse.c b/src/kernel/curse.c index b0367484d..9702d7649 100644 --- a/src/kernel/curse.c +++ b/src/kernel/curse.c @@ -273,8 +273,7 @@ attrib_type at_curse = { curse_age, curse_write, curse_read, - NULL, - ATF_CURSE + NULL }; /* ------------------------------------------------------------- */ @@ -363,7 +362,7 @@ void ct_checknames(void) { static bool cmp_curse(const attrib * a, const void *data) { const curse *c = (const curse *)data; - if (a->type->flags & ATF_CURSE) { + if (a->type == &at_curse) { if (!data || c == (curse *)a->data.v) return true; } @@ -375,7 +374,7 @@ curse *get_curse(attrib * ap, const curse_type * ctype) attrib *a = ap; if (!ctype) return NULL; while (a) { - if (a->type->flags & ATF_CURSE) { + if (a->type == &at_curse) { const attrib_type *at = a->type; while (a && a->type == at) { curse *c = (curse *)a->data.v; @@ -710,7 +709,7 @@ bool is_cursed_with(const attrib * ap, const curse * c) const attrib *a = ap; while (a) { - if ((a->type->flags & ATF_CURSE) && (c == (const curse *)a->data.v)) { + if ((a->type == &at_curse) && (c == (const curse *)a->data.v)) { return true; } a = a->next; diff --git a/src/kernel/curse.h b/src/kernel/curse.h index 9b6113d96..054387d59 100644 --- a/src/kernel/curse.h +++ b/src/kernel/curse.h @@ -311,9 +311,6 @@ extern "C" { #define get_curseeffect(a, ctype) \ curse_geteffect(get_curse(a, ctype)) - /* eressea-defined attribute-type flags */ -#define ATF_CURSE ATF_USER_DEFINED - #ifdef __cplusplus } #endif diff --git a/src/report.c b/src/report.c index 2cafe3157..18d48b86b 100644 --- a/src/report.c +++ b/src/report.c @@ -568,7 +568,7 @@ nr_curses_i(struct stream *out, int indent, const faction *viewer, objtype_t typ char buf[4096]; message *msg = 0; - if (fval(a->type, ATF_CURSE)) { + if (a->type == &at_curse) { curse *c = (curse *)a->data.v; self = curse_cansee(c, viewer, typ, obj, self); diff --git a/src/spells.c b/src/spells.c index b1022f7cc..c6860bebe 100644 --- a/src/spells.c +++ b/src/spells.c @@ -144,7 +144,7 @@ static void magicanalyse_region(region * r, unit * mage, double force) double probability; int mon; - if (!fval(a->type, ATF_CURSE)) + if (a->type != &at_curse) continue; /* ist der curse schwaecher als der Analysezauber, so ergibt sich @@ -184,7 +184,7 @@ static void magicanalyse_unit(unit * u, unit * mage, double force) curse *c; double probability; int mon; - if (!fval(a->type, ATF_CURSE)) + if (a->type != &at_curse) continue; c = (curse *)a->data.v; @@ -225,7 +225,7 @@ static void magicanalyse_building(building * b, unit * mage, double force) double probability; int mon; - if (!fval(a->type, ATF_CURSE)) + if (a->type != &at_curse) continue; c = (curse *)a->data.v; @@ -266,7 +266,7 @@ static void magicanalyse_ship(ship * sh, unit * mage, double force) curse *c; double probability; int mon; - if (!fval(a->type, ATF_CURSE)) + if (a->type != &at_curse) continue; c = (curse *)a->data.v; @@ -308,7 +308,7 @@ static int break_curse(attrib ** alist, int cast_level, double force, curse * c) while (*ap && force > 0) { curse *c1; attrib *a = *ap; - if (!fval(a->type, ATF_CURSE)) { + if (a->type != &at_curse) { do { ap = &(*ap)->next; } while (*ap && a->type == (*ap)->type); @@ -2970,7 +2970,7 @@ static int sp_deathcloud(castorder * co) unit *u; while (a) { - if ((a->type->flags & ATF_CURSE)) { + if (a->type == &at_curse) { curse *c = a->data.v; if (c->type == &ct_deathcloud) { report_failure(mage, co->order);