mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-07-29 07:21:54 -04:00
actually save attribute overrides
This commit is contained in:
@@ -129,6 +129,10 @@ std::optional<std::string> RandomizerContext::WriteToFile() {
|
||||
textData << YAML::EndMap;
|
||||
textData << YAML::EndMap;
|
||||
|
||||
for (const auto& [key, override] : mAttributeOverrides) {
|
||||
out["mAttributeOverrides"][key] = ContainerToHexString(override);
|
||||
}
|
||||
|
||||
for (const auto& [key, override] : mEntranceOverrides) {
|
||||
out["mEntranceOverrides"][key] = std::bit_cast<int>(override);
|
||||
}
|
||||
@@ -303,6 +307,15 @@ std::optional<std::string> RandomizerContext::LoadFromHash(const std::string& ha
|
||||
}
|
||||
}
|
||||
|
||||
// Attribute Overrides
|
||||
for (const auto& attributeNode : in["mAttributeOverrides"]) {
|
||||
auto key = attributeNode.first.as<u32>();
|
||||
std::vector<u8> overrideVec = HexToBytes(attributeNode.second.as<std::string>());
|
||||
std::array<u8, 20> override{};
|
||||
std::copy(overrideVec.begin(), overrideVec.end(), override.begin());
|
||||
this->mAttributeOverrides[key] = override;
|
||||
}
|
||||
|
||||
// Entrance Overrides
|
||||
for (const auto& entranceNode : in["mEntranceOverrides"]) {
|
||||
auto key = entranceNode.first.as<int>();
|
||||
|
||||
Reference in New Issue
Block a user