Fix compile errors

This commit is contained in:
Ted John 2019-08-04 17:12:34 +01:00
parent 8022211112
commit f49447bed5
8 changed files with 22 additions and 17 deletions

View File

@ -186,7 +186,7 @@ static void research_rides_setup()
}
// Set research required for rides in use
for (const auto &ride : GetRideManager())
for (const auto& ride : GetRideManager())
{
Editor::SetSelectedObject(OBJECT_TYPE_RIDE, ride.subtype, OBJECT_SELECTION_FLAG_SELECTED);
}

View File

@ -314,7 +314,7 @@ static void window_new_campaign_dropdown(rct_window* w, rct_widgetindex widgetIn
if (widgetIndex != WIDX_RIDE_DROPDOWN_BUTTON)
return;
if (dropdownIndex < 0 || dropdownIndex >= window_new_campaign_rides.size())
if (dropdownIndex < 0 || (size_t)dropdownIndex >= window_new_campaign_rides.size())
return;
if (w->campaign.campaign_type == ADVERTISING_CAMPAIGN_FOOD_OR_DRINK_FREE)

View File

@ -2296,9 +2296,8 @@ 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;

View File

@ -534,10 +534,10 @@ static void window_ride_list_invalidate(rct_window* w)
{
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;
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;
return ride.GetClassification() == c && ride.status != RIDE_STATUS_OPEN;
});
}

View File

@ -401,7 +401,7 @@ static bool award_is_deserved_best_restrooms([[maybe_unused]] int32_t activeAwar
{
// Count open restrooms
const auto& rideManager = GetRideManager();
auto numRestrooms = std::count_if(rideManager.begin(), rideManager.end(), [](const Ride& ride) {
auto numRestrooms = (size_t)std::count_if(rideManager.begin(), rideManager.end(), [](const Ride& ride) {
return ride.type == RIDE_TYPE_TOILETS && ride.status == RIDE_STATUS_OPEN;
});

View File

@ -143,7 +143,15 @@ RideManager GetRideManager()
size_t RideManager::size() const
{
return ride_get_count();
size_t count = 0;
for (size_t i = 0; i < _rides.size(); i++)
{
if (_rides[i].type != RIDE_TYPE_NULL)
{
count++;
}
}
return count;
}
RideManager::Iterator RideManager::begin()
@ -297,12 +305,7 @@ uint8_t* get_ride_entry_indices_for_ride_type(uint8_t rideType)
int32_t ride_get_count()
{
int32_t count = 0;
for ([[maybe_unused]] auto& ride : GetRideManager())
{
count++;
}
return count;
return (int32_t)GetRideManager().size();
}
int32_t Ride::GetTotalQueueLength() const

View File

@ -118,9 +118,9 @@ void large_scenery_paint(paint_session* session, uint8_t direction, uint16_t hei
{
}
Ride* get_ride(int index)
Ride* get_ride(ride_id_t index)
{
if (index < 0 || index >= MAX_RIDES)
if (index >= RCT12_MAX_RIDES_IN_PARK)
{
log_error("invalid index %d for ride", index);
return nullptr;

View File

@ -16,6 +16,7 @@
#include <openrct2/interface/Colour.h>
#include <openrct2/paint/Paint.h>
#include <openrct2/paint/tile_element/Paint.TileElement.h>
#include <openrct2/rct12/RCT12.h>
#include <vector>
#define gRideEntries RCT2_ADDRESS(0x009ACFA4, rct_ride_entry*)
@ -79,4 +80,6 @@ enum Verbosity
NORMAL,
};
extern Ride gRideList[RCT12_MAX_RIDES_IN_PARK];
int generatePaintCode(uint8_t rideType);