The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
gamestate_observer.cpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2010 - 2016 by Yurii Chernyi <[email protected]>
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  * Base gamestate observer - useful to see if the gamestate has changed
17  * between two points of time
18  * @file
19  */
20 
21 #include "ai/manager.hpp"
23 
24 namespace ai {
25 // =======================================================================
26 
28  : gamestate_change_counter_(0)
29 {
31 }
32 
33 
35 {
37 }
38 
39 
41 {
43 }
44 
45 
47 {
48  return (gamestate_change_counter_>0);
49 }
50 
51 
53 {
55 }
56 
57 // =======================================================================
58 } //end 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 helper class to observe the game state.
A small explanation about what's going on here: Each action has access to two game_info objects First...
Definition: actions.cpp:57
static void remove_gamestate_observer(events::observer *event_observer)
Removes an observer of game events except ai_user_interact event and ai_sync_network event...
Definition: manager.cpp:378
void reset()
Reset the counter of gamestate changes.
Managing the AIs lifecycle - headers.
static void add_gamestate_observer(events::observer *event_observer)
Adds observer of game events except ai_user_interact event and ai_sync_network event.
Definition: manager.cpp:371
GLsizei const GLcharARB ** string
Definition: glew.h:4503