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

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)
 Choose the best unit the city can build to defend against attacker v. More...
 
struct adv_choicemilitary_advisor_choose_build (struct ai_type *ait, struct player *pplayer, struct city *pcity, const struct civ_map *mamap, player_unit_list_getter ul_cb)
 This function selects either a defender or an attacker to be built. More...
 
void dai_assess_danger_player (struct ai_type *ait, struct player *pplayer, const struct civ_map *dmap)
 Call assess_danger() for all cities owned by pplayer. More...
 
int assess_defense_quadratic (struct ai_type *ait, struct city *pcity)
 Need positive feedback in m_a_c_b and bodyguard routines. More...
 
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. More...
 
int assess_defense (struct ai_type *ait, struct city *pcity)
 Estimate defense strength of city. More...
 
int dai_unit_defence_desirability (struct ai_type *ait, const struct unit_type *punittype)
 How much we would want that unit to defend a city? (Do not use this function to find bodyguards for ships or air units.) More...
 
int dai_unit_attack_desirability (struct ai_type *ait, const struct unit_type *punittype)
 How much we would want that unit to attack with? More...
 
bool dai_process_defender_want (struct ai_type *ait, struct player *pplayer, struct city *pcity, int danger, struct adv_choice *choice)
 What would be the best defender for that city? Records the best defender type in choice. More...
 

Macro Definition Documentation

◆ FINISH_HIM_CITY_COUNT

#define FINISH_HIM_CITY_COUNT   5

Definition at line 24 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 333 of file daimilitary.cpp.

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 262 of file daimilitary.cpp.

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 300 of file daimilitary.cpp.

Referenced by assess_defense_backend(), and dai_set_defenders().

◆ dai_assess_danger_player()

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

Call assess_danger() for all cities owned by pplayer.

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

Definition at line 415 of file daimilitary.cpp.

Referenced by cai_split_by_civil_war(), dai_do_first_activities(), dai_gained_control(), texwai_split_by_civil_war(), and twai_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 72 of file daimilitary.cpp.

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,
struct player pplayer,
struct city pcity,
int  danger,
struct adv_choice choice 
)

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 767 of file daimilitary.cpp.

Referenced by dai_city_choose_build(), and military_advisor_choose_build().

◆ dai_unit_attack_desirability()

int dai_unit_attack_desirability ( struct ai_type ait,
const struct unit_type punittype 
)

How much we would want that unit to attack with?

Definition at line 733 of file daimilitary.cpp.

Referenced by dai_choose_attacker().

◆ dai_unit_defence_desirability()

int dai_unit_defence_desirability ( struct ai_type ait,
const struct unit_type punittype 
)

How much we would want that unit to defend a city? (Do not use this function to find bodyguards for ships or air units.)

Definition at line 697 of file daimilitary.cpp.

Referenced by dai_choose_bodyguard(), and dai_process_defender_want().

◆ military_advisor_choose_build()

struct adv_choice* military_advisor_choose_build ( struct ai_type ait,
struct player pplayer,
struct city pcity,
const struct civ_map mamap,
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 1454 of file daimilitary.cpp.

Referenced by dai_manage_cities().