From f5f2f625072181b999668c7c4d78580a9b5edcd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Janiszewski?= Date: Sun, 3 Apr 2016 17:37:45 +0200 Subject: [PATCH 1/2] Cap dropdown items count to 64 --- src/windows/ride.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/windows/ride.c b/src/windows/ride.c index b23ac990ee..54e41fa56e 100644 --- a/src/windows/ride.c +++ b/src/windows/ride.c @@ -2414,7 +2414,7 @@ static void window_ride_vehicle_mousedown(int widgetIndex, rct_window *w, rct_wi rideEntryIndexPtr = get_ride_entry_indices_for_ride_type(rideTypeIterator); - for (uint8 *currentRideEntryIndex = rideEntryIndexPtr; *currentRideEntryIndex != 0xFF; currentRideEntryIndex++) { + for (uint8 *currentRideEntryIndex = rideEntryIndexPtr; *currentRideEntryIndex != 0xFF && numItems <= 63; currentRideEntryIndex++) { rideEntryIndex = *currentRideEntryIndex; currentRideEntry = get_ride_entry(rideEntryIndex); // Skip if vehicle has the same track type, but not same subtype, unless subtype switching is enabled From 83a543c86fe4c2a44725519694c9a69bff1ded74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Janiszewski?= Date: Sun, 3 Apr 2016 17:49:23 +0200 Subject: [PATCH 2/2] Make sure shifted value can fit in uint32 --- src/management/research.c | 2 +- src/windows/ride.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/management/research.c b/src/management/research.c index cfcd2c3bec..fe9de1bd54 100644 --- a/src/management/research.c +++ b/src/management/research.c @@ -328,7 +328,7 @@ void sub_684AC3(){ for (int j = 0; j < scenery_set->entry_count; ++j){ uint8 value = scenery_set->scenery_entries[j] & 0x1F; - RCT2_ADDRESS(0x01357BD0, uint32)[scenery_set->scenery_entries[j] >> 5] &= ~(1 << value); + RCT2_ADDRESS(0x01357BD0, uint32)[scenery_set->scenery_entries[j] >> 5] &= ~(1u << value); } } diff --git a/src/windows/ride.c b/src/windows/ride.c index 54e41fa56e..efd50c8e7c 100644 --- a/src/windows/ride.c +++ b/src/windows/ride.c @@ -2424,7 +2424,7 @@ static void window_ride_vehicle_mousedown(int widgetIndex, rct_window *w, rct_wi quadIndex = rideEntryIndex >> 5; bitIndex = rideEntryIndex & 0x1F; // Skip if vehicle type is not invented yet - if (!(RCT2_ADDRESS(0x01357424, uint32)[quadIndex] & (1 << bitIndex))) + if (!(RCT2_ADDRESS(0x01357424, uint32)[quadIndex] & (1u << bitIndex))) continue; if (ride->subtype == rideEntryIndex)