mirror of https://github.com/OpenRCT2/OpenRCT2.git
Fix #5325: Crash from invalid ride type in research_finish_item
This commit is contained in:
parent
10d1e8a538
commit
cf87760b60
|
@ -15,6 +15,7 @@
|
|||
#pragma endregion
|
||||
|
||||
#include "../config/Config.h"
|
||||
#include "../core/Guard.hpp"
|
||||
#include "../game.h"
|
||||
#include "../interface/window.h"
|
||||
#include "../localisation/date.h"
|
||||
|
@ -183,9 +184,10 @@ void research_finish_item(sint32 entryIndex)
|
|||
sint32 base_ride_type = (entryIndex >> 8) & 0xFF;
|
||||
sint32 rideEntryIndex = entryIndex & 0xFF;
|
||||
rct_ride_entry *rideEntry = get_ride_entry(rideEntryIndex);
|
||||
if (rideEntry != NULL && rideEntry != (rct_ride_entry *)-1)
|
||||
if (rideEntry != NULL && rideEntry != (rct_ride_entry *)-1 && base_ride_type != RIDE_TYPE_NULL)
|
||||
{
|
||||
ride_type_set_invented(base_ride_type);
|
||||
openrct2_assert(base_ride_type < countof(RideTypePossibleTrackConfigurations), "Invalid base_ride_type = %d", base_ride_type);
|
||||
gResearchedTrackTypesA[base_ride_type] = (RideTypePossibleTrackConfigurations[base_ride_type]) & 0xFFFFFFFFULL;
|
||||
gResearchedTrackTypesB[base_ride_type] = (RideTypePossibleTrackConfigurations[base_ride_type] >> 32ULL) & 0xFFFFFFFFULL;
|
||||
|
||||
|
|
Loading…
Reference in New Issue