Freeciv-3.3
|
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_BELOW_MIL_EMERGENCY (1000.0) |
Definition at line 31 of file daitools.h.
#define DAI_WANT_DOMESTIC_MAX (DAI_WANT_MILITARY_EMERGENCY / 4 * 3) |
Definition at line 33 of file daitools.h.
#define DAI_WANT_MILITARY_EMERGENCY (DAI_WANT_BELOW_MIL_EMERGENCY + 0.1) |
Definition at line 32 of file daitools.h.
void adjust_choice | ( | int | pct, |
struct adv_choice * | choice | ||
) |
Adjust want for choice to given percentage.
Definition at line 1336 of file daitools.c.
"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 1416 of file daitools.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 1368 of file daitools.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 1345 of file daitools.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 141 of file daitools.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 469 of file daitools.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 1326 of file daitools.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 244 of file daitools.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 1307 of file daitools.c.
Referenced by dai_manage_government().
Log the cost of travelling a path.
Definition at line 356 of file daitools.c.
Referenced by dai_unit_goto_constrained().
Move and attack with an ai unit. We do not wait for server reply.
Definition at line 817 of file daitools.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 605 of file daitools.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 378 of file daitools.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 755 of file daitools.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 1084 of file daitools.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 1066 of file daitools.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 619 of file daitools.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 643 of file daitools.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 76 of file daitools.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 429 of file daitools.c.
Referenced by dai_gothere(), dai_is_unit_tired_waiting_boat(), dai_manage_barbarian_leader(), dai_military_bodyguard(), and dai_unit_goto_constrained().
Returns the destination for a unit moving towards a given final destination. That is, it gives a suitable way-point, if necessary. For example, aircraft need these way-points to refuel.
Definition at line 302 of file daitools.c.
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 117 of file daitools.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 1281 of file daitools.c.
Referenced by dai_evaluate_tile_for_air_attack(), and dai_rampage_want().