[Freeciv-Dev] (PR#6260) server bug: city tile status
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Here's the general situation:
- I conquer a city.
- In transfer_city, update_city_tile_status_map is called for every tile
of the city.
- Update_city_tile_status_map calls update_city_tile_status.
- For any tile that is changed from WORKER to UNAVAILABLE,
auto_arrange_workers is called. Note that WORKER means the city was
being worked before I conquered it (e.g., by its previous owner),
whereas UNAVAILABLE means it is not available to _me_.
- auto_arrange_workers runs on the city. But remember the city tile
status hasn't been fully updated yet, since we didn't make it all the
way through the loop.
- In auto_arrange_workers, the CM chooses positions for all workers
based on the city tile status map (which is not up-to-date).
- auto_arrange_workers calls server_set_worker_city for some tile that
claims to be WORKER but is actually unavailable.
- server_set_worker_city calls server_set_tile_city to change the tile
to WORKER.
- server_set_tile_city calls update_city_tile_status for that same tile
for an adjacent city.
- update_city_tile_status calls server_set_tile_city. This enemy sees
that the tile is worked by our city, and doesn't (I think) know that I
am not allowed to work that tile. So I think it sets the tile status to
UNAVAILABLE.
- This then calls update_city_tile_status on the original city.
- We now find that the correct status for this tile is UNAVAILABLE, and
change it to that from WORKER. This invokes a re-entrant call to
auto_arrange_workers.
- At this point the city status map is in an inconsistent state, and
auto_arrange_workers barfs.
This is part of a general problem whereby auto_arrange_workers is called
about 10 times for each conquered city.
jason
|
|