mirror of https://github.com/OpenRCT2/OpenRCT2.git
Introduce DATLimits.h for RCT2 Dat file object limits (#16034)
This commit is contained in:
parent
e4a314a160
commit
79b12d2953
|
@ -1371,7 +1371,7 @@ private:
|
|||
if (item->Type == ObjectType::Ride)
|
||||
{
|
||||
uint8_t rideType = 0;
|
||||
for (int32_t i = 0; i < MAX_RIDE_TYPES_PER_RIDE_ENTRY; i++)
|
||||
for (int32_t i = 0; i < RCT2::ObjectLimits::MaxRideTypesPerRideEntry; i++)
|
||||
{
|
||||
if (item->RideInfo.RideType[i] != RIDE_TYPE_NULL)
|
||||
{
|
||||
|
@ -1503,7 +1503,7 @@ static bool VisibleListSortRideType(const ObjectListItem& a, const ObjectListIte
|
|||
static rct_string_id GetRideTypeStringId(const ObjectRepositoryItem* item)
|
||||
{
|
||||
rct_string_id result = STR_NONE;
|
||||
for (int32_t i = 0; i < MAX_RIDE_TYPES_PER_RIDE_ENTRY; i++)
|
||||
for (int32_t i = 0; i < RCT2::ObjectLimits::MaxRideTypesPerRideEntry; i++)
|
||||
{
|
||||
uint8_t rideType = item->RideInfo.RideType[i];
|
||||
if (rideType != RIDE_TYPE_NULL)
|
||||
|
|
|
@ -821,7 +821,7 @@ static void WindowNewRideScrollpaint(rct_window* w, rct_drawpixelinfo* dpi, int3
|
|||
rideEntry = get_ride_entry(listItem->EntryIndex);
|
||||
int32_t imageId = rideEntry->images_offset;
|
||||
|
||||
for (size_t i = 0; i < MAX_RIDE_TYPES_PER_RIDE_ENTRY; i++)
|
||||
for (size_t i = 0; i < RCT2::ObjectLimits::MaxRideTypesPerRideEntry; i++)
|
||||
{
|
||||
if (rideEntry->ride_type[i] == listItem->Type)
|
||||
break;
|
||||
|
|
|
@ -3837,7 +3837,7 @@ static void WindowRideMaintenanceMousedown(rct_window* w, rct_widgetindex widget
|
|||
|
||||
case WIDX_FORCE_BREAKDOWN:
|
||||
num_items = 1;
|
||||
for (j = 0; j < MAX_RIDE_TYPES_PER_RIDE_ENTRY; j++)
|
||||
for (j = 0; j < RCT2::ObjectLimits::MaxRideTypesPerRideEntry; j++)
|
||||
{
|
||||
if (rideEntry->ride_type[j] != RIDE_TYPE_NULL)
|
||||
break;
|
||||
|
@ -3980,7 +3980,7 @@ static void WindowRideMaintenanceDropdown(rct_window* w, rct_widgetindex widgetI
|
|||
else
|
||||
{
|
||||
int32_t j;
|
||||
for (j = 0; j < MAX_RIDE_TYPES_PER_RIDE_ENTRY; j++)
|
||||
for (j = 0; j < RCT2::ObjectLimits::MaxRideTypesPerRideEntry; j++)
|
||||
{
|
||||
if (rideEntry->ride_type[j] != RIDE_TYPE_NULL)
|
||||
break;
|
||||
|
|
|
@ -194,7 +194,7 @@ GameActions::Result RideCreateAction::Execute() const
|
|||
|
||||
if (!(gParkFlags & PARK_FLAGS_NO_MONEY))
|
||||
{
|
||||
for (auto i = 0; i < NUM_SHOP_ITEMS_PER_RIDE; i++)
|
||||
for (auto i = 0; i < RCT2::ObjectLimits::MaxShopItemsPerRideEntry; i++)
|
||||
{
|
||||
ride->price[i] = rtd.DefaultPrices[i];
|
||||
}
|
||||
|
@ -232,7 +232,7 @@ GameActions::Result RideCreateAction::Execute() const
|
|||
}
|
||||
}
|
||||
|
||||
for (auto i = 0; i < NUM_SHOP_ITEMS_PER_RIDE; i++)
|
||||
for (auto i = 0; i < RCT2::ObjectLimits::MaxShopItemsPerRideEntry; i++)
|
||||
{
|
||||
if (rideEntry->shop_item[i] != ShopItem::None)
|
||||
{
|
||||
|
|
|
@ -1105,7 +1105,7 @@ static int32_t cc_load_object(InteractiveConsole& console, const arguments_t& ar
|
|||
|
||||
rideEntry = get_ride_entry(groupIndex);
|
||||
|
||||
for (int32_t j = 0; j < MAX_RIDE_TYPES_PER_RIDE_ENTRY; j++)
|
||||
for (int32_t j = 0; j < RCT2::ObjectLimits::MaxRideTypesPerRideEntry; j++)
|
||||
{
|
||||
rideType = rideEntry->ride_type[j];
|
||||
if (rideType != RIDE_TYPE_NULL)
|
||||
|
|
|
@ -320,6 +320,7 @@
|
|||
<ClInclude Include="rct1\Limits.h" />
|
||||
<ClInclude Include="rct1\RCT1.h" />
|
||||
<ClInclude Include="rct1\Tables.h" />
|
||||
<ClInclude Include="rct2\DATLimits.h" />
|
||||
<ClInclude Include="rct2\Limits.h" />
|
||||
<ClInclude Include="rct2\RCT2.h" />
|
||||
<ClInclude Include="rct2\T6Exporter.h" />
|
||||
|
|
|
@ -261,7 +261,7 @@ void research_finish_item(ResearchItem* researchItem)
|
|||
rct_ride_entry* rideEntry2 = get_ride_entry(i);
|
||||
if (rideEntry2 != nullptr)
|
||||
{
|
||||
for (uint8_t j = 0; j < MAX_RIDE_TYPES_PER_RIDE_ENTRY; j++)
|
||||
for (uint8_t j = 0; j < RCT2::ObjectLimits::MaxRideTypesPerRideEntry; j++)
|
||||
{
|
||||
if (rideEntry2->ride_type[j] == base_ride_type)
|
||||
{
|
||||
|
|
|
@ -49,8 +49,8 @@ struct ObjectRepositoryItem
|
|||
struct
|
||||
{
|
||||
uint8_t RideFlags;
|
||||
uint8_t RideCategory[MAX_CATEGORIES_PER_RIDE];
|
||||
uint8_t RideType[MAX_RIDE_TYPES_PER_RIDE_ENTRY];
|
||||
uint8_t RideCategory[RCT2::ObjectLimits::MaxCategoriesPerRide];
|
||||
uint8_t RideType[RCT2::ObjectLimits::MaxRideTypesPerRideEntry];
|
||||
} RideInfo;
|
||||
struct
|
||||
{
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include "../core/String.hpp"
|
||||
#include "../drawing/Drawing.h"
|
||||
#include "../localisation/Language.h"
|
||||
#include "../rct2/DATLimits.h"
|
||||
#include "../rct2/RCT2.h"
|
||||
#include "../ride/Ride.h"
|
||||
#include "../ride/RideData.h"
|
||||
|
@ -41,7 +42,7 @@ static void RideObjectUpdateRideType(rct_ride_entry* rideEntry)
|
|||
return;
|
||||
}
|
||||
|
||||
for (auto i = 0; i < MAX_RIDE_TYPES_PER_RIDE_ENTRY; i++)
|
||||
for (auto i = 0; i < RCT2::ObjectLimits::MaxRideTypesPerRideEntry; i++)
|
||||
{
|
||||
auto oldRideType = rideEntry->ride_type[i];
|
||||
if (oldRideType != RIDE_TYPE_NULL)
|
||||
|
@ -124,7 +125,7 @@ void RideObject::ReadLegacy(IReadObjectContext* context, IStream* stream)
|
|||
}
|
||||
|
||||
// Read peep loading positions
|
||||
for (int32_t i = 0; i < RCT2::Limits::MaxVehiclesPerRideEntry; i++)
|
||||
for (int32_t i = 0; i < RCT2::ObjectLimits::MaxVehiclesPerRideEntry; i++)
|
||||
{
|
||||
_peepLoadingWaypoints[i].clear();
|
||||
_peepLoadingPositions[i].clear();
|
||||
|
@ -197,8 +198,8 @@ void RideObject::Load()
|
|||
_legacyType.images_offset = gfx_object_allocate_images(GetImageTable().GetImages(), GetImageTable().GetCount());
|
||||
_legacyType.vehicle_preset_list = &_presetColours;
|
||||
|
||||
int32_t cur_vehicle_images_offset = _legacyType.images_offset + MAX_RIDE_TYPES_PER_RIDE_ENTRY;
|
||||
for (int32_t i = 0; i < RCT2::Limits::MaxVehiclesPerRideEntry; i++)
|
||||
int32_t cur_vehicle_images_offset = _legacyType.images_offset + RCT2::ObjectLimits::MaxRideTypesPerRideEntry;
|
||||
for (int32_t i = 0; i < RCT2::ObjectLimits::MaxVehiclesPerRideEntry; i++)
|
||||
{
|
||||
rct_ride_entry_vehicle* vehicleEntry = &_legacyType.vehicles[i];
|
||||
if (vehicleEntry->sprite_flags & VEHICLE_SPRITE_FLAG_FLAT)
|
||||
|
@ -410,11 +411,11 @@ void RideObject::SetRepositoryItem(ObjectRepositoryItem* item) const
|
|||
uint8_t firstRideType = ride_entry_get_first_non_null_ride_type(&_legacyType);
|
||||
uint8_t category = GetRideTypeDescriptor(firstRideType).Category;
|
||||
|
||||
for (int32_t i = 0; i < RCT2::Limits::MaxRideTypesPerRideEntry; i++)
|
||||
for (int32_t i = 0; i < RCT2::ObjectLimits::MaxRideTypesPerRideEntry; i++)
|
||||
{
|
||||
item->RideInfo.RideType[i] = _legacyType.ride_type[i];
|
||||
}
|
||||
for (int32_t i = 0; i < RCT2::Limits::MaxCategoriesPerRide; i++)
|
||||
for (int32_t i = 0; i < RCT2::ObjectLimits::MaxCategoriesPerRide; i++)
|
||||
{
|
||||
item->RideInfo.RideCategory[i] = category;
|
||||
}
|
||||
|
@ -541,7 +542,7 @@ void RideObject::ReadJson(IReadObjectContext* context, json_t& root)
|
|||
json_t rideTypes = Json::AsArray(properties["type"]);
|
||||
size_t numRideTypes = rideTypes.size();
|
||||
|
||||
for (size_t i = 0; i < MAX_RIDE_TYPES_PER_RIDE_ENTRY; i++)
|
||||
for (size_t i = 0; i < RCT2::ObjectLimits::MaxRideTypesPerRideEntry; i++)
|
||||
{
|
||||
ObjectEntryIndex rideType = RIDE_TYPE_NULL;
|
||||
|
||||
|
@ -586,7 +587,7 @@ void RideObject::ReadJson(IReadObjectContext* context, json_t& root)
|
|||
|
||||
// Shop item
|
||||
auto rideSells = Json::AsArray(properties["sells"]);
|
||||
auto numShopItems = std::min(static_cast<size_t>(NUM_SHOP_ITEMS_PER_RIDE), rideSells.size());
|
||||
auto numShopItems = std::min(static_cast<size_t>(RCT2::ObjectLimits::MaxShopItemsPerRideEntry), rideSells.size());
|
||||
for (size_t i = 0; i < numShopItems; i++)
|
||||
{
|
||||
auto shopItem = ParseShopItem(Json::GetString(rideSells[i]));
|
||||
|
|
|
@ -15,17 +15,13 @@
|
|||
|
||||
#include <vector>
|
||||
|
||||
// TODO: MOVE TO COMMON LIMITS HEADER
|
||||
#define MAX_RIDE_TYPES_PER_RIDE_ENTRY 3
|
||||
#define MAX_CATEGORIES_PER_RIDE 2
|
||||
|
||||
class RideObject final : public Object
|
||||
{
|
||||
private:
|
||||
rct_ride_entry _legacyType = {};
|
||||
vehicle_colour_preset_list _presetColours = {};
|
||||
std::vector<int8_t> _peepLoadingPositions[MAX_VEHICLES_PER_RIDE_ENTRY];
|
||||
std::vector<std::array<CoordsXY, 3>> _peepLoadingWaypoints[MAX_VEHICLES_PER_RIDE_ENTRY];
|
||||
std::vector<int8_t> _peepLoadingPositions[RCT2::ObjectLimits::MaxVehiclesPerRideEntry];
|
||||
std::vector<std::array<CoordsXY, 3>> _peepLoadingWaypoints[RCT2::ObjectLimits::MaxVehiclesPerRideEntry];
|
||||
|
||||
public:
|
||||
void* GetLegacyData() override
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
/*****************************************************************************
|
||||
* Copyright (c) 2014-2021 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.
|
||||
*****************************************************************************/
|
||||
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
|
||||
namespace RCT2::ObjectLimits
|
||||
{
|
||||
constexpr const uint8_t MaxCategoriesPerRide = 2;
|
||||
constexpr const uint8_t MaxRideTypesPerRideEntry = 3;
|
||||
// The max number of different types of vehicle.
|
||||
// Examples of vehicles here are the locomotive, tender and carriage of the Miniature Railway.
|
||||
constexpr const uint8_t MaxVehiclesPerRideEntry = 4;
|
||||
constexpr const uint8_t MaxShopItemsPerRideEntry = 2;
|
||||
} // namespace RCT2::ObjectLimits
|
|
@ -16,9 +16,6 @@ namespace RCT2::Limits
|
|||
constexpr const uint8_t MaxStaff = 200;
|
||||
constexpr const uint8_t MaxBanners = 250;
|
||||
constexpr const uint8_t MaxTrainsPerRide = 32;
|
||||
constexpr const uint8_t MaxCategoriesPerRide = 2;
|
||||
constexpr const uint8_t MaxRideTypesPerRideEntry = 3;
|
||||
constexpr const uint8_t MaxVehiclesPerRideEntry = 4;
|
||||
constexpr const uint8_t DowntimeHistorySize = 8;
|
||||
constexpr const uint16_t MaxEntities = 10000;
|
||||
constexpr const uint32_t MaxTileElements = 0x30000;
|
||||
|
|
|
@ -5428,7 +5428,7 @@ bool ride_has_ratings(const Ride* ride)
|
|||
*/
|
||||
uint8_t ride_entry_get_first_non_null_ride_type(const rct_ride_entry* rideEntry)
|
||||
{
|
||||
for (uint8_t i = 0; i < MAX_RIDE_TYPES_PER_RIDE_ENTRY; i++)
|
||||
for (uint8_t i = 0; i < RCT2::ObjectLimits::MaxRideTypesPerRideEntry; i++)
|
||||
{
|
||||
if (rideEntry->ride_type[i] != RIDE_TYPE_NULL)
|
||||
{
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
#include "../common.h"
|
||||
#include "../localisation/Formatter.h"
|
||||
#include "../rct2/DATLimits.h"
|
||||
#include "../rct2/Limits.h"
|
||||
#include "../world/Map.h"
|
||||
#include "RideColour.h"
|
||||
|
@ -51,8 +52,6 @@ constexpr uint16_t const MAX_HELICES = RCT12::Limits::MaxHelices;
|
|||
|
||||
constexpr uint16_t const MAZE_CLEARANCE_HEIGHT = 4 * COORDS_Z_STEP;
|
||||
|
||||
constexpr const uint8_t NUM_SHOP_ITEMS_PER_RIDE = 2;
|
||||
|
||||
struct RideStation
|
||||
{
|
||||
CoordsXY Start;
|
||||
|
@ -192,7 +191,7 @@ struct Ride
|
|||
uint16_t num_customers_timeout;
|
||||
// Customer count in the last 10 * 960 game ticks (sliding window)
|
||||
uint16_t num_customers[CUSTOMER_HISTORY_SIZE];
|
||||
money16 price[NUM_SHOP_ITEMS_PER_RIDE];
|
||||
money16 price[RCT2::ObjectLimits::MaxShopItemsPerRideEntry];
|
||||
TileCoordsXYZ ChairliftBullwheelLocation[2];
|
||||
union
|
||||
{
|
||||
|
|
|
@ -177,7 +177,7 @@ struct RideTypeDescriptor
|
|||
UpkeepCostsDescriptor UpkeepCosts;
|
||||
// rct2: 0x0097DD78
|
||||
RideBuildCost BuildCosts;
|
||||
money16 DefaultPrices[NUM_SHOP_ITEMS_PER_RIDE];
|
||||
money16 DefaultPrices[RCT2::ObjectLimits::MaxShopItemsPerRideEntry];
|
||||
std::string_view DefaultMusic;
|
||||
/** rct2: 0x0097D7CB */
|
||||
ShopItemIndex PhotoItem;
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "../rct2/Limits.h"
|
||||
#include "../rct2/DATLimits.h"
|
||||
#include "RideColour.h"
|
||||
#include "ShopItem.h"
|
||||
#include "VehicleColour.h"
|
||||
|
@ -17,13 +17,6 @@
|
|||
|
||||
#include <cstdint>
|
||||
|
||||
// TODO: MOVE TO COMMON LIMITS HEADER DUPLICATED FROM RIDE.H
|
||||
constexpr const uint8_t NUM_SHOP_ITEMS_PER_RIDE_2 = 2;
|
||||
|
||||
// The max number of different types of vehicle.
|
||||
// Examples of vehicles here are the locomotive, tender and carriage of the Miniature Railway.
|
||||
#define MAX_VEHICLES_PER_RIDE_ENTRY 4
|
||||
|
||||
struct RideNaming
|
||||
{
|
||||
rct_string_id Name;
|
||||
|
@ -51,7 +44,7 @@ struct rct_ride_entry
|
|||
// The first three images are previews. They correspond to the ride_type[] array.
|
||||
uint32_t images_offset;
|
||||
uint32_t flags;
|
||||
uint8_t ride_type[RCT2::Limits::MaxRideTypesPerRideEntry];
|
||||
uint8_t ride_type[RCT2::ObjectLimits::MaxRideTypesPerRideEntry];
|
||||
uint8_t min_cars_in_train;
|
||||
uint8_t max_cars_in_train;
|
||||
uint8_t cars_per_flat_ride;
|
||||
|
@ -66,13 +59,13 @@ struct rct_ride_entry
|
|||
uint8_t rear_vehicle;
|
||||
uint8_t third_vehicle;
|
||||
uint8_t BuildMenuPriority;
|
||||
rct_ride_entry_vehicle vehicles[RCT2::Limits::MaxVehiclesPerRideEntry];
|
||||
rct_ride_entry_vehicle vehicles[RCT2::ObjectLimits::MaxVehiclesPerRideEntry];
|
||||
vehicle_colour_preset_list* vehicle_preset_list;
|
||||
int8_t excitement_multiplier;
|
||||
int8_t intensity_multiplier;
|
||||
int8_t nausea_multiplier;
|
||||
uint8_t max_height;
|
||||
ShopItem shop_item[NUM_SHOP_ITEMS_PER_RIDE_2];
|
||||
ShopItem shop_item[RCT2::ObjectLimits::MaxShopItemsPerRideEntry];
|
||||
rct_string_id capacity;
|
||||
void* obj;
|
||||
|
||||
|
|
Loading…
Reference in New Issue