The Battle for Wesnoth  1.13.10+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
gamestate_observer.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2010 - 2017 by Yurii Chernyi <terraninfo@terraninfo.net>
3  Part of the Battle for Wesnoth Project http://www.wesnoth.org/
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY.
11 
12  See the COPYING file for more details.
13 */
14 
15 /**
16  * @file
17  * A helper class to observe the game state
18  */
19 
20 #pragma once
21 
22 #include "generic_event.hpp"
23 
24 namespace ai {
25 
27 public:
28 
29 
31 
32 
33  virtual ~gamestate_observer();
34 
35 
36  void handle_generic_event(const std::string &event_name);
37 
38 
39  /**
40  * Check if the gamestate has changed since last reset
41  * reset is done once on construction, and can be done
42  * by hand via reset() method.
43  * @return has gamestate changed since last reset?
44  */
45  bool is_gamestate_changed();
46 
47  /**
48  * Reset the counter of gamestate changes.
49  */
50  void reset();
51 
52 private:
54 };
55 
56 } //of namespace ai
std::vector< char_t > string
bool is_gamestate_changed()
Check if the gamestate has changed since last reset reset is done once on construction, and can be done by hand via reset() method.
void handle_generic_event(const std::string &event_name)
A small explanation about what's going on here: Each action has access to two game_info objects First...
Definition: actions.cpp:58
void reset()
Reset the counter of gamestate changes.