aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/game.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/game.cpp b/src/game.cpp
index 6bddfe905..24ecc99d2 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -2181,7 +2181,10 @@ bool Game::connectToServer(const std::string &playername,
input->clear();
FpsControl fps_control = { 0 };
- f32 dtime; // in seconds
+ f32 dtime;
+ f32 wait_time = 0; // in seconds
+
+ fps_control.last_time = device->getTimer()->getTime();
while (device->run()) {
@@ -2213,6 +2216,13 @@ bool Game::connectToServer(const std::string &playername,
break;
}
+ wait_time += dtime;
+ if (wait_time > 10) {
+ *error_message = "Connection timed out.";
+ errorstream << *error_message << std::endl;
+ break;
+ }
+
// Update status
showOverlayMessage(wgettext("Connecting to server..."), dtime, 20);
}
@@ -2232,6 +2242,8 @@ bool Game::getServerContent(bool *aborted)
FpsControl fps_control = { 0 };
f32 dtime; // in seconds
+ fps_control.last_time = device->getTimer()->getTime();
+
while (device->run()) {
limitFps(&fps_control, &dtime);
@@ -4137,7 +4149,6 @@ inline void Game::limitFps(FpsControl *fps_timings, f32 *dtime)
// not using getRealTime is necessary for wine
device->getTimer()->tick(); // Maker sure device time is up-to-date
u32 time = device->getTimer()->getTime();
-
u32 last_time = fps_timings->last_time;
if (time > last_time) // Make sure time hasn't overflowed