Remove ride classifications

This commit is contained in:
Ted John 2019-08-03 18:11:30 +01:00
parent a3fe00f0a3
commit 414b53b56d
13 changed files with 118 additions and 203 deletions

View File

@ -12,6 +12,7 @@
#include "../interface/Window.h"
#include "Window.h"
#include <algorithm>
#include <iterator>
#include <openrct2/Context.h>
#include <openrct2/GameState.h>
@ -1040,7 +1041,7 @@ static void window_editor_objective_options_rides_update(rct_window* w)
numItems = 0;
FOR_ALL_RIDES (i, ride)
{
if (gRideClassifications[ride->type] == RIDE_CLASS_RIDE)
if (ride->IsRide())
{
w->list_item_positions[numItems] = i;
numItems++;
@ -1187,20 +1188,9 @@ static void window_editor_objective_options_rides_scrollpaint(rct_window* w, rct
*/
static void window_editor_objective_options_update_disabled_widgets(rct_window* w)
{
Ride* ride;
int32_t i, numRides;
// Check if there are any rides (not shops or facilities)
numRides = 0;
FOR_ALL_RIDES (i, ride)
{
if (gRideClassifications[ride->type] == RIDE_CLASS_RIDE)
{
numRides++;
}
}
if (numRides != 0)
const auto& rideManager = GetRideManager();
if (std::any_of(rideManager.begin(), rideManager.end(), [](const Ride& ride) { return ride.IsRide(); }))
{
w->disabled_widgets &= ~(1 << WIDX_TAB_2);
}

View File

@ -1583,7 +1583,7 @@ void window_guest_rides_update(rct_window* w)
uint8_t curr_list_position = 0;
for (const auto& ride : GetRideManager())
{
if (guest->HasRidden(&ride) && gRideClassifications[ride.type] == RIDE_CLASS_RIDE)
if (ride.IsRide() && guest->HasRidden(&ride))
{
w->list_item_positions[curr_list_position] = ride.id;
curr_list_position++;

View File

@ -1264,32 +1264,32 @@ static void window_ride_draw_tab_image(rct_drawpixelinfo* dpi, rct_window* w, in
static void window_ride_draw_tab_main(rct_drawpixelinfo* dpi, rct_window* w)
{
rct_widgetindex widgetIndex = WIDX_TAB_1 + WINDOW_RIDE_PAGE_MAIN;
if (!(w->disabled_widgets & (1LL << widgetIndex)))
{
int32_t spriteIndex = 0;
int32_t rideType = get_ride(w->number)->type;
switch (gRideClassifications[rideType])
auto ride = get_ride(w->number);
if (ride != nullptr)
{
case RIDE_CLASS_RIDE:
spriteIndex = SPR_TAB_RIDE_0;
if (w->page == WINDOW_RIDE_PAGE_MAIN)
spriteIndex += (w->frame_no / 4) % 16;
break;
case RIDE_CLASS_SHOP_OR_STALL:
spriteIndex = SPR_TAB_SHOPS_AND_STALLS_0;
if (w->page == WINDOW_RIDE_PAGE_MAIN)
spriteIndex += (w->frame_no / 4) % 16;
break;
case RIDE_CLASS_KIOSK_OR_FACILITY:
spriteIndex = SPR_TAB_KIOSKS_AND_FACILITIES_0;
if (w->page == WINDOW_RIDE_PAGE_MAIN)
spriteIndex += (w->frame_no / 4) % 8;
break;
int32_t spriteIndex = 0;
switch (ride->GetClassification())
{
case RideClassification::Ride:
spriteIndex = SPR_TAB_RIDE_0;
if (w->page == WINDOW_RIDE_PAGE_MAIN)
spriteIndex += (w->frame_no / 4) % 16;
break;
case RideClassification::ShopOrStall:
spriteIndex = SPR_TAB_SHOPS_AND_STALLS_0;
if (w->page == WINDOW_RIDE_PAGE_MAIN)
spriteIndex += (w->frame_no / 4) % 16;
break;
case RideClassification::KioskOrFacility:
spriteIndex = SPR_TAB_KIOSKS_AND_FACILITIES_0;
if (w->page == WINDOW_RIDE_PAGE_MAIN)
spriteIndex += (w->frame_no / 4) % 8;
break;
}
gfx_draw_sprite(dpi, spriteIndex, w->x + w->widgets[widgetIndex].left, w->y + w->widgets[widgetIndex].top, 0);
}
gfx_draw_sprite(dpi, spriteIndex, w->x + w->widgets[widgetIndex].left, w->y + w->widgets[widgetIndex].top, 0);
}
}
@ -2296,8 +2296,9 @@ static void populate_vehicle_type_dropdown(Ride* ride)
bool selectionShouldBeExpanded;
int32_t rideTypeIterator, rideTypeIteratorMax;
if (gCheatsShowVehiclesFromOtherTrackTypes
&& !(ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_FLAT_RIDE) || ride->type == RIDE_TYPE_MAZE
|| ride->type == RIDE_TYPE_MINI_GOLF))
&& !(
ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_FLAT_RIDE) || ride->type == RIDE_TYPE_MAZE
|| ride->type == RIDE_TYPE_MINI_GOLF))
{
selectionShouldBeExpanded = true;
rideTypeIterator = 0;
@ -6837,7 +6838,7 @@ static void window_ride_customer_paint(rct_window* w, rct_drawpixelinfo* dpi)
y = w->y + window_ride_customer_widgets[WIDX_PAGE_BACKGROUND].top + 4;
// Customers currently on ride
if (gRideClassifications[ride->type] == RIDE_CLASS_RIDE)
if (ride->IsRide())
{
int16_t customersOnRide = ride->num_riders;
gfx_draw_string_left(dpi, STR_CUSTOMERS_ON_RIDE, &customersOnRide, COLOUR_BLACK, x, y);
@ -6878,7 +6879,7 @@ static void window_ride_customer_paint(rct_window* w, rct_drawpixelinfo* dpi)
y += LIST_ROW_HEIGHT;
// Queue time
if (gRideClassifications[ride->type] == RIDE_CLASS_RIDE)
if (ride->IsRide())
{
queueTime = ride->GetMaxQueueTime();
stringId = queueTime == 1 ? STR_QUEUE_TIME_MINUTE : STR_QUEUE_TIME_MINUTES;
@ -6912,7 +6913,7 @@ static void window_ride_customer_paint(rct_window* w, rct_drawpixelinfo* dpi)
y += LIST_ROW_HEIGHT;
// Guests favourite
if (gRideClassifications[ride->type] == RIDE_CLASS_RIDE)
if (ride->IsRide())
{
stringId = ride->guests_favourite == 1 ? STR_FAVOURITE_RIDE_OF_GUEST : STR_FAVOURITE_RIDE_OF_GUESTS;
gfx_draw_string_left(dpi, stringId, &ride->guests_favourite, COLOUR_BLACK, x, y);

View File

@ -527,30 +527,23 @@ static void window_ride_list_invalidate(rct_window* w)
w->widgets[WIDX_CLOSE_LIGHT].type = WWT_IMGBTN;
w->widgets[WIDX_OPEN_LIGHT].type = WWT_IMGBTN;
int8_t allClosed = -1;
int8_t allOpen = -1;
int32_t i;
Ride* ride;
FOR_ALL_RIDES (i, ride)
const auto& rideManager = GetRideManager();
auto allClosed = false;
auto allOpen = false;
if (std::size(rideManager) != 0)
{
if (w->page != gRideClassifications[ride->type])
continue;
if (ride->status == RIDE_STATUS_OPEN)
{
if (allOpen == -1)
allOpen = true;
allClosed = false;
}
else
{
if (allClosed == -1)
allClosed = true;
allOpen = false;
}
auto c = (RideClassification)w->page;
allClosed = std::all_of(rideManager.begin(), rideManager.end(), [c](const Ride& ride) {
return ride.GetClassification() == c&& ride.status == RIDE_STATUS_OPEN;
});
allOpen = std::all_of(rideManager.begin(), rideManager.end(), [c](const Ride& ride) {
return ride.GetClassification() == c&& ride.status != RIDE_STATUS_OPEN;
});
}
w->widgets[WIDX_CLOSE_LIGHT].image = SPR_G2_RCT1_CLOSE_BUTTON_0 + (allClosed == 1) * 2
w->widgets[WIDX_CLOSE_LIGHT].image = SPR_G2_RCT1_CLOSE_BUTTON_0 + (allClosed ? 1 : 0) * 2
+ widget_is_pressed(w, WIDX_CLOSE_LIGHT);
w->widgets[WIDX_OPEN_LIGHT].image = SPR_G2_RCT1_OPEN_BUTTON_0 + (allOpen == 1) * 2
w->widgets[WIDX_OPEN_LIGHT].image = SPR_G2_RCT1_OPEN_BUTTON_0 + (allOpen ? 1 : 0) * 2
+ widget_is_pressed(w, WIDX_OPEN_LIGHT);
w->widgets[WIDX_QUICK_DEMOLISH].top = w->widgets[WIDX_OPEN_LIGHT].bottom + 3;
}
@ -731,7 +724,7 @@ static void window_ride_list_scrollpaint(rct_window* w, rct_drawpixelinfo* dpi,
break;
case INFORMATION_TYPE_GUESTS_FAVOURITE:
formatSecondary = 0;
if (gRideClassifications[ride->type] == RIDE_CLASS_RIDE)
if (ride->IsRide())
{
set_format_arg(2, uint16_t, ride->guests_favourite);
formatSecondary = ride->guests_favourite == 1 ? STR_GUESTS_FAVOURITE_LABEL
@ -782,13 +775,11 @@ static void window_ride_list_draw_tab_images(rct_drawpixelinfo* dpi, rct_window*
*/
void window_ride_list_refresh_list(rct_window* w)
{
int32_t i;
Ride *ride, *otherRide;
int32_t list_index = 0;
FOR_ALL_RIDES (i, ride)
for (auto& ridec : GetRideManager())
{
if (w->page != gRideClassifications[ride->type]
auto ride = &ridec;
if (ride->GetClassification() != (RideClassification)w->page
|| (ride->status == RIDE_STATUS_CLOSED && !ride_has_any_track_elements(ride)))
continue;
@ -797,7 +788,7 @@ void window_ride_list_refresh_list(rct_window* w)
ride->window_invalidate_flags &= ~RIDE_INVALIDATE_RIDE_LIST;
}
w->list_item_positions[list_index] = i;
w->list_item_positions[list_index] = ride->id;
int32_t current_list_position = list_index;
switch (w->list_information_type)
{
@ -806,7 +797,7 @@ void window_ride_list_refresh_list(rct_window* w)
auto strA = ride->GetName();
while (--current_list_position >= 0)
{
otherRide = get_ride(w->list_item_positions[current_list_position]);
auto otherRide = get_ride(w->list_item_positions[current_list_position]);
auto strB = otherRide->GetName();
if (_strcmpi(strA.c_str(), strB.c_str()) >= 0)
break;
@ -818,7 +809,7 @@ void window_ride_list_refresh_list(rct_window* w)
case INFORMATION_TYPE_POPULARITY:
while (--current_list_position >= 0)
{
otherRide = get_ride(w->list_item_positions[current_list_position]);
auto otherRide = get_ride(w->list_item_positions[current_list_position]);
if (ride->popularity * 4 <= otherRide->popularity * 4)
break;
@ -828,7 +819,7 @@ void window_ride_list_refresh_list(rct_window* w)
case INFORMATION_TYPE_SATISFACTION:
while (--current_list_position >= 0)
{
otherRide = get_ride(w->list_item_positions[current_list_position]);
auto otherRide = get_ride(w->list_item_positions[current_list_position]);
if (ride->satisfaction * 5 <= otherRide->satisfaction * 5)
break;
@ -838,7 +829,7 @@ void window_ride_list_refresh_list(rct_window* w)
case INFORMATION_TYPE_PROFIT:
while (--current_list_position >= 0)
{
otherRide = get_ride(w->list_item_positions[current_list_position]);
auto otherRide = get_ride(w->list_item_positions[current_list_position]);
if (ride->profit <= otherRide->profit)
break;
@ -848,7 +839,7 @@ void window_ride_list_refresh_list(rct_window* w)
case INFORMATION_TYPE_TOTAL_CUSTOMERS:
while (--current_list_position >= 0)
{
otherRide = get_ride(w->list_item_positions[current_list_position]);
auto otherRide = get_ride(w->list_item_positions[current_list_position]);
if (ride->total_customers <= otherRide->total_customers)
break;
@ -858,7 +849,7 @@ void window_ride_list_refresh_list(rct_window* w)
case INFORMATION_TYPE_TOTAL_PROFIT:
while (--current_list_position >= 0)
{
otherRide = get_ride(w->list_item_positions[current_list_position]);
auto otherRide = get_ride(w->list_item_positions[current_list_position]);
if (ride->total_profit <= otherRide->total_profit)
break;
@ -868,7 +859,7 @@ void window_ride_list_refresh_list(rct_window* w)
case INFORMATION_TYPE_CUSTOMERS:
while (--current_list_position >= 0)
{
otherRide = get_ride(w->list_item_positions[current_list_position]);
auto otherRide = get_ride(w->list_item_positions[current_list_position]);
if (ride_customers_per_hour(ride) <= ride_customers_per_hour(otherRide))
break;
@ -878,7 +869,7 @@ void window_ride_list_refresh_list(rct_window* w)
case INFORMATION_TYPE_AGE:
while (--current_list_position >= 0)
{
otherRide = get_ride(w->list_item_positions[current_list_position]);
auto otherRide = get_ride(w->list_item_positions[current_list_position]);
if (ride->build_date <= otherRide->build_date)
break;
@ -888,7 +879,7 @@ void window_ride_list_refresh_list(rct_window* w)
case INFORMATION_TYPE_INCOME:
while (--current_list_position >= 0)
{
otherRide = get_ride(w->list_item_positions[current_list_position]);
auto otherRide = get_ride(w->list_item_positions[current_list_position]);
if (ride->income_per_hour <= otherRide->income_per_hour)
break;
@ -898,7 +889,7 @@ void window_ride_list_refresh_list(rct_window* w)
case INFORMATION_TYPE_RUNNING_COST:
while (--current_list_position >= 0)
{
otherRide = get_ride(w->list_item_positions[current_list_position]);
auto otherRide = get_ride(w->list_item_positions[current_list_position]);
if (ride->upkeep_cost <= otherRide->upkeep_cost)
break;
@ -908,7 +899,7 @@ void window_ride_list_refresh_list(rct_window* w)
case INFORMATION_TYPE_QUEUE_LENGTH:
while (--current_list_position >= 0)
{
otherRide = get_ride(w->list_item_positions[current_list_position]);
auto otherRide = get_ride(w->list_item_positions[current_list_position]);
if (ride->GetTotalQueueLength() <= otherRide->GetTotalQueueLength())
break;
@ -918,7 +909,7 @@ void window_ride_list_refresh_list(rct_window* w)
case INFORMATION_TYPE_QUEUE_TIME:
while (--current_list_position >= 0)
{
otherRide = get_ride(w->list_item_positions[current_list_position]);
auto otherRide = get_ride(w->list_item_positions[current_list_position]);
if (ride->GetMaxQueueTime() <= otherRide->GetMaxQueueTime())
break;
@ -928,7 +919,7 @@ void window_ride_list_refresh_list(rct_window* w)
case INFORMATION_TYPE_RELIABILITY:
while (--current_list_position >= 0)
{
otherRide = get_ride(w->list_item_positions[current_list_position]);
auto otherRide = get_ride(w->list_item_positions[current_list_position]);
if (ride->reliability_percentage <= otherRide->reliability_percentage)
break;
@ -938,7 +929,7 @@ void window_ride_list_refresh_list(rct_window* w)
case INFORMATION_TYPE_DOWN_TIME:
while (--current_list_position >= 0)
{
otherRide = get_ride(w->list_item_positions[current_list_position]);
auto otherRide = get_ride(w->list_item_positions[current_list_position]);
if (ride->downtime <= otherRide->downtime)
break;
@ -948,7 +939,7 @@ void window_ride_list_refresh_list(rct_window* w)
case INFORMATION_TYPE_GUESTS_FAVOURITE:
while (--current_list_position >= 0)
{
otherRide = get_ride(w->list_item_positions[current_list_position]);
auto otherRide = get_ride(w->list_item_positions[current_list_position]);
if (ride->guests_favourite <= otherRide->guests_favourite)
break;
@ -967,30 +958,22 @@ void window_ride_list_refresh_list(rct_window* w)
static void window_ride_list_close_all(rct_window* w)
{
int32_t i;
Ride* ride;
FOR_ALL_RIDES (i, ride)
for (auto& ride : GetRideManager())
{
if (w->page != gRideClassifications[ride->type])
continue;
if (ride->status == RIDE_STATUS_CLOSED)
continue;
ride_set_status(ride, RIDE_STATUS_CLOSED);
if (ride.status != RIDE_STATUS_CLOSED && ride.GetClassification() == (RideClassification)w->page)
{
ride_set_status(&ride, RIDE_STATUS_CLOSED);
}
}
}
static void window_ride_list_open_all(rct_window* w)
{
int32_t i;
Ride* ride;
FOR_ALL_RIDES (i, ride)
for (auto& ride : GetRideManager())
{
if (w->page != gRideClassifications[ride->type])
continue;
if (ride->status == RIDE_STATUS_OPEN)
continue;
ride_set_status(ride, RIDE_STATUS_OPEN);
if (ride.status != RIDE_STATUS_OPEN && ride.GetClassification() == (RideClassification)w->page)
{
ride_set_status(&ride, RIDE_STATUS_OPEN);
}
}
}

View File

@ -182,7 +182,7 @@ bool marketing_is_campaign_type_applicable(int32_t campaignType)
// Check if any rides exist
FOR_ALL_RIDES (i, ride)
{
if (gRideClassifications[ride->type] == RIDE_CLASS_RIDE)
if (ride->IsRide())
{
return true;
}

View File

@ -1399,7 +1399,7 @@ void Guest::CheckIfLost()
{
if (!(peep_flags & PEEP_FLAGS_LOST))
{
if (gRideCount < 2)
if (ride_get_count() < 2)
return;
peep_flags ^= PEEP_FLAGS_21;
@ -6510,7 +6510,7 @@ static bool peep_should_watch_ride(TileElement* tileElement)
return false;
}
if (gRideClassifications[ride->type] != RIDE_CLASS_RIDE)
if (!ride->IsRide())
{
return false;
}

View File

@ -1208,8 +1208,6 @@ void peep_problem_warnings_update()
disgust_counter = 0, bathroom_counter = 0, vandalism_counter = 0;
uint8_t* warning_throttle = gPeepWarningThrottle;
gRideCount = ride_get_count(); // refactor this to somewhere else
FOR_ALL_GUESTS (spriteIndex, peep)
{
if (peep->outside_of_park != 0 || peep->thoughts[0].freshness > 5)

View File

@ -303,7 +303,7 @@ void S6Exporter::Export()
// _s6.game_version_number
_s6.completed_company_value_record = gScenarioCompanyValueRecord;
_s6.loan_hash = GetLoanHash(gInitialCash, gBankLoan, gMaxBankLoan);
_s6.ride_count = gRideCount;
_s6.ride_count = ride_get_count();
// pad_013587CA
_s6.historical_profit = gHistoricalProfit;
// pad_013587D4

View File

@ -321,7 +321,6 @@ public:
_gameVersion = _s6.game_version_number;
gScenarioCompanyValueRecord = _s6.completed_company_value_record;
// _s6.loan_hash;
gRideCount = _s6.ride_count;
// pad_013587CA
gHistoricalProfit = _s6.historical_profit;
// pad_013587D4

View File

@ -70,89 +70,13 @@
using namespace OpenRCT2;
#pragma region Ride classification table
/** rct2: 0x0097C3AF */
// clang-format off
const uint8_t gRideClassifications[255] = {
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
RIDE_CLASS_SHOP_OR_STALL, RIDE_CLASS_SHOP_OR_STALL, RIDE_CLASS_SHOP_OR_STALL,
RIDE_CLASS_SHOP_OR_STALL, RIDE_CLASS_SHOP_OR_STALL, RIDE_CLASS_RIDE, RIDE_CLASS_SHOP_OR_STALL,
RIDE_CLASS_KIOSK_OR_FACILITY, RIDE_CLASS_KIOSK_OR_FACILITY, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_KIOSK_OR_FACILITY, RIDE_CLASS_RIDE,
RIDE_CLASS_RIDE, RIDE_CLASS_KIOSK_OR_FACILITY, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
RIDE_CLASS_RIDE, RIDE_CLASS_SHOP_OR_STALL, RIDE_CLASS_RIDE, RIDE_CLASS_SHOP_OR_STALL,
RIDE_CLASS_SHOP_OR_STALL, RIDE_CLASS_SHOP_OR_STALL, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE
};
// clang-format on
uint8_t gTypeToRideEntryIndexMap[TYPE_TO_RIDE_ENTRY_SLOTS];
#pragma endregion
static constexpr const int32_t RideInspectionInterval[] = {
10, 20, 30, 45, 60, 120, 0, 0,
};
static std::vector<Ride> _rides;
uint16_t gRideCount;
bool gGotoStartPlacementMode = false;
money16 gTotalRideValueForMoney;
@ -217,6 +141,11 @@ RideManager GetRideManager()
return {};
}
size_t RideManager::size() const
{
return ride_get_count();
}
RideManager::Iterator RideManager::begin()
{
return RideManager::Iterator(*this, 0, _rides.size());
@ -7311,7 +7240,7 @@ void Ride::Renew()
reliability = RIDE_INITIAL_RELIABILITY;
}
bool Ride::IsRide() const
RideClassification Ride::GetClassification() const
{
switch (type)
{
@ -7321,16 +7250,26 @@ bool Ride::IsRide() const
case RIDE_TYPE_1F:
case RIDE_TYPE_SHOP:
case RIDE_TYPE_22:
case RIDE_TYPE_50:
case RIDE_TYPE_52:
case RIDE_TYPE_53:
case RIDE_TYPE_54:
return RideClassification::ShopOrStall;
case RIDE_TYPE_INFORMATION_KIOSK:
case RIDE_TYPE_TOILETS:
case RIDE_TYPE_CASH_MACHINE:
case RIDE_TYPE_FIRST_AID:
return false;
return RideClassification::KioskOrFacility;
default:
return true;
return RideClassification::Ride;
}
}
bool Ride::IsRide() const
{
return GetClassification() == RideClassification::Ride;
}
money16 ride_get_price(const Ride* ride)
{
if (gParkFlags & PARK_FLAGS_NO_MONEY)

View File

@ -194,6 +194,13 @@ struct RideMeasurement
uint8_t altitude[MAX_ITEMS]{};
};
enum class RideClassification
{
Ride,
ShopOrStall,
KioskOrFacility
};
/**
* Ride structure.
*
@ -388,6 +395,7 @@ private:
public:
bool CanBreakDown() const;
RideClassification GetClassification() const;
bool IsRide() const;
void Renew();
void Delete();
@ -470,13 +478,6 @@ assert_struct_size(ride_name_args, 4);
#define TYPE_TO_RIDE_ENTRY_SLOTS 492
extern uint8_t gTypeToRideEntryIndexMap[TYPE_TO_RIDE_ENTRY_SLOTS];
enum
{
RIDE_CLASS_RIDE,
RIDE_CLASS_SHOP_OR_STALL,
RIDE_CLASS_KIOSK_OR_FACILITY
};
// Constants used by the lifecycle_flags property at 0x1D0
enum
{
@ -1061,8 +1062,17 @@ struct RideManager
}
};
size_t size() const;
Iterator begin();
Iterator end();
Iterator begin() const
{
return ((RideManager*)this)->begin();
}
Iterator end() const
{
return ((RideManager*)this)->end();
}
};
RideManager GetRideManager();
@ -1074,12 +1084,8 @@ RideMeasurement* get_ride_measurement(int32_t index);
extern money16 gTotalRideValueForMoney;
extern const uint8_t gRideClassifications[MAX_RIDES];
extern const rct_string_id ColourSchemeNames[4];
extern uint16_t gRideCount;
extern money32 _currentTrackPrice;
extern uint16_t _numCurrentPossibleRideConfigurations;

View File

@ -45,7 +45,7 @@ TEST(MultiLaunchTest, all)
game_load_init();
// Check ride count to check load was successful
ASSERT_EQ(gRideCount, 134);
ASSERT_EQ(ride_get_count(), 134);
auto gs = context->GetGameState();
ASSERT_NE(gs, nullptr);
auto& date = gs->GetDate();
@ -59,7 +59,7 @@ TEST(MultiLaunchTest, all)
ASSERT_EQ(date.GetMonthTicks(), 7862 + updatesToTest);
// Check ride count again
ASSERT_EQ(gRideCount, 134);
ASSERT_EQ(ride_get_count(), 134);
}
SUCCEED();
}

View File

@ -68,7 +68,6 @@ TEST_F(RideRatings, all)
load_from_sv6(path.c_str());
// Check ride count to check load was successful
ASSERT_EQ(gRideCount, 134);
ASSERT_EQ(ride_get_count(), 134);
CalculateRatingsForAllRides();