mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-06-20 03:59:32 +01:00
Codechange: remove _realtime_tick variable
This commit is contained in:
parent
853bfc3562
commit
fe451b8dc7
@ -45,8 +45,6 @@ int _debug_console_level;
|
|||||||
int _debug_random_level;
|
int _debug_random_level;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
uint32 _realtime_tick = 0;
|
|
||||||
|
|
||||||
struct DebugLevel {
|
struct DebugLevel {
|
||||||
const char *name;
|
const char *name;
|
||||||
int *level;
|
int *level;
|
||||||
|
@ -121,7 +121,4 @@ void CDECL ShowInfoF(const char *str, ...) WARN_FORMAT(1, 2);
|
|||||||
|
|
||||||
const char *GetLogPrefix();
|
const char *GetLogPrefix();
|
||||||
|
|
||||||
/** The real time in the game. */
|
|
||||||
extern uint32 _realtime_tick;
|
|
||||||
|
|
||||||
#endif /* DEBUG_H */
|
#endif /* DEBUG_H */
|
||||||
|
@ -20,17 +20,6 @@ bool VideoDriver::Tick()
|
|||||||
{
|
{
|
||||||
auto cur_ticks = std::chrono::steady_clock::now();
|
auto cur_ticks = std::chrono::steady_clock::now();
|
||||||
|
|
||||||
/* If more than a millisecond has passed, increase the _realtime_tick. */
|
|
||||||
if (cur_ticks - this->last_realtime_tick > std::chrono::milliseconds(1)) {
|
|
||||||
auto delta = std::chrono::duration_cast<std::chrono::milliseconds>(cur_ticks - this->last_realtime_tick);
|
|
||||||
_realtime_tick += delta.count();
|
|
||||||
this->last_realtime_tick += delta;
|
|
||||||
|
|
||||||
/* Keep the interactive randomizer a bit more random by requesting
|
|
||||||
* new values when-ever we can. */
|
|
||||||
InteractiveRandom();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cur_ticks >= this->next_game_tick || (_fast_forward && !_pause_mode)) {
|
if (cur_ticks >= this->next_game_tick || (_fast_forward && !_pause_mode)) {
|
||||||
if (_fast_forward && !_pause_mode) {
|
if (_fast_forward && !_pause_mode) {
|
||||||
this->next_game_tick = cur_ticks + this->GetGameInterval();
|
this->next_game_tick = cur_ticks + this->GetGameInterval();
|
||||||
@ -60,6 +49,10 @@ bool VideoDriver::Tick()
|
|||||||
/* Avoid next_draw_tick getting behind more and more if it cannot keep up. */
|
/* Avoid next_draw_tick getting behind more and more if it cannot keep up. */
|
||||||
if (this->next_draw_tick < cur_ticks - ALLOWED_DRIFT * this->GetDrawInterval()) this->next_draw_tick = cur_ticks;
|
if (this->next_draw_tick < cur_ticks - ALLOWED_DRIFT * this->GetDrawInterval()) this->next_draw_tick = cur_ticks;
|
||||||
|
|
||||||
|
/* Keep the interactive randomizer a bit more random by requesting
|
||||||
|
* new values when-ever we can. */
|
||||||
|
InteractiveRandom();
|
||||||
|
|
||||||
while (this->PollEvent()) {}
|
while (this->PollEvent()) {}
|
||||||
this->InputLoop();
|
this->InputLoop();
|
||||||
::InputLoop();
|
::InputLoop();
|
||||||
|
@ -276,7 +276,6 @@ protected:
|
|||||||
return std::chrono::microseconds(1000000 / _settings_client.gui.refresh_rate);
|
return std::chrono::microseconds(1000000 / _settings_client.gui.refresh_rate);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::chrono::steady_clock::time_point last_realtime_tick;
|
|
||||||
std::chrono::steady_clock::time_point next_game_tick;
|
std::chrono::steady_clock::time_point next_game_tick;
|
||||||
std::chrono::steady_clock::time_point next_draw_tick;
|
std::chrono::steady_clock::time_point next_draw_tick;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user