From 12ba104485aa410e81630efc98e975101728d72c Mon Sep 17 00:00:00 2001 From: duncanspumpkin Date: Fri, 24 Feb 2017 20:48:04 +0000 Subject: [PATCH] Add force commands for ratings. Note these do not save and will reset if the rating is recalculated --- src/openrct2/interface/console.c | 100 +++++++++++++++++++++++++++---- 1 file changed, 90 insertions(+), 10 deletions(-) diff --git a/src/openrct2/interface/console.c b/src/openrct2/interface/console.c index bd3aeedec7..db70738d75 100644 --- a/src/openrct2/interface/console.c +++ b/src/openrct2/interface/console.c @@ -460,6 +460,9 @@ static sint32 cc_rides(const utf8 **argv, sint32 argc) if (argc < 4) { console_printf("rides set type "); console_printf("rides set friction "); + console_printf("rides set excitement "); + console_printf("rides set intensity "); + console_printf("rides set nausea "); return 0; } if (strcmp(argv[1], "type") == 0) { @@ -477,33 +480,110 @@ static sint32 cc_rides(const utf8 **argv, sint32 argc) console_printf("That didn't work"); } } - } else if (strcmp(argv[1], "friction") == 0) { + } + else if (strcmp(argv[1], "friction") == 0) { bool int_valid[2] = { 0 }; sint32 ride_index = console_parse_int(argv[2], &int_valid[0]); sint32 friction = console_parse_int(argv[3], &int_valid[1]); if (ride_index < 0) { console_printf("Ride index must not be negative"); - } else if (!int_valid[0] || !int_valid[1]) { + } + else if (!int_valid[0] || !int_valid[1]) { console_printf("This command expects integer arguments"); - } else { + } + else { rct_ride *ride = get_ride(ride_index); if (friction <= 0) { console_printf("Friction value must be strictly positive"); - } else if (ride->type == RIDE_TYPE_NULL) { - console_printf("No ride found with index %d",ride_index); - } else { + } + else if (ride->type == RIDE_TYPE_NULL) { + console_printf("No ride found with index %d", ride_index); + } + else { for (sint32 i = 0; i < ride->num_vehicles; i++) { uint16 vehicle_index = ride->vehicles[i]; - while (vehicle_index != SPRITE_INDEX_NULL) { - rct_vehicle *vehicle=GET_VEHICLE(vehicle_index); - vehicle->friction=friction; - vehicle_index=vehicle->next_vehicle_on_train; + while (vehicle_index != SPRITE_INDEX_NULL) { + rct_vehicle *vehicle = GET_VEHICLE(vehicle_index); + vehicle->friction = friction; + vehicle_index = vehicle->next_vehicle_on_train; } } } } } + else if (strcmp(argv[1], "excitement") == 0) { + bool int_valid[2] = { 0 }; + sint32 ride_index = console_parse_int(argv[2], &int_valid[0]); + ride_rating excitement = console_parse_int(argv[3], &int_valid[1]); + + if (ride_index < 0) { + console_printf("Ride index must not be negative"); + } + else if (!int_valid[0] || !int_valid[1]) { + console_printf("This command expects integer arguments"); + } + else { + rct_ride *ride = get_ride(ride_index); + if (excitement <= 0) { + console_printf("Excitement value must be strictly positive"); + } + else if (ride->type == RIDE_TYPE_NULL) { + console_printf("No ride found with index %d", ride_index); + } + else { + ride->excitement = excitement; + } + } + } + else if (strcmp(argv[1], "intensity") == 0) { + bool int_valid[2] = { 0 }; + sint32 ride_index = console_parse_int(argv[2], &int_valid[0]); + ride_rating intensity = console_parse_int(argv[3], &int_valid[1]); + + if (ride_index < 0) { + console_printf("Ride index must not be negative"); + } + else if (!int_valid[0] || !int_valid[1]) { + console_printf("This command expects integer arguments"); + } + else { + rct_ride *ride = get_ride(ride_index); + if (intensity <= 0) { + console_printf("Intensity value must be strictly positive"); + } + else if (ride->type == RIDE_TYPE_NULL) { + console_printf("No ride found with index %d", ride_index); + } + else { + ride->intensity = intensity; + } + } + } + else if (strcmp(argv[1], "nausea") == 0) { + bool int_valid[2] = { 0 }; + sint32 ride_index = console_parse_int(argv[2], &int_valid[0]); + ride_rating nausea = console_parse_int(argv[3], &int_valid[1]); + + if (ride_index < 0) { + console_printf("Ride index must not be negative"); + } + else if (!int_valid[0] || !int_valid[1]) { + console_printf("This command expects integer arguments"); + } + else { + rct_ride *ride = get_ride(ride_index); + if (nausea <= 0) { + console_printf("Nausea value must be strictly positive"); + } + else if (ride->type == RIDE_TYPE_NULL) { + console_printf("No ride found with index %d", ride_index); + } + else { + ride->nausea = nausea; + } + } + } } } else { console_printf("subcommands: list, set");