Skip to content

Commit

Permalink
Fix output result of remove_unused_objects (OpenRCT2#10029)
Browse files Browse the repository at this point in the history
  • Loading branch information
IntelOrca authored and Evan Haataja committed Apr 27, 2020
1 parent 58ac17d commit 889e888
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
25 changes: 14 additions & 11 deletions src/openrct2/EditorObjectSelectionSession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 2 additions & 0 deletions src/openrct2/peep/Staff.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 889e888

Please sign in to comment.