Freeciv21
Develop your civilization from humble roots to a global empire
aitools.h
Go to the documentation of this file.
1
/**************************************************************************
2
Copyright (c) 1996-2020 Freeciv21 and Freeciv contributors. This file is
3
__ __ part of Freeciv21. Freeciv21 is free software: you can
4
/ \\..// \ redistribute it and/or modify it under the terms of the GNU
5
( oo ) General Public License as published by the Free Software
6
\__/ Foundation, either version 3 of the License, or (at your
7
option) any later version. You should have received
8
a copy of the GNU General Public License along with Freeciv21. If not,
9
see https://www.gnu.org/licenses/.
10
**************************************************************************/
11
#pragma once
12
13
// utility
14
#include "
support.h
"
// bool type
15
16
// common
17
#include "
fc_types.h
"
18
#include "
unit.h
"
// enum ai_unit_task
19
20
/* server/advisors */
21
#include "
advgoto.h
"
22
23
/* ai/default */
24
#include "
aiunit.h
"
25
#include "
daicity.h
"
26
27
class
PFPath
;
28
struct
pf_parameter
;
29
struct
pft_amphibious
;
30
31
const
char
*
dai_unit_task_rule_name
(
const
enum
ai_unit_task
task);
32
const
char
*
dai_choice_rule_name
(
const
struct
adv_choice
*choice);
33
34
int
military_amortize
(
struct
player
*pplayer,
struct
city
*pcity,
int
value,
35
int
delay,
int
build_cost);
36
int
stack_cost
(
struct
unit
*pattacker,
struct
unit
*pdefender);
37
38
void
dai_unit_move_or_attack
(
ai_type
*ait,
unit
*punit,
tile
*ptile,
39
const
PFPath
&path,
int
step
);
40
41
void
dai_fill_unit_param
(
struct
ai_type
*ait,
struct
pf_parameter
*parameter,
42
struct
adv_risk_cost
*risk_cost,
struct
unit
*punit,
43
struct
tile
*ptile);
44
bool
dai_gothere
(
struct
ai_type
*ait,
struct
player
*pplayer,
45
struct
unit
*punit,
struct
tile
*dst_tile);
46
struct
tile
*
immediate_destination
(
struct
unit
*punit,
47
struct
tile
*dest_tile);
48
void
dai_log_path
(
struct
unit
*punit,
const
PFPath
&path,
49
struct
pf_parameter
*parameter);
50
bool
dai_unit_goto_constrained
(
struct
ai_type
*ait,
struct
unit
*punit,
51
struct
tile
*ptile,
52
struct
pf_parameter
*parameter);
53
bool
dai_unit_goto
(
struct
ai_type
*ait,
struct
unit
*punit,
54
struct
tile
*ptile);
55
bool
goto_is_sane
(
struct
unit
*punit,
struct
tile
*ptile);
56
57
void
dai_unit_new_task
(
struct
ai_type
*ait,
struct
unit
*punit,
58
enum
ai_unit_task
task,
struct
tile
*ptile);
59
void
dai_unit_new_adv_task
(
struct
ai_type
*ait,
struct
unit
*punit,
60
enum
adv_unit_task
task,
struct
tile
*ptile);
61
bool
dai_unit_make_homecity
(
struct
unit
*punit,
struct
city
*pcity);
62
bool
dai_unit_attack
(
struct
ai_type
*ait,
struct
unit
*punit,
63
struct
tile
*ptile);
64
bool
dai_unit_move
(
struct
ai_type
*ait,
struct
unit
*punit,
65
struct
tile
*ptile);
66
67
void
dai_government_change
(
struct
player
*pplayer,
struct
government
*gov);
68
int
dai_gold_reserve
(
struct
player
*pplayer);
69
70
bool
dai_choose_role_unit
(
struct
ai_type
*ait,
struct
player
*pplayer,
71
struct
city
*pcity,
struct
adv_choice
*choice,
72
enum
choice_type
type,
int
role,
int
want,
73
bool
need_boat);
74
void
dai_build_adv_override
(
struct
ai_type
*ait,
struct
city
*pcity,
75
struct
adv_choice
*choice);
76
bool
dai_assess_military_unhappiness
(
struct
city
*pcity);
77
78
void
dai_consider_plr_dangerous
(
struct
ai_type
*ait,
struct
player
*plr1,
79
struct
player
*plr2,
80
enum
override_bool
*result);
choice_type
choice_type
Definition:
advchoice.h:22
advgoto.h
dai_unit_move_or_attack
void dai_unit_move_or_attack(ai_type *ait, unit *punit, tile *ptile, const PFPath &path, int step)
Ai unit moving function called from AI interface.
Definition:
aitools.cpp:928
dai_choice_rule_name
const char * dai_choice_rule_name(const struct adv_choice *choice)
Return the (untranslated) rule name of the adv_choice.
Definition:
aitools.cpp:105
dai_government_change
void dai_government_change(struct player *pplayer, struct government *gov)
Change government, pretty fast...
Definition:
aitools.cpp:1099
dai_fill_unit_param
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.
Definition:
aitools.cpp:475
stack_cost
int stack_cost(struct unit *pattacker, struct unit *pdefender)
Calculate the value of the target unit including the other units which will die in a successful attac...
Definition:
aitools.cpp:1072
dai_gothere
bool dai_gothere(struct ai_type *ait, struct player *pplayer, struct unit *punit, struct tile *dst_tile)
This is ferry-enabled goto.
Definition:
aitools.cpp:258
goto_is_sane
bool goto_is_sane(struct unit *punit, struct tile *ptile)
Use pathfinding to determine whether a GOTO is possible, considering all aspects of the unit being mo...
Definition:
aitools.cpp:436
dai_log_path
void dai_log_path(struct unit *punit, const PFPath &path, struct pf_parameter *parameter)
Log the cost of travelling a path.
Definition:
aitools.cpp:359
dai_assess_military_unhappiness
bool dai_assess_military_unhappiness(struct city *pcity)
"The following evaluates the unhappiness caused by military units in the field (or aggressive) at a c...
Definition:
aitools.cpp:1203
dai_build_adv_override
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:
aitools.cpp:1155
dai_unit_attack
bool dai_unit_attack(struct ai_type *ait, struct unit *punit, struct tile *ptile)
Move and attack with an ai unit.
Definition:
aitools.cpp:825
dai_unit_task_rule_name
const char * dai_unit_task_rule_name(const enum ai_unit_task task)
Return the (untranslated) rule name of the ai_unit_task.
Definition:
aitools.cpp:70
dai_unit_goto
bool dai_unit_goto(struct ai_type *ait, struct unit *punit, struct tile *ptile)
Go to specified destination but do not disturb existing role or activity and do not clear the role's ...
Definition:
aitools.cpp:609
dai_unit_goto_constrained
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 act...
Definition:
aitools.cpp:381
immediate_destination
struct tile * immediate_destination(struct unit *punit, struct tile *dest_tile)
Returns the destination for a unit moving towards a given final destination.
Definition:
aitools.cpp:314
dai_consider_plr_dangerous
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 him, he has done lots of ig...
Definition:
aitools.cpp:156
dai_unit_new_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 f...
Definition:
aitools.cpp:648
dai_gold_reserve
int dai_gold_reserve(struct player *pplayer)
Credits the AI wants to have in reserves.
Definition:
aitools.cpp:1120
dai_unit_make_homecity
bool dai_unit_make_homecity(struct unit *punit, struct city *pcity)
Try to make pcity our new homecity.
Definition:
aitools.cpp:763
dai_choose_role_unit
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.
Definition:
aitools.cpp:1131
military_amortize
int military_amortize(struct player *pplayer, struct city *pcity, int value, int delay, int build_cost)
Amortize a want modified by the shields (build_cost) we risk losing.
Definition:
aitools.cpp:132
dai_unit_move
bool dai_unit_move(struct ai_type *ait, struct unit *punit, struct tile *ptile)
Move a unit.
Definition:
aitools.cpp:947
dai_unit_new_adv_task
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:
aitools.cpp:624
aiunit.h
ai_unit_task
ai_unit_task
Definition:
aiunit.h:25
PFPath
Definition:
path_finding.h:312
daicity.h
fc_types.h
adv_unit_task
adv_unit_task
Definition:
fc_types.h:287
override_bool
override_bool
Definition:
fc_types.h:78
step
int step
Definition:
specpq.h:83
adv_choice
Definition:
advchoice.h:31
adv_risk_cost
Definition:
advgoto.h:22
ai_type
Definition:
ai.h:42
city
Definition:
city.h:291
government
Definition:
government.h:35
pf_parameter
Definition:
path_finding.h:339
pft_amphibious
Definition:
pf_tools.h:27
player
Definition:
player.h:231
tile
Definition:
tile.h:42
unit
Definition:
unit.h:134
support.h
unit.h
ai
default
aitools.h
Generated by
1.9.1