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 };
32 /**
33  * This class is used by the BattleUnit AI.
34  */
35 class BattleAIState
36 {
37 protected:
38 	SavedBattleGame *_save;
39 	BattleUnit *_unit;
40 public:
41 	/// Creates a new BattleAIState linked to the game and a certain unit.
42 	BattleAIState(SavedBattleGame *save, BattleUnit *unit);
43 	/// Cleans up the BattleAIState.
44 	virtual ~BattleAIState();
45 	/// Loads the AI state from YAML.
46 	void load(const YAML::Node& node);
47 	/// Saves the AI state to YAML.
48 	virtual YAML::Node save() const;
49 	/// Enters the state.
50 	virtual void enter();
51 	/// Exits the state.
52 	virtual void exit();
53 	/// Runs state functionality every AI cycle.
54 	virtual void think(BattleAction *action);
55 };
56 
57 }
58 
59 #endif
60