Skip to content

Commit 33a88fb

Browse files
Fix OpenRCT2#10946: On-ride photo profit assumes every guest buys one (OpenRCT2#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
1 parent f549698 commit 33a88fb

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

contributors.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ The following people are not part of the development team, but have been contrib
147147
* Michael Coates (outerwear)
148148
* Reid Baris (Rdbaris)
149149
* Deanna Baris (dbaris)
150+
* Chaitanya Thengdi (chaitanyathengdi)
150151

151152
## Toolchain
152153
* (Balletie) - macOS

distribution/changelog.txt

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

src/openrct2/ride/Ride.cpp

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -396,8 +396,24 @@ money32 Ride::CalculateIncomePerHour() const
396396

397397
if (currentShopItem != SHOP_ITEM_NONE)
398398
{
399-
priceMinusCost += price[1];
400-
priceMinusCost -= ShopItems[currentShopItem].Cost;
399+
const money16 shopItemProfit = price[1] - ShopItems[currentShopItem].Cost;
400+
401+
if (ShopItems[currentShopItem].IsPhoto())
402+
{
403+
const int32_t rideTicketsSold = total_customers - no_secondary_items_sold;
404+
405+
// Use the ratio between photo sold and total admissions to approximate the photo income(as not every guest will buy
406+
// one).
407+
// TODO: use data from the last 5 minutes instead of all-time values for a more accurate calculation
408+
if (rideTicketsSold > 0)
409+
{
410+
priceMinusCost += ((no_secondary_items_sold * shopItemProfit) / rideTicketsSold);
411+
}
412+
}
413+
else
414+
{
415+
priceMinusCost += shopItemProfit;
416+
}
401417

402418
if (entry->shop_item[0] != SHOP_ITEM_NONE)
403419
priceMinusCost /= 2;

0 commit comments

Comments
 (0)