refactor: look up the oldest zone files' scenes in a CDClient SceneTable table

Zone held a std::function that queried the SceneTable, so tests could swap it out. CDSceneTableTable now loads the table with the others, and Zone looks scenes up in it; tests fill its entries like the zone table's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Aaron Kimbrell
2026-10-27 09:53:13 -05:00
parent d0d280d3ad
commit 9367ad6207
7 changed files with 64 additions and 22 deletions

View File

@@ -7,8 +7,6 @@
#include "ZoneScenes.h"
#include "tinyxml2.h"
#include <string>
#include <functional>
#include <optional>
#include <vector>
#include <map>
#include "Raw.h"
@@ -43,10 +41,6 @@ public:
const uint32_t GetChecksum() const { return m_CheckSum; }
LUTriggers::Trigger* GetTrigger(uint32_t sceneID, uint32_t triggerID) const;
const Path* GetPath(std::string name) const;
// The CDClient SceneTable's sceneName for a scene of a file from before PrePreAlpha; the database's by default
using SceneTableLookup = std::function<std::optional<std::string>(uint32_t sceneTableID)>;
void SetSceneTableLookup(SceneTableLookup lookup) { m_SceneTableLookup = std::move(lookup); }
const std::vector<Path>& GetPaths() const { return m_Paths; }
// A path that isn't in the zone's files (tests); earlier GetPath pointers may move
void AddPath(Path path) { m_Paths.push_back(std::move(path)); }
@@ -103,7 +97,6 @@ private:
std::vector<Path> m_Paths;
std::map<LWOSCENEID, uint32_t> m_MapRevisions; //rhs is the revision!
SceneTableLookup m_SceneTableLookup;
//private ("helper") functions:
void LoadScene(ZoneScene&& zoneScene);
void LoadLUTriggers(std::string triggerFile, SceneRef& scene);