1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-17 20:13:07 +01:00

Fix #18606: JSON objects do not take priority over DATs they supersede

This commit is contained in:
Michael Steenbeek
2022-11-17 18:50:20 +01:00
committed by GitHub
parent b2ffcf3b8a
commit e13a2d70b3
2 changed files with 17 additions and 0 deletions

View File

@@ -419,6 +419,7 @@ private:
{
conflict = FindObject(item.Identifier);
}
if (conflict == nullptr)
{
size_t index = _items.size();
@@ -435,6 +436,21 @@ private:
}
return true;
}
// When there is a conflict between a DAT file and a JSON file, the JSON should take precedence.
else if (item.Generation == ObjectGeneration::JSON && conflict->Generation == ObjectGeneration::DAT)
{
const auto id = conflict->Id;
const auto oldPath = conflict->Path;
_items[id] = item;
_items[id].Id = id;
if (!item.Identifier.empty())
{
_newItemMap[item.Identifier] = id;
}
Console::Error::WriteLine("Object conflict: '%s' was overridden by '%s'", oldPath.c_str(), item.Path.c_str());
return true;
}
Console::Error::WriteLine("Object conflict: '%s'", conflict->Path.c_str());
Console::Error::WriteLine(" : '%s'", item.Path.c_str());