Freeciv21
Develop your civilization from humble roots to a global empire
aiguard.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 redistribute it
4  and/or modify it under the terms of the GNU General Public License as
5  published by the Free Software Foundation, either version 3 of the
6  License, or (at your option) any later version. You should have received
7  a copy of the GNU General Public License along with Freeciv21. If not,
8  see https://www.gnu.org/licenses/.
9 **************************************************************************/
10 #pragma once
11 
12 #include "support.h" // bool type
13 
14 #include "fc_types.h"
15 
16 #define CHECK_GUARD(ait, guard) aiguard_check_guard(ait, guard)
17 #define CHECK_CHARGE_UNIT(ait, charge) aiguard_check_charge_unit(ait, charge)
18 
19 void aiguard_check_guard(struct ai_type *ait, const struct unit *guard);
20 void aiguard_check_charge_unit(struct ai_type *ait,
21  const struct unit *charge);
22 void aiguard_clear_charge(struct ai_type *ait, struct unit *guard);
23 void aiguard_clear_guard(struct ai_type *ait, struct unit *charge);
24 void aiguard_assign_guard_unit(struct ai_type *ait, struct unit *charge,
25  struct unit *guard);
26 void aiguard_assign_guard_city(struct ai_type *ait, struct city *charge,
27  struct unit *guard);
28 void aiguard_request_guard(struct ai_type *ait, struct unit *punit);
29 bool aiguard_wanted(struct ai_type *ait, struct unit *charge);
30 bool aiguard_has_charge(struct ai_type *ait, struct unit *charge);
31 bool aiguard_has_guard(struct ai_type *ait, struct unit *charge);
32 struct unit *aiguard_guard_of(struct ai_type *ait, struct unit *charge);
33 struct unit *aiguard_charge_unit(struct ai_type *ait, struct unit *guard);
34 struct city *aiguard_charge_city(struct ai_type *ait, struct unit *guard);
35 void aiguard_update_charge(struct ai_type *ait, struct unit *guard);
struct unit * aiguard_charge_unit(struct ai_type *ait, struct unit *guard)
Which unit (if any) has a guard been assigned to? Returns nullptr if the unit is not the guard for a ...
Definition: aiguard.cpp:270
void aiguard_clear_charge(struct ai_type *ait, struct unit *guard)
Remove the assignment of a charge to a guard.
Definition: aiguard.cpp:109
void aiguard_request_guard(struct ai_type *ait, struct unit *punit)
Request a (new) bodyguard for the unit.
Definition: aiguard.cpp:218
bool aiguard_has_guard(struct ai_type *ait, struct unit *charge)
Has a guard been assigned to a charge?
Definition: aiguard.cpp:250
void aiguard_assign_guard_unit(struct ai_type *ait, struct unit *charge, struct unit *guard)
Assign a bodyguard to a unit.
Definition: aiguard.cpp:165
bool aiguard_wanted(struct ai_type *ait, struct unit *charge)
Has a unit requested a guard and not (yet) been provided with one?
Definition: aiguard.cpp:232
void aiguard_assign_guard_city(struct ai_type *ait, struct city *charge, struct unit *guard)
Assign a guard to a city.
Definition: aiguard.cpp:188
struct city * aiguard_charge_city(struct ai_type *ait, struct unit *guard)
Which city (if any) has a guard been assigned to? Returns nullptr if the unit is not a guard for a ci...
Definition: aiguard.cpp:280
void aiguard_clear_guard(struct ai_type *ait, struct unit *charge)
Remove assignment of bodyguard for a unit.
Definition: aiguard.cpp:138
bool aiguard_has_charge(struct ai_type *ait, struct unit *charge)
Has a charge unit been assigned to a guard?
Definition: aiguard.cpp:241
struct unit * aiguard_guard_of(struct ai_type *ait, struct unit *charge)
Which unit, if any, is the body guard of a unit? Returns nullptr if the unit has not been assigned a ...
Definition: aiguard.cpp:260
void aiguard_update_charge(struct ai_type *ait, struct unit *guard)
Check whether the assignment of a guard is still sane, and fix and problems.
Definition: aiguard.cpp:291
void aiguard_check_charge_unit(struct ai_type *ait, const struct unit *charge)
Do sanity checks on a charge, reporting error messages to the log if necessary.
Definition: aiguard.cpp:81
void aiguard_check_guard(struct ai_type *ait, const struct unit *guard)
Do sanity checks on a guard, reporting error messages to the log if necessary.
Definition: aiguard.cpp:39
Definition: ai.h:42
Definition: city.h:291
Definition: unit.h:134