From 682b15343b675ab88c9996b5fcc9323fe02e9d88 Mon Sep 17 00:00:00 2001 From: Gymnasiast Date: Wed, 17 Jun 2020 19:10:39 +0200 Subject: [PATCH 1/2] Create RCT2_RIDE_TYPE_COUNT --- src/openrct2/rct2/RCT2.h | 1 + src/openrct2/rct2/S6Exporter.cpp | 2 +- src/openrct2/rct2/S6Importer.cpp | 2 +- test/testpaint/Data.cpp | 4 ++-- test/testpaint/Data.h | 6 +++--- test/testpaint/TrackDataOld.cpp | 2 +- test/testpaint/main.cpp | 4 ++-- 7 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/openrct2/rct2/RCT2.h b/src/openrct2/rct2/RCT2.h index bcafb95af6..28bced5060 100644 --- a/src/openrct2/rct2/RCT2.h +++ b/src/openrct2/rct2/RCT2.h @@ -48,6 +48,7 @@ constexpr const uint8_t RCT2_MAX_SCENERY_GROUP_OBJECTS = 19; constexpr const uint8_t RCT2_MAX_PARK_ENTRANCE_OBJECTS = 1; constexpr const uint8_t RCT2_MAX_WATER_OBJECTS = 1; constexpr const uint8_t RCT2_MAX_SCENARIO_TEXT_OBJECTS = 1; +constexpr const uint8_t RCT2_RIDE_TYPE_COUNT = 91; // clang-format off constexpr const uint16_t RCT2_OBJECT_ENTRY_COUNT = diff --git a/src/openrct2/rct2/S6Exporter.cpp b/src/openrct2/rct2/S6Exporter.cpp index 08da14a5a1..70df271688 100644 --- a/src/openrct2/rct2/S6Exporter.cpp +++ b/src/openrct2/rct2/S6Exporter.cpp @@ -852,7 +852,7 @@ void S6Exporter::ExportResearchedRideTypes() { std::fill(std::begin(_s6.researched_ride_types), std::end(_s6.researched_ride_types), false); - for (int32_t rideType = 0; rideType < RIDE_TYPE_COUNT; rideType++) + for (int32_t rideType = 0; rideType < RCT2_RIDE_TYPE_COUNT; rideType++) { if (ride_type_is_invented(rideType)) { diff --git a/src/openrct2/rct2/S6Importer.cpp b/src/openrct2/rct2/S6Importer.cpp index 23fd05548b..f00a84f839 100644 --- a/src/openrct2/rct2/S6Importer.cpp +++ b/src/openrct2/rct2/S6Importer.cpp @@ -852,7 +852,7 @@ public: { set_every_ride_type_not_invented(); - for (int32_t rideType = 0; rideType < RIDE_TYPE_COUNT; rideType++) + for (int32_t rideType = 0; rideType < RCT2_RIDE_TYPE_COUNT; rideType++) { int32_t quadIndex = rideType >> 5; int32_t bitIndex = rideType & 0x1F; diff --git a/test/testpaint/Data.cpp b/test/testpaint/Data.cpp index 4a919d9f52..d0e471677a 100644 --- a/test/testpaint/Data.cpp +++ b/test/testpaint/Data.cpp @@ -10,7 +10,7 @@ #include #include -const_utf8string RideNames[RIDE_TYPE_COUNT] = { +const_utf8string RideNames[RCT2_RIDE_TYPE_COUNT] = { "SpiralRollerCoaster", "StandUpRollerCoaster", "SuspendedSwingingCoaster", @@ -883,7 +883,7 @@ const_utf8string TrackElemNames[] = { "TRACK_ELEM_255", }; -const_utf8string RideCodeNames[RIDE_TYPE_COUNT] = { +const_utf8string RideCodeNames[RCT2_RIDE_TYPE_COUNT] = { "spiral_rc", "stand_up_rc", "suspended_swinging_rc", diff --git a/test/testpaint/Data.h b/test/testpaint/Data.h index 1342bc84f9..cb7feebffe 100644 --- a/test/testpaint/Data.h +++ b/test/testpaint/Data.h @@ -13,12 +13,12 @@ #include #include -extern const utf8string RideNames[RIDE_TYPE_COUNT]; +extern const utf8string RideNames[RCT2_RIDE_TYPE_COUNT]; extern const utf8string TrackNames[256]; extern const utf8string FlatTrackNames[256]; extern const utf8string TrackElemNames[256]; -extern const utf8string RideCodeNames[RIDE_TYPE_COUNT]; +extern const utf8string RideCodeNames[RCT2_RIDE_TYPE_COUNT]; extern const utf8string TrackCodeNames[256]; -extern const uint32_t* RideTypeTrackPaintFunctionsOld[RIDE_TYPE_COUNT]; +extern const uint32_t* RideTypeTrackPaintFunctionsOld[RCT2_RIDE_TYPE_COUNT]; #endif // #endif _TEST_PAINT_DATA_H_ diff --git a/test/testpaint/TrackDataOld.cpp b/test/testpaint/TrackDataOld.cpp index a37a8b5303..c8ea066427 100644 --- a/test/testpaint/TrackDataOld.cpp +++ b/test/testpaint/TrackDataOld.cpp @@ -19262,7 +19262,7 @@ static constexpr const uint32_t _OldLimLaunchedRollerCoasterTrackPaintFunctions[ static constexpr const uint32_t _null[256] = {0}; -const uint32_t * RideTypeTrackPaintFunctionsOld[RIDE_TYPE_COUNT] = { +const uint32_t * RideTypeTrackPaintFunctionsOld[RCT2_RIDE_TYPE_COUNT] = { _OldSpiralRollerCoasterTrackPaintFunctions, // RIDE_TYPE_SPIRAL_ROLLER_COASTER _OldStandUpRollerCoasterTrackPaintFunctions, // RIDE_TYPE_STAND_UP_ROLLER_COASTER _OldSuspendedSwingingCoasterTrackPaintFunctions, // RIDE_TYPE_SUSPENDED_SWINGING_COASTER diff --git a/test/testpaint/main.cpp b/test/testpaint/main.cpp index 0f873a031d..e39aecab47 100644 --- a/test/testpaint/main.cpp +++ b/test/testpaint/main.cpp @@ -398,7 +398,7 @@ static bool openrct2_setup_rct2_segment() static void PrintRideTypes() { - for (uint8_t rideType = 0; rideType < RIDE_TYPE_COUNT; rideType++) + for (uint8_t rideType = 0; rideType < RCT2_RIDE_TYPE_COUNT; rideType++) { CLIColour colour = CLIColour::DEFAULT; bool implemented = Utils::rideIsImplemented(rideType); @@ -505,7 +505,7 @@ int main(int argc, char* argv[]) return generatePaintCode(specificRideType); } - for (uint8_t rideType = 0; rideType < RIDE_TYPE_COUNT; rideType++) + for (uint8_t rideType = 0; rideType < RCT2_RIDE_TYPE_COUNT; rideType++) { if (specificRideType != RIDE_TYPE_NULL && rideType != specificRideType) { From 2a9c2be7d0ee120798f803521212e655ade2f716 Mon Sep 17 00:00:00 2001 From: Gymnasiast Date: Wed, 17 Jun 2020 19:10:57 +0200 Subject: [PATCH 2/2] Remove unused function --- src/openrct2/ride/Ride.cpp | 7 ------- src/openrct2/ride/Ride.h | 1 - 2 files changed, 8 deletions(-) diff --git a/src/openrct2/ride/Ride.cpp b/src/openrct2/ride/Ride.cpp index a7458a78f0..061153dd48 100644 --- a/src/openrct2/ride/Ride.cpp +++ b/src/openrct2/ride/Ride.cpp @@ -7441,13 +7441,6 @@ uint8_t ride_entry_get_first_non_null_ride_type(const rct_ride_entry* rideEntry) return RIDE_TYPE_NULL; } -bool ride_type_supports_boosters(uint8_t rideType) -{ - return rideType == RIDE_TYPE_LOOPING_ROLLER_COASTER || rideType == RIDE_TYPE_CORKSCREW_ROLLER_COASTER - || rideType == RIDE_TYPE_TWISTER_ROLLER_COASTER || rideType == RIDE_TYPE_VERTICAL_DROP_ROLLER_COASTER - || rideType == RIDE_TYPE_GIGA_COASTER || rideType == RIDE_TYPE_JUNIOR_ROLLER_COASTER; -} - int32_t get_booster_speed(uint8_t rideType, int32_t rawSpeed) { int8_t shiftFactor = RideTypeDescriptors[rideType].OperatingSettings.BoosterSpeedFactor; diff --git a/src/openrct2/ride/Ride.h b/src/openrct2/ride/Ride.h index 05a2b0285a..00eb7547e0 100644 --- a/src/openrct2/ride/Ride.h +++ b/src/openrct2/ride/Ride.h @@ -1211,7 +1211,6 @@ bool ride_has_ratings(const Ride* ride); const char* ride_type_get_enum_name(int32_t rideType); uint8_t ride_entry_get_first_non_null_ride_type(const rct_ride_entry* rideEntry); -bool ride_type_supports_boosters(uint8_t rideType); int32_t get_booster_speed(uint8_t rideType, int32_t rawSpeed); void fix_invalid_vehicle_sprite_sizes(); bool ride_entry_has_category(const rct_ride_entry* rideEntry, uint8_t category);