mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-11-14 02:10:06 +00:00
Implement automatic tdata patching
This commit is contained in:
parent
bf12ed4c47
commit
26894c8a69
@ -1013,7 +1013,20 @@ void TableData::init() {
|
||||
}
|
||||
fstream.close();
|
||||
|
||||
// patching
|
||||
// patching: loop through every directory within the patch directory, looking for a matching file
|
||||
json patch;
|
||||
for (const auto& patchModule : std::filesystem::directory_iterator(settings::PATCHDIR)) {
|
||||
// this is the theoretical path of a corresponding patch for this file
|
||||
std::string patchFile = patchModule.path().generic_u8string() + "/" + table.second;
|
||||
if (std::filesystem::exists(patchFile)) {
|
||||
// file exists
|
||||
std::cout << "[INFO] Patching " << patchFile << std::endl;
|
||||
fstream.open(patchFile);
|
||||
fstream >> patch; // load into temporary json object
|
||||
patchJSON(table.first, &patch); // patch
|
||||
fstream.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// fetch data from patched tables and load them appropriately
|
||||
|
@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
#include <map>
|
||||
#include <filesystem>
|
||||
|
||||
#include "NPCManager.hpp"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user