56 pcity->server.adv->downtown = 0;
73 "Non existence of wonder helper unit not caught");
82 struct adv_city *city_data = pcity->server.adv;
93 if (move_cost >
range) {
142 if (pcity != wonder_city &&
is_wonder(pimprove)) {
145 }
else if (!is_coinage
198 if (wonder_city &&
city_owner(wonder_city) != pplayer) {
200 adv->wonder_city = 0;
201 wonder_city =
nullptr;
215 int best_candidate_value = 0;
216 struct city *best_candidate =
nullptr;
225 int value = pcity->surplus[
O_SHIELD];
227 struct adv_city *city_data = pcity->server.adv;
229 if (
is_ai(pplayer)) {
260 if (value > best_candidate_value
261 && (!has_help || (place >= 0 && adv->
stats.
cities[place] > 5))
262 && (!has_help || city_data->
downtown > 3)) {
263 best_candidate = pcity;
264 best_candidate_value = value;
268 if (best_candidate) {
271 wonder_city = best_candidate;
275 if (
is_ai(pplayer)) {
333 .kind = VUT_IMPROVEMENT};
343 && pimprove->genus != IG_SMALL_WONDER) {
345 .kind = VUT_IMPROVEMENT};
#define action_id_get_role(act_id)
static void calculate_city_clusters(struct player *pplayer)
Calculate walking distance to nearest friendly cities from every city.
void building_advisor(struct player *pplayer)
Prime pcity->server.adv.building_want[].
static void ba_human_wants(struct player *pplayer, struct city *wonder_city)
Set building wants for human player.
void building_advisor_choose(struct city *pcity, struct adv_choice *choice)
Choose improvement we like most and put it into adv_choice.
void advisor_choose_build(struct player *pplayer, struct city *pcity)
Setup improvement building.
struct adv_data * adv_data_get(struct player *pplayer, bool *caller_closes)
Return a pointer to our data.
#define CALL_FUNC_EACH_AI(_func,...)
#define CALL_PLR_AI_FUNC(_func, _player,...)
bool city_has_building(const struct city *pcity, const struct impr_type *pimprove)
Return TRUE iff the city has this building in it.
struct player * city_owner(const struct city *pcity)
Return the owner of the city.
bool can_city_build_improvement_now(const struct city *pcity, const struct impr_type *pimprove)
Return whether given city can build given building; returns FALSE if the building is obsolete.
bool can_city_build_improvement_later(const struct city *pcity, const struct impr_type *pimprove)
Return whether player can eventually build given building in the city; returns FALSE if improvement c...
#define city_list_iterate(citylist, pcity)
#define city_list_iterate_end
signed short Continent_id
struct city * game_city_by_number(int id)
Often used function to get a city pointer from a city ID.
bool has_handicap(const struct player *pplayer, enum handicap_type htype)
AI players may have handicaps - allowing them to cheat or preventing them from using certain algorith...
const char * improvement_rule_name(const struct impr_type *pimprove)
Return the (untranslated) rule name of the improvement.
bool can_player_build_improvement_later(const struct player *p, const struct impr_type *pimprove)
Whether player can eventually build given building somewhere – i.e., returns TRUE if building is avai...
const struct impr_type * valid_improvement(const struct impr_type *pimprove)
Returns pointer when the improvement_type "exists" in this game, returns nullptr otherwise.
Impr_type_id improvement_index(const struct impr_type *pimprove)
Return the improvement index.
bool is_wonder(const struct impr_type *pimprove)
Returns whether improvement is some kind of wonder.
bool improvement_has_flag(const struct impr_type *pimprove, enum impr_flag_id flag)
Return TRUE if the impr has this flag otherwise FALSE.
bool is_improvement_productive(const struct city *pcity, const struct impr_type *pimprove)
Returns TRUE if an improvement in a city is productive, in some way.
#define improvement_iterate_end
#define improvement_iterate(_p)
#define fc_assert_msg(condition, message,...)
int unit_move_rate(const struct unit *punit)
This function calculates the move rate of the unit.
struct pf_map * pf_map_new(const struct pf_parameter *parameter)
Factory function to create a new map according to the parameter.
void pf_map_destroy(struct pf_map *pfm)
After usage the map must be destroyed.
#define pf_map_move_costs_iterate_end
#define pf_map_move_costs_iterate(ARG_pfm, NAME_tile, NAME_cost, COND_from_start)
#define CITY_LOG(_, pcity, msg,...)
struct adv_data::@85 threats
struct adv_data::@87 stats
struct universal production
struct city::@15::@17 server
struct city_list * cities
bool is_terrain_class_near_tile(const struct tile *ptile, enum terrain_class tclass)
Is there terrain of the given class near tile? (Does not check ptile itself.)
struct city * tile_city(const struct tile *ptile)
Return the city on this tile (or nullptr), checking for city center.
#define tile_continent(_tile)
const struct impr_type * building
void unit_virtual_destroy(struct unit *punit)
Free the memory used by virtual unit.
struct unit * unit_virtual_create(struct player *pplayer, struct city *pcity, const struct unit_type *punittype, int veteran_level)
Create a virtual unit skeleton.
void unit_tile_set(struct unit *punit, struct tile *ptile)
Set the tile location of the unit.
struct unit_type * best_role_unit_for_player(const struct player *pplayer, int role)
Return "best" unit the player can build, with given role/flag.
int num_role_units(int role)
How many unit types have specified role/flag.
struct unit_type * get_role_unit(int role, int role_index)
Return index-th unit with specified role/flag.
struct unit_type * first_role_unit_for_player(const struct player *pplayer, int role)
Return first unit the player can build, with given role/flag.
bool utype_can_do_action(const struct unit_type *putype, const action_id act_id)
Return TRUE iff units of the given type can do the specified generalized (ruleset defined) action ena...