Codechange: introduce a framework for all our timers
IntervalTimer and TimeoutTimer use RAII, and can be used to replace all the time-based timeouts, lag-detection, "execute every N" we have. As it uses RAII, you can safely use it as static variable, class member, temporary variable, etc. As soon as it goes out-of-scope, it will be safely removed. This allows for much easier to read code when it comes to intervals.
This commit is contained in:

committed by
Patric Stout

parent
730687080a
commit
5e1bcee39b
@@ -68,6 +68,8 @@
|
||||
#include "industry.h"
|
||||
#include "network/network_gui.h"
|
||||
#include "misc_cmd.h"
|
||||
#include "timer/timer.h"
|
||||
#include "timer/timer_game_calendar.h"
|
||||
|
||||
#include "linkgraph/linkgraphschedule.h"
|
||||
|
||||
@@ -82,7 +84,6 @@
|
||||
#endif
|
||||
|
||||
void CallLandscapeTick();
|
||||
void IncreaseDate();
|
||||
void DoPaletteAnimations();
|
||||
void MusicLoop();
|
||||
void ResetMusic();
|
||||
@@ -1408,7 +1409,7 @@ void StateGameLoop()
|
||||
|
||||
BasePersistentStorageArray::SwitchMode(PSM_ENTER_GAMELOOP);
|
||||
AnimateAnimatedTiles();
|
||||
IncreaseDate();
|
||||
TimerManager<TimerGameCalendar>::Elapsed(1);
|
||||
RunTileLoop();
|
||||
CallVehicleTicks();
|
||||
CallLandscapeTick();
|
||||
|
Reference in New Issue
Block a user