diff --git a/Source/Entities/MovableObject.cpp b/Source/Entities/MovableObject.cpp index c64fb84326..0833fd3065 100644 --- a/Source/Entities/MovableObject.cpp +++ b/Source/Entities/MovableObject.cpp @@ -563,7 +563,7 @@ int MovableObject::ReloadScripts() { // TODO consider getting rid of this const_cast. It would require either code duplication or creating some non-const methods (specifically of PresetMan::GetEntityPreset, which may be unsafe. Could be this gross exceptional handling is the best way to go. MovableObject* movableObjectPreset = const_cast(dynamic_cast(g_PresetMan.GetEntityPreset(GetClassName(), GetPresetName(), GetModuleID()))); - if (this != movableObjectPreset) { + if (movableObjectPreset && this != movableObjectPreset) { movableObjectPreset->ReloadScripts(); } diff --git a/Source/Main.cpp b/Source/Main.cpp index f2ddb59555..31629b1457 100644 --- a/Source/Main.cpp +++ b/Source/Main.cpp @@ -319,7 +319,10 @@ void RunGameLoop() { g_PerformanceMan.StartPerformanceMeasurement(PerformanceMan::SimTotal); + g_LuaMan.Update(); + g_UInputMan.Update(); + g_ConsoleMan.Update(); // It is vital that server is updated after input manager but before activity because input manager will clear received pressed and released events on next update. if (g_NetworkServer.IsServerModeEnabled()) { @@ -328,7 +331,7 @@ void RunGameLoop() { } g_FrameMan.Update(); - g_LuaMan.Update(); + g_ActivityMan.Update(); if (g_SceneMan.GetScene()) { @@ -347,7 +350,6 @@ void RunGameLoop() { // It's in this spot to allow it to be set by UInputMan update and ConsoleMan update, and read from ActivityMan update. g_PresetMan.ClearReloadEntityPresetCalledThisUpdate(); - g_ConsoleMan.Update(); g_PerformanceMan.StopPerformanceMeasurement(PerformanceMan::SimTotal); if (!g_ActivityMan.IsInActivity()) {