Skip to content

Commit 7918fcc

Browse files
committed
Override datapath to save preset properly
1 parent 49b6221 commit 7918fcc

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

Source/Entities/SceneLayer.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ namespace RTE {
7676
/// @return Whether this SceneLayer's bitmap data was loaded from a file or not.
7777
virtual bool IsLoadedFromDisk() const { return !m_BitmapFile.GetDataPath().empty(); }
7878

79+
/// Override's this SceneLayer's datapath. Used for saved games
80+
/// @param dataPath The new datapath to override this SceneLayer to use.
81+
void OverrideDataPath(const std::string& dataPath) { m_BitmapFile.SetDataPath(dataPath); }
82+
7983
/// Loads previously specified/created data into memory from an existing BITMAP. Has to be done before using this SceneLayer if the bitmap was not generated at runtime.
8084
/// @param bitmap Pointer to the bitmap to take. Takes ownership!
8185
/// @return An error return value signaling success or any particular failure. Anything below 0 is an error signal.

Source/Managers/ActivityMan.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,10 @@ bool ActivityMan::SaveCurrentGame(const std::string& fileName) {
100100
modifiableScene->GetTerrain()->SetPresetName(fileName);
101101
modifiableScene->GetTerrain()->MigrateToModule(g_PresetMan.GetModuleID(c_UserScriptedSavesModuleName));
102102

103+
modifiableScene->GetTerrain()->OverrideDataPath("Save Mat.png");
104+
modifiableScene->GetTerrain()->GetFGSceneLayer()->OverrideDataPath("Save FG.png");
105+
modifiableScene->GetTerrain()->GetBGSceneLayer()->OverrideDataPath("Save BG.png");
106+
103107
std::unique_ptr<std::stringstream> iniStream = std::make_unique<std::stringstream>();
104108

105109
// Block the main thread for a bit to let the Writer access the relevant data.

0 commit comments

Comments
 (0)