Fix #7772. Check for vehicles using an object when setting inuse (#14056)

* Fix #7772. Check for vehicles using an object when setting inuse

* Update changelog
This commit is contained in:
Duncan 2021-02-10 18:14:23 +00:00 committed by GitHub
parent f99c35d88f
commit fe8b8280e8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 0 deletions

View file

@ -24,6 +24,7 @@
- Change: [#13346] [Plugin] Renamed FootpathScenery to FootpathAddition, fix typos.
- Change: [#13857] Change Rotation Control Toggle to track element number 256
- Fix: [#4605, #11912] Water palettes are not updated properly when selected in Object Selection.
- Fix: [#7772] Hacked vehicles may incorrectly not mark a vehicle object as in use causing accidental removal when remove_unused_objects is used.
- Fix: [#9631, #10716] Banners drawing glitches when there are more than 32 on the screen at once.
- Fix: [#11438] Freeze when shrinking map size.
- Fix: [#12895] Mechanics are called to repair rides that have already been fixed.

View file

@ -200,6 +200,24 @@ void setup_in_use_selection_flags()
}
}
// Apply selected object status for hacked vehicles that may not have an associated ride
for (auto vehicle : EntityList<Vehicle>(EntityListId::TrainHead))
{
ObjectEntryIndex type = vehicle->ride_subtype;
if (type != RIDE_ENTRY_INDEX_NULL) // cable lifts use index null. Ignore them
{
Editor::SetSelectedObject(ObjectType::Ride, type, OBJECT_SELECTION_FLAG_SELECTED);
}
}
for (auto vehicle : EntityList<Vehicle>(EntityListId::Vehicle))
{
ObjectEntryIndex type = vehicle->ride_subtype;
if (type != RIDE_ENTRY_INDEX_NULL) // cable lifts use index null. Ignore them
{
Editor::SetSelectedObject(ObjectType::Ride, type, OBJECT_SELECTION_FLAG_SELECTED);
}
}
int32_t numObjects = static_cast<int32_t>(object_repository_get_items_count());
const ObjectRepositoryItem* items = object_repository_get_items();
for (int32_t i = 0; i < numObjects; i++)