Skip to content
This repository was archived by the owner on Jan 5, 2024. It is now read-only.

Commit 6995012

Browse files
committed
Fix for metagame crash (thanks MinerBoy)
1 parent c37f655 commit 6995012

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Menus/MetagameGUI.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2966,6 +2966,13 @@ void MetagameGUI::CompletedActivity()
29662966
pAlteredScene->SaveData(METASAVEPATH + std::string(AUTOSAVENAME) + " - " + pAlteredScene->GetPresetName());
29672967
// Clear the bitmap data etc of the altered scene, we don't need to copy that over
29682968
pAlteredScene->ClearData();
2969+
2970+
// Clear waypoints on resident brains, otherwise when they're cloned they try to update their move paths, which requires a material bitmap (which we destroyed when we cleared data above).
2971+
for (int player = Players::PlayerOne; player < Players::MaxPlayerCount; ++player) {
2972+
if (Actor *residentBrain = dynamic_cast<Actor *>(pAlteredScene->GetResidentBrain(player))) {
2973+
residentBrain->ClearAIWaypoints();
2974+
}
2975+
}
29692976
// Deep copy over all the edits made to the newly played Scene
29702977
m_pPlayingScene->Destroy();
29712978
m_pPlayingScene->Create(*pAlteredScene);

0 commit comments

Comments
 (0)