From ddab3a1b7484d3a1feb61529e7a4d5aab2c1a1c3 Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Mon, 11 Jan 2016 12:13:17 +0100 Subject: [PATCH] Use `GET_RIDE_ENTRY` macro to get ride entry --- src/windows/new_ride.c | 10 +++------- src/windows/research.c | 4 ++-- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/windows/new_ride.c b/src/windows/new_ride.c index c04badbe87..b4e2d861a8 100644 --- a/src/windows/new_ride.c +++ b/src/windows/new_ride.c @@ -290,7 +290,6 @@ static void window_new_ride_populate_list() uint8 currentCategory = _window_new_ride_current_tab; ride_list_item *nextListItem = (ride_list_item*)0x00F43523; - rct_ride_type **rideEntries = (rct_ride_type**)RCT2_ADDRESS_RIDE_ENTRIES; // For each ride type in the view order list for (i = 0; i < countof(RideTypeViewOrder); i++) { @@ -326,7 +325,7 @@ static void window_new_ride_populate_list() continue; // Ride entries - rct_ride_type *rideEntry = rideEntries[rideEntryIndex]; + rct_ride_type *rideEntry = GET_RIDE_ENTRY(rideEntryIndex); // Check if ride is in this category if (!gConfigInterface.select_by_track_type && (currentCategory != rideEntry->category[0] && currentCategory != rideEntry->category[1])) @@ -773,8 +772,6 @@ static void window_new_ride_paint(rct_window *w, rct_drawpixelinfo *dpi) */ static void window_new_ride_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, int scrollIndex) { - rct_ride_type **rideEntries = (rct_ride_type**)RCT2_ADDRESS_RIDE_ENTRIES; - if (_window_new_ride_current_tab == WINDOW_NEW_RIDE_PAGE_RESEARCH) return; @@ -793,7 +790,7 @@ static void window_new_ride_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, i gfx_fill_rect_inset(dpi, x, y, x + 115, y + 115, w->colours[1], 0x80 | flags); // Draw ride image with feathered border - rideEntry = rideEntries[listItem->entry_index]; + rideEntry = GET_RIDE_ENTRY(listItem->entry_index); int image_id = rideEntry->images_offset; if (listItem->type != rideEntry->ride_type[0]) { image_id++; @@ -863,8 +860,7 @@ static int get_num_track_designs(ride_list_item item) */ static void window_new_ride_paint_ride_information(rct_window *w, rct_drawpixelinfo *dpi, ride_list_item item, int x, int y, int width) { - rct_ride_type **rideEntries = (rct_ride_type**)RCT2_ADDRESS_RIDE_ENTRIES; - rct_ride_type *rideEntry = rideEntries[item.entry_index]; + rct_ride_type *rideEntry = GET_RIDE_ENTRY(item.entry_index); // Ride name and description rct_string_id rideName = rideEntry->name; diff --git a/src/windows/research.c b/src/windows/research.c index 213195d8ff..7156722202 100644 --- a/src/windows/research.c +++ b/src/windows/research.c @@ -350,7 +350,7 @@ void window_research_development_page_paint(rct_window *w, rct_drawpixelinfo *dp if (RCT2_GLOBAL(RCT2_ADDRESS_RESEARH_PROGRESS_STAGE, uint8) != RESEARCH_STAGE_DESIGNING) { uint32 typeId = RCT2_GLOBAL(RCT2_ADDRESS_NEXT_RESEARCH_ITEM, uint32); if (typeId >= 0x10000) { - rct_ride_type *rideEntry = RCT2_GLOBAL(RCT2_ADDRESS_RIDE_ENTRIES + (typeId & 0xFF) * 4, rct_ride_type*); + rct_ride_type *rideEntry = GET_RIDE_ENTRY(typeId & 0xFF); stringId = (rideEntry->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE_NAME) ? rideEntry->name : ((typeId >> 8) & 0xFF) + 2; @@ -388,7 +388,7 @@ void window_research_development_page_paint(rct_window *w, rct_drawpixelinfo *dp int lastDevelopmentFormat; if (typeId != 0xFFFFFFFF) { if (typeId >= 0x10000) { - rct_ride_type *rideEntry = RCT2_GLOBAL(RCT2_ADDRESS_RIDE_ENTRIES + (typeId & 0xFF) * 4, rct_ride_type*); + rct_ride_type *rideEntry = GET_RIDE_ENTRY(typeId & 0xFF); stringId = (rideEntry->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE_NAME) ? rideEntry->name : ((typeId >> 8) & 0xFF) + 2;