MCPcopy Create free account
hub / github.com/OpenRCT2/OpenRCT2 / IncomeOnTextInput

Method IncomeOnTextInput

src/openrct2-ui/windows/Ride.cpp:6638–6660  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6636 }
6637
6638 void IncomeOnTextInput(WidgetIndex widgetIndex, std::string_view text)
6639 {
6640 if ((widgetIndex != WIDX_PRIMARY_PRICE && widgetIndex != WIDX_SECONDARY_PRICE) || text.empty())
6641 return;
6642
6643 std::string strText{ text };
6644 money64 price = StringToMoney(strText.c_str());
6645 if (price == kMoney64Undefined)
6646 {
6647 return;
6648 }
6649
6650 price = std::clamp(price, kRideMinPrice, kRideMaxPrice);
6651
6652 if (widgetIndex == WIDX_PRIMARY_PRICE)
6653 {
6654 IncomeSetPrimaryPrice(price);
6655 }
6656 else
6657 {
6658 IncomeSetSecondaryPrice(price);
6659 }
6660 }
6661
6662 void IncomeOnPrepareDraw()
6663 {

Callers

nothing calls this directly

Calls 2

StringToMoneyFunction · 0.85
emptyMethod · 0.45

Tested by

no test coverage detected