Don't start demo world wrongly when isNetworking is true in menu

Fix the weird abyss screenshot with tux in android
This commit is contained in:
Benau 2018-10-24 14:37:51 +08:00
parent ce8125b03a
commit e78dbe2cce
2 changed files with 8 additions and 2 deletions

View File

@ -159,7 +159,8 @@ float MainLoop::getLimitedDt()
// when the computer can't keep it up, slow down the shown time instead
// But this can not be done in networking, otherwise the game time on
// client and server will not be in synch anymore
if(!NetworkConfig::get()->isNetworking())
if (!NetworkConfig::get()->isNetworking() ||
!World::getWorld())
{
/* time 3 internal substeps take */
const float MAX_ELAPSED_TIME = 3.0f*1.0f / 60.0f*1000.0f;

View File

@ -28,9 +28,11 @@
#include "tracks/track.hpp"
#include "tracks/track_manager.hpp"
#include <limits>
std::vector<std::string> DemoWorld::m_demo_tracks;
int DemoWorld::m_default_num_karts = 2;
float DemoWorld::m_max_idle_time = 99999.0f;
float DemoWorld::m_max_idle_time = std::numeric_limits<float>::max();
float DemoWorld::m_current_idle_time = 0;
bool DemoWorld::m_do_demo = false;
@ -104,6 +106,9 @@ void DemoWorld::enterRaceOverState()
*/
bool DemoWorld::updateIdleTimeAndStartDemo(float dt)
{
// Demo world is disabled if max float
if (m_max_idle_time == std::numeric_limits<float>::max())
return false;
// We get crashes if stk is activated when a modal dialog is open
if(GUIEngine::ModalDialog::isADialogActive())
return false;