forked from github/server
"Partei fehlt im cr" Bei Einheiten, die auf der Durchreise (auf dem Ozean) gesichtet wurden fehlte manchmal der entsprechende Partei-Block im cr. Das gehoert getestet, glaube ich :-)
This commit is contained in:
parent
9da7d99f22
commit
2220f4b2c3
|
@ -1101,6 +1101,40 @@ cansee(const faction * f, const region * r, const unit * u, int modifier)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean
|
||||||
|
cansee_unit(const unit * u, const unit * target, int modifier)
|
||||||
|
/* target->region kann != u->region sein, wenn es um durchreisen geht */
|
||||||
|
{
|
||||||
|
if (target->race == new_race[RC_SPELL] || target->number == 0) return false;
|
||||||
|
else if (target->faction == u->faction) return true;
|
||||||
|
else {
|
||||||
|
int n, rings, o;
|
||||||
|
|
||||||
|
if (getguard(target) || usiege(target) || target->building || target->ship) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
n = eff_stealth(target, target->region) - modifier;
|
||||||
|
rings = invisible(target, NULL);
|
||||||
|
if (rings==0 && n<=0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rings && invisible(target, u) >= target->number) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
o = eff_skill(u, SK_OBSERVATION, target->region);
|
||||||
|
|
||||||
|
#ifdef NIGHTEYES
|
||||||
|
if (u->enchanted == SP_NIGHT_EYES && o < NIGHT_EYE_TALENT)
|
||||||
|
o = NIGHT_EYE_TALENT;
|
||||||
|
#endif
|
||||||
|
if (o >= n) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
boolean
|
boolean
|
||||||
cansee_durchgezogen(const faction * f, const region * r, const unit * u, int modifier)
|
cansee_durchgezogen(const faction * f, const region * r, const unit * u, int modifier)
|
||||||
|
|
|
@ -905,6 +905,7 @@ extern int atoi36(const char * s);
|
||||||
|
|
||||||
extern boolean cansee(const struct faction * f, const struct region * r, const struct unit * u, int modifier);
|
extern boolean cansee(const struct faction * f, const struct region * r, const struct unit * u, int modifier);
|
||||||
boolean cansee_durchgezogen(const struct faction * f, const struct region * r, const struct unit * u, int modifier);
|
boolean cansee_durchgezogen(const struct faction * f, const struct region * r, const struct unit * u, int modifier);
|
||||||
|
extern boolean cansee_unit(const struct unit * u, const struct unit * target, int modifier);
|
||||||
boolean seefaction(const struct faction * f, const struct region * r, const struct unit * u, int modifier);
|
boolean seefaction(const struct faction * f, const struct region * r, const struct unit * u, int modifier);
|
||||||
extern int effskill(const struct unit * u, skill_t sk);
|
extern int effskill(const struct unit * u, skill_t sk);
|
||||||
|
|
||||||
|
|
|
@ -809,6 +809,21 @@ ucansee(const struct faction *f, const struct unit *u, const struct unit *x)
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
add_faction(faction_list ** flist, faction * sf)
|
||||||
|
{
|
||||||
|
faction_list ** fnew = flist;
|
||||||
|
while (*fnew && (*fnew)->data->no < sf->no) {
|
||||||
|
fnew =&(*fnew)->next;
|
||||||
|
}
|
||||||
|
if ((*fnew==NULL) || (*fnew)->data!=sf) {
|
||||||
|
faction_list * finsert = malloc(sizeof(faction_list));
|
||||||
|
finsert->next = *fnew;
|
||||||
|
*fnew = finsert;
|
||||||
|
finsert->data = sf;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
get_addresses(report_context * ctx)
|
get_addresses(report_context * ctx)
|
||||||
{
|
{
|
||||||
|
@ -825,44 +840,50 @@ get_addresses(report_context * ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
for (;sr!=NULL;sr=sr->next) {
|
for (;sr!=NULL;sr=sr->next) {
|
||||||
const region * r = sr->r;
|
if (sr->mode==see_travel) {
|
||||||
const unit * u = r->units;
|
unit * u = r->units;
|
||||||
|
while (u) {
|
||||||
while (u!=NULL) {
|
faction * sf = visible_faction(ctx->f, u);
|
||||||
faction * sf = visible_faction(ctx->f, u);
|
assert(u->faction!=ctx->f);
|
||||||
boolean ballied = sf && sf!=ctx->f && sf!=lastf
|
if (lastf!=sf) {
|
||||||
&& !fval(u, UFL_PARTEITARNUNG) && cansee(ctx->f, r, u, 0);
|
attrib * a = a_find(r->attribs, &at_travelunit);
|
||||||
if (ballied || ALLIED(ctx->f, sf)) {
|
while (a && a->type==&at_travelunit) {
|
||||||
faction_list ** fnew = &flist;
|
unit * u2 = (unit*)a->data.v;
|
||||||
while (*fnew && (*fnew)->data->no < sf->no) {
|
if (u2->faction==ctx->f) {
|
||||||
fnew =&(*fnew)->next;
|
if (cansee_unit(u2, u, 0)) {
|
||||||
|
add_faction(&flist, sf);
|
||||||
|
lastf = sf;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
a = a->next;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if ((*fnew==NULL) || (*fnew)->data!=sf) {
|
u = u->next;
|
||||||
faction_list * finsert = malloc(sizeof(faction_list));
|
}
|
||||||
finsert->next = *fnew;
|
} else if (sr->mode<see_travel) {
|
||||||
*fnew = finsert;
|
const region * r = sr->r;
|
||||||
finsert->data = sf;
|
const unit * u = r->units;
|
||||||
}
|
while (u!=NULL) {
|
||||||
lastf = sf;
|
if (u->faction!=ctx->f) {
|
||||||
|
faction * sf = visible_faction(ctx->f, u);
|
||||||
|
boolean ballied = sf && sf!=ctx->f && sf!=lastf
|
||||||
|
&& !fval(u, UFL_PARTEITARNUNG) && cansee(ctx->f, r, u, 0);
|
||||||
|
if (ballied || ALLIED(ctx->f, sf)) {
|
||||||
|
add_faction(&flist, sf);
|
||||||
|
lastf = sf;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
u = u->next;
|
||||||
}
|
}
|
||||||
u = u->next;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ctx->f->alliance != NULL) {
|
if (ctx->f->alliance != NULL) {
|
||||||
faction *f2;
|
faction *f2;
|
||||||
for(f2 = factions; f2; f2 = f2->next) {
|
for (f2 = factions; f2; f2 = f2->next) {
|
||||||
if(f2->alliance != NULL && f2->alliance == ctx->f->alliance) {
|
if (f2->alliance != NULL && f2->alliance == ctx->f->alliance) {
|
||||||
faction_list ** fnew = &flist;
|
add_faction(&flist, f2);
|
||||||
while (*fnew && (*fnew)->data->no < f2->no) {
|
|
||||||
fnew =&(*fnew)->next;
|
|
||||||
}
|
|
||||||
if ((*fnew==NULL) || (*fnew)->data!=f2) {
|
|
||||||
faction_list * finsert = malloc(sizeof(faction_list));
|
|
||||||
finsert->next = *fnew;
|
|
||||||
*fnew = finsert;
|
|
||||||
finsert->data = f2;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -992,12 +1013,12 @@ static report_type * report_types;
|
||||||
void
|
void
|
||||||
register_reporttype(const char * extension, report_fun write, int flag)
|
register_reporttype(const char * extension, report_fun write, int flag)
|
||||||
{
|
{
|
||||||
report_type * type = malloc(sizeof(report_type));
|
report_type * type = malloc(sizeof(report_type));
|
||||||
type->extension = extension;
|
type->extension = extension;
|
||||||
type->write = write;
|
type->write = write;
|
||||||
type->flag = flag;
|
type->flag = flag;
|
||||||
type->next = report_types;
|
type->next = report_types;
|
||||||
report_types = type;
|
report_types = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
static region_list *
|
static region_list *
|
||||||
|
|
Loading…
Reference in New Issue