1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-16 03:23:15 +01:00

Fix #19823. Disallow overriding with wrong object type (#20182)

* Fix #19823. Disallow overriding with wrong object type

Some community objects have been made incorrectly and override small scenery objects with large scenery objects. This prevents that overload from being allowed.

* Bump network version and add changelog
This commit is contained in:
Duncan
2023-05-14 21:31:06 +01:00
committed by GitHub
parent c4b70358c8
commit db1c9fab41
3 changed files with 14 additions and 3 deletions

View File

@@ -531,10 +531,20 @@ namespace ObjectFactory
RCTObjectEntry entry = {};
entry.flags = std::stoul(originalId.substr(0, 8), nullptr, 16);
entry.checksum = std::stoul(originalId.substr(18, 8), nullptr, 16);
entry.SetType(objectType);
auto minLength = std::min<size_t>(8, originalName.length());
std::memcpy(entry.name, originalName.c_str(), minLength);
descriptor = ObjectEntryDescriptor(entry);
// Some bad objects try to override different types
if (entry.GetType() != objectType)
{
LOG_ERROR(
"Object \"%s\" has invalid originalId set \"%s\". Ignoring override.", id.c_str(), originalId.c_str());
descriptor = ObjectEntryDescriptor(objectType, id);
}
else
{
descriptor = ObjectEntryDescriptor(entry);
}
}
else
{