diff --git a/data/language/en-GB.txt b/data/language/en-GB.txt index f5627982cc..c5256930c5 100644 --- a/data/language/en-GB.txt +++ b/data/language/en-GB.txt @@ -3630,6 +3630,8 @@ STR_6524 :Increase the priority of the selected asset pack. STR_6525 :Reload all assets in the game with the enabled asset packs. STR_6526 :(base graphics, music and sound effects) STR_6527 :Competitions +STR_6528 :Invalid track parameters! +STR_6529 :Invalid colour scheme parameter! ############# # Scenarios # diff --git a/src/openrct2/actions/RideSetColourSchemeAction.cpp b/src/openrct2/actions/RideSetColourSchemeAction.cpp index b7ecf3ec0f..dcf5548404 100644 --- a/src/openrct2/actions/RideSetColourSchemeAction.cpp +++ b/src/openrct2/actions/RideSetColourSchemeAction.cpp @@ -54,6 +54,22 @@ GameActions::Result RideSetColourSchemeAction::Query() const return GameActions::Result( GameActions::Status::InvalidParameters, STR_CANT_SET_COLOUR_SCHEME, STR_LAND_NOT_OWNED_BY_PARK); } + // Find the relevant track piece, prefer sequence 0 (logic copied from GetTrackElementOriginAndApplyChanges) + auto trackElement = MapGetTrackElementAtOfTypeSeq(_loc, _trackType, 0); + if (trackElement == nullptr) + { + trackElement = MapGetTrackElementAtOfType(_loc, _trackType); + if (trackElement == nullptr) + { + return GameActions::Result( + GameActions::Status::InvalidParameters, STR_CANT_SET_COLOUR_SCHEME, STR_INVALID_TRACK_PARAMETERS); + } + } + if (_newColourScheme >= OpenRCT2::Limits::NumColourSchemes) + { + return GameActions::Result( + GameActions::Status::InvalidParameters, STR_CANT_SET_COLOUR_SCHEME, STR_INVALID_COLOUR_SCHEME_PARAMETER); + } return GameActions::Result(); } diff --git a/src/openrct2/localisation/StringIds.h b/src/openrct2/localisation/StringIds.h index 769bd8f0f4..76b9d7f537 100644 --- a/src/openrct2/localisation/StringIds.h +++ b/src/openrct2/localisation/StringIds.h @@ -3915,6 +3915,8 @@ enum : uint16_t STR_COMPETITIONS = 6527, + STR_INVALID_TRACK_PARAMETERS = 6528, + STR_INVALID_COLOUR_SCHEME_PARAMETER = 6529, // Have to include resource strings (from scenarios and objects) for the time being now that language is partially working /* MAX_STR_COUNT = 32768 */ // MAX_STR_COUNT - upper limit for number of strings, not the current count strings };