Durchreisemeldungen fehlen

Kleiner Bug bei der Änderung von attrib::nexttype
This commit is contained in:
Enno Rehling 2006-02-26 11:59:58 +00:00
parent 23247f1831
commit caab8471ed
1 changed files with 49 additions and 51 deletions

View File

@ -1146,65 +1146,63 @@ statistics(FILE * F, const region * r, const faction * f)
static void static void
durchreisende(FILE * F, const region * r, const faction * f) durchreisende(FILE * F, const region * r, const faction * f)
{ {
attrib *ru; if (fval(r, RF_TRAVELUNIT)) {
int maxtravel; attrib *abegin = a_find(r->attribs, &at_travelunit), *a;
int counter; int counter = 0, maxtravel = 0;
char * str = buf;
maxtravel = counter = 0;
/* Wieviele sind aufzulisten? Für die Grammatik. */ /* Wieviele sind aufzulisten? Für die Grammatik. */
for (a = abegin; a && a->type==&at_travelunit; a = a->next) {
unit * u = (unit*)a->data.v;
if (fval(r, RF_TRAVELUNIT)) { if (r!=u->region && (u->ship==NULL || fval(u, UFL_OWNER))) {
for (ru = a_find(r->attribs, &at_travelunit); ru && ru->type!=&at_travelunit; ru = ru->next) { if (cansee_durchgezogen(f, r, u, 0)) {
unit * u = (unit*)ru->data.v; ++maxtravel;
if (cansee_durchgezogen(f, r, u, 0) > 0 && r!=u->region) { }
if (u->ship && !fval(u, UFL_OWNER))
continue;
maxtravel++;
} }
} }
if (!maxtravel) if (maxtravel==0) {
return; return;
} else return; }
/* Auflisten. */ /* Auflisten. */
*str = '\0';
buf[0] = 0;
rnl(F); rnl(F);
for (ru = a_find(r->attribs, &at_travelunit); ru && ru->type==&at_travelunit; ru = ru->next) { for (a = abegin; a && a->type==&at_travelunit; a = a->next) {
unit * u = (unit*)ru->data.v; unit * u = (unit*)a->data.v;
if (cansee_durchgezogen(f, r, u, 0) > 0 && r!=u->region) {
if (u->ship && !fval(u, UFL_OWNER)) if (r!=u->region && (u->ship==NULL || fval(u, UFL_OWNER))) {
continue; if (cansee_durchgezogen(f, r, u, 0)) {
counter++; ++counter;
if (u->ship != (ship *) NULL) { if (u->ship != NULL) {
if (counter == 1) { if (counter == 1) {
scat("Die "); str += strxcpy(str, "Die ");
} else { } else {
scat("die "); str += strxcpy(str, "die ");
} }
scat(shipname(u->ship)); str += strxcpy(str, shipname(u->ship));
} else { } else {
scat(unitname(u)); str += strxcpy(str, unitname(u));
} }
if (counter + 1 < maxtravel) { if (counter + 1 < maxtravel) {
scat(", "); str += strxcpy(str, ", ");
} else if (counter + 1 == maxtravel) { } else if (counter + 1 == maxtravel) {
scat(" und "); str += strxcpy(str, "und ");
}
} }
} }
} }
if (maxtravel == 1) { if (maxtravel == 1) {
scat(" hat die Region durchquert."); str += strxcpy(str, " hat die Region durchquert.");
rparagraph(F, buf, 0, 0, 0); rparagraph(F, buf, 0, 0, 0);
} else { } else {
scat(" haben die Region durchquert."); str += strxcpy(str, " haben die Region durchquert.");
rparagraph(F, buf, 0, 0, 0); rparagraph(F, buf, 0, 0, 0);
} }
} }
}
static int static int
buildingmaintenance(const building * b, const resource_type * rtype) buildingmaintenance(const building * b, const resource_type * rtype)