we don't need to track age statistics for any but the new factions. rename global age to newbies.

This commit is contained in:
Enno Rehling 2021-02-21 00:54:21 +01:00
parent e1d117754a
commit d8c0b57864
3 changed files with 11 additions and 14 deletions

View File

@ -1268,8 +1268,8 @@ void do_enter(struct region *r, bool is_final_attempt)
}
}
int newbies[MAXNEWPLAYERS];
int dropouts[2];
int *age = NULL;
bool nmr_death(const faction * f, int turn, int timeout)
{
@ -1321,15 +1321,13 @@ static void remove_idle_players(void)
i = turn + 1;
if (i < 4) i = 4;
free(age);
age = calloc(i, sizeof(int));
if (!age) abort();
for (fp = &factions; *fp;) {
faction *f = *fp;
if (!is_monsters(f)) {
if (RemoveNMRNewbie() && !fval(f, FFL_NOIDLEOUT)) {
if (f->age >= 0 && f->age <= turn)
++age[f->age];
if (f->age >= 0 && f->age < MAXNEWPLAYERS) {
++newbies[f->age];
}
if (f->age == 2 || f->age == 3) {
if (f->lastorders == turn - 2) {
++dropouts[f->age - 2];

View File

@ -18,8 +18,9 @@ extern "C" {
extern struct attrib_type at_germs;
#define MAXNEWPLAYERS 4
extern int newbies[MAXNEWPLAYERS];
extern int dropouts[2];
extern int *age;
void demographics(void);
void immigration(void);

View File

@ -324,13 +324,11 @@ void report_summary(const summary * s, bool full)
}
}
}
if (age) {
if (age[2] != 0) {
fprintf(F, "Erstabgaben: %3d%%\n", 100 - (dropouts[0] * 100 / age[2]));
}
if (age[3] != 0) {
fprintf(F, "Zweitabgaben: %3d%%\n", 100 - (dropouts[1] * 100 / age[3]));
}
if (newbies[2] != 0) {
fprintf(F, "Erstabgaben: %3d%%\n", 100 - (dropouts[0] * 100 / newbies[2]));
}
if (newbies[3] != 0) {
fprintf(F, "Zweitabgaben: %3d%%\n", 100 - (dropouts[1] * 100 / newbies[3]));
}
fprintf(F, "Neue Spieler: %d\n", newplayers);