Fix #10946: On-ride photo profit assumes every guest buys one (#12285)

* Use stored values of customers to adjust income from on-ride photos

Use stored values of photos sold and total customers to calculate ratio
and use that to predict income per hour for rides that include
on-ride-photo sections.

* Get rid of float

* Fix formatting

* Fix formatting - again

* Review changes

* Fix formatting

* Use new method of checking on-ride photo

* Use constants

* Add a changelog and contributors entry
This commit is contained in:
chaitanyathengdi 2020-07-25 11:49:51 +05:30 committed by GitHub
parent f549698e96
commit 33a88fbdbd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 2 deletions

View file

@ -147,6 +147,7 @@ The following people are not part of the development team, but have been contrib
* Michael Coates (outerwear)
* Reid Baris (Rdbaris)
* Deanna Baris (dbaris)
* Chaitanya Thengdi (chaitanyathengdi)
## Toolchain
* (Balletie) - macOS

View file

@ -48,6 +48,7 @@
- Fix: [#12123] Long server descriptions are not cut off properly.
- Fix: [#12211] Map Generator shows incorrect map sizes (e.g. "150 x 0").
- Fix: [#12221] Map Generation tool doesn't place any trees.
- Fix: [#12285] On-ride photo profit assumes every guest buys one.
- Fix: [#12312] Softlock when loading save file via command line fails.
- Fix: RCT1 scenarios have more items in the object list than are present in the park or the research list.
- Improved: [#6530] Allow water and land height changes on park borders.

View file

@ -396,8 +396,24 @@ money32 Ride::CalculateIncomePerHour() const
if (currentShopItem != SHOP_ITEM_NONE)
{
priceMinusCost += price[1];
priceMinusCost -= ShopItems[currentShopItem].Cost;
const money16 shopItemProfit = price[1] - ShopItems[currentShopItem].Cost;
if (ShopItems[currentShopItem].IsPhoto())
{
const int32_t rideTicketsSold = total_customers - no_secondary_items_sold;
// Use the ratio between photo sold and total admissions to approximate the photo income(as not every guest will buy
// one).
// TODO: use data from the last 5 minutes instead of all-time values for a more accurate calculation
if (rideTicketsSold > 0)
{
priceMinusCost += ((no_secondary_items_sold * shopItemProfit) / rideTicketsSold);
}
}
else
{
priceMinusCost += shopItemProfit;
}
if (entry->shop_item[0] != SHOP_ITEM_NONE)
priceMinusCost /= 2;