Fix CR output for list of regions

Add pvp/pve battle statistics
This commit is contained in:
Enno Rehling 2020-09-05 23:08:10 +02:00
parent 17e8144757
commit ba39de9d25
2 changed files with 14 additions and 1 deletions

View File

@ -3986,6 +3986,7 @@ static void do_battle(region * r) {
battle *b = NULL;
bool fighting;
ship *sh;
int i;
fighting = start_battle(r, &b);
@ -4007,6 +4008,18 @@ static void do_battle(region * r) {
join_allies(b);
make_heroes(b);
/* statistics are fun */
for (i = 0; i != b->nsides; ++i) {
side *s = b->sides + i;
if (s->faction->flags & FFL_NPC) {
stats_count("battle.pve", 1);
break;
}
}
if (i == b->nsides) {
stats_count("battle.pvp", 1);
}
/* make sure no ships are damaged initially */
for (sh = r->ships; sh; sh = sh->next)
freset(sh, SF_DAMAGED);

View File

@ -462,7 +462,7 @@ static int cr_regions(variant var, const char *name, char *buffer, const void *u
z = plane_id(pl);
wp += sprintf(wp, ", %d %d %d", nx, ny, z);
}
wp += sprintf(wp, "\"%s\n", name);
wp += sprintf(wp, "\";%s\n", name);
}
else {
sprintf(buffer, "\"\";%s\n", name);