- nunits/no_units vereinigt

This commit is contained in:
Christian Schlittchen 2002-03-31 08:46:36 +00:00
parent 0f28866c0d
commit 71cda9aa27
7 changed files with 47 additions and 21 deletions

View File

@ -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",

View File

@ -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

View File

@ -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;

View File

@ -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,"<faction>\n");
fprintf(F,"\t<id>%s</id>\n",itoa36(f->no));
fprintf(F,"\t<name>%s</name>\n",f->name);
fprintf(F,"\t<email>%s</email>\n",f->email);
fprintf(F,"\t<password>%s</password>\n",f->passw);
fprintf(F,"\t<race>%s</race>\n",rc_name(f->race,1));
fprintf(F,"\t<magic>%s</magic>\n",neue_gebiete[f->magiegebiet]);
fprintf(F,"\t<nmrs>%d</nmrs>\n",turn-f->lastorders);
fprintf(F,"\t<score>%d</score>\n",f->score);
fprintf(F,"</faction>\n");
}
}
fclose(F);
}
static void
writepasswd(void)
{

View File

@ -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);
}

View File

@ -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);

View File

@ -355,20 +355,20 @@ showregion(region * r, char full)
adddbllist(&reglist, 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(&reglist, 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(&reglist, buf);
}