summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPatric Stout <truebrain@openttd.org>2021-02-26 14:01:12 +0100
committerPatric Stout <github@truebrain.nl>2021-02-27 00:36:14 +0100
commitfe451b8dc76caf87f09b120b9d57b7f4eff5d46c (patch)
tree37aa9c3efc8df9e97743ec823db583b6524edd1e /src
parent853bfc35626ddb1c1c5794b6afdaa059e2d79f05 (diff)
downloadopenttd-fe451b8dc76caf87f09b120b9d57b7f4eff5d46c.tar.xz
Codechange: remove _realtime_tick variable
Diffstat (limited to 'src')
-rw-r--r--src/debug.cpp2
-rw-r--r--src/debug.h3
-rw-r--r--src/video/video_driver.cpp15
-rw-r--r--src/video/video_driver.hpp1
4 files changed, 4 insertions, 17 deletions
diff --git a/src/debug.cpp b/src/debug.cpp
index e54d931ad..034af755f 100644
--- a/src/debug.cpp
+++ b/src/debug.cpp
@@ -45,8 +45,6 @@ int _debug_console_level;
int _debug_random_level;
#endif
-uint32 _realtime_tick = 0;
-
struct DebugLevel {
const char *name;
int *level;
diff --git a/src/debug.h b/src/debug.h
index 1a0955b55..29a7114aa 100644
--- a/src/debug.h
+++ b/src/debug.h
@@ -121,7 +121,4 @@ void CDECL ShowInfoF(const char *str, ...) WARN_FORMAT(1, 2);
const char *GetLogPrefix();
-/** The real time in the game. */
-extern uint32 _realtime_tick;
-
#endif /* DEBUG_H */
diff --git a/src/video/video_driver.cpp b/src/video/video_driver.cpp
index bc9d28ff0..d528bbec7 100644
--- a/src/video/video_driver.cpp
+++ b/src/video/video_driver.cpp
@@ -20,17 +20,6 @@ bool VideoDriver::Tick()
{
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 (_fast_forward && !_pause_mode) {
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. */
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()) {}
this->InputLoop();
::InputLoop();
diff --git a/src/video/video_driver.hpp b/src/video/video_driver.hpp
index 67c8064bc..2e478def9 100644
--- a/src/video/video_driver.hpp
+++ b/src/video/video_driver.hpp
@@ -276,7 +276,6 @@ protected:
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_draw_tick;
};