Merge pull request #8337 from ZehMatt/fix-8333

Fix #8333: Replace assert with in-game error.
This commit is contained in:
ζeh Matt 2018-12-23 22:48:17 +01:00 committed by GitHub
commit 8d9fcb7f98
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 38 additions and 3 deletions

View File

@ -3723,6 +3723,7 @@ STR_6272 :Stations
STR_6273 :Music
STR_6274 :Can't set colour scheme...
STR_6275 :{WINDOW_COLOUR_2}Station style:
STR_6276 :{RED}{STRINGID} has guests getting stuck, possibly due to invalid ride type or operating mode.
#############
# Scenarios #

View File

@ -173,6 +173,8 @@ public:
ride->race_winner = SPRITE_INDEX_NULL;
ride->status = _status;
ride->current_issues = 0;
ride->last_issue_time = 0;
ride_get_measurement(_rideIndex, nullptr);
ride->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_MAIN | RIDE_INVALIDATE_RIDE_LIST;
window_invalidate_by_number(WC_RIDE, _rideIndex);

View File

@ -3894,6 +3894,7 @@ enum
STR_CANT_SET_COLOUR_SCHEME = 6274,
STR_STATION_STYLE = 6275,
STR_GUESTS_GETTING_STUCK_ON_RIDE = 6276,
// Have to include resource strings (from scenarios and objects) for the time being now that language is partially working
STR_COUNT = 32768

View File

@ -3597,10 +3597,30 @@ void rct_peep::UpdateRideAdvanceThroughEntrance()
peep_update_ride_leave_entrance_maze(this, ride, entranceLocation);
return;
}
Guard::Assert(ride->type == RIDE_TYPE_SPIRAL_SLIDE);
else if (ride->type == RIDE_TYPE_SPIRAL_SLIDE)
{
peep_update_ride_leave_entrance_spiral_slide(this, ride, entranceLocation);
return;
}
else
{
// If the ride type was changed guests will become stuck.
// Inform the player about this if its a new issue or hasn't been addressed within 120 seconds.
if ((ride->current_issues & RIDE_ISSUE_GUESTS_STUCK) == 0 || gCurrentTicks - ride->last_issue_time > 3000)
{
ride->current_issues |= RIDE_ISSUE_GUESTS_STUCK;
ride->last_issue_time = gCurrentTicks;
peep_update_ride_leave_entrance_spiral_slide(this, ride, entranceLocation);
return;
set_format_arg(0, rct_string_id, ride->name);
set_format_arg(2, uint32_t, ride->name_arguments);
if (gConfigNotifications.ride_warnings)
{
news_item_add_to_queue(NEWS_ITEM_RIDE, STR_GUESTS_GETTING_STUCK_ON_RIDE, current_ride);
}
}
return;
}
}
rct_vehicle* vehicle = GET_VEHICLE(ride->vehicles[current_train]);

View File

@ -342,6 +342,11 @@ struct Ride
uint8_t cable_lift_z;
uint16_t cable_lift;
uint16_t queue_length[MAX_STATIONS];
// These fields are used to warn users about issues.
// Such issue can be hacked rides with incompatible options set.
// They don't require export/import.
uint8_t current_issues;
uint32_t last_issue_time;
bool CanBreakDown() const;
};
@ -881,6 +886,12 @@ enum
RIDE_MODIFY_RENEW
};
enum
{
RIDE_ISSUE_NONE = 0,
RIDE_ISSUE_GUESTS_STUCK = (1 << 0),
};
struct rct_ride_properties
{
uint32_t flags;