Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
\/_____/ \/_____/ \/_/ \/_/ \/_/ \/_/ \/_____/ \/_/ \/_/ \/_/ \/_/ \/_____/ \/_/ \/_/ /_/ \/_____/\/_____/ \/_____/ \/_____/ \/_/

/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\*/

a
b

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

asda

c
/// <summary>
/// Main driver implementation of the Retro Terrain Engine.
/// Data Realms, LLC - http://www.datarealms.com
Expand Down
16 changes: 13 additions & 3 deletions Managers/SceneMan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -441,8 +441,8 @@ void SceneMan::Destroy()

Vector SceneMan::GetSceneDim() const
{
RTEAssert(m_pCurrentScene && m_pCurrentScene->GetTerrain() && m_pCurrentScene->GetTerrain()->GetBitmap(), "Trying to get terrain info before there is a scene or terrain!");
if (m_pCurrentScene)
RTEAssert(m_pCurrentScene->GetTerrain() && m_pCurrentScene->GetTerrain()->GetBitmap(), "Trying to get terrain info before there is a scene or terrain!");
return m_pCurrentScene->GetDimensions();
return Vector();
}
Expand Down Expand Up @@ -3432,7 +3432,9 @@ bool SceneMan::AddSceneObject(SceneObject *pObject)

void SceneMan::Update(int screen)
{
RTEAssert(m_pCurrentScene, "Trying to access scene before there is one!");
if (m_pCurrentScene == nullptr) {
return;
}

// Record screen was the last updated screen
m_LastUpdatedScreen = screen;
Expand Down Expand Up @@ -3572,7 +3574,9 @@ void SceneMan::Update(int screen)

void SceneMan::Draw(BITMAP *pTargetBitmap, BITMAP *pTargetGUIBitmap, const Vector &targetPos, bool skipSkybox, bool skipTerrain)
{
RTEAssert(m_pCurrentScene, "Trying to access scene before there is one!");
if (m_pCurrentScene == nullptr) {
return;
}
// Handy
SLTerrain *pTerrain = m_pCurrentScene->GetTerrain();

Expand Down Expand Up @@ -3689,4 +3693,10 @@ void SceneMan::ClearSeenPixels()
m_pCurrentScene->ClearSeenPixels(team);
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

void SceneMan::ClearCurrentScene() {
m_pCurrentScene = nullptr;
}

} // namespace RTE
6 changes: 5 additions & 1 deletion Managers/SceneMan.h
Original file line number Diff line number Diff line change
Expand Up @@ -1714,6 +1714,10 @@ class SceneMan:
bool back;
};

/// <summary>
/// Sets the current scene pointer to null
/// </summary>
void SceneMan::ClearCurrentScene();

//////////////////////////////////////////////////////////////////////////////////////////
// Protected member variable and method declarations
Expand Down Expand Up @@ -1821,7 +1825,7 @@ class SceneMan:

void Clear();


// Disallow the use of some implicit methods.
SceneMan(const SceneMan &reference);
SceneMan & operator=(const SceneMan &rhs);
Expand Down
2 changes: 2 additions & 0 deletions Menus/MetagameGUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3016,6 +3016,8 @@ void MetagameGUI::CompletedActivity()
// Deep copy over all the edits made to the newly played Scene
m_pPlayingScene->Destroy();
m_pPlayingScene->Create(*pAlteredScene);
// Null the current scene, which is pointed to by pAlteredScene.
g_SceneMan.ClearCurrentScene();
// Scrub the module ID so the migration goes well.. this is a bit hacky, but ok in this special case
m_pPlayingScene->SetModuleID(-1);
m_pPlayingScene->GetTerrain()->SetModuleID(-1);
Expand Down