From 6eb4ea796bc8dc76856ca4cbc8e5e229a2efb83f Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Tue, 2 Feb 2010 07:30:03 +0000 Subject: [PATCH] QUIT-gifts and NMR-warnings depend on alliance, not HELP --- src/common/kernel/reports.c | 10 +++++++++- src/common/kernel/unit.c | 11 +++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/common/kernel/reports.c b/src/common/kernel/reports.c index f85e2f5e8..e03de6941 100644 --- a/src/common/kernel/reports.c +++ b/src/common/kernel/reports.c @@ -1443,7 +1443,15 @@ nmr_warnings(void) if (!is_monsters(f) && (turn-f->lastorders) >= 2) { message * msg = NULL; for (fa=factions;fa;fa=fa->next) { - if (alliedfaction(NULL, f, fa, FRIEND) && alliedfaction(NULL, fa, f, FRIEND)) { + int warn = 0; + if (get_param_int(global.parameters, "rules.alliances", 0)!=0) { + if (f->alliance && f->alliance==fa->alliance) { + warn = 1; + } + } else if (alliedfaction(NULL, f, fa, FRIEND) && alliedfaction(NULL, fa, f, FRIEND)) { + warn = 1; + } + if (warn) { if (msg==NULL) { msg = msg_message("warn_dropout", "faction", f); } diff --git a/src/common/kernel/unit.c b/src/common/kernel/unit.c index 803461ef9..9802e74c0 100644 --- a/src/common/kernel/unit.c +++ b/src/common/kernel/unit.c @@ -174,7 +174,14 @@ get_friends(const unit * u, int * numfriends) for (u2=r->units;u2;u2=u2->next) { if (u2->faction!=f && u2->number>0) { - if (alliedunit(u, u2->faction, HELP_MONEY) && alliedunit(u2, f, HELP_GIVE)) { + int allied = 0; + if (get_param_int(global.parameters, "rules.alliances", 0)!=0) { + allied = (f->alliance && f->alliance==u2->faction->alliance); + } + else if (alliedunit(u, u2->faction, HELP_MONEY) && alliedunit(u2, f, HELP_GIVE)) { + allied = 1; + } + if (allied) { friend * nf, ** fr = &friends; /* some units won't take stuff: */ @@ -226,7 +233,7 @@ gift_items(unit * u, int flags) if ((u->race->ec_flags & GIVEITEM) == 0) return 0; /* at first, I should try giving my crap to my own units in this region */ - if (u->faction && (flags & GIFT_SELF)) { + if (u->faction && (u->faction->flags&FFL_QUIT)==0 && (flags & GIFT_SELF)) { unit * u2, * u3 = NULL; for (u2 = r->units; u2; u2 = u2->next) { if (u2 != u && u2->faction == u->faction && u2->number>0) {