1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-24 00:03:11 +01:00

Fix output result of remove_unused_objects (#10029)

This commit is contained in:
Ted John
2019-10-01 21:30:11 +01:00
committed by Michael Steenbeek
parent a63395eb1c
commit 15767c3be3
2 changed files with 16 additions and 11 deletions

View File

@@ -530,20 +530,23 @@ int32_t editor_remove_unused_objects()
int32_t numUnselectedObjects = 0;
for (int32_t i = 0; i < numObjects; i++)
{
if (!(_objectSelectionFlags[i] & OBJECT_SELECTION_FLAG_IN_USE)
&& !(_objectSelectionFlags[i] & OBJECT_SELECTION_FLAG_ALWAYS_REQUIRED))
if (_objectSelectionFlags[i] & OBJECT_SELECTION_FLAG_SELECTED)
{
const ObjectRepositoryItem* item = &items[i];
uint8_t objectType = object_entry_get_type(&item->ObjectEntry);
if (objectType >= OBJECT_TYPE_SCENERY_GROUP)
if (!(_objectSelectionFlags[i] & OBJECT_SELECTION_FLAG_IN_USE)
&& !(_objectSelectionFlags[i] & OBJECT_SELECTION_FLAG_ALWAYS_REQUIRED))
{
continue;
}
const ObjectRepositoryItem* item = &items[i];
uint8_t objectType = object_entry_get_type(&item->ObjectEntry);
_numSelectedObjectsForType[objectType]--;
_objectSelectionFlags[i] &= ~OBJECT_SELECTION_FLAG_SELECTED;
numUnselectedObjects++;
if (objectType >= OBJECT_TYPE_SCENERY_GROUP)
{
continue;
}
_numSelectedObjectsForType[objectType]--;
_objectSelectionFlags[i] &= ~OBJECT_SELECTION_FLAG_SELECTED;
numUnselectedObjects++;
}
}
}
unload_unselected_objects();

View File

@@ -1714,6 +1714,8 @@ static int32_t peep_update_patrolling_find_bin(Peep* peep)
if (!tileElement->AsPath()->HasAddition())
return 0;
rct_scenery_entry* sceneryEntry = tileElement->AsPath()->GetAdditionEntry();
if (sceneryEntry == nullptr)
return 0;
if (!(sceneryEntry->path_bit.flags & PATH_BIT_FLAG_IS_BIN))
return 0;