From ce4067646938443f75e1b0d4869637c49cc01658 Mon Sep 17 00:00:00 2001 From: Christian Schlittchen Date: Mon, 4 Nov 2002 19:16:45 +0000 Subject: [PATCH] - Punkte der Allianzen in score.alliances --- src/common/modules/score.c | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/src/common/modules/score.c b/src/common/modules/score.c index 5ca05710d..bd0b11221 100644 --- a/src/common/modules/score.c +++ b/src/common/modules/score.c @@ -27,6 +27,7 @@ #include "region.h" #include #include +#include "alliance.h" #include "race.h" #include "unit.h" #include "skill.h" @@ -260,15 +261,37 @@ score(void) allscores = 1; sprintf(buf, "%s/score", basepath()); - scoreFP = fopen(buf, "w"); - for (f = factions; f; f = f->next) { + for (f = factions; f; f = f->next) if(f->number != 0) { fprintf(scoreFP, "%8d (%8d/%4.2f%%/%5.2f) %30.30s (%3.3s) %5s (%3d)\n", f->score, f->score - average_score_of_age(f->age, f->age / 24 + 1), ((float) f->score / (float) allscores) * 100.0, (float) f->score / f->number, f->name, LOC(default_locale, rc_name(f->race, 0)), factionid(f), f->age); } - fclose(scoreFP); + +#ifdef ALLIANCES + { + alliance *a; + + sprintf(buf, "%s/score.alliances", basepath()); + scoreFP = fopen(buf, "w"); + + for (a = alliances; a; a = a->next) { + int alliance_score = 0; + + for (f = factions; f; f = f->next) { + if(f->alliance && f->alliance->id == a->id) { + alliance_score += f->score; + } + } + + fprintf(scoreFP, "%d:%d\n", a->id, alliance_score); + } + fclose(scoreFP); + } +#endif + } +