OpenXcom  1.0
Open-source clone of the original X-Com
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
BattleAIState.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_BATTLEAISTATE_H
20 #define OPENXCOM_BATTLEAISTATE_H
21 
22 #include <yaml-cpp/yaml.h>
23 
24 namespace OpenXcom
25 {
26 
27 class SavedBattleGame;
28 class BattleUnit;
29 struct BattleAction;
30 
31 enum AIMode { AI_PATROL, AI_AMBUSH, AI_COMBAT, AI_ESCAPE };
36 {
37 protected:
38  SavedBattleGame *_save;
39  BattleUnit *_unit;
40 public:
44  virtual ~BattleAIState();
46  void load(const YAML::Node& node);
48  virtual YAML::Node save() const;
50  virtual void enter();
52  virtual void exit();
54  virtual void think(BattleAction *action);
55 };
56 
57 }
58 
59 #endif
BattleAIState(SavedBattleGame *save, BattleUnit *unit)
Creates a new BattleAIState linked to the game and a certain unit.
Definition: BattleAIState.cpp:29
Definition: BattlescapeGame.h:45
This class is used by the BattleUnit AI.
Definition: BattleAIState.h:35
virtual void enter()
Enters the state.
Definition: BattleAIState.cpp:63
virtual void think(BattleAction *action)
Runs state functionality every AI cycle.
Definition: BattleAIState.cpp:82
virtual ~BattleAIState()
Cleans up the BattleAIState.
Definition: BattleAIState.cpp:37
virtual YAML::Node save() const
Saves the AI state to YAML.
Definition: BattleAIState.cpp:54
void load(const YAML::Node &node)
Loads the AI state from YAML.
Definition: BattleAIState.cpp:46
The battlescape data that gets written to disk when the game is saved.
Definition: SavedBattleGame.h:50
virtual void exit()
Exits the state.
Definition: BattleAIState.cpp:72
Represents a moving unit in the battlescape, player controlled or AI controlled it holds info about i...
Definition: BattleUnit.h:58