Feature #2067 ยป 0036-Move-city.server.aarea-to-city.aarea.patch
| common/city.c | ||
|---|---|---|
|
pcity->routes = trade_route_list_new();
|
||
|
pcity->task_reqs = worker_task_list_new();
|
||
|
pcity->aarea = nullptr;
|
||
|
if (is_server()) {
|
||
|
pcity->server.mgr_score_calc_turn = -1; /* -1 = never */
|
||
| common/city.h | ||
|---|---|---|
|
struct cm_parameter *cm_parameter;
|
||
|
struct access_area *aarea;
|
||
|
union {
|
||
|
struct {
|
||
|
/* Only used in the server (./ai/ and ./server/). */
|
||
| ... | ... | |
|
void *ais[FREECIV_AI_MOD_LAST];
|
||
|
struct vision *vision;
|
||
|
struct access_area *aarea;
|
||
|
} server;
|
||
|
struct {
|
||
| common/requirements.c | ||
|---|---|---|
|
if (req->range == REQ_RANGE_CITY) {
|
||
|
if (context->city == nullptr
|
||
|
|| context->city->server.aarea == nullptr) {
|
||
|
|| context->city->aarea == nullptr) {
|
||
|
return TRI_MAYBE;
|
||
|
}
|
||
|
if (BV_ISSET(context->city->server.aarea->tiledefs,
|
||
|
if (BV_ISSET(context->city->aarea->tiledefs,
|
||
|
tiledef_index(req->source.value.tiledef))) {
|
||
|
return TRI_YES;
|
||
|
}
|
||
| ... | ... | |
|
switch (req->range) {
|
||
|
case REQ_RANGE_CITY:
|
||
|
return BOOL_TO_TRISTATE(context->city->server.aarea != nullptr
|
||
|
&& context->city->server.aarea->capital);
|
||
|
return BOOL_TO_TRISTATE(context->city->aarea != nullptr
|
||
|
&& context->city->aarea->capital);
|
||
|
case REQ_RANGE_TRADE_ROUTE:
|
||
|
{
|
||
|
enum fc_tristate ret;
|
||
|
if (context->city->server.aarea != nullptr
|
||
|
&& context->city->server.aarea->capital) {
|
||
|
if (context->city->aarea != nullptr
|
||
|
&& context->city->aarea->capital) {
|
||
|
return TRI_YES;
|
||
|
}
|
||
| ... | ... | |
|
trade_partners_iterate(context->city, trade_partner) {
|
||
|
if (trade_partner == nullptr) {
|
||
|
ret = TRI_MAYBE;
|
||
|
} else if (trade_partner->server.aarea != nullptr
|
||
|
&& trade_partner->server.aarea->capital) {
|
||
|
} else if (trade_partner->aarea != nullptr
|
||
|
&& trade_partner->aarea->capital) {
|
||
|
return TRI_YES;
|
||
|
}
|
||
|
} trade_partners_iterate_end;
|
||
| server/aahand.c | ||
|---|---|---|
|
area_list_for_player_set(plr, alist);
|
||
|
city_list_iterate(plr->cities, pcity) {
|
||
|
pcity->server.aarea = nullptr;
|
||
|
pcity->aarea = nullptr;
|
||
|
} city_list_iterate_end;
|
||
|
access_unit = unit_virtual_create(plr, nullptr,
|
||
| ... | ... | |
|
packet.player = player_number(plr);
|
||
|
city_list_iterate(plr->cities, pcity) {
|
||
|
if (pcity->server.aarea == nullptr) {
|
||
|
if (pcity->aarea == nullptr) {
|
||
|
struct access_area *aarea = fc_malloc(sizeof(struct access_area));
|
||
|
struct pf_parameter parameter;
|
||
|
struct pf_map *pfm;
|
||
| ... | ... | |
|
aarea->cities = city_list_new();
|
||
|
aarea->capital = is_capital(pcity);
|
||
|
pcity->server.aarea = aarea;
|
||
|
pcity->aarea = aarea;
|
||
|
city_list_append(aarea->cities, pcity);
|
||
|
aarea_list_append(alist, aarea);
|
||
| ... | ... | |
|
pfm = pf_map_new(¶meter);
|
||
|
city_list_iterate(plr->cities, pcity2) {
|
||
|
if (pcity2->server.aarea == nullptr) {
|
||
|
if (pcity2->aarea == nullptr) {
|
||
|
struct pf_path *path;
|
||
|
path = pf_map_path(pfm, city_tile(pcity2));
|
||
|
if (path != nullptr) {
|
||
|
pcity2->server.aarea = aarea;
|
||
|
pcity2->aarea = aarea;
|
||
|
city_list_append(aarea->cities, pcity2);
|
||
|
if (!aarea->capital && is_capital(pcity2)) {
|
||