mirror of https://github.com/OpenRCT2/OpenRCT2.git
Take kAllObjectTypes internal as well
This commit is contained in:
parent
e898e9211d
commit
cec251bb63
|
@ -806,7 +806,7 @@ namespace OpenRCT2
|
|||
private:
|
||||
bool HasObjectsThatUseFallbackImages()
|
||||
{
|
||||
for (auto objectType : ObjectTypes)
|
||||
for (auto objectType : getAllObjectTypes())
|
||||
{
|
||||
auto maxObjectsOfType = static_cast<ObjectEntryIndex>(getObjectEntryGroupCount(objectType));
|
||||
for (ObjectEntryIndex i = 0; i < maxObjectsOfType; i++)
|
||||
|
|
|
@ -1311,7 +1311,7 @@ static_assert(_objectTypeNames.size() == EnumValue(ObjectType::Count));
|
|||
|
||||
static int32_t ConsoleCommandCountObjects(InteractiveConsole& console, [[maybe_unused]] const arguments_t& argv)
|
||||
{
|
||||
for (auto objectType : ObjectTypes)
|
||||
for (auto objectType : getAllObjectTypes())
|
||||
{
|
||||
uint32_t entryGroupIndex = 0;
|
||||
for (; entryGroupIndex < getObjectEntryGroupCount(objectType); entryGroupIndex++)
|
||||
|
|
|
@ -143,7 +143,7 @@ public:
|
|||
ObjectList GetLoadedObjects() override
|
||||
{
|
||||
ObjectList objectList;
|
||||
for (auto objectType : ObjectTypes)
|
||||
for (auto objectType : getAllObjectTypes())
|
||||
{
|
||||
auto maxObjectsOfType = static_cast<ObjectEntryIndex>(getObjectEntryGroupCount(objectType));
|
||||
for (ObjectEntryIndex i = 0; i < maxObjectsOfType; i++)
|
||||
|
@ -312,7 +312,7 @@ private:
|
|||
|
||||
void UnloadAll(bool onlyTransient)
|
||||
{
|
||||
for (auto type : ObjectTypes)
|
||||
for (auto type : getAllObjectTypes())
|
||||
{
|
||||
if (!onlyTransient || !IsIntransientObjectType(type))
|
||||
{
|
||||
|
@ -443,7 +443,7 @@ private:
|
|||
// Unload objects that are not in the hash set
|
||||
size_t totalObjectsLoaded = 0;
|
||||
size_t numObjectsUnloaded = 0;
|
||||
for (auto type : ObjectTypes)
|
||||
for (auto type : getAllObjectTypes())
|
||||
{
|
||||
if (!IsIntransientObjectType(type))
|
||||
{
|
||||
|
@ -522,7 +522,7 @@ private:
|
|||
std::vector<ObjectToLoad> requiredObjects;
|
||||
std::vector<ObjectEntryDescriptor> missingObjects;
|
||||
|
||||
for (auto objectType : ObjectTypes)
|
||||
for (auto objectType : getAllObjectTypes())
|
||||
{
|
||||
auto& descriptors = objectList.GetList(objectType);
|
||||
auto maxSize = static_cast<size_t>(getObjectEntryGroupCount(objectType));
|
||||
|
@ -673,7 +673,7 @@ private:
|
|||
}
|
||||
|
||||
// Set the new object lists
|
||||
for (auto type : ObjectTypes)
|
||||
for (auto type : getAllObjectTypes())
|
||||
{
|
||||
if (!IsIntransientObjectType(type))
|
||||
{
|
||||
|
|
|
@ -14,6 +14,29 @@
|
|||
|
||||
#include <algorithm>
|
||||
|
||||
constexpr std::array kAllObjectTypes = {
|
||||
ObjectType::Ride,
|
||||
ObjectType::SmallScenery,
|
||||
ObjectType::LargeScenery,
|
||||
ObjectType::Walls,
|
||||
ObjectType::Banners,
|
||||
ObjectType::Paths,
|
||||
ObjectType::PathAdditions,
|
||||
ObjectType::SceneryGroup,
|
||||
ObjectType::ParkEntrance,
|
||||
ObjectType::Water,
|
||||
ObjectType::ScenarioText,
|
||||
ObjectType::TerrainSurface,
|
||||
ObjectType::TerrainEdge,
|
||||
ObjectType::Station,
|
||||
ObjectType::Music,
|
||||
ObjectType::FootpathSurface,
|
||||
ObjectType::FootpathRailings,
|
||||
ObjectType::Audio,
|
||||
};
|
||||
|
||||
static_assert(kAllObjectTypes.size() == EnumValue(ObjectType::Count));
|
||||
|
||||
// Object types that can be saved in a park file.
|
||||
static constexpr std::array<const ObjectType, kNumTransientObjectTypes> kTransientObjectTypes = {
|
||||
ObjectType::Ride, ObjectType::SmallScenery, ObjectType::LargeScenery, ObjectType::Walls,
|
||||
|
@ -40,6 +63,11 @@ bool ObjectTypeIsIntransient(ObjectType type)
|
|||
return std::find(kIntransientObjectTypes.begin(), kIntransientObjectTypes.end(), type) != std::end(kIntransientObjectTypes);
|
||||
}
|
||||
|
||||
std::span<const ObjectType> getAllObjectTypes()
|
||||
{
|
||||
return kAllObjectTypes;
|
||||
}
|
||||
|
||||
std::span<const ObjectType> getTransientObjectTypes()
|
||||
{
|
||||
return kTransientObjectTypes;
|
||||
|
|
|
@ -44,33 +44,12 @@ enum class ObjectType : uint8_t
|
|||
None = 255
|
||||
};
|
||||
|
||||
constexpr std::array ObjectTypes = {
|
||||
ObjectType::Ride,
|
||||
ObjectType::SmallScenery,
|
||||
ObjectType::LargeScenery,
|
||||
ObjectType::Walls,
|
||||
ObjectType::Banners,
|
||||
ObjectType::Paths,
|
||||
ObjectType::PathAdditions,
|
||||
ObjectType::SceneryGroup,
|
||||
ObjectType::ParkEntrance,
|
||||
ObjectType::Water,
|
||||
ObjectType::ScenarioText,
|
||||
ObjectType::TerrainSurface,
|
||||
ObjectType::TerrainEdge,
|
||||
ObjectType::Station,
|
||||
ObjectType::Music,
|
||||
ObjectType::FootpathSurface,
|
||||
ObjectType::FootpathRailings,
|
||||
ObjectType::Audio,
|
||||
};
|
||||
// Not using EnumValue to reduce header includes
|
||||
static_assert(ObjectTypes.size() == static_cast<uint8_t>(ObjectType::Count));
|
||||
|
||||
static constexpr size_t kNumTransientObjectTypes = 16;
|
||||
static constexpr size_t kNumIntransientObjectTypes = 2;
|
||||
|
||||
bool ObjectTypeIsTransient(ObjectType type);
|
||||
bool ObjectTypeIsIntransient(ObjectType type);
|
||||
|
||||
std::span<const ObjectType> getAllObjectTypes();
|
||||
std::span<const ObjectType> getTransientObjectTypes();
|
||||
std::span<const ObjectType> getIntransientObjectTypes();
|
||||
|
|
Loading…
Reference in New Issue