Don't crash when dealing with a hacked ride subtype

This commit is contained in:
Michał Janiszewski 2016-02-14 18:47:57 +01:00
parent c137ac41c0
commit 2cce13da1b
2 changed files with 5 additions and 1 deletions

View File

@ -307,6 +307,9 @@ money32 ride_calculate_income_per_hour(rct_ride *ride)
int currentShopItem;
entry = get_ride_entry(ride->subtype);
if (entry == NULL) {
return 0;
}
customersPerHour = ride_customers_per_hour(ride);
priceMinusCost = ride->price;

View File

@ -1294,7 +1294,8 @@ static void scenario_objective_check_10_rollercoasters()
uint8 subtype_id = ride->subtype;
rct_ride_type *rideType = get_ride_entry(subtype_id);
if ((rideType->category[0] == RIDE_GROUP_ROLLERCOASTER || rideType->category[1] == RIDE_GROUP_ROLLERCOASTER) &&
if (rideType != NULL &&
(rideType->category[0] == RIDE_GROUP_ROLLERCOASTER || rideType->category[1] == RIDE_GROUP_ROLLERCOASTER) &&
ride->status == RIDE_STATUS_OPEN &&
ride->excitement >= RIDE_RATING(6,00) && type_already_counted[subtype_id] == 0){
type_already_counted[subtype_id]++;