Freeciv21
Develop your civilization from humble roots to a global empire
aiactions.cpp
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 
12 // common
13 #include "unittype.h"
14 
15 #include "aiactions.h"
16 
22 {
23  return (
24  utype_can_do_action_result(putype, ACTRES_SPY_POISON)
25  || utype_can_do_action_result(putype, ACTRES_SPY_SPREAD_PLAGUE)
26  || utype_can_do_action_result(putype, ACTRES_SPY_SABOTAGE_CITY)
28  ACTRES_SPY_TARGETED_SABOTAGE_CITY)
30  ACTRES_SPY_SABOTAGE_CITY_PRODUCTION)
31  || utype_can_do_action_result(putype, ACTRES_SPY_INCITE_CITY)
32  || utype_can_do_action_result(putype, ACTRES_ESTABLISH_EMBASSY)
33  || utype_can_do_action_result(putype, ACTRES_SPY_STEAL_TECH)
34  || utype_can_do_action_result(putype, ACTRES_SPY_TARGETED_STEAL_TECH)
35  || utype_can_do_action_result(putype, ACTRES_SPY_INVESTIGATE_CITY)
36  || utype_can_do_action_result(putype, ACTRES_SPY_STEAL_GOLD)
37  || utype_can_do_action_result(putype, ACTRES_STEAL_MAPS)
38  || utype_can_do_action_result(putype, ACTRES_SPY_NUKE));
39 }
40 
45 bool aia_utype_is_considered_spy(const struct unit_type *putype)
46 {
48  || utype_can_do_action_result(putype, ACTRES_SPY_ATTACK)
49  || utype_can_do_action_result(putype, ACTRES_SPY_BRIBE_UNIT)
50  || utype_can_do_action_result(putype, ACTRES_SPY_SABOTAGE_UNIT));
51 }
52 
58 {
59  return (utype_can_do_action_result(putype, ACTRES_TRADE_ROUTE)
60  || utype_can_do_action_result(putype, ACTRES_MARKETPLACE));
61 }
62 
67 bool aia_utype_is_considered_worker(const struct unit_type *putype)
68 {
69  return (utype_can_do_action_result(putype, ACTRES_TRANSFORM_TERRAIN)
70  || utype_can_do_action_result(putype, ACTRES_CULTIVATE)
71  || utype_can_do_action_result(putype, ACTRES_PLANT)
72  || utype_can_do_action_result(putype, ACTRES_ROAD)
73  || utype_can_do_action_result(putype, ACTRES_BASE)
74  || utype_can_do_action_result(putype, ACTRES_MINE)
75  || utype_can_do_action_result(putype, ACTRES_IRRIGATE)
76  || utype_can_do_action_result(putype, ACTRES_CLEAN_POLLUTION)
77  || utype_can_do_action_result(putype, ACTRES_CLEAN_FALLOUT));
78 }
bool aia_utype_is_considered_caravan_trade(const struct unit_type *putype)
Returns TRUE if the specified unit type is able to perform trade caravan actions.
Definition: aiactions.cpp:57
bool aia_utype_is_considered_spy_vs_city(const struct unit_type *putype)
Returns TRUE if the specified unit type is able to perform diplomatic actions against cities.
Definition: aiactions.cpp:21
bool aia_utype_is_considered_spy(const struct unit_type *putype)
Returns TRUE if the specified unit type is able to perform diplomatic actions.
Definition: aiactions.cpp:45
bool aia_utype_is_considered_worker(const struct unit_type *putype)
Returns TRUE if the specified unit type is able to perform worker actions.
Definition: aiactions.cpp:67
bool utype_can_do_action_result(const struct unit_type *putype, enum action_result result)
Return TRUE iff units of the given type can do any enabler controlled action with the specified actio...
Definition: unittype.cpp:402