QUIT-gifts and NMR-warnings depend on alliance, not HELP

This commit is contained in:
Enno Rehling 2010-02-02 07:30:03 +00:00
parent 98b529e106
commit 6eb4ea796b
2 changed files with 18 additions and 3 deletions

View File

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

View File

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