forked from github/server
inheitliche Zählung von Personen/Einheiten einer Partei
This commit is contained in:
parent
f242d80832
commit
d7cb8c517e
|
@ -1121,7 +1121,7 @@ parse_quit(void)
|
|||
if (turn!=f->lastorders) {
|
||||
char info[256];
|
||||
sprintf(info, "%d Einheiten, %d Personen, %d Silber",
|
||||
f->no_units, f->number, f->money);
|
||||
f->no_units, f->num_total, f->money);
|
||||
if (f->subscription) {
|
||||
sql_print(("UPDATE subscriptions SET lastturn=%d, password='%s', info='%s' WHERE id=%u;\n",
|
||||
f->lastorders, f->override, info, f->subscription));
|
||||
|
|
|
@ -3004,7 +3004,7 @@ make_summary(boolean count_new)
|
|||
}
|
||||
++plang->number;
|
||||
f->nregions = 0;
|
||||
f->number = 0;
|
||||
f->num_total = 0;
|
||||
f->money = 0;
|
||||
if (f->alive && (count_new || f->age > 0)) s->factions++;
|
||||
}
|
||||
|
@ -3096,7 +3096,7 @@ make_summary(boolean count_new)
|
|||
}
|
||||
}
|
||||
|
||||
f->number += u->number;
|
||||
f->num_total += u->number;
|
||||
f->money += get_money(u);
|
||||
s->poprace[old_race(u->race)] += u->number;
|
||||
}
|
||||
|
@ -3338,12 +3338,12 @@ out_faction(FILE *file, faction *f)
|
|||
fprintf(file, "%s (%s/%d) (%.3s/%.3s), %d Einh., %d Pers., $%d, %d %s\n",
|
||||
f->name, itoa36(f->no), f->alliance?f->alliance->id:0,
|
||||
LOC(default_locale, rc_name(f->race, 0)), neue_gebiete[f->magiegebiet],
|
||||
f->no_units, f->number, f->money, turn - f->lastorders,
|
||||
f->no_units, f->num_total, f->money, turn - f->lastorders,
|
||||
turn - f->lastorders != 1 ? "NMRs" : "NMR ");
|
||||
} else {
|
||||
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->no_units, f->number, f->money,
|
||||
neue_gebiete[f->magiegebiet], f->no_units, f->num_total, f->money,
|
||||
turn - f->lastorders, turn - f->lastorders != 1 ? "NMRs" : "NMR ");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1180,6 +1180,7 @@ update_lighthouse(building * lh)
|
|||
int
|
||||
count_all(const faction * f)
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
int n = 0;
|
||||
unit *u;
|
||||
for (u=f->units;u;u=u->nextF) {
|
||||
|
@ -1188,6 +1189,12 @@ count_all(const faction * f)
|
|||
assert(f==u->faction);
|
||||
}
|
||||
}
|
||||
if (f->num_people != n) {
|
||||
log_error(("Anzahl Personen für (%s) ist != num_people: %d statt %d.\n",
|
||||
factionid(f), f->num_migrants, n));
|
||||
f->num_people = n;
|
||||
}
|
||||
#endif
|
||||
return n;
|
||||
}
|
||||
|
||||
|
@ -1206,8 +1213,11 @@ count_migrants (const faction * f)
|
|||
}
|
||||
u = u->nextF;
|
||||
}
|
||||
if (f->num_migrants != n)
|
||||
log_error(("Anzahl Migranten für (%s) ist falsch: %d statt %d.\n", factionid(f), f->num_migrants, n));
|
||||
if (f->num_migrants != n) {
|
||||
log_error(("Anzahl Migranten für (%s) ist != num_migrants: %d statt %d.\n",
|
||||
factionid(f), f->num_migrants, n));
|
||||
f->num_migrants = n;
|
||||
}
|
||||
#endif
|
||||
return f->num_migrants;
|
||||
}
|
||||
|
@ -1869,7 +1879,7 @@ create_unit(region * r, faction * f, int number, const struct race *urace, int i
|
|||
|
||||
/* Nicht zu der Einheitenzahl zählen sollten auch alle Monster. Da
|
||||
* aber auf die MAXUNITS nur in MACHE TEMP geprüft wird, ist es egal */
|
||||
if(!fval(u->race, RCF_UNDEAD)) {
|
||||
if (playerrace(u->race)) {
|
||||
f->no_units++;
|
||||
}
|
||||
|
||||
|
|
|
@ -63,7 +63,8 @@ typedef struct faction {
|
|||
magic_t magiegebiet;
|
||||
int newbies;
|
||||
int num_migrants; /* Anzahl Migranten */
|
||||
int num_people; /* Anzahl Personen */
|
||||
int num_people; /* Anzahl Personen ohne Monster */
|
||||
int num_total; /* Anzahl Personen mit Monstern */
|
||||
int options;
|
||||
int no_units;
|
||||
int karma;
|
||||
|
@ -79,7 +80,6 @@ typedef struct faction {
|
|||
struct strlist *mistakes; /* enno: das muß irgendwann noch ganz raus */
|
||||
boolean alive; /* enno: sollte ein flag werden */
|
||||
int nregions;
|
||||
int number; /* enno: unterschied zu num_people ? */
|
||||
int money;
|
||||
int score;
|
||||
struct alliance * alliance;
|
||||
|
|
|
@ -807,7 +807,9 @@ u_setfaction(unit * u, faction * f)
|
|||
if (u->faction==f) return;
|
||||
if (u->faction) {
|
||||
set_number(u, 0);
|
||||
if (playerrace(u->race)) {
|
||||
--u->faction->no_units;
|
||||
}
|
||||
join_group(u, NULL);
|
||||
free_orders(&u->orders);
|
||||
set_order(&u->thisorder, NULL);
|
||||
|
@ -831,8 +833,10 @@ u_setfaction(unit * u, faction * f)
|
|||
u->faction = f;
|
||||
if (cnt && f) {
|
||||
set_number(u, cnt);
|
||||
if (playerrace(u->race)) {
|
||||
++f->no_units;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* vorsicht Sprüche können u->number == 0 (RS_FARVISION) haben! */
|
||||
void
|
||||
|
@ -844,11 +848,14 @@ set_number(unit * u, int count)
|
|||
#endif
|
||||
if (u->faction && u->race != u->faction->race && playerrace(u->race)
|
||||
&& old_race(u->race) != RC_SPELL && old_race(u->race) != RC_SPECIAL
|
||||
&& !(is_cursed(u->attribs, C_SLAVE, 0))){
|
||||
&& !(is_cursed(u->attribs, C_SLAVE, 0)))
|
||||
{
|
||||
u->faction->num_migrants += count - u->number;
|
||||
}
|
||||
|
||||
if (playerrace(u->race)) {
|
||||
u->faction->num_people += count - u->number;
|
||||
}
|
||||
u->number = count;
|
||||
}
|
||||
|
||||
|
|
|
@ -243,11 +243,11 @@ score(void)
|
|||
|
||||
sprintf(buf, "%s/score", basepath());
|
||||
scoreFP = fopen(buf, "w");
|
||||
for (f = factions; f; f = f->next) if(f->number != 0) {
|
||||
for (f = factions; f; f = f->next) if (f->num_total != 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,
|
||||
(float) f->score / f->num_total,
|
||||
f->name, LOC(default_locale, rc_name(f->race, 0)), factionid(f), f->age);
|
||||
}
|
||||
fclose(scoreFP);
|
||||
|
@ -268,7 +268,7 @@ score(void)
|
|||
if(f->alliance && f->alliance->id == a->id) {
|
||||
alliance_factions++;
|
||||
alliance_score += f->score;
|
||||
alliance_number += f->number;
|
||||
alliance_number += f->num_total;
|
||||
if (token!=NULL) {
|
||||
unit * u = f->units;
|
||||
while (u!=NULL) {
|
||||
|
|
Loading…
Reference in New Issue