From 20671dc2c9d0b2be5ff0af377a11db4cc721b6f5 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 6 Oct 2002 07:28:36 +0000 Subject: [PATCH] alliance-Abfragen in ifdefs gepackt, neues Makro: ALLIED(f1, f2), funktioniert mit oder ohne Allianzen aktiviert im Code - bitte benutzen, statt tests von hand zu machen. --- src/common/gamecode/economy.c | 2 ++ src/common/gamecode/report.c | 2 +- src/common/kernel/eressea.h | 5 +++++ src/common/kernel/reports.c | 8 +++++--- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/common/gamecode/economy.c b/src/common/gamecode/economy.c index 947d775f0..6e9c773c1 100644 --- a/src/common/gamecode/economy.c +++ b/src/common/gamecode/economy.c @@ -2929,10 +2929,12 @@ steal(region * r, unit * u, request ** stealorders) return; } +#ifdef ALLIANCES if(u->faction->alliance == u2->faction->alliance) { cmistake(u, findorder(u, u->thisorder), 47, MSG_INCOME); return; } +#endif assert(u->region==u2->region); if (!can_contact(r, u, u2)) { diff --git a/src/common/gamecode/report.c b/src/common/gamecode/report.c index 3464c0f29..e1ad4c6ff 100644 --- a/src/common/gamecode/report.c +++ b/src/common/gamecode/report.c @@ -1811,7 +1811,7 @@ list_address(FILE * F, const faction * uf, const faction_list * seenfactions) const faction * f = flist->data; if (f->no!=MONSTER_FACTION) { sprintf(buf, "%s: %s; %s", factionname(f), f->email, f->banner); - rparagraph(F, buf, 4, (uf->alliance != NULL && f->alliance != NULL && uf->alliance == f->alliance)?'+':'*'); + rparagraph(F, buf, 4, ALLIED(uf, f)?'+':'*'); } flist = flist->next; } diff --git a/src/common/kernel/eressea.h b/src/common/kernel/eressea.h index 33972ad83..aefd5994b 100644 --- a/src/common/kernel/eressea.h +++ b/src/common/kernel/eressea.h @@ -83,6 +83,11 @@ struct xml_stack; #include #define AT_PERSISTENT +#ifdef ALLIANCES +# define ALLIED(f1, f2) (f1->alliance && f1->alliance==f2->alliance) +#else +# define ALLIED(f1, f2) (f1==f2) +#endif /* eressea-defined attribute-type flags */ #define ATF_CURSE ATF_USER_DEFINED diff --git a/src/common/kernel/reports.c b/src/common/kernel/reports.c index 02071b0cb..8a14ccbd9 100644 --- a/src/common/kernel/reports.c +++ b/src/common/kernel/reports.c @@ -857,7 +857,6 @@ faction_list * get_addresses(const faction * f, const seen_region * seenregions) { /* "TODO: travelthru" */ - faction *f2; const seen_region * sr = seenregions; const faction * lastf = NULL; faction_list * flist = calloc(1, sizeof(faction_list)); @@ -867,8 +866,9 @@ get_addresses(const faction * f, const seen_region * seenregions) const unit * u = r->units; while (u!=NULL) { faction * sf = visible_faction(f, u); - if (sf && sf!=f && sf!=lastf && ((!fval(u, FL_PARTEITARNUNG) && cansee(f, r, u, 0)) - || (f->alliance != NULL && sf->alliance != NULL && f->alliance == sf->alliance))) { + boolean ballied = sf && sf!=f && sf!=lastf + && !fval(u, FL_PARTEITARNUNG) && cansee(f, r, u, 0); + if (ballied || ALLIED(f, sf)) { faction_list ** fnew = &flist; while (*fnew && (*fnew)->data->no < sf->no) { fnew =&(*fnew)->next; @@ -885,6 +885,7 @@ get_addresses(const faction * f, const seen_region * seenregions) } sr = sr->next; } +#ifdef ALLIANCES if(f->alliance != NULL) { for(f2 = factions; f2; f2 = f2->next) { if(f2->alliance != NULL && f2->alliance == f->alliance) { @@ -901,5 +902,6 @@ get_addresses(const faction * f, const seen_region * seenregions) } } } +#endif return flist; }