Freeciv-3.3
Loading...
Searching...
No Matches
Data Structures | Macros | Functions
daicity.h File Reference
#include "effects.h"
#include "fc_types.h"
#include "advchoice.h"

Go to the source code of this file.

Data Structures

struct  ai_invasion
 
struct  ai_city
 

Macros

#define BUILDING_WAIT_MINIMUM   (1)
 

Functions

void dai_manage_cities (struct ai_type *ait, struct player *pplayer)
 
void dai_city_alloc (struct ai_type *ait, struct city *pcity)
 
void dai_city_free (struct ai_type *ait, struct city *pcity)
 
void dai_city_save (struct ai_type *ait, const char *aitstr, struct section_file *file, const struct city *pcity, const char *citystr)
 
void dai_city_load (struct ai_type *ait, const char *aitstr, const struct section_file *file, struct city *pcity, const char *citystr)
 
void want_techs_for_improvement_effect (struct ai_type *ait, struct player *pplayer, const struct city *pcity, const struct impr_type *pimprove, struct tech_vector *needed_techs, adv_want building_want)
 
void dont_want_tech_obsoleting_impr (struct ai_type *ait, struct player *pplayer, const struct city *pcity, const struct impr_type *pimprove, adv_want building_want)
 
void dai_build_adv_init (struct ai_type *ait, struct player *pplayer)
 
void dai_build_adv_adjust (struct ai_type *ait, struct player *pplayer, struct city *wonder_city)
 
void dai_consider_wonder_city (struct ai_type *ait, struct city *pcity, bool *result)
 
bool dai_can_city_build_improvement_later (const struct city *pcity, const struct impr_type *pimprove)
 
bool dai_can_player_build_improvement_later (const struct player *p, const struct impr_type *pimprove)
 
Impr_type_id dai_find_source_building (struct city *pcity, enum effect_type effect_type, const struct unit_type *utype)
 
adv_want dai_city_want (struct player *pplayer, struct city *acity, struct adv_data *adv, struct impr_type *pimprove)
 

Macro Definition Documentation

◆ BUILDING_WAIT_MINIMUM

#define BUILDING_WAIT_MINIMUM   (1)

Definition at line 39 of file daicity.h.

Function Documentation

◆ dai_build_adv_adjust()

void dai_build_adv_adjust ( struct ai_type ait,
struct player pplayer,
struct city wonder_city 
)

Calculate how much an AI player should want to build particular improvements, because of the effects of those improvements, and increase the want for technologies that will enable buildings with desirable effects.

Definition at line 1949 of file daicity.c.

Referenced by cai_build_adv_adjust(), and texwai_build_adv_adjust().

◆ dai_build_adv_init()

void dai_build_adv_init ( struct ai_type ait,
struct player pplayer 
)

Initialize building advisor. Calculates data of all players, not only of those controlled by current ai type.

Definition at line 1933 of file daicity.c.

Referenced by cai_build_adv_init(), and texwai_build_adv_init().

◆ dai_can_city_build_improvement_later()

bool dai_can_city_build_improvement_later ( const struct city pcity,
const struct impr_type pimprove 
)

Whether AI expects to be ever able to build given building in the city

Definition at line 2094 of file daicity.c.

Referenced by should_force_recalc().

◆ dai_can_player_build_improvement_later()

bool dai_can_player_build_improvement_later ( const struct player p,
const struct impr_type pimprove 
)

Whether AI expects to be ever able to build given building

Definition at line 2124 of file daicity.c.

Referenced by dai_can_city_build_improvement_later().

◆ dai_city_alloc()

void dai_city_alloc ( struct ai_type ait,
struct city pcity 
)

Initialize city for use with default AI.

Definition at line 1112 of file daicity.c.

Referenced by cai_city_alloc().

◆ dai_city_free()

void dai_city_free ( struct ai_type ait,
struct city pcity 
)

Free city from use with default AI.

Definition at line 1125 of file daicity.c.

Referenced by cai_city_free().

◆ dai_city_load()

void dai_city_load ( struct ai_type ait,
const char aitstr,
const struct section_file file,
struct city pcity,
const char citystr 
)

Load ai city segment from savefile

Definition at line 1166 of file daicity.c.

Referenced by cai_city_load(), and texwai_city_load().

◆ dai_city_save()

void dai_city_save ( struct ai_type ait,
const char aitstr,
struct section_file file,
const struct city pcity,
const char citystr 
)

Write ai city segments to savefile

Definition at line 1139 of file daicity.c.

Referenced by cai_city_save(), and texwai_city_save().

◆ dai_city_want()

adv_want dai_city_want ( struct player pplayer,
struct city acity,
struct adv_data adv,
struct impr_type pimprove 
)

Calculates city want from some input values. Set pimprove to NULL when nothing in the city has changed, and you just want to know the base want of a city.

Definition at line 1426 of file daicity.c.

Referenced by base_want(), dai_adjust_policies(), dai_build_adv_init(), dai_gov_value(), and dai_tech_base_want().

◆ dai_consider_wonder_city()

void dai_consider_wonder_city ( struct ai_type ait,
struct city pcity,
bool result 
)

Is it ok for advisor code to consider given city as wonder city?

Definition at line 2060 of file daicity.c.

Referenced by cai_consider_wonder_city(), and texwai_consider_wonder_city().

◆ dai_find_source_building()

Impr_type_id dai_find_source_building ( struct city pcity,
enum effect_type  effect_type,
const struct unit_type utype 
)

Returns a buildable, non-obsolete building that can provide the effect.

Note: this function is an inefficient hack to be used by the old AI. It will never find wonders, since that's not what the AI wants.

Definition at line 2160 of file daicity.c.

Referenced by adjust_ai_unit_choice(), assess_danger(), and military_advisor_choose_build().

◆ dai_manage_cities()

void dai_manage_cities ( struct ai_type ait,
struct player pplayer 
)

One of the top level AI functions. It does (by calling other functions): worker allocations, build choices, extra gold spending.

Definition at line 852 of file daicity.c.

Referenced by dai_do_last_activities().

◆ dont_want_tech_obsoleting_impr()

void dont_want_tech_obsoleting_impr ( struct ai_type ait,
struct player pplayer,
const struct city pcity,
const struct impr_type pimprove,
adv_want  building_want 
)

Decrease want for a technology because of the value of that technology in obsoleting an improvement effect.

Definition at line 178 of file daicity.c.

Referenced by adjust_improvement_wants_by_effects().

◆ want_techs_for_improvement_effect()

void want_techs_for_improvement_effect ( struct ai_type ait,
struct player pplayer,
const struct city pcity,
const struct impr_type pimprove,
struct tech_vector needed_techs,
adv_want  building_want 
)

Increase want for a technologies because of the value of that technology in providing an improvement effect.

Definition at line 157 of file daicity.c.

Referenced by adjust_improvement_wants_by_effects(), and adjust_wants_for_reqs().