Skip to content

Commit 6aa3e78

Browse files
committed
replace pak file and tile map compiler feature flags with pak file runtime setting
1 parent 05854b5 commit 6aa3e78

3 files changed

Lines changed: 17 additions & 27 deletions

File tree

map/src/MapWindow/DataView/DataView.cpp

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,9 @@ Satisfactory3DMap::DataView::DataView(std::shared_ptr<Configuration> config)
9696
: config_(std::move(config)),
9797
selectedObject_(nullptr) {
9898

99+
usePakSetting_ = BoolSetting::create("UsePakFiles", false);
99100
gameDirSetting_ = PathSetting::create("GameDirectory", PathSetting::PathType::Directory);
101+
config_->registerSetting(usePakSetting_);
100102
config_->registerSetting(gameDirSetting_);
101103

102104
if (gameDirSetting_->getVal().empty()) {
@@ -105,19 +107,19 @@ Satisfactory3DMap::DataView::DataView(std::shared_ptr<Configuration> config)
105107
gameDirSetting_->setVal(gameDirs[0]);
106108
}
107109
}
108-
#ifdef FEATURE_PAK_FILE
109-
if (!gameDirSetting_->getVal().empty()) {
110-
try {
111-
pakManager_ = SatisfactorySave::PakManager::create(gameDirSetting_->getVal());
112-
} catch (const std::exception& ex) {
113-
spdlog::error("Error init PakManager: {}", ex.what());
114-
showErrors_.push_back(std::string("Error reading game dir: ") + ex.what());
110+
if (usePakSetting_->getVal()) {
111+
if (!gameDirSetting_->getVal().empty()) {
112+
try {
113+
pakManager_ = SatisfactorySave::PakManager::create(gameDirSetting_->getVal());
114+
} catch (const std::exception& ex) {
115+
spdlog::error("Error init PakManager: {}", ex.what());
116+
showErrors_.push_back(std::string("Error reading game dir: ") + ex.what());
117+
}
118+
} else {
119+
spdlog::warn("No game dir set!");
120+
showErrors_.emplace_back("No game dir found! Please go to File > Settings and select a game dir.");
115121
}
116-
} else {
117-
spdlog::warn("No game dir set!");
118-
showErrors_.emplace_back("No game dir found! Please go to File > Settings and select a game dir.");
119122
}
120-
#endif
121123

122124
manager_ = std::make_unique<ModelManager>(pakManager_);
123125
}

map/src/MapWindow/DataView/DataView.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include "SatisfactorySave/GameTypes/Save/SaveGame.h"
1313
#include "SatisfactorySave/Pak/PakManager.h"
1414

15+
#include "../Config/BoolSetting.h"
1516
#include "../Config/Configuration.h"
1617
#include "../Config/PathSetting.h"
1718
#include "ModelManager.h"
@@ -142,6 +143,7 @@ namespace Satisfactory3DMap {
142143
void addToNode(const ObjectProxyPtr& proxy, SaveNode& rootNode);
143144

144145
std::shared_ptr<Configuration> config_;
146+
std::shared_ptr<BoolSetting> usePakSetting_;
145147
std::shared_ptr<PathSetting> gameDirSetting_;
146148

147149
std::shared_ptr<SatisfactorySave::PakManager> pakManager_;

map/src/MapWindow/MapWindow.cpp

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -58,22 +58,8 @@ Satisfactory3DMap::MapWindow::MapWindow()
5858
std::vector<float>{0.25f, 0.5f, 1.0f, 1.5f, 2.0f, 2.5f, 3.0f, 4.0f}, 4);
5959
metallicSetting_ = FloatSetting::create("Metallic", 0.0f);
6060
roughnessSetting_ = FloatSetting::create("Roughness", 0.5f);
61-
worldRenderModeSetting_ = EnumSetting<WorldRenderMode>::create("World Mode",
62-
{"None", "HeightMap",
63-
#ifdef FEATURE_TILEMAP
64-
"TileMap"
65-
#else
66-
"HeightMap (temp. replacement for TileMap)"
67-
#endif
68-
},
69-
{WorldRenderMode::None, WorldRenderMode::HeightMap,
70-
#ifdef FEATURE_TILEMAP
71-
WorldRenderMode::TileMap
72-
#else
73-
WorldRenderMode::HeightMap
74-
#endif
75-
},
76-
2);
61+
worldRenderModeSetting_ = EnumSetting<WorldRenderMode>::create("World Mode", {"None", "HeightMap", "TileMap"},
62+
{WorldRenderMode::None, WorldRenderMode::HeightMap, WorldRenderMode::TileMap}, 2);
7763
showSelectionMarkerSetting_ = BoolSetting::create("Selection marker", false);
7864
showSaveTreePerLevelSetting_ = BoolSetting::create("Show save tree per level", false);
7965

0 commit comments

Comments
 (0)