OpenXcom  1.0
Open-source clone of the original X-Com
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
CivilianBAIState.h
1 /*
2  * Copyright 2010-2014 OpenXcom Developers.
3  *
4  * This file is part of OpenXcom.
5  *
6  * OpenXcom is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * OpenXcom is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with OpenXcom. If not, see <http://www.gnu.org/licenses/>.
18  */
19 #ifndef OPENXCOM_CIVILIANBAISTATE_H
20 #define OPENXCOM_CIVILIANBAISTATE_H
21 
22 #include "BattleAIState.h"
23 #include "Position.h"
24 #include <yaml-cpp/yaml.h>
25 
26 namespace OpenXcom
27 {
28 
29 class BattleUnit;
30 class SavedBattleGame;
31 class Node;
32 struct BattleAction;
33 
38 {
39 private:
40  BattleAction *_escapeAction, *_patrolAction;
41  BattleUnit *_aggroTarget;
42  int _escapeTUs, _AIMode, _visibleEnemies, _spottingEnemies;
43  bool _traceAI;
44 protected:
45  Node *_fromNode, *_toNode;
46 public:
52  void load(const YAML::Node& node);
54  YAML::Node save() const;
56  void enter();
58  void exit();
60  void think(BattleAction *action);
61  int getSpottingUnits(Position pos) const;
62  int selectNearestTarget();
63  void setupEscape();
64  void setupPatrol();
65  void evaluateAIMode();
66 };
67 
68 }
69 
70 #endif
Definition: BattlescapeGame.h:45
CivilianBAIState(SavedBattleGame *save, BattleUnit *unit, Node *node)
Creates a new BattleAIState linked to the game and a certain unit.
Definition: CivilianBAIState.cpp:43
This is the intial AI state of units, walking around and looking for intruders.
Definition: CivilianBAIState.h:37
void enter()
Enters the state.
Definition: CivilianBAIState.cpp:101
This class is used by the BattleUnit AI.
Definition: BattleAIState.h:35
YAML::Node save() const
Saves the AI state to YAML.
Definition: CivilianBAIState.cpp:83
void exit()
Exits the state.
Definition: CivilianBAIState.cpp:109
void think(BattleAction *action)
Runs state functionality every AI cycle.
Definition: CivilianBAIState.cpp:118
void load(const YAML::Node &node)
Loads the AI state from YAML.
Definition: CivilianBAIState.cpp:63
~CivilianBAIState()
Cleans up the BattleAIState.
Definition: CivilianBAIState.cpp:53
The battlescape data that gets written to disk when the game is saved.
Definition: SavedBattleGame.h:50
Represents a node/spawnpoint in the battlescape, loaded from RMP files.
Definition: Node.h:34
Easy handling of X-Y-Z coordinates.
Definition: Position.h:30
Represents a moving unit in the battlescape, player controlled or AI controlled it holds info about i...
Definition: BattleUnit.h:58