kill ATF_CURSE flag, compare to at_curse directly.

This commit is contained in:
Enno Rehling 2017-08-25 21:11:01 +02:00
parent 612cd1158a
commit f4df6bd9db
6 changed files with 13 additions and 17 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -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

View File

@ -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);

View File

@ -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);