mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-16 03:23:15 +01:00
* 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:
@@ -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
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user