mirror of https://github.com/OpenRCT2/OpenRCT2.git
* Add ObjectTypeIsTransient() and ObjectTypeIsIntransient() * Fix #19434, #19509: remove_unused_objects does not remove OpenRCT2 types
This commit is contained in:
parent
e26a18f8b9
commit
6a89dfbfe9
|
@ -54,6 +54,7 @@
|
|||
- Fix: [#19379] “No platforms” station style shows platforms on the Junior Roller Coaster.
|
||||
- Fix: [#19380] Startup crash when no sequences are installed and random sequences are enabled.
|
||||
- Fix: [#19391] String corruption caused by an improper buffer handling in ‘GfxWrapString’.
|
||||
- Fix: [#19434, #19509] Object types added by OpenRCT2 do not get removed when executing ‘remove_unused_objects’.
|
||||
- Fix: [#19475] Cannot increase loan when more than £1000 in debt.
|
||||
- Fix: [#19493] SV4 saves not importing the correct vehicle colours.
|
||||
- Fix: [#19517] Crash when peeps try to exit or enter hacked rides that have no waypoints specified.
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -814,6 +814,7 @@
|
|||
<ClCompile Include="object\ObjectList.cpp" />
|
||||
<ClCompile Include="object\ObjectManager.cpp" />
|
||||
<ClCompile Include="object\ObjectRepository.cpp" />
|
||||
<ClCompile Include="object\ObjectTypes.cpp" />
|
||||
<ClCompile Include="object\ResourceTable.cpp" />
|
||||
<ClCompile Include="object\RideObject.cpp" />
|
||||
<ClCompile Include="object\SceneryGroupObject.cpp" />
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
/*****************************************************************************
|
||||
* Copyright (c) 2014-2023 OpenRCT2 developers
|
||||
*
|
||||
* For a complete list of all authors, please refer to contributors.md
|
||||
* Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
|
||||
*
|
||||
* OpenRCT2 is licensed under the GNU General Public License version 3.
|
||||
*****************************************************************************/
|
||||
|
||||
#include "ObjectTypes.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
bool ObjectTypeIsTransient(ObjectType type)
|
||||
{
|
||||
return std::find(TransientObjectTypes.begin(), TransientObjectTypes.end(), type) != std::end(TransientObjectTypes);
|
||||
}
|
||||
|
||||
bool ObjectTypeIsIntransient(ObjectType type)
|
||||
{
|
||||
return std::find(IntransientObjectTypes.begin(), IntransientObjectTypes.end(), type) != std::end(IntransientObjectTypes);
|
||||
}
|
|
@ -72,3 +72,9 @@ constexpr std::array<ObjectType, 16> TransientObjectTypes = {
|
|||
ObjectType::ParkEntrance, ObjectType::Water, ObjectType::TerrainSurface, ObjectType::TerrainEdge,
|
||||
ObjectType::Station, ObjectType::Music, ObjectType::FootpathSurface, ObjectType::FootpathRailings,
|
||||
};
|
||||
|
||||
// Object types that cannot be saved in a park file.
|
||||
constexpr std::array<ObjectType, 2> IntransientObjectTypes = { ObjectType::ScenarioText, ObjectType::Audio };
|
||||
|
||||
bool ObjectTypeIsTransient(ObjectType type);
|
||||
bool ObjectTypeIsIntransient(ObjectType type);
|
||||
|
|
Loading…
Reference in New Issue