Freeciv21
Develop your civilization from humble roots to a global empire
daicity.h File Reference
#include "effects.h"
#include "fc_types.h"
#include "advchoice.h"
+ Include dependency graph for daicity.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  ai_invasion
 
struct  ai_city
 

Macros

#define BUILDING_WAIT_MINIMUM   (1)
 

Functions

void dai_manage_cities (struct ai_type *ait, struct player *pplayer)
 One of the top level AI functions. More...
 
void dai_city_alloc (struct ai_type *ait, struct city *pcity)
 Initialize city for use with default AI. More...
 
void dai_city_free (struct ai_type *ait, struct city *pcity)
 Free city from use with default AI. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
void dai_build_adv_init (struct ai_type *ait, struct player *pplayer)
 Initialize building advisor. More...
 
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. More...
 
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? More...
 
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. More...
 
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. More...
 

Macro Definition Documentation

◆ BUILDING_WAIT_MINIMUM

#define BUILDING_WAIT_MINIMUM   (1)

Definition at line 36 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 1947 of file daicity.cpp.

Referenced by cai_build_adv_adjust(), texwai_build_adv_adjust(), and twai_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 1928 of file daicity.cpp.

Referenced by cai_build_adv_init(), texwai_build_adv_init(), and twai_build_adv_init().

◆ dai_city_alloc()

void dai_city_alloc ( struct ai_type ait,
struct city pcity 
)

Initialize city for use with default AI.

Definition at line 1129 of file daicity.cpp.

Referenced by cai_city_alloc(), and twai_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 1142 of file daicity.cpp.

Referenced by cai_city_free(), and twai_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 1185 of file daicity.cpp.

Referenced by cai_city_load(), texwai_city_load(), and twai_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 1157 of file daicity.cpp.

Referenced by cai_city_save(), texwai_city_save(), and twai_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 nullptr when nothing in the city has changed, and you just want to know the base want of a city.

Definition at line 1419 of file daicity.cpp.

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 2079 of file daicity.cpp.

Referenced by cai_consider_wonder_city(), texwai_consider_wonder_city(), and twai_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 2095 of file daicity.cpp.

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 861 of file daicity.cpp.

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 173 of file daicity.cpp.

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 152 of file daicity.cpp.

Referenced by adjust_improvement_wants_by_effects(), and adjust_wants_for_reqs().