1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-06 06:32:56 +01:00

Fix #4525: Track Designs Manager Crashing

Handle tracks that use a vehicle object that can not be found, fall-back if possible to another object of the same ride type.
This commit is contained in:
Ted John
2016-10-05 21:34:21 +01:00
parent 6599cee193
commit 4f247c16b2
2 changed files with 11 additions and 9 deletions

View File

@@ -5954,6 +5954,9 @@ static money32 ride_create(int type, int subType, int flags, int *outRideIndex,
}
}
subType = availableRideEntries[0];
if (subType == 255) {
return MONEY32_UNDEFINED;
}
}
foundRideEntry:
@@ -5961,7 +5964,7 @@ foundRideEntry:
rideIndex = ride_get_empty_slot();
if (subType >= 128)
{
log_warning("Invalid request for ride type %u", subType);
log_warning("Invalid request for ride entry %u", subType);
return MONEY32_UNDEFINED;
}
if (rideIndex == -1) {

View File

@@ -332,16 +332,15 @@ static void window_track_list_update(rct_window *w)
*/
static void window_track_list_invalidate(rct_window *w)
{
rct_ride_entry *entry;
rct_string_id stringId;
colour_scheme_update(w);
entry = get_ride_entry(_window_track_list_item.entry_index);
stringId = entry->name;
if (!(entry->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE_NAME) || rideTypeShouldLoseSeparateFlag(entry))
stringId = _window_track_list_item.type + 2;
rct_string_id stringId = STR_NONE;
rct_ride_entry *entry = get_ride_entry(_window_track_list_item.entry_index);
if (entry != NULL && entry != (rct_ride_entry*)-1) {
stringId = entry->name;
if (!(entry->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE_NAME) || rideTypeShouldLoseSeparateFlag(entry))
stringId = _window_track_list_item.type + 2;
}
set_format_arg(0, rct_string_id, stringId);
if (gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) {