1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-19 04:53:12 +01:00

Fix #19434, #19509: OpenRCT2 object types not removed by ‘remove_unused_objects’ (#19511)

* Add ObjectTypeIsTransient() and ObjectTypeIsIntransient()

* Fix #19434, #19509: remove_unused_objects does not remove OpenRCT2 types
This commit is contained in:
Michael Steenbeek
2023-03-02 20:26:19 +01:00
committed by GitHub
parent e26a18f8b9
commit 6a89dfbfe9
5 changed files with 36 additions and 4 deletions

View File

@@ -671,11 +671,13 @@ int32_t EditorRemoveUnusedObjects()
{
const ObjectRepositoryItem* item = &items[i];
ObjectType objectType = item->Type;
if (objectType >= ObjectType::SceneryGroup)
{
if (ObjectTypeIsIntransient(objectType))
continue;
// These object types require exactly one object to be selected at all times.
// Removing that object can badly break the game state.
if (objectType == ObjectType::ParkEntrance || objectType == ObjectType::Water)
continue;
}
_numSelectedObjectsForType[EnumValue(objectType)]--;
_objectSelectionFlags[i] &= ~ObjectSelectionFlags::Selected;