<URL: http://bugs.freeciv.org/Ticket/Display.html?id=40100 >
I've asked on the developers list, and nobody knows a reason for this
anachronistic structure. Any time there are 2 different copies of the
same data, there's bound to be trouble keeping them synchronized.
The server side doesn't depend on its validity. It is refreshed just
before use in common/aicore/cm.c cm_query_result():
/* Refresh the city. Otherwise the CM can give wrong results or just be
* slower than necessary. Note that cities are often passed in in an
* unrefreshed state (which should probably be fixed). */
generic_city_refresh(pcity, TRUE);
===
There are a total of 37 references. Many of them (client and server)
could be replaced with a direct reference to the main map tiles!
Most of this code is devoted to updating it, and sanity checking it.
ai/aicity.c:171:
if (acity->city_map[x][y] == C_TILE_WORKER) {
client/agents/cma_core.c:144:
(pcity->city_map[x][y] == C_TILE_WORKER);
client/agents/cma_core.c:225:
if ((pcity->city_map[x][y] == C_TILE_WORKER) &&
client/agents/cma_core.c:258:
pcity->city_map[x][y] != C_TILE_WORKER) {
client/agents/cma_core.c:259:
assert(pcity->city_map[x][y] == C_TILE_EMPTY);
client/citydlg_common.c:899:
if (pcity->city_map[city_x][city_y] == C_TILE_WORKER) {
client/citydlg_common.c:902:
} else if (pcity->city_map[city_x][city_y] == C_TILE_EMPTY) {
client/packhand.c:603:
pcity->city_map[x][y] =
client/packhand.c:607:
set_worker_city(pcity, x, y, packet->city_map[i]);
client/packhand.c:864:
pcity->city_map[x][y] = C_TILE_EMPTY;
client/tilespec.c:4068:
worked[i] = citymode->city_map[cx][cy] == C_TILE_WORKER;
client/tilespec.c:4137:
&& citymode->city_map[cx][cy] == C_TILE_UNAVAILABLE)
common/aicore/cm.c:640:
if (pcity->city_map[x][y] == C_TILE_WORKER) {
common/aicore/cm.c:641:
pcity->city_map[x][y] = C_TILE_EMPTY;
common/aicore/cm.c:670:
pcity->city_map[tile->x][tile->y] = C_TILE_WORKER;
common/aicore/cm.c:1123:
if (pcity->city_map[x][y] == C_TILE_UNAVAILABLE) {
common/aicore/cm.c:1910:
(pcity->city_map[x][y] == C_TILE_WORKER);
common/aicore/cm.c:2049:
if (pcity->city_map[x][y] == C_TILE_WORKER) {
common/city.c:301:
if (pcity->city_map[city_x][city_y] == C_TILE_WORKER
common/city.c:314:
pcity->city_map[city_x][city_y] = type;
common/city.c:327:
return pcity->city_map[city_x][city_y];
common/city.c:1713:
if (pcity->city_map[x][y] == C_TILE_WORKER) {
common/city.h:329:
enum city_tile_type city_map[CITY_MAP_SIZE][CITY_MAP_SIZE];
server/citytools.c:1037:
pcity->city_map[x_itr][y_itr] = C_TILE_EMPTY;
server/citytools.c:1039:
pcity->city_map[x_itr][y_itr] = C_TILE_UNAVAILABLE;
server/citytools.c:1715:
packet->city_map[x + y * CITY_MAP_SIZE] = get_worker_city(pcity, x, y);
server/citytools.c:2043:
current = pcity->city_map[city_x][city_y];
server/cityturn.c:172:
switch (pcity->city_map[x][y]) {
server/cityturn.c:439:
&& C_TILE_WORKER == pcity->city_map[city_x][city_y]
server/sanitycheck.c:284:
switch (pcity->city_map[x][y]) {
server/sanitycheck.c:410:
if (pcity->city_map[city_x][city_y] != C_TILE_WORKER) {
server/sanitycheck.c:416:
pcity->city_map[city_x][city_y],
server/savegame.c:2473:
/* Initialize pcity->city_map[][], using set_worker_city() so that
server/savegame.c:2488:
pcity->city_map[x][y] = valid ? C_TILE_EMPTY : C_TILE_UNAVAILABLE;
server/savegame.c:2533:
assert(pcity->city_map[x][y] == C_TILE_UNAVAILABLE);
server/savegame.c:2558:
pcity->city_map[city_x][city_y] = C_TILE_WORKER;
server/savegame.c:3695:
switch (pcity->city_map[x][y]) {
_______________________________________________
Freeciv-dev mailing list
[email protected]
https://mail.gna.org/listinfo/freeciv-dev