Create kMaximumBrakeSpeed

This commit is contained in:
Gymnasiast authored and Michael Steenbeek committed 2024-04-30 13:39:49 +02:00
1 parent 575cd756b3
commit dbbfc2f1d1
6 files changed
+19 -2

No files matched your search

+1
View File
@@ -3698,6 +3698,7 @@ STR_6623 :Type ‘help’ for a list of available commands. Type ‘hide’ t
STR_6624 :Tile Inspector: Sort elements
STR_6625 :Invalid colour
STR_6626 :Animation is backwards
STR_6627 :Track speed too high!
#############
# Scenarios #
+1 -2
View File
@@ -1336,9 +1336,8 @@ static Widget _rideConstructionWidgets[] = {
else
{
uint8_t* brakesSpeedPtr = &_currentBrakeSpeed2;
uint8_t maxBrakesSpeed = 30;
uint8_t brakesSpeed = *brakesSpeedPtr + 2;
if (brakesSpeed <= maxBrakesSpeed)
if (brakesSpeed <= kMaximumBrakeSpeed)
{
if (_rideConstructionState == RideConstructionState::Selected)
{
@@ -104,6 +104,13 @@ GameActions::Result TrackPlaceAction::Query() const
GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_ERR_VALUE_OUT_OF_RANGE);
}
if (_brakeSpeed > kMaximumBrakeSpeed)
{
LOG_WARNING("Invalid speed for track placement, speed = %d", _brakeSpeed);
return GameActions::Result(
GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_SPEED_TOO_HIGH);
}
auto res = GameActions::Result();
res.Expenditure = ExpenditureType::RideConstruction;
res.Position.x = _origin.x + 16;
@@ -68,6 +68,12 @@ GameActions::Result TrackSetBrakeSpeedAction::QueryExecute(bool isExecuting) con
GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_TILE_ELEMENT_NOT_FOUND);
}
if (_brakeSpeed > kMaximumBrakeSpeed)
{
LOG_WARNING("Invalid speed for track, speed = %d", _brakeSpeed);
return GameActions::Result(GameActions::Status::InvalidParameters, STR_SPEED_TOO_HIGH, STR_NONE);
}
if (isExecuting)
{
GetTrackElementOriginAndApplyChanges(
+2
View File
@@ -4045,6 +4045,8 @@ enum : uint16_t
STR_TILE_INSPECTOR_WALL_ANIMATION_IS_BACKWARDS = 6626,
STR_SPEED_TOO_HIGH = 6627,
// 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
};
+2
View File
@@ -22,6 +22,8 @@ constexpr uint8_t kRCT2DefaultBlockBrakeSpeed = 2;
constexpr int32_t kBlockBrakeBaseSpeed = 0x20364;
constexpr int32_t kBlockBrakeSpeedOffset = kBlockBrakeBaseSpeed - (kRCT2DefaultBlockBrakeSpeed << 16);
constexpr uint8_t kMaximumBrakeSpeed = 30;
using track_type_t = uint16_t;
struct ResultWithMessage;