File tree 1 file changed +13
-2
lines changed
1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -2181,7 +2181,10 @@ bool Game::connectToServer(const std::string &playername,
2181
2181
input->clear ();
2182
2182
2183
2183
FpsControl fps_control = { 0 };
2184
- f32 dtime; // in seconds
2184
+ f32 dtime;
2185
+ f32 wait_time = 0 ; // in seconds
2186
+
2187
+ fps_control.last_time = device->getTimer ()->getTime ();
2185
2188
2186
2189
while (device->run ()) {
2187
2190
@@ -2213,6 +2216,13 @@ bool Game::connectToServer(const std::string &playername,
2213
2216
break ;
2214
2217
}
2215
2218
2219
+ wait_time += dtime;
2220
+ if (wait_time > 10 ) {
2221
+ *error_message = " Connection timed out." ;
2222
+ errorstream << *error_message << std::endl;
2223
+ break ;
2224
+ }
2225
+
2216
2226
// Update status
2217
2227
showOverlayMessage (wgettext (" Connecting to server..." ), dtime, 20 );
2218
2228
}
@@ -2232,6 +2242,8 @@ bool Game::getServerContent(bool *aborted)
2232
2242
FpsControl fps_control = { 0 };
2233
2243
f32 dtime; // in seconds
2234
2244
2245
+ fps_control.last_time = device->getTimer ()->getTime ();
2246
+
2235
2247
while (device->run ()) {
2236
2248
2237
2249
limitFps (&fps_control, &dtime);
@@ -4137,7 +4149,6 @@ inline void Game::limitFps(FpsControl *fps_timings, f32 *dtime)
4137
4149
// not using getRealTime is necessary for wine
4138
4150
device->getTimer ()->tick (); // Maker sure device time is up-to-date
4139
4151
u32 time = device->getTimer ()->getTime ();
4140
-
4141
4152
u32 last_time = fps_timings->last_time ;
4142
4153
4143
4154
if (time > last_time) // Make sure time hasn't overflowed
You can’t perform that action at this time.
0 commit comments