1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-21 14:02:59 +01:00

Move kObjectEntryGroupCounts to ObjectList.cpp

This commit is contained in:
Aaron van Geffen
2024-03-27 20:13:10 +01:00
parent d645906003
commit e898e9211d
15 changed files with 48 additions and 33 deletions

View File

@@ -21,6 +21,7 @@
#include "BannerSceneryEntry.h"
#include "LargeSceneryObject.h"
#include "Object.h"
#include "ObjectLimits.h"
#include "ObjectList.h"
#include "ObjectRepository.h"
#include "PathAdditionObject.h"
@@ -79,7 +80,7 @@ public:
return nullptr;
}
if (index >= static_cast<size_t>(object_entry_group_counts[EnumValue(objectType)]))
if (index >= static_cast<size_t>(getObjectEntryGroupCount(objectType)))
{
#ifdef DEBUG
if (index != OBJECT_ENTRY_INDEX_NULL)
@@ -144,7 +145,7 @@ public:
ObjectList objectList;
for (auto objectType : ObjectTypes)
{
auto maxObjectsOfType = static_cast<ObjectEntryIndex>(object_entry_group_counts[EnumValue(objectType)]);
auto maxObjectsOfType = static_cast<ObjectEntryIndex>(getObjectEntryGroupCount(objectType));
for (ObjectEntryIndex i = 0; i < maxObjectsOfType; i++)
{
auto obj = GetLoadedObject(objectType, i);
@@ -384,7 +385,7 @@ private:
return static_cast<ObjectEntryIndex>(std::distance(list.begin(), it));
}
auto maxSize = object_entry_group_counts[EnumValue(objectType)];
auto maxSize = getObjectEntryGroupCount(objectType);
if (list.size() < static_cast<size_t>(maxSize))
{
list.emplace_back();
@@ -524,7 +525,7 @@ private:
for (auto objectType : ObjectTypes)
{
auto& descriptors = objectList.GetList(objectType);
auto maxSize = static_cast<size_t>(object_entry_group_counts[EnumValue(objectType)]);
auto maxSize = static_cast<size_t>(getObjectEntryGroupCount(objectType));
auto listSize = static_cast<ObjectEntryIndex>(std::min(descriptors.size(), maxSize));
for (ObjectEntryIndex i = 0; i < listSize; i++)
{
@@ -724,7 +725,7 @@ private:
}
// Build object lists
const auto maxRideObjects = static_cast<size_t>(object_entry_group_counts[EnumValue(ObjectType::Ride)]);
const auto maxRideObjects = static_cast<size_t>(getObjectEntryGroupCount(ObjectType::Ride));
for (size_t i = 0; i < maxRideObjects; i++)
{
auto* rideObject = static_cast<RideObject*>(GetLoadedObject(ObjectType::Ride, i));