00001 /* $Id: gamestate_observer.hpp 52533 2012-01-07 02:35:17Z shadowmaster $ */ 00002 /* 00003 Copyright (C) 2010 - 2012 by Yurii Chernyi <terraninfo@terraninfo.net> 00004 Part of the Battle for Wesnoth Project http://www.wesnoth.org/ 00005 00006 This program is free software; you can redistribute it and/or modify 00007 it under the terms of the GNU General Public License as published by 00008 the Free Software Foundation; either version 2 of the License, or 00009 (at your option) any later version. 00010 This program is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY. 00012 00013 See the COPYING file for more details. 00014 */ 00015 00016 /** 00017 * @file 00018 * A helper class to observe the game state 00019 */ 00020 00021 #ifndef AI_GAMESTATE_OBSERVER_HPP_INCLUDED 00022 #define AI_GAMESTATE_OBSERVER_HPP_INCLUDED 00023 00024 #include "../generic_event.hpp" 00025 00026 namespace ai { 00027 00028 class gamestate_observer : public events::observer { 00029 public: 00030 00031 00032 gamestate_observer(); 00033 00034 00035 virtual ~gamestate_observer(); 00036 00037 00038 void handle_generic_event(const std::string &event_name); 00039 00040 00041 /** 00042 * Check if the gamestate has changed since last reset 00043 * reset is done once on construction, and can be done 00044 * by hand via reset() method. 00045 * @return has gamestate changed since last reset? 00046 */ 00047 bool is_gamestate_changed(); 00048 00049 /** 00050 * Reset the counter of gamestate changes. 00051 */ 00052 void reset(); 00053 00054 private: 00055 int gamestate_change_counter_; 00056 }; 00057 00058 } //of namespace ai 00059 00060 #endif
| Generated by doxygen 1.7.1 on Fri May 25 2012 01:02:44 for The Battle for Wesnoth | Gna! | Forum | Wiki | CIA | devdocs |