From feebb7b39dbc912900c0be24f523177a1cf12995 Mon Sep 17 00:00:00 2001 From: Gymnasiast Date: Thu, 3 Sep 2015 15:08:33 +0200 Subject: [PATCH] Take on-ride photos into account when calculating profit per hour, fixes #1877 --- src/ride/ride.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/ride/ride.c b/src/ride/ride.c index 2b72896d39..60d326c961 100644 --- a/src/ride/ride.c +++ b/src/ride/ride.c @@ -246,7 +246,7 @@ money32 ride_calculate_income_per_hour(rct_ride *ride) { rct_ride_type *entry; money32 incomePerHour, priceMinusCost; - int shopItem; + int currentShopItem; entry = GET_RIDE_ENTRY(ride->subtype); incomePerHour = @@ -263,16 +263,21 @@ money32 ride_calculate_income_per_hour(rct_ride *ride) incomePerHour *= 12; priceMinusCost = ride->price; - shopItem = entry->shop_item; - if (shopItem != 255) { - priceMinusCost -= get_shop_item_cost(shopItem); + currentShopItem = entry->shop_item; + if (currentShopItem != 255) { + priceMinusCost -= get_shop_item_cost(currentShopItem); + } - shopItem = entry->shop_item_secondary; - if (shopItem != 255) { - priceMinusCost += ride->price_secondary; - priceMinusCost -= get_shop_item_cost(shopItem); + currentShopItem = ride->lifecycle_flags & RIDE_LIFECYCLE_ON_RIDE_PHOTO ? + RCT2_GLOBAL(0x0097D7CB + (ride->type * 4), uint8) : + entry->shop_item_secondary; + + if (currentShopItem != 255) { + priceMinusCost += ride->price_secondary; + priceMinusCost -= get_shop_item_cost(currentShopItem); + + if(entry->shop_item!=255) priceMinusCost /= 2; - } } incomePerHour *= priceMinusCost;