Freeciv-3.2
|
Go to the source code of this file.
Macros | |
#define | DAI_WANT_BELOW_MIL_EMERGENCY (1000.0) |
#define | DAI_WANT_MILITARY_EMERGENCY (DAI_WANT_BELOW_MIL_EMERGENCY + 0.1) |
#define | DAI_WANT_DOMESTIC_MAX (DAI_WANT_MILITARY_EMERGENCY / 4 * 3) |
#define DAI_WANT_DOMESTIC_MAX (DAI_WANT_MILITARY_EMERGENCY / 4 * 3) |
#define DAI_WANT_MILITARY_EMERGENCY (DAI_WANT_BELOW_MIL_EMERGENCY + 0.1) |
void adjust_choice | ( | int | pct, |
struct adv_choice * | choice | ||
) |
"The following evaluates the unhappiness caused by military units in the field (or aggressive) at a city when at Republic or Democracy. Now generalised somewhat for government rulesets, though I'm not sure whether it is fully general for all possible parameters/ combinations." –dwp
Definition at line 1417 of file aitools.c.
Referenced by find_something_to_kill(), and process_attacker_want().
void dai_build_adv_override | ( | struct ai_type * | ait, |
struct city * | pcity, | ||
struct adv_choice * | choice | ||
) |
Consider overriding building target selected by common advisor code.
Definition at line 1369 of file aitools.c.
Referenced by cai_build_adv_override(), and texwai_build_adv_override().
bool dai_choose_role_unit | ( | struct ai_type * | ait, |
struct player * | pplayer, | ||
struct city * | pcity, | ||
struct adv_choice * | choice, | ||
enum choice_type | type, | ||
int | role, | ||
int | want, | ||
bool | need_boat | ||
) |
Calls dai_wants_role_unit to choose the best unit with the given role and set tech wants. Sets choice->value.utype when we can build something.
Definition at line 1346 of file aitools.c.
Referenced by domestic_advisor_choose_build(), and kill_something_with().
void dai_consider_plr_dangerous | ( | struct ai_type * | ait, |
struct player * | plr1, | ||
struct player * | plr2, | ||
enum override_bool * | result | ||
) |
There are some signs that a player might be dangerous: We are at war with them, they have done lots of ignoble things to us, they are an ally of one of our enemies (a ticking bomb to be sure), they are our war target, we don't like them, diplomatic state is neutral or we have case fire. This function is used for example to check if pplayer can leave their city undefended when aplayer's units are near it.
Definition at line 142 of file aitools.c.
Referenced by cai_consider_plr_dangerous(), and texwai_consider_plr_dangerous().
void dai_fill_unit_param | ( | struct ai_type * | ait, |
struct pf_parameter * | parameter, | ||
struct adv_risk_cost * | risk_cost, | ||
struct unit * | punit, | ||
struct tile * | ptile | ||
) |
Set up the constraints on a path for an AI unit.
parameter: constraints (output) risk_cost: auxiliary data used by the constraints (output) ptile: the destination of the unit. For ferries, the destination may be a coastal land tile, in which case the ferry should stop on an adjacent tile.
Definition at line 470 of file aitools.c.
Referenced by dai_unit_goto().
Credits the AI wants to have in reserves. We need some gold to bribe and incite cities.
"I still don't trust this function" – Syela
Definition at line 1327 of file aitools.c.
Referenced by dai_diplomat_bribe_nearby(), dai_manage_taxes(), and dai_spend_gold().
bool dai_gothere | ( | struct ai_type * | ait, |
struct player * | pplayer, | ||
struct unit * | punit, | ||
struct tile * | dest_tile | ||
) |
This is ferry-enabled goto. Should not normally be used for non-ferried units (i.e. planes or ships), use dai_unit_goto instead.
Return values: TRUE if got to or next to our destination, FALSE otherwise.
TODO: A big one is rendezvous points. When this is implemented, we won't have to be at the coast to ask for a boat to come to us.
Definition at line 245 of file aitools.c.
Referenced by dai_auto_settler_run(), dai_caravan_goto(), dai_military_attack_barbarian(), dai_military_bodyguard(), and dai_military_defend().
void dai_government_change | ( | struct player * | pplayer, |
struct government * | gov | ||
) |
Change government, pretty fast...
Definition at line 1308 of file aitools.c.
Referenced by dai_manage_government().
Log the cost of travelling a path.
Definition at line 357 of file aitools.c.
Referenced by dai_unit_goto_constrained().
Move and attack with an ai unit. We do not wait for server reply.
Definition at line 818 of file aitools.c.
Referenced by dai_hunter_try_launch(), dai_military_attack(), and dai_unit_move_or_attack().
Go to specified destination but do not disturb existing role or activity and do not clear the role's destination. Return FALSE iff we died.
Definition at line 606 of file aitools.c.
Referenced by dai_caravan_goto(), dai_find_boat_for_unit(), dai_gothere(), dai_hunter_try_launch(), dai_manage_barbarian_leader(), dai_manage_hitpoint_recovery(), dai_manage_paratrooper(), dai_military_attack(), and search_homecity_for_caravan().
bool dai_unit_goto_constrained | ( | struct ai_type * | ait, |
struct unit * | punit, | ||
struct tile * | ptile, | ||
struct pf_parameter * | parameter | ||
) |
Go to specified destination, subject to given PF constraints, but do not disturb existing role or activity and do not clear the role's destination. Return FALSE iff we died.
parameter: the PF constraints on the computed path. The unit will move as far along the computed path is it can; the movement code will impose all the real constraints (ZoC, etc).
Definition at line 379 of file aitools.c.
Referenced by dai_unit_goto().
Try to make pcity our new homecity. Fails if we can't upkeep it. Assumes success from server.
Definition at line 756 of file aitools.c.
Referenced by search_homecity_for_caravan().
Move a unit. Do not attack. Do not leave bodyguard. For AI units.
This function returns only when we have a reply from the server and we can tell the calling function what happened to the move request. (Right now it is not a big problem, since we call the server directly.)
Definition at line 1085 of file aitools.c.
Referenced by dai_unit_bodyguard_move(), and dai_unit_move_or_attack().
void dai_unit_move_or_attack | ( | struct ai_type * | ait, |
struct unit * | punit, | ||
struct tile * | ptile, | ||
struct pf_path * | path, | ||
int | step | ||
) |
Ai unit moving function called from AI interface.
Definition at line 1067 of file aitools.c.
Referenced by cai_unit_move_or_attack(), and texwai_unit_move_or_attack().
void dai_unit_new_adv_task | ( | struct ai_type * | ait, |
struct unit * | punit, | ||
enum adv_unit_task | task, | ||
struct tile * | ptile | ||
) |
Adviser task for unit has been changed.
Definition at line 620 of file aitools.c.
Referenced by cai_unit_new_adv_task(), and texwai_unit_new_adv_task().
void dai_unit_new_task | ( | struct ai_type * | ait, |
struct unit * | punit, | ||
enum ai_unit_task | task, | ||
struct tile * | ptile | ||
) |
Ensure unit sanity by telling charge that we won't bodyguard it anymore, tell bodyguard it can roam free if our job is done, add and remove city spot reservation, and set destination. If we set a unit to hunter, also reserve its target, and try to load it with cruise missiles or nukes to bring along.
Definition at line 644 of file aitools.c.
Referenced by dai_auto_settler_run(), dai_diplomat_city(), dai_do_build_city(), dai_hunter_manage(), dai_manage_caravan(), dai_manage_diplomat(), dai_manage_hitpoint_recovery(), dai_manage_military(), dai_manage_unit(), dai_manage_units(), dai_military_bodyguard(), dai_military_findjob(), dai_set_defenders(), dai_unit_new_adv_task(), and dai_unit_new_task().
const char * dai_unit_task_rule_name | ( | const enum ai_unit_task | task | ) |
Return the (untranslated) rule name of the ai_unit_task. You don't have to free the return pointer.
Definition at line 77 of file aitools.c.
Referenced by dai_caravan_goto(), dai_manage_caravan(), and dai_unit_new_task().
Use pathfinding to determine whether a GOTO is possible, considering all aspects of the unit being moved and the terrain under consideration. Don't bother with pathfinding if the unit is already there.
Definition at line 430 of file aitools.c.
Referenced by dai_gothere(), dai_is_unit_tired_waiting_boat(), dai_manage_barbarian_leader(), dai_military_bodyguard(), and dai_unit_goto_constrained().
adv_want military_amortize | ( | struct player * | pplayer, |
struct city * | pcity, | ||
adv_want | value, | ||
int | delay, | ||
int | build_cost | ||
) |
Amortize a want modified by the shields (build_cost) we risk losing. We add the build time of the unit(s) we risk to amortize delay. The build time is calculated as the build cost divided by the production output of the unit's homecity or the city where we want to produce the unit. If the city has less than average shield output, we use the average instead, to encourage long-term thinking.
Definition at line 118 of file aitools.c.
Referenced by dai_choose_diplomat_offensive(), dai_evaluate_tile_for_air_attack(), find_something_to_kill(), and process_attacker_want().
Calculate the value of the target unit including the other units which will die in a successful attack
Definition at line 1282 of file aitools.c.
Referenced by dai_evaluate_tile_for_air_attack(), and dai_rampage_want().