Update of bug #19219 (project freeciv):

                  Status:                    None => Confirmed              
        Operating System:       Microsoft Windows => Any                    
         Planned Release:                         => 2.3.2                  

    _______________________________________________________

Follow-up Comment #11:

OK, I think I understand what's going on.

We're at the start of the game and the client hasn't yet got all the game
info -- I think the server has just started sending it cities
(send_all_known_cities()).

The client already knows some numeric city IDs -- the IDs of cities in which
the player has wonders ((struct player)->wonders[]), and the IDs of cities
that work tiles. "Invisible city" structures are created for the latter but
not the former; however, since the player should have knowledge of tiles
worked by all its own cities, invisible cities should cover all the city IDs
in the player's own wonders[] array.

When the client gets to num_continent_buildings() as part of processing the
first city sent to the client, it calls city_from_wonder() for Adam Smith.
This returns an invisible city, as the city we're processing the packet for is
not the one with Adam Smith.

Then it evaluates "if (pcity && tile_continent(pcity->tile) == continent)".
Had the invisible city not been created as a side effect of tile info, this
would have worked out fine (the income calculation would have proceeded as if
Adam Smith wasn't present, but this would be fixed up later). However, since
the invisible city exists, we attempt to dereference its tile and come a
cropper.

I think this would be fairly easy to band-aid: add a "pcity->tile" NULL check
in num_continent_buildings() (IMO this would be a better patch than the
current one floating around). However, I'm now worried about how many more
latent instances of this error we have. I suppose that auditing uses of
city_from_wonder() would be a good start and not too onerous.

    _______________________________________________________

Reply to this item at:

  <http://gna.org/bugs/?19219>

_______________________________________________
  Message sent via/by Gna!
  http://gna.org/


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

Reply via email to