Merge pull request #1888 from Gymnasiast/fix-1877

Take on-ride photos into account when calculating profit per hour, fixes #1877
This commit is contained in:
Ted John 2015-09-03 17:45:14 +01:00
commit 18bb8b9bb0
1 changed files with 14 additions and 9 deletions

View File

@ -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;