The Battle for Wesnoth  1.15.1+dev
Public Member Functions | Private Attributes | List of all members
ai::gamestate_observer Class Reference

#include <gamestate_observer.hpp>

Inheritance diagram for ai::gamestate_observer:
Inheritance graph

Public Member Functions

 gamestate_observer ()
 
virtual ~gamestate_observer ()
 
void handle_generic_event (const std::string &event_name)
 
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. More...
 
void reset ()
 Reset the counter of gamestate changes. More...
 
- Public Member Functions inherited from events::observer
virtual ~observer ()
 

Private Attributes

int gamestate_change_counter_
 

Detailed Description

Definition at line 26 of file gamestate_observer.hpp.

Constructor & Destructor Documentation

◆ gamestate_observer()

ai::gamestate_observer::gamestate_observer ( )

◆ ~gamestate_observer()

ai::gamestate_observer::~gamestate_observer ( )
virtual

Member Function Documentation

◆ handle_generic_event()

void ai::gamestate_observer::handle_generic_event ( const std::string &  event_name)
virtual

Implements events::observer.

Definition at line 40 of file gamestate_observer.cpp.

References gamestate_change_counter_.

◆ is_gamestate_changed()

bool ai::gamestate_observer::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.

Returns
has gamestate changed since last reset?

Definition at line 46 of file gamestate_observer.cpp.

References gamestate_change_counter_.

Referenced by ai::ai_default_rca::candidate_action_evaluation_loop::do_play_stage(), and ai::lua_stage_wrapper::do_play_stage().

◆ reset()

void ai::gamestate_observer::reset ( )

Reset the counter of gamestate changes.

Definition at line 52 of file gamestate_observer.cpp.

References gamestate_change_counter_.

Member Data Documentation

◆ gamestate_change_counter_

int ai::gamestate_observer::gamestate_change_counter_
private

Definition at line 53 of file gamestate_observer.hpp.

Referenced by handle_generic_event(), is_gamestate_changed(), and reset().


The documentation for this class was generated from the following files: