The Battle for Wesnoth  1.19.5+dev
Public Member Functions | Private Types | Private Attributes | List of all members
countdown_clock Class Reference

#include <countdown_clock.hpp>

Inheritance diagram for countdown_clock:

Public Member Functions

 countdown_clock (team &team)
 
 ~countdown_clock ()
 
std::chrono::milliseconds update_timestamp ()
 
void update_team ()
 
virtual void process () override
 Inherited from pump_monitor. More...
 
bool update ()
 
void maybe_play_sound ()
 
- Public Member Functions inherited from events::pump_monitor
 pump_monitor ()
 
virtual ~pump_monitor ()
 

Private Types

using clock = std::chrono::steady_clock
 

Private Attributes

teamteam_
 
clock::time_point last_timestamp_
 
bool playing_sound_
 

Detailed Description

Definition at line 21 of file countdown_clock.hpp.

Member Typedef Documentation

◆ clock

using countdown_clock::clock = std::chrono::steady_clock
private

Definition at line 23 of file countdown_clock.hpp.

Constructor & Destructor Documentation

◆ countdown_clock()

countdown_clock::countdown_clock ( team team)

Definition at line 30 of file countdown_clock.cpp.

◆ ~countdown_clock()

countdown_clock::~countdown_clock ( )

Definition at line 37 of file countdown_clock.cpp.

References playing_sound_, and sound::stop_bell().

Member Function Documentation

◆ maybe_play_sound()

void countdown_clock::maybe_play_sound ( )

◆ process()

void countdown_clock::process ( )
overridevirtual

Inherited from pump_monitor.

Implements events::pump_monitor.

Definition at line 59 of file countdown_clock.cpp.

References update().

◆ update()

bool countdown_clock::update ( )
Returns
whether there is time left

Definition at line 66 of file countdown_clock.cpp.

References team::countdown_time(), maybe_play_sound(), team_, and update_team().

Referenced by process().

◆ update_team()

void countdown_clock::update_team ( )

Definition at line 52 of file countdown_clock.cpp.

References team::countdown_time(), team::set_countdown_time(), team_, and update_timestamp().

Referenced by update().

◆ update_timestamp()

std::chrono::milliseconds countdown_clock::update_timestamp ( )
Returns
ticks passed since last update

Definition at line 45 of file countdown_clock.cpp.

References last_timestamp_.

Referenced by update_team().

Member Data Documentation

◆ last_timestamp_

clock::time_point countdown_clock::last_timestamp_
private

Definition at line 44 of file countdown_clock.hpp.

Referenced by update_timestamp().

◆ playing_sound_

bool countdown_clock::playing_sound_
private

Definition at line 45 of file countdown_clock.hpp.

Referenced by maybe_play_sound(), and ~countdown_clock().

◆ team_

team& countdown_clock::team_
private

Definition at line 43 of file countdown_clock.hpp.

Referenced by maybe_play_sound(), update(), and update_team().


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