From 71cda9aa27e637e42665f81dbf986299e25f50ad Mon Sep 17 00:00:00 2001 From: Christian Schlittchen Date: Sun, 31 Mar 2002 08:46:36 +0000 Subject: [PATCH] - nunits/no_units vereinigt --- src/common/gamecode/laws.c | 2 +- src/common/gamecode/report.c | 21 +++++++++++---------- src/common/kernel/faction.h | 1 - src/eressea/main.c | 26 ++++++++++++++++++++++++++ src/mapper/map_modify.c | 8 ++++---- src/mapper/map_partei.c | 2 +- src/mapper/map_region.c | 8 ++++---- 7 files changed, 47 insertions(+), 21 deletions(-) diff --git a/src/common/gamecode/laws.c b/src/common/gamecode/laws.c index 99de3be03..3c0065762 100644 --- a/src/common/gamecode/laws.c +++ b/src/common/gamecode/laws.c @@ -1197,7 +1197,7 @@ quit(void) if (turn!=f->lastorders) { char info[256]; sprintf(info, "%d Einheiten, %d Personen, %d Silber", - f->nunits, f->number, f->money); + f->no_units, f->number, f->money); fprintf(sqlstream, "UPDATE subscriptions SET lastturn=%d, password='%s', info='%s' " "WHERE game=%d AND faction='%s';\n", diff --git a/src/common/gamecode/report.c b/src/common/gamecode/report.c index c455e5ebe..8a91d309f 100644 --- a/src/common/gamecode/report.c +++ b/src/common/gamecode/report.c @@ -3082,7 +3082,6 @@ make_summary(boolean count_new) } ++plang->number; f->nregions = 0; - f->nunits = 0; f->number = 0; f->money = 0; if (count_new == true || f->age > 0) s->factions++; @@ -3168,7 +3167,6 @@ make_summary(boolean count_new) } } - f->nunits++; f->number += u->number; f->money += get_money(u); s->poprace[old_race(u->race)] += u->number; @@ -3389,7 +3387,7 @@ out_faction(FILE *file, faction *f) { fprintf(file, "%s (%.3s/%.3s), %d Einh., %d Pers., $%d, %d %s\n", factionname(f), LOC(default_locale, rc_name(f->race, 0)), - neue_gebiete[f->magiegebiet], f->nunits, f->number, f->money, + neue_gebiete[f->magiegebiet], f->no_units, f->number, f->money, turn - f->lastorders, turn - f->lastorders != 1 ? "NMRs" : "NMR "); } @@ -3579,14 +3577,17 @@ report_summary(summary * s, summary * o, boolean full) if (!F) return; printf("Schreibe Spielerliste (players)...\n"); r = findregion(0, 0); - if (r) for (f=factions;f;f=f->next) { + fputs("id;name;email;info;age;x;y;nmr;score;race;magic;units;people;money", F); + if (r) { fputs("id;name;email;info;age;x;y;nmr;score;race;magic;units;people;money", F); - fprintf(F, "%s;\"%s\";\"%s\";\"%s\";\"%s\";%d;%d;%d;%d;%d;" - "\"%s\";\"%s\";" - "%d;%d;%d\n", - factionid(f), f->name, f->email, f->banner, f->passw, f->age, region_x(r, f), region_y(r, f), turn-f->lastorders, f->score, - f->race->name[0], neue_gebiete[f->magiegebiet], - f->nunits, f->number, f->money); + for (f=factions;f;f=f->next) { + fprintf(F, "%s;\"%s\";\"%s\";\"%s\";\"%s\";%d;%d;%d;%d;%d;" + "\"%s\";\"%s\";" + "%d;%d;%d\n", + factionid(f), f->name, f->email, f->banner, f->passw, f->age, region_x(r, f), region_y(r, f), turn-f->lastorders, f->score, + f->race->name[0], neue_gebiete[f->magiegebiet], + f->no_units, f->number, f->money); + } } fclose(F); #endif diff --git a/src/common/kernel/faction.h b/src/common/kernel/faction.h index 1c2b57478..75dd99935 100644 --- a/src/common/kernel/faction.h +++ b/src/common/kernel/faction.h @@ -52,7 +52,6 @@ typedef struct faction { struct strlist *mistakes; /* enno: das muß irgendwann noch ganz raus */ boolean alive; /* enno: sollte ein flag werden */ int nregions; - int nunits; /* enno: unterschied zu no_units ? */ int number; /* enno: unterschied zu num_people ? */ int money; int score; diff --git a/src/eressea/main.c b/src/eressea/main.c index d9119b188..344da2b93 100644 --- a/src/eressea/main.c +++ b/src/eressea/main.c @@ -208,6 +208,32 @@ getgarbage(void) #endif } +static void +writefactiondata(void) +{ + FILE *F; + char zText[128]; + + sprintf(zText, "%s/faction-data.xml", basepath()); + F = cfopen(zText, "w"); + if(F) { + faction *f; + for(f = factions; f; f=f->next) { + fprintf(F,"\n"); + fprintf(F,"\t%s\n",itoa36(f->no)); + fprintf(F,"\t%s\n",f->name); + fprintf(F,"\t%s\n",f->email); + fprintf(F,"\t%s\n",f->passw); + fprintf(F,"\t%s\n",rc_name(f->race,1)); + fprintf(F,"\t%s\n",neue_gebiete[f->magiegebiet]); + fprintf(F,"\t%d\n",turn-f->lastorders); + fprintf(F,"\t%d\n",f->score); + fprintf(F,"\n"); + } + } + fclose(F); +} + static void writepasswd(void) { diff --git a/src/mapper/map_modify.c b/src/mapper/map_modify.c index 42433a716..c4b3c4563 100644 --- a/src/mapper/map_modify.c +++ b/src/mapper/map_modify.c @@ -445,17 +445,17 @@ create_region_menu(menulist ** menu, region * r) addmenulist(menu, buf, 0); } else { for (f = factions; f; f = f->next) - f->num_people = f->nunits = 0; + f->num_people = f->no_units = 0; for (u = r->units; u; u = u->next) { - u->faction->nunits++; + u->faction->no_units++; u->faction->num_people += u->number; } addmenulist(menu, buf, 0); for (f = factions; f; f = f->next) { - if (f->nunits) { + if (f->no_units) { sprintf(buf, " %s: ", factionname(f)); - sprintf(str, "Einheiten: %d; Leute: %d", f->nunits, f->num_people); + sprintf(str, "Einheiten: %d; Leute: %d", f->no_units, f->num_people); sncat(buf, str, BUFSIZE); addmenulist(menu, buf, 0); } diff --git a/src/mapper/map_partei.c b/src/mapper/map_partei.c index 8ecd7bd28..7c92a06f2 100644 --- a/src/mapper/map_partei.c +++ b/src/mapper/map_partei.c @@ -506,7 +506,7 @@ ModifyPartei(faction * f) wmove(win, 1, 2); wprintw(win, (NCURSES_CONST char*)"Rasse: %s", f->race->_name[1]); wmove(win, 2, 2); - wprintw(win, (NCURSES_CONST char*)"Einheiten: %d", f->nunits); + wprintw(win, (NCURSES_CONST char*)"Einheiten: %d", f->no_units); wmove(win, 3, 2); wprintw(win, (NCURSES_CONST char*)"Personen: %d", f->num_people); wmove(win, 4, 2); diff --git a/src/mapper/map_region.c b/src/mapper/map_region.c index d28c494d3..c93fcd87f 100644 --- a/src/mapper/map_region.c +++ b/src/mapper/map_region.c @@ -355,20 +355,20 @@ showregion(region * r, char full) adddbllist(®list, buf); for (f = factions; f; f = f->next) - f->num_people = f->nunits = 0; + f->num_people = f->no_units = 0; for (u = r->units; u; u = u->next) { if (u->faction) { - u->faction->nunits++; + u->faction->no_units++; u->faction->num_people += u->number; } else fprintf(stderr,"Unit %s hat keine faction!\n",unitid(u)); } for (f = factions; f; f = f->next) - if (f->nunits) { + if (f->no_units) { sprintf(buf, " %-29.29s (%s)", f->name, factionid(f)); adddbllist(®list, buf); sprintf(buf, " Einheiten: %d; Leute: %d %c", - f->nunits, f->num_people, Tchar[old_race(f->race)]); + f->no_units, f->num_people, Tchar[old_race(f->race)]); adddbllist(®list, buf); }