Freeciv-3.2
Loading...
Searching...
No Matches
Macros | Typedefs | Functions
daimilitary.h File Reference
#include "fc_types.h"
#include "unittype.h"
#include "advchoice.h"

Go to the source code of this file.

Macros

#define FINISH_HIM_CITY_COUNT   5
 

Typedefs

typedef struct unit_list *() player_unit_list_getter(struct player *pplayer)
 

Functions

struct unit_typedai_choose_defender_versus (struct city *pcity, struct unit *attacker)
 
struct adv_choicemilitary_advisor_choose_build (struct ai_type *ait, const struct civ_map *nmap, struct player *pplayer, struct city *pcity, player_unit_list_getter ul_cb)
 
void dai_assess_danger_player (struct ai_type *ait, const struct civ_map *nmap, struct player *pplayer)
 
int assess_defense_quadratic (struct ai_type *ait, struct city *pcity)
 
int assess_defense_unit (struct ai_type *ait, struct city *pcity, struct unit *punit, bool igwall)
 
int assess_defense (struct ai_type *ait, struct city *pcity)
 
bool dai_process_defender_want (struct ai_type *ait, const struct civ_map *nmap, struct player *pplayer, struct city *pcity, unsigned int danger, struct adv_choice *choice, adv_want extra_want)
 

Macro Definition Documentation

◆ FINISH_HIM_CITY_COUNT

#define FINISH_HIM_CITY_COUNT   5

Definition at line 32 of file daimilitary.h.

Typedef Documentation

◆ player_unit_list_getter

typedef struct unit_list *() player_unit_list_getter(struct player *pplayer)

Definition at line 1 of file daimilitary.h.

Function Documentation

◆ assess_defense()

int assess_defense ( struct ai_type ait,
struct city pcity 
)

Estimate defense strength of city

Definition at line 345 of file daimilitary.c.

Referenced by dai_spend_gold(), and kill_something_with().

◆ assess_defense_quadratic()

int assess_defense_quadratic ( struct ai_type ait,
struct city pcity 
)

Need positive feedback in m_a_c_b and bodyguard routines. – Syela

Definition at line 281 of file daimilitary.c.

Referenced by dai_city_choose_build(), dai_military_findjob(), look_for_charge(), and military_advisor_choose_build().

◆ assess_defense_unit()

int assess_defense_unit ( struct ai_type ait,
struct city pcity,
struct unit punit,
bool  igwall 
)

One unit only, mostly for findjob; handling boats correctly. 980803 – Syela

Definition at line 315 of file daimilitary.c.

Referenced by assess_defense_backend(), and dai_set_defenders().

◆ dai_assess_danger_player()

void dai_assess_danger_player ( struct ai_type ait,
const struct civ_map nmap,
struct player pplayer 
)

Call assess_danger() for all cities owned by pplayer.

This is necessary to initialize some ai data before some ai calculations.

Definition at line 634 of file daimilitary.c.

Referenced by cai_split_by_civil_war(), dai_do_first_activities(), dai_gained_control(), and texwai_split_by_civil_war().

◆ dai_choose_defender_versus()

struct unit_type * dai_choose_defender_versus ( struct city pcity,
struct unit attacker 
)

Choose the best unit the city can build to defend against attacker v.

Definition at line 91 of file daimilitary.c.

Referenced by dai_gothere_bodyguard(), find_something_to_kill(), and kill_something_with().

◆ dai_process_defender_want()

bool dai_process_defender_want ( struct ai_type ait,
const struct civ_map nmap,
struct player pplayer,
struct city pcity,
unsigned int  danger,
struct adv_choice choice,
adv_want  extra_want 
)

What would be the best defender for that city? Records the best defender type in choice. Also sets the technology want for the units we can't build yet.

Definition at line 1057 of file daimilitary.c.

Referenced by dai_city_choose_build(), and military_advisor_choose_build().

◆ military_advisor_choose_build()

struct adv_choice * military_advisor_choose_build ( struct ai_type ait,
const struct civ_map nmap,
struct player pplayer,
struct city pcity,
player_unit_list_getter  ul_cb 
)

This function selects either a defender or an attacker to be built. It records its choice into adv_choice struct. If 'choice->want' is 0 this advisor doesn't want anything.

Definition at line 1779 of file daimilitary.c.

Referenced by dai_manage_cities(), and texai_check_messages().