fix(editor): harden JSON handling, quest loading, and content validation

- Quest editor: add loadFromFile() with nlohmann/json, chain validation
  with circular reference detection, wire into ADT load and save pipeline
- Project: replace naive substring JSON parsing with nlohmann/json for
  both save() and load(), fix shell injection in gitCommit()
- Content pack: replace manual JSON with nlohmann/json, validate binary
  format magic numbers (WHM1/WOM1/WOB1), add WOB to openFormatScore
  (now scores 0-6), mark invalid files with (!) in summary
This commit is contained in:
Kelsi 2026-05-05 12:48:50 -07:00
parent 4fc0361f7a
commit 2eec089ef5
6 changed files with 265 additions and 153 deletions

View file

@ -653,6 +653,8 @@ void EditorApp::loadADT(const std::string& mapName, int tileX, int tileY) {
showToast("Loaded " + std::to_string(objectPlacer_.objectCount()) + " objects");
if (npcSpawner_.loadFromFile(outBase + "/creatures.json"))
showToast("Loaded " + std::to_string(npcSpawner_.spawnCount()) + " NPCs");
if (questEditor_.loadFromFile(outBase + "/quests.json"))
showToast("Loaded " + std::to_string(questEditor_.questCount()) + " quests");
if (objectPlacer_.objectCount() > 0 || npcSpawner_.spawnCount() > 0)
objectsDirty_ = true;
}
@ -726,6 +728,11 @@ void EditorApp::exportZone(const std::string& outputDir) {
if (questEditor_.questCount() > 0) {
std::string questPath = base + "/quests.json";
questEditor_.saveToFile(questPath);
std::vector<std::string> chainErrors;
if (!questEditor_.validateChains(chainErrors)) {
for (const auto& err : chainErrors)
LOG_WARNING("Quest chain issue: ", err);
}
}
// Update WDT with additional tiles from adjacent exports