diff --git a/src/object.c b/src/object.c index 3d1256ce0d..b496fd79a4 100644 --- a/src/object.c +++ b/src/object.c @@ -903,7 +903,7 @@ static uint8* object_type_ride_load(void *objectEntry, uint32 entryIndex, int *c continue; } - uint8 *typeToRideEntryIndexMap = RCT2_ADDRESS(0x009E32F8, uint8); + uint8 *typeToRideEntryIndexMap = gTypeToRideEntryIndexMap; while (dl >= 0) { if (*typeToRideEntryIndexMap++ == 0xFF) { dl--; @@ -1275,7 +1275,7 @@ static void object_type_ride_reset(void *objectEntry, uint32 entryIndex) continue; } - uint8 *typeToRideEntryIndexMap = RCT2_ADDRESS(0x009E32F8, uint8); + uint8 *typeToRideEntryIndexMap = gTypeToRideEntryIndexMap; while (dl >= 0) { if (*typeToRideEntryIndexMap++ == 0xFF) { dl--; diff --git a/src/ride/ride.c b/src/ride/ride.c index 85d18073ef..40df29bc6a 100644 --- a/src/ride/ride.c +++ b/src/ride/ride.c @@ -121,6 +121,8 @@ const uint8 gRideClassifications[255] = { RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE }; +uint8 gTypeToRideEntryIndexMap[91]; + #pragma endregion static const int RideInspectionInterval[] = { @@ -250,14 +252,12 @@ rct_ride_entry *get_ride_entry_by_ride(rct_ride *ride) * rct2: 0x006DED68 */ void reset_type_to_ride_entry_index_map(){ - uint8* typeToRideEntryIndexMap = RCT2_ADDRESS(0x009E32F8, uint8); - memset(typeToRideEntryIndexMap, 0xFF, 91); + memset(gTypeToRideEntryIndexMap, 0xFF, 91); } uint8 *get_ride_entry_indices_for_ride_type(uint8 rideType) { - uint8 *typeToRideEntryIndexMap = (uint8*)0x009E32F8; - uint8 *entryIndexList = typeToRideEntryIndexMap; + uint8 *entryIndexList = gTypeToRideEntryIndexMap; while (rideType > 0) { do { entryIndexList++; diff --git a/src/ride/ride.h b/src/ride/ride.h index 69809cbe7c..338f47ea81 100644 --- a/src/ride/ride.h +++ b/src/ride/ride.h @@ -369,6 +369,8 @@ assert_struct_size(track_begin_end, 36); #pragma pack(pop) +extern uint8 gTypeToRideEntryIndexMap[]; + enum { RIDE_CLASS_RIDE, RIDE_CLASS_SHOP_OR_STALL,