Feature #2130 ยป 0053-Send-city-aarea-information-to-client.patch
| client/packhand.c | ||
|---|---|---|
|
aarea_list_append(alist, aarea);
|
||
|
}
|
||
|
/**********************************************************************//**
|
||
|
Handle city access area packet.
|
||
|
**************************************************************************/
|
||
|
void handle_city_access_area(const struct packet_city_access_area *packet)
|
||
|
{
|
||
|
struct city *pcity = game_city_by_number(packet->city);
|
||
|
struct player *plr;
|
||
|
struct aarea_list *alist;
|
||
|
if (pcity == nullptr) {
|
||
|
log_warn("handle_city_access_area() received illegal city");
|
||
|
return;
|
||
|
}
|
||
|
plr = city_owner(pcity);
|
||
|
/* Currently we support only packets about our own cities. */
|
||
|
fc_assert(plr == client_player());
|
||
|
alist = area_list_for_player(plr);
|
||
|
aarea_list_iterate(alist, aarea) {
|
||
|
if (aarea->index == packet->aarea) {
|
||
|
fc_assert(pcity->aarea == nullptr);
|
||
|
pcity->aarea = aarea;
|
||
|
break;
|
||
|
}
|
||
|
} aarea_list_iterate_end;
|
||
|
}
|
||
| common/networking/packets.def | ||
|---|---|---|
|
Max used id:
|
||
|
============
|
||
|
Max id: 521
|
||
|
Max id: 522
|
||
|
Packets are not ordered by their id, but by their category. New packet
|
||
|
with higher id may get added to existing category, and not to the end of file.
|
||
| ... | ... | |
|
BV_TILEDEFS tiledefs;
|
||
|
end
|
||
|
PACKET_CITY_ACCESS_AREA = 522; sc, lsend
|
||
|
CITY city;
|
||
|
UINT16 aarea;
|
||
|
end
|
||
|
/*************** Webclient specific packets ****************/
|
||
|
/* Use range 256:511 for these */
|
||
| server/aahand.c | ||
|---|---|---|
|
packet.player = player_number(plr);
|
||
|
city_list_iterate(plr->cities, pcity) {
|
||
|
struct packet_city_access_area caarea_packet;
|
||
|
if (pcity->aarea == nullptr) {
|
||
|
struct access_area *aarea = fc_malloc(sizeof(struct access_area));
|
||
|
struct pf_parameter parameter;
|
||
| ... | ... | |
|
lsend_packet_access_area(plr->connections, &packet);
|
||
|
}
|
||
|
caarea_packet.city = pcity->id;
|
||
|
caarea_packet.aarea = pcity->aarea->index;
|
||
|
lsend_packet_city_access_area(plr->connections, &caarea_packet);
|
||
|
} city_list_iterate_end;
|
||
|
unit_virtual_destroy(access_unit);
|
||