21 Log::Error(
"GameData: {} was not read: {}", path, file.error().Detail);
25 _file = std::make_unique<GameDataDocument>(std::move(*file));
26 _originalSlots = originalSlots;
27 _scriptBindings = scriptBindings;
28 _scanner = std::make_unique<GameDataScanner>(*_file, _originalSlots, _scriptBindings);
29 _scanner->ResolveAll();
30 _scanner->LogSummary(path);
32 const std::vector<std::string>& failures = _scanner->Failures();
33 if (!failures.empty())
44 const GameDataEntry* entry = _scanner ? _scanner->Find(key) :
nullptr;
47 return NotBound(
"not in gamedata");
49 if (!entry->
Reason.empty())
51 return NotBound(entry->
Reason);
53 if ((
static_cast<uint32_t
>(sections) &
static_cast<uint32_t
>(entry->
Kind)) == 0)
55 return NotBound(std::format(
"in '{}', which this member does not bind from", entry->
Sections[0]));
58 return {.Found =
true, .Address = entry->
Address, .Value = entry->
Value};
63 _reason = std::move(reason);
64 return {.Reason = _reason};
GameDataTable(std::string_view path, const OriginalSlotLookup &originalSlots={}, const ScriptBindingLookup &scriptBindings={})
GameDataLocation Lookup(GameDataSection sections, std::string_view key) override
static Result< T > ReadFile(std::string_view path)
Parse path (resolved via ResolvePath) into T.
static std::string Join(const std::vector< std::string > &parts, std::string_view delimiter)
void Error(std::format_string< Args... > fmt, Args &&... args)
void WriteGameDataRecord(const GameDataRecord &resolved)
std::function< const void *(void **vtable, int index)> OriginalSlotLookup
std::function< Result< ScriptTarget >(void *classTable, std::string_view name)> ScriptBindingLookup
std::vector< std::string_view > Sections