Merge branch 'master' into jgrpp
# Conflicts: # src/articulated_vehicles.cpp # src/articulated_vehicles.h # src/autoreplace_cmd.cpp # src/build_vehicle_gui.cpp # src/company_gui.cpp # src/core/format.hpp # src/genworld_gui.cpp # src/gfx.cpp # src/group_gui.cpp # src/linkgraph/linkgraph_gui.cpp # src/misc/endian_buffer.hpp # src/music/music_driver.hpp # src/newgrf_gui.cpp # src/rail_cmd.cpp # src/road_gui.cpp # src/settings_type.h # src/strgen/strgen.cpp # src/strings.cpp # src/timetable_cmd.cpp # src/town.h # src/vehicle.cpp # src/vehicle_gui.cpp # src/vehicle_gui_base.h # src/widget.cpp # src/widgets/dropdown.cpp # src/widgets/road_widget.h
This commit is contained in:
@@ -39,7 +39,8 @@ public:
|
||||
*
|
||||
* @param timer The timer to register.
|
||||
*/
|
||||
static void RegisterTimer(BaseTimer<TTimerType> &timer) {
|
||||
static void RegisterTimer(BaseTimer<TTimerType> &timer)
|
||||
{
|
||||
#ifdef WITH_ASSERT
|
||||
Validate(timer.period);
|
||||
#endif /* WITH_ASSERT */
|
||||
@@ -51,7 +52,8 @@ public:
|
||||
*
|
||||
* @param timer The timer to unregister.
|
||||
*/
|
||||
static void UnregisterTimer(BaseTimer<TTimerType> &timer) {
|
||||
static void UnregisterTimer(BaseTimer<TTimerType> &timer)
|
||||
{
|
||||
GetTimers().erase(&timer);
|
||||
}
|
||||
|
||||
@@ -88,14 +90,16 @@ private:
|
||||
* same, it will sort based on the pointer value.
|
||||
*/
|
||||
struct base_timer_sorter {
|
||||
bool operator() (BaseTimer<TTimerType> *a, BaseTimer<TTimerType> *b) const {
|
||||
bool operator() (BaseTimer<TTimerType> *a, BaseTimer<TTimerType> *b) const
|
||||
{
|
||||
if (a->period == b->period) return a < b;
|
||||
return a->period < b->period;
|
||||
}
|
||||
};
|
||||
|
||||
/** Singleton list, to store all the active timers. */
|
||||
static std::set<BaseTimer<TTimerType> *, base_timer_sorter> &GetTimers() {
|
||||
static std::set<BaseTimer<TTimerType> *, base_timer_sorter> &GetTimers()
|
||||
{
|
||||
static std::set<BaseTimer<TTimerType> *, base_timer_sorter> timers;
|
||||
return timers;
|
||||
}
|
||||
|
Reference in New Issue
Block a user