From 5ddee57978e087ab2c817ffec904f014fe6db0cb Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Mon, 6 Jun 2005 20:08:20 +0000 Subject: [PATCH] http://eressea.upb.de/mantis/view.php?id=464 piraterie: eigene boote verfolgen sich? Ab sofort verfolgt man nur noch Boote von Leuten, denen man nicht HELFE BEWACHE gesetzt hat. Issue: 464 --- src/common/kernel/movement.c | 15 ++++++++++----- src/common/kernel/reports.c | 14 -------------- src/common/kernel/reports.h | 1 - src/common/kernel/unit.c | 1 + 4 files changed, 11 insertions(+), 20 deletions(-) diff --git a/src/common/kernel/movement.c b/src/common/kernel/movement.c index 86766090c..9b803e4ce 100644 --- a/src/common/kernel/movement.c +++ b/src/common/kernel/movement.c @@ -61,6 +61,7 @@ #include #include #include +#include extern border_type bt_wisps; int * storms; @@ -2037,14 +2038,18 @@ piracy_cmd(unit *u, struct order * ord) for(dir = 0; dir < MAXDIRECTIONS; dir++) { region *rc = rconnect(r, dir); aff[dir] = 0; - if(rc && (terrain[rterrain(rc)].flags & SWIM_INTO) + if (rc && (terrain[rterrain(rc)].flags & SWIM_INTO) && check_takeoff(sh, r, rc) == true) { - for(sh2 = rc->ships; sh2; sh2 = sh2->next) { + for (sh2 = rc->ships; sh2; sh2 = sh2->next) { unit * cap = shipowner(sh2); - if (cap && (intlist_find(il, cap->faction->no) || all)) { - aff[dir]++; - } + if (cap) { + faction * f = visible_faction(cap->faction, cap); + if (alliedunit(u, f, HELP_GUARD)) continue; + if (all || intlist_find(il, cap->faction->no)) { + aff[dir]++; + } + } } /* Und aufaddieren. */ diff --git a/src/common/kernel/reports.c b/src/common/kernel/reports.c index f18178879..5512cf037 100644 --- a/src/common/kernel/reports.c +++ b/src/common/kernel/reports.c @@ -879,20 +879,6 @@ ucansee(const struct faction *f, const struct unit *u, const struct unit *x) return x; } -faction * -visible_faction(const faction *f, const unit * u) -{ - if (!alliedunit(u, f, HELP_FSTEALTH)) { - attrib *a = a_find(u->attribs, &at_otherfaction); - if (a) { - faction *fv = get_otherfaction(a); - assert (fv != NULL); /* fv should never be NULL! */ - return fv; - } - } - return u->faction; -} - faction_list * get_addresses(faction * f, struct seen_region * seehash[]) { diff --git a/src/common/kernel/reports.h b/src/common/kernel/reports.h index 308fa95a7..587bbae86 100644 --- a/src/common/kernel/reports.h +++ b/src/common/kernel/reports.h @@ -97,7 +97,6 @@ extern int bufunit_ugroupleader(const struct faction * f, const struct unit * u, #endif extern const char * reportpath(void); -extern struct faction * visible_faction(const struct faction *f, const struct unit * u); extern struct faction_list * get_addresses(struct faction * f, struct seen_region * seehash[]); extern const char * trailinto(const struct region * r, const struct locale * lang); diff --git a/src/common/kernel/unit.c b/src/common/kernel/unit.c index 65c060d27..65a40fdbd 100644 --- a/src/common/kernel/unit.c +++ b/src/common/kernel/unit.c @@ -1166,4 +1166,5 @@ countheroes(const struct faction * f) } return n; } + #endif