The Battle for Wesnoth  1.17.0-dev
countdown_clock.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2017 - 2021
3  Part of the Battle for Wesnoth Project https://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 #pragma once
16 #include "events.hpp"
17 #include <SDL2/SDL_timer.h>
18 
19 class team;
21 {
22 public:
25  /**
26  * @returns ticks passed since last update
27  * @param new_timestamp latest result of SDL_GetTicks()
28  */
29  int update_timestamp(int new_timestamp);
30  /** @param new_timestamp latest result of SDL_GetTicks() */
31  void update_team(int new_timestamp);
33  /**
34  * @return whether there is time left
35  * @param new_timestamp latest result of SDL_GetTicks()
36  */
37  bool update(int new_timestamp = SDL_GetTicks());
38  void maybe_play_sound();
39 private:
40  team& team_;
43 };
countdown_clock(team &team)
int update_timestamp(int new_timestamp)
logger & info()
Definition: log.cpp:89
This class stores all the data for a single &#39;side&#39; (in game nomenclature).
Definition: team.hpp:72
void process(events::pump_info &info)
void update_team(int new_timestamp)
bool update(int new_timestamp=SDL_GetTicks())