[Freeciv-Dev] assertion in package_dump_city (PR#1288)
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Player A gives tile info to player B
A thinks that there is a city on that tile. The city has been destroyed.
B doesn't know that tile.
In that case assertion in package_dumb_city is incorrect.
Attached patch fixes it.
====maphand 1120: (really_give_tile_info_from_player)
if ((from_city = from_tile->city) && (dest_city = dest_tile->city)) {
dest_city->id = from_city->id;
sz_strlcpy(dest_city->name, from_city->name);
dest_city->size = from_city->size;
dest_city->has_walls = from_city->has_walls;
dest_city->owner = from_city->owner;
send_city_info_at_tile(pdest, &pdest->connections, NULL, x, y);
}
citytools.c 1508: (send_city_info_at_tile)
} else { /* not seen; send old info */
pdcity = map_get_player_tile(x, y, pviewer)->city;
if (pdcity) {
package_dumb_city(pviewer, x, y, &sc_pack);
lsend_packet_short_city(dest, &sc_pack);
}
citytools.c 1307:
static void package_dumb_city(struct player* pplayer, int x, int y,
struct packet_short_city *packet)
{
struct dumb_city *pdcity = map_get_player_tile(x, y, pplayer)->city;
struct city *pcity = map_get_city(x, y);
assert(pcity != NULL);
packet->id=pdcity->id;
packet->owner=pdcity->owner;
packet->x=x;
packet->y=y;
sz_strlcpy(packet->name, pdcity->name);
packet->size=pdcity->size;
if (map_get_known_and_seen(x, y, pplayer)) {
/* Since the tile is visible the player can see the tile,
and if it didn't actually have a city pdcity would be NULL */
packet->happy = !city_unhappy(pcity);
} else {
packet->happy = TRUE;
}
if (pcity->id == pdcity->id && city_got_building(pcity, B_PALACE))
packet->capital = TRUE;
else
packet->capital = FALSE;
packet->walls = pdcity->has_walls;
if (player_has_traderoute_with_city(pplayer, pcity)) {
packet->tile_trade = pcity->tile_trade;
} else {
packet->tile_trade = 0;
}
}
===mateusz
give_tile_info_bug.diff
Description: Binary data
- [Freeciv-Dev] assertion in package_dump_city (PR#1288),
mateusz stefek <=
|
|