1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-15 11:03:00 +01:00

Implement #5370: add ability to change ride operating mode from console

This commit is contained in:
Richard Jenkins
2017-04-17 23:02:47 +01:00
committed by Michał Janiszewski
parent a90e5a2492
commit c564659aa4

View File

@@ -454,11 +454,12 @@ static sint32 cc_rides(const utf8 **argv, sint32 argc)
FOR_ALL_RIDES(i, ride) {
char name[128];
format_string(name, 128, ride->name, &ride->name_arguments);
console_printf("rides %03d type: %02u subtype %03u name %s", i, ride->type, ride->subtype, name);
console_printf("ride: %03d type: %02u subtype %03u operating mode: %02u name: %s", i, ride->type, ride->subtype, ride->mode, name);
}
} else if (strcmp(argv[0], "set") == 0) {
if (argc < 4) {
console_printf("rides set type <ride id> <ride type>");
console_printf("rides set mode <ride id> <operating mode>");
console_printf("rides set friction <ride id> <friction value>");
console_printf("rides set excitement <ride id> <excitement value>");
console_printf("rides set intensity <ride id> <intensity value>");
@@ -481,6 +482,27 @@ static sint32 cc_rides(const utf8 **argv, sint32 argc)
}
}
}
else if (strcmp(argv[1], "mode") == 0) {
bool int_valid[3] = { 0 };
sint32 ride_index = console_parse_int(argv[2], &int_valid[0]);
sint32 mode = console_parse_int(argv[3], &int_valid[1]);
if (!int_valid[0] || !int_valid[1]) {
console_printf("This command expects integer arguments");
} else if (ride_index < 0) {
console_printf("Ride index must not be negative");
} else {
rct_ride *ride = get_ride(ride_index);
if (mode <= 0) {
console_printf("Ride mode must be strictly positive");
}
else if (ride->type == RIDE_TYPE_NULL) {
console_printf("No ride found with index %d", ride_index);
}
else {
ride->mode = mode;
}
}
}
else if (strcmp(argv[1], "friction") == 0) {
bool int_valid[2] = { 0 };
sint32 ride_index = console_parse_int(argv[2], &int_valid[0]);