working on refactoring

This commit is contained in:
Vladislav Khorev committed 2026-10-24 22:37:20 +06:00
1 parent 9b71ee447a
commit d5ef126264
12 files changed
+309 -219

No files matched your search

+17
View File
@@ -44,6 +44,7 @@ namespace FRG {
out.lightsJsonPath = j.value("lights", "");
if (j.contains("playerPosition")) out.playerPosition = readVec3(j["playerPosition"]);
out.lockInteractiveObjectsDuringTutorial = j.value("lockInteractiveObjectsDuringTutorial", false);
out.loadingScreenPath = j.value("loadingScreen", "");
if (j.contains("taxi") && j["taxi"].is_object()) {
const json& t = j["taxi"];
@@ -71,6 +72,18 @@ namespace FRG {
return titles.empty() ? id : titles.begin()->second;
}
const LocationConfig* CampaignConfig::findLocation(const std::string& locationId) const {
for (const auto& loc : locations) {
if (loc.id == locationId) return &loc;
}
return nullptr;
}
std::string CampaignConfig::loadingScreenFor(const std::string& locationId) const {
const LocationConfig* loc = findLocation(locationId);
return (loc && !loc->loadingScreenPath.empty()) ? loc->loadingScreenPath : loadingScreenPath;
}
CampaignRegistry& CampaignRegistry::instance() {
static CampaignRegistry reg;
return reg;
@@ -97,6 +110,10 @@ namespace FRG {
c.questsPath = entry.value("quests", "");
c.tutorial = entry.value("tutorial", false);
c.loadingScreenPath = entry.value("loadingScreen", std::string(CampaignConfig::kDefaultLoadingScreen));
for (const std::string& path : c.locationConfigPaths) {
LocationConfig loc;
if (LocationConfig::fromFile(path, zipFile, loc)) c.locations.push_back(std::move(loc));
}
campaigns_.push_back(std::move(c));
}