Merge branch 'master' of https://github.com/supertuxkart/stk-code
This commit is contained in:
commit
5bd37e1e2e
@ -1841,7 +1841,7 @@ void main_abort()
|
||||
{
|
||||
if (main_loop)
|
||||
{
|
||||
main_loop->abort();
|
||||
main_loop->requestAbort();
|
||||
}
|
||||
}
|
||||
#ifdef ANDROID
|
||||
|
@ -65,7 +65,8 @@ LRESULT CALLBACK separateProcessProc(_In_ HWND hwnd, _In_ UINT uMsg,
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
MainLoop::MainLoop(unsigned parent_pid)
|
||||
: m_abort(false), m_ticks_adjustment(0), m_parent_pid(parent_pid)
|
||||
: m_abort(false), m_request_abort(false), m_ticks_adjustment(0),
|
||||
m_parent_pid(parent_pid)
|
||||
{
|
||||
m_curr_time = 0;
|
||||
m_prev_time = 0;
|
||||
@ -327,14 +328,20 @@ void MainLoop::run()
|
||||
|
||||
// Shutdown next frame if shutdown request is sent while loading the
|
||||
// world
|
||||
if (STKHost::existHost() && STKHost::get()->requestedShutdown())
|
||||
if (STKHost::existHost() &&
|
||||
(STKHost::get()->requestedShutdown() || m_request_abort))
|
||||
{
|
||||
SFXManager::get()->quickSound("anvil");
|
||||
core::stringw msg = _("Server connection timed out.");
|
||||
if (!STKHost::get()->getErrorMessage().empty())
|
||||
|
||||
if (!ProfileWorld::isNoGraphics())
|
||||
{
|
||||
msg = STKHost::get()->getErrorMessage();
|
||||
SFXManager::get()->quickSound("anvil");
|
||||
if (!STKHost::get()->getErrorMessage().empty())
|
||||
{
|
||||
msg = STKHost::get()->getErrorMessage();
|
||||
}
|
||||
}
|
||||
|
||||
STKHost::get()->shutdown();
|
||||
// In case the user opened a race pause dialog
|
||||
GUIEngine::ModalDialog::dismiss();
|
||||
@ -365,6 +372,11 @@ void MainLoop::run()
|
||||
NetworkConfig::get()->unsetNetworking();
|
||||
}
|
||||
|
||||
if (m_request_abort)
|
||||
{
|
||||
m_abort = true;
|
||||
}
|
||||
|
||||
if (!m_abort)
|
||||
{
|
||||
float frame_duration = num_steps * dt;
|
||||
@ -482,12 +494,4 @@ void MainLoop::run()
|
||||
|
||||
} // run
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** Set the abort flag, causing the mainloop to be left.
|
||||
*/
|
||||
void MainLoop::abort()
|
||||
{
|
||||
m_abort = true;
|
||||
} // abort
|
||||
|
||||
/* EOF */
|
||||
|
@ -32,6 +32,8 @@ private:
|
||||
/** True if the main loop should exit. */
|
||||
std::atomic_bool m_abort;
|
||||
|
||||
std::atomic_bool m_request_abort;
|
||||
|
||||
/** True if the frame rate should be throttled. */
|
||||
bool m_throttle_fps;
|
||||
|
||||
@ -48,7 +50,9 @@ public:
|
||||
MainLoop(unsigned parent_pid);
|
||||
~MainLoop();
|
||||
void run();
|
||||
void abort();
|
||||
/** Set the abort flag, causing the mainloop to be left. */
|
||||
void abort() { m_abort = true; }
|
||||
void requestAbort() { m_request_abort = true; }
|
||||
void setThrottleFPS(bool throttle) { m_throttle_fps = throttle; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns true if STK is to be stoppe. */
|
||||
|
Loading…
Reference in New Issue
Block a user