The Battle for Wesnoth  1.15.12+dev
countdown_clock.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2017-2018 by the Battle for Wesnoth Project https://www.wesnoth.org/
3 
4  This program is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; either version 2 of the License, or
7  (at your option) any later version.
8  This program is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY.
10 
11  See the COPYING file for more details.
12 */
13 
14 #pragma once
15 #include "events.hpp"
16 #include <SDL2/SDL_timer.h>
17 
18 class team;
20 {
21 public:
24  /**
25  * @returns ticks passed since last update
26  * @param new_timestamp latest result of SDL_GetTicks()
27  */
28  int update_timestamp(int new_timestamp);
29  /** @param new_timestamp latest result of SDL_GetTicks() */
30  void update_team(int new_timestamp);
32  /**
33  * @return whether there is time left
34  * @param new_timestamp latest result of SDL_GetTicks()
35  */
36  bool update(int new_timestamp = SDL_GetTicks());
37  void maybe_play_sound();
38 private:
39  team& team_;
42 };
countdown_clock(team &team)
int update_timestamp(int new_timestamp)
logger & info()
Definition: log.cpp:88
This class stores all the data for a single &#39;side&#39; (in game nomenclature).
Definition: team.hpp:44
void process(events::pump_info &info)
void update_team(int new_timestamp)
bool update(int new_timestamp=SDL_GetTicks())