From 6c28df82503d6e6535038139a984e30486b35417 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Janiszewski?= Date: Fri, 24 Jun 2016 22:57:40 +0200 Subject: [PATCH] Integrate gTypeToRideEntryIndexMap --- src/object.c | 4 ++-- src/ride/ride.c | 6 ++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/object.c b/src/object.c index ad3928100a..2cb315bfdf 100644 --- a/src/object.c +++ b/src/object.c @@ -732,7 +732,7 @@ static bool object_type_ride_load(void *objectEntry, uint32 entryIndex) continue; } - uint8 *typeToRideEntryIndexMap = RCT2_ADDRESS(0x009E32F8, uint8); + uint8 *typeToRideEntryIndexMap = gTypeToRideEntryIndexMap; while (dl >= 0) { if (*typeToRideEntryIndexMap++ == 0xFF) { dl--; @@ -741,7 +741,7 @@ static bool object_type_ride_load(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; diff --git a/src/ride/ride.c b/src/ride/ride.c index b905609a28..f77c559b06 100644 --- a/src/ride/ride.c +++ b/src/ride/ride.c @@ -251,14 +251,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++;