The Battle for Wesnoth  1.17.0-dev
gamestate_observer.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2010 - 2021
3  by Yurii Chernyi <terraninfo@terraninfo.net>
4  Part of the Battle for Wesnoth Project https://www.wesnoth.org/
5 
6  This program 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 2 of the License, or
9  (at your option) any later version.
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY.
12 
13  See the COPYING file for more details.
14 */
15 
16 /**
17  * @file
18  * A helper class to observe the game state
19  */
20 
21 #pragma once
22 
23 #include "generic_event.hpp"
24 
25 namespace ai {
26 
28 public:
29 
30 
32 
33 
34  virtual ~gamestate_observer();
35 
36 
37  void handle_generic_event(const std::string &event_name);
38 
39 
40  /**
41  * Check if the gamestate has changed since last reset
42  * reset is done once on construction, and can be done
43  * by hand via reset() method.
44  * @return has gamestate changed since last reset?
45  */
46  bool is_gamestate_changed();
47 
48  /**
49  * Reset the counter of gamestate changes.
50  */
51  void reset();
52 
53 private:
55 };
56 
57 } //of namespace ai
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&#39;s going on here: Each action has access to two game_info objects First...
Definition: actions.cpp:61
void reset()
Reset the counter of gamestate changes.