<URL: http://bugs.freeciv.org/Ticket/Display.html?id=40072 >

An interesting savegame -- it reproducibly demonstrates three different
bugs!  Two of which are detailed in the report.  In the savegame file,

Tenochtitlan:
   the city id (176) hasn't changed.
   originally owned by player1 "Aztec"
   currently owned by player1 "Aztec"
! Shown in Dutch territory!

   players 0, 2, 4 agree it's player1 "Aztec"

Teotitlan:
   the city id (209) hasn't changed.
   originally owned by player1 "Aztec"
   currently owned by player2 "Dutch"
   Shown in Dutch territory.

   players 1, 3, 4 agree it's player2 "Dutch"

! player0 thinks it's owned by player1 "Aztec"!

===

We've seen these problems in 2.1, because the the city itself has an owner
field, and the tiles have another owner field.  They should be the same.

The border code in 2.1 (and consequently 2.2) doesn't always update the
tile owner properly.  Ideally, we should eliminate the city->owner field,
and access the city->tile->owner instead.

I've already taken steps toward that goal, trying to ensure that everything
uses the city_owner() access function (see PR#39841 and others).

It was complicated by the use of virtual cities for AI calculations, so the
tile->owner needs to be saved and restored.  And the Editor has a NULL tile,
but the city->original owner field can be used instead.

===

The savegame.c:2800 code tries to fix inconsistent games.  This leads to
reality_check_city() and update_dumb_city().  I've straightened the logic in
update_dumb_city(), and added a bit more error checking.  Found a bug in
PR#39895, missing one crucial line: update_vision_site_from_city().

Now, player0 correctly lists Teotitlan as player2 "Dutch".

===

The third problem was only visible by loading the game in the server:

1: Tile at Middelburg->44,23 (city center) marked as empty but worked by 
Middelburg!
1: Tile at Tenochtitl?n->49,11 (city center) marked as empty but worked by 
Tenochtitl?n!
1: Tile at Chiauhtia->46,8 (city center) marked as empty but worked by 
Chiauhtia!
1: 46,8 is listed as being worked by Chiauhtia on the map, but Chiauhtia lists 
the tile 2,2 as having status 0
1: 49,11 is listed as being worked by Tenochtitl?n on the map, but Tenochtitl?n 
lists the tile 2,2 as having status 0
1: 44,23 is listed as being worked by Middelburg on the map, but Middelburg 
lists the tile 2,2 as having status 0

These are really two views of the same 3 savegame errors.  Working on it.



_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to