fix #3917: no rides show in new ride window

Make sure gTypeToRideEntryIndexMap is properly sized
This commit is contained in:
Michał Janiszewski 2016-06-20 11:20:22 +02:00 committed by Ted John
parent 301f5297ef
commit c177cc72e9
3 changed files with 11 additions and 4 deletions

View File

@ -913,7 +913,7 @@ static uint8* object_type_ride_load(void *objectEntry, uint32 entryIndex, int *c
typeToRideEntryIndexMap--;
uint8 previous_entry = entryIndex;
while (typeToRideEntryIndexMap < RCT2_ADDRESS(0x9E34E4, uint8)){
while (typeToRideEntryIndexMap < gTypeToRideEntryIndexMap + countof(gTypeToRideEntryIndexMap)){
uint8 backup_entry = *typeToRideEntryIndexMap;
*typeToRideEntryIndexMap++ = previous_entry;
previous_entry = backup_entry;
@ -1285,7 +1285,7 @@ static void object_type_ride_reset(void *objectEntry, uint32 entryIndex)
typeToRideEntryIndexMap--;
uint8 previous_entry = entryIndex;
while (typeToRideEntryIndexMap < RCT2_ADDRESS(0x9E34E4, uint8)){
while (typeToRideEntryIndexMap < gTypeToRideEntryIndexMap + countof(gTypeToRideEntryIndexMap)){
uint8 backup_entry = *typeToRideEntryIndexMap;
*typeToRideEntryIndexMap++ = previous_entry;
previous_entry = backup_entry;

View File

@ -121,7 +121,7 @@ const uint8 gRideClassifications[255] = {
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE
};
uint8 gTypeToRideEntryIndexMap[91];
uint8 gTypeToRideEntryIndexMap[TYPE_TO_RIDE_ENTRY_SLOTS];
#pragma endregion

View File

@ -369,7 +369,14 @@ assert_struct_size(track_begin_end, 36);
#pragma pack(pop)
extern uint8 gTypeToRideEntryIndexMap[];
/*
* This array should probably be only 91 + 128 * 3 = 475 bytes long.
* It was originally stored at address 0x009E32F8 and continued until 0x009E34E3
* (inclusive). 0x009E34E4 is the address of s6 header, so it's likely it had
* some padding at the end as well.
*/
#define TYPE_TO_RIDE_ENTRY_SLOTS 492
extern uint8 gTypeToRideEntryIndexMap[TYPE_TO_RIDE_ENTRY_SLOTS];
enum {
RIDE_CLASS_RIDE,