diff --git a/distribution/changelog.txt b/distribution/changelog.txt index dfdbf2b9af..d6ffe552b2 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -1,5 +1,6 @@ 0.2.2+ (in development) ------------------------------------------------------------------------ +- Feature: [#8919] Allow setting ride price from console. - Change: [#8688] Move common actions from debug menu into cheats menu. - Fix: [#5579] Network desync immediately after connecting. - Fix: [#6006] Objects higher than 6 metres are considered trees (original bug). diff --git a/src/openrct2/interface/InteractiveConsole.cpp b/src/openrct2/interface/InteractiveConsole.cpp index 579500f49f..8471897f1a 100644 --- a/src/openrct2/interface/InteractiveConsole.cpp +++ b/src/openrct2/interface/InteractiveConsole.cpp @@ -16,6 +16,7 @@ #include "../ReplayManager.h" #include "../Version.h" #include "../actions/ClimateSetAction.hpp" +#include "../actions/RideSetPriceAction.hpp" #include "../actions/RideSetSetting.hpp" #include "../actions/StaffSetCostumeAction.hpp" #include "../config/Config.h" @@ -169,6 +170,7 @@ static int32_t cc_rides(InteractiveConsole& console, const arguments_t& argv) console.WriteFormatLine("rides set excitement "); console.WriteFormatLine("rides set intensity "); console.WriteFormatLine("rides set nausea "); + console.WriteFormatLine("rides set price "); } return 0; } @@ -358,6 +360,70 @@ static int32_t cc_rides(InteractiveConsole& console, const arguments_t& argv) } } } + else if (argv[1] == "price") + { + bool int_valid[2] = { false }; + if (argv[2] == "all") + { + auto arg1 = console_parse_int(argv[3], &int_valid[0]); + if (argv.size() <= 4) + { + auto price = arg1; + if (int_valid[0]) + { + uint16_t rideId{}; + Ride* ride; + FOR_ALL_RIDES (rideId, ride) + { + auto rideSetPrice = RideSetPriceAction(rideId, price, true); + GameActions::Execute(&rideSetPrice); + } + } + else + { + console.WriteFormatLine("This command expects one or two integer arguments"); + } + } + else + { + auto rideType = arg1; + auto price = console_parse_int(argv[4], &int_valid[1]); + + if (int_valid[0] && int_valid[1]) + { + uint16_t rideId{}; + Ride* ride; + FOR_ALL_RIDES (rideId, ride) + { + if (ride->type == rideType) + { + auto rideSetPrice = RideSetPriceAction(rideId, price, true); + GameActions::Execute(&rideSetPrice); + } + } + } + else + { + console.WriteFormatLine("This command expects one or two integer arguments"); + } + } + } + else + { + int32_t rideId = console_parse_int(argv[2], &int_valid[0]); + money16 price = console_parse_int(argv[3], &int_valid[1]); + + if (!int_valid[0] || !int_valid[1]) + { + console.WriteFormatLine("This command expects the string all or two integer arguments"); + } + else + { + auto rideSetPrice = RideSetPriceAction(rideId, price, true); + GameActions::Execute(&rideSetPrice); + } + } + } } } else