Index: server/srv_main.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/server/srv_main.c,v retrieving revision 1.126 diff -u -r1.126 srv_main.c --- server/srv_main.c 5 May 2003 12:11:13 -0000 1.126 +++ server/srv_main.c 10 May 2003 19:00:41 -0000 @@ -199,6 +198,48 @@ gamelog(GAMELOG_NORMAL, _("Game ended in a draw as end year exceeded")); return TRUE; } + +#ifdef AI_MEASUREMENT_MODE +#ifndef AI_END_GAME +#define AI_END_GAME A_UNSET +#endif + /* Special AI debug and measurement mode. Compile with + * -DAI_MEASUREMENT_MODE as parameter to activate. Compile + * with -DAI_END_GAME=81 to stop the game at 'The Republic'. */ + players_iterate(pplayer) { + int workers = 0, food = 0, shields = 0, trade = 0, settlers = 0; + + if (!ai_handicap(pplayer, H_EXPERIMENTAL)) { + continue; /* Not relevant. */ + } + /* Compile statistics */ + unit_list_iterate(pplayer->units, punit) { + if (unit_flag(punit, F_CITIES)) { + settlers++; + } + } unit_list_iterate_end; + city_list_iterate(pplayer->cities, pcity) { + workers += pcity->size; + shields += pcity->shield_prod; + food += pcity->food_prod; + trade += pcity->trade_prod; + } city_list_iterate_end; + if (get_invention(pplayer, AI_END_GAME) == TECH_KNOWN + || game.turn % 10 == 0) { + freelog(LOG_NORMAL, "%s stats: %d cities, %d citizens, %d " + "food, %d production, %d trade, %d settlers, %d " + "other units.", pplayer->name, + city_list_size(&pplayer->cities), workers, food, + shields, trade, settlers, + unit_list_size(&pplayer->units) - settlers); + } + if (get_invention(pplayer, AI_END_GAME) == TECH_KNOWN) { + freelog(LOG_NORMAL, "%s reached %s, game ended in turn %d.", + pplayer->name, advances[AI_END_GAME].name, game.turn); + return TRUE; + } + } players_iterate_end; +#endif /* count barbarians */ players_iterate(pplayer) {