bug in alliance-scoring

This commit is contained in:
Enno Rehling 2003-05-27 22:12:54 +00:00
parent 2e1537cb2c
commit 72b8a79fc9
1 changed files with 11 additions and 11 deletions

View File

@ -282,24 +282,24 @@ score(void)
for (a = alliances; a; a = a->next) { for (a = alliances; a; a = a->next) {
int alliance_score = 0, alliance_number = 0, alliance_factions = 0; int alliance_score = 0, alliance_number = 0, alliance_factions = 0;
int grails = 0; int grails = 0;
for (f = factions; f; f = f->next) { for (f = factions; f; f = f->next) {
if(f->alliance && f->alliance->id == a->id) { if(f->alliance && f->alliance->id == a->id) {
alliance_factions++; alliance_factions++;
alliance_score += f->score; alliance_score += f->score;
alliance_number += f->number; alliance_number += f->number;
if (token!=NULL) {
unit * u = f->units;
while (u!=NULL) {
item ** iitem = i_find(&u->items, token);
if (iitem!=NULL && *iitem!=NULL) {
grails += (*iitem)->number;
}
u=u->nextF;
}
}
} }
if (token!=NULL) {
unit * u = f->units;
while (u!=NULL) {
item ** iitem = i_find(&u->items, token);
if (iitem!=NULL && *iitem!=NULL) {
grails += (*iitem)->number;
}
u=u->nextF;
}
}
} }
fprintf(scoreFP, "%d:%d:%d:%d", a->id, alliance_factions, alliance_number, alliance_score); fprintf(scoreFP, "%d:%d:%d:%d", a->id, alliance_factions, alliance_number, alliance_score);