Fix #6026: 'Select ride to advertise' dropdown does not display all items (#6032)

Show up to 128 open rides in the New Campaign dropdown.
This commit is contained in:
Michael Steenbeek 2017-07-29 10:44:51 +02:00 committed by Ted John
parent 6460f0afbb
commit 8c48b5a249
2 changed files with 17 additions and 6 deletions

View File

@ -20,6 +20,7 @@
- Fix: [#5981] Ride list doesn't update after using quick demolish.
- Fix: [#5984] Allow socket binding to same port after crash
- Fix: [#5998] Staff not getting paid / no loan interest.
- Fix: [#6026] 'Select ride to advertise' dropdown does not display all items.
- Improved: [#4301] Leading and trailing whitespace in player name is now removed.
- Improved: [#5859] OpenGL rendering performance
- Improved: [#5863] Switching drawing engines no longer requires the application to restart.

View File

@ -165,15 +165,25 @@ void window_new_campaign_open(sint16 campaignType)
// Get all applicable rides
numApplicableRides = 0;
window_new_campaign_rides[0] = 255;
FOR_ALL_RIDES(i, ride) {
if (!ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_IS_SHOP | RIDE_TYPE_FLAG_SELLS_FOOD | RIDE_TYPE_FLAG_SELLS_DRINKS | RIDE_TYPE_FLAG_IS_BATHROOM))
window_new_campaign_rides[numApplicableRides++] = i;
FOR_ALL_RIDES(i, ride)
{
if (ride->status != RIDE_STATUS_OPEN)
{
continue;
}
if (ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_IS_SHOP | RIDE_TYPE_FLAG_SELLS_FOOD | RIDE_TYPE_FLAG_SELLS_DRINKS | RIDE_TYPE_FLAG_IS_BATHROOM))
{
continue;
}
window_new_campaign_rides[numApplicableRides++] = i;
}
// Take top 40 most reliable rides
if (numApplicableRides > 40) {
// Take top 128 most valuable rides
if (numApplicableRides > DROPDOWN_ITEMS_MAX_SIZE)
{
qsort(window_new_campaign_rides, numApplicableRides, sizeof(uint8), ride_value_compare);
numApplicableRides = 40;
numApplicableRides = DROPDOWN_ITEMS_MAX_SIZE;
}
// Sort rides by name