diff --git a/Code/Sandbox/Editor/CryEdit.cpp b/Code/Sandbox/Editor/CryEdit.cpp index 9ad57d6581..b88aee8bd9 100644 --- a/Code/Sandbox/Editor/CryEdit.cpp +++ b/Code/Sandbox/Editor/CryEdit.cpp @@ -3200,7 +3200,7 @@ CCryEditApp::ECreateLevelResult CCryEditApp::CreateLevel(const QString& levelNam m_bIsExportingLegacyData = false; } - GetIEditor()->GetGameEngine()->LoadLevel(GetIEditor()->GetGameEngine()->GetMissionName(), true, true); + GetIEditor()->GetGameEngine()->LoadLevel(true, true); GetIEditor()->GetSystem()->GetISystemEventDispatcher()->OnSystemEvent(ESYSTEM_EVENT_LEVEL_PRECACHE_START, 0, 0); GetIEditor()->GetSystem()->GetISystemEventDispatcher()->OnSystemEvent(ESYSTEM_EVENT_LEVEL_PRECACHE_END, 0, 0); diff --git a/Code/Sandbox/Editor/CryEditDoc.cpp b/Code/Sandbox/Editor/CryEditDoc.cpp index 557341f28c..ffcbd00a5f 100644 --- a/Code/Sandbox/Editor/CryEditDoc.cpp +++ b/Code/Sandbox/Editor/CryEditDoc.cpp @@ -459,6 +459,11 @@ void CCryEditDoc::Load(TDocMultiArchive& arrXmlAr, const QString& szFilename) Audio::AudioSystemRequestBus::Broadcast(&Audio::AudioSystemRequestBus::Events::PushRequestBlocking, oAudioRequestData); } + { + CAutoLogTime logtime("Game Engine level load"); + GetIEditor()->GetGameEngine()->LoadLevel(true, true); + } + if (!isPrefabEnabled) { ////////////////////////////////////////////////////////////////////////// diff --git a/Code/Sandbox/Editor/GameEngine.cpp b/Code/Sandbox/Editor/GameEngine.cpp index 6c1bef7a68..073684eaad 100644 --- a/Code/Sandbox/Editor/GameEngine.cpp +++ b/Code/Sandbox/Editor/GameEngine.cpp @@ -539,19 +539,12 @@ void CGameEngine::SetLevelPath(const QString& path) } } -void CGameEngine::SetMissionName(const QString& mission) -{ - m_missionName = mission; -} - bool CGameEngine::LoadLevel( - const QString& mission, [[maybe_unused]] bool bDeleteAIGraph, bool bReleaseResources) { LOADING_TIME_PROFILE_SECTION(GetIEditor()->GetSystem()); m_bLevelLoaded = false; - m_missionName = mission; CLogFile::FormatLine("Loading map '%s' into engine...", m_levelPath.toUtf8().data()); // Switch the current directory back to the Primary CD folder first. // The engine might have trouble to find some files when the current @@ -600,7 +593,7 @@ bool CGameEngine::LoadLevel( bool CGameEngine::ReloadLevel() { - if (!LoadLevel(GetMissionName(), false, false)) + if (!LoadLevel(false, false)) { return false; } diff --git a/Code/Sandbox/Editor/GameEngine.h b/Code/Sandbox/Editor/GameEngine.h index c660f971f2..b59e2c9ac8 100644 --- a/Code/Sandbox/Editor/GameEngine.h +++ b/Code/Sandbox/Editor/GameEngine.h @@ -89,7 +89,6 @@ public: //! Load new terrain level into 3d engine. //! Also load AI triangulation for this level. bool LoadLevel( - const QString& mission, bool bDeleteAIGraph, bool bReleaseResources); //!* Reload level if it was already loaded. @@ -107,14 +106,10 @@ public: bool IsLevelLoaded() const { return m_bLevelLoaded; }; //! Assign new level path name. void SetLevelPath(const QString& path); - //! Assign new current mission name. - void SetMissionName(const QString& mission); //! Return name of currently loaded level. const QString& GetLevelName() const { return m_levelName; }; //! Return extension of currently loaded level. const QString& GetLevelExtension() const { return m_levelExtension; }; - //! Return name of currently active mission. - const QString& GetMissionName() const { return m_missionName; }; //! Get fully specified level path. const QString& GetLevelPath() const { return m_levelPath; }; //! Query if engine is in game mode. @@ -172,7 +167,6 @@ private: CLogFile m_logFile; QString m_levelName; QString m_levelExtension; - QString m_missionName; QString m_levelPath; QString m_MOD; bool m_bLevelLoaded;