mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-22 06:23:04 +01:00
Remove screaming snake case constant TRACK_BLOCK_2 (#23657)
This commit is contained in:
@@ -150,11 +150,6 @@ namespace OpenRCT2
|
||||
// Update the magic number with the current number of track elements to silence
|
||||
static_assert(EnumValue(TrackElemType::Count) == 349, "Reminder to add new track element to special dropdown list");
|
||||
|
||||
constexpr bool TrackPieceDirectionIsDiagonal(const uint8_t direction)
|
||||
{
|
||||
return direction >= kNumOrthogonalDirections;
|
||||
}
|
||||
|
||||
struct SpecialElement
|
||||
{
|
||||
OpenRCT2::TrackElemType TrackType;
|
||||
|
||||
@@ -504,7 +504,7 @@ bool TrackBlockGetNextFromZero(
|
||||
{
|
||||
auto trackPos = startPos;
|
||||
|
||||
if (!(direction_start & TRACK_BLOCK_2))
|
||||
if (!TrackPieceDirectionIsDiagonal(direction_start))
|
||||
{
|
||||
trackPos += CoordsDirectionDelta[direction_start];
|
||||
}
|
||||
@@ -538,7 +538,7 @@ bool TrackBlockGetNextFromZero(
|
||||
|
||||
const auto& nextTrackCoordinate = ted.coordinates;
|
||||
uint8_t nextRotation = tileElement->GetDirectionWithOffset(nextTrackCoordinate.rotationBegin)
|
||||
| (nextTrackCoordinate.rotationBegin & TRACK_BLOCK_2);
|
||||
| (nextTrackCoordinate.rotationBegin & kTrackDirectionDiagonalMask);
|
||||
|
||||
if (nextRotation != direction_start)
|
||||
continue;
|
||||
@@ -605,7 +605,7 @@ bool TrackBlockGetNext(CoordsXYE* input, CoordsXYE* output, int32_t* z, int32_t*
|
||||
OriginZ += trackCoordinate.zEnd;
|
||||
|
||||
uint8_t directionStart = ((trackCoordinate.rotationEnd + rotation) & kTileElementDirectionMask)
|
||||
| (trackCoordinate.rotationEnd & TRACK_BLOCK_2);
|
||||
| (trackCoordinate.rotationEnd & kTrackDirectionDiagonalMask);
|
||||
|
||||
return TrackBlockGetNextFromZero({ coords, OriginZ }, *ride, directionStart, output, z, direction, false);
|
||||
}
|
||||
@@ -625,7 +625,7 @@ bool TrackBlockGetPreviousFromZero(
|
||||
direction = DirectionReverse(direction);
|
||||
auto trackPos = startPos;
|
||||
|
||||
if (!(direction & TRACK_BLOCK_2))
|
||||
if (!TrackPieceDirectionIsDiagonal(direction))
|
||||
{
|
||||
trackPos += CoordsDirectionDelta[direction];
|
||||
}
|
||||
@@ -661,7 +661,7 @@ bool TrackBlockGetPreviousFromZero(
|
||||
|
||||
const auto& nextTrackCoordinate = ted.coordinates;
|
||||
uint8_t nextRotation = tileElement->GetDirectionWithOffset(nextTrackCoordinate.rotationEnd)
|
||||
| (nextTrackCoordinate.rotationEnd & TRACK_BLOCK_2);
|
||||
| (nextTrackCoordinate.rotationEnd & kTrackDirectionDiagonalMask);
|
||||
|
||||
if (nextRotation != directionStart)
|
||||
continue;
|
||||
@@ -671,7 +671,7 @@ bool TrackBlockGetPreviousFromZero(
|
||||
continue;
|
||||
|
||||
nextRotation = tileElement->GetDirectionWithOffset(nextTrackCoordinate.rotationBegin)
|
||||
| (nextTrackCoordinate.rotationBegin & TRACK_BLOCK_2);
|
||||
| (nextTrackCoordinate.rotationBegin & kTrackDirectionDiagonalMask);
|
||||
outTrackBeginEnd->begin_element = tileElement;
|
||||
outTrackBeginEnd->begin_x = trackPos.x;
|
||||
outTrackBeginEnd->begin_y = trackPos.y;
|
||||
@@ -743,7 +743,7 @@ bool TrackBlockGetPrevious(const CoordsXYE& trackPos, TrackBeginEnd* outTrackBeg
|
||||
z += trackCoordinate.zBegin;
|
||||
|
||||
rotation = ((trackCoordinate.rotationBegin + rotation) & kTileElementDirectionMask)
|
||||
| (trackCoordinate.rotationBegin & TRACK_BLOCK_2);
|
||||
| (trackCoordinate.rotationBegin & kTrackDirectionDiagonalMask);
|
||||
|
||||
return TrackBlockGetPreviousFromZero({ coords, z }, *ride, rotation, outTrackBeginEnd);
|
||||
}
|
||||
|
||||
@@ -872,11 +872,6 @@ enum
|
||||
RIDE_ISSUE_GUESTS_STUCK = (1 << 0),
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
TRACK_BLOCK_2 = (1 << 2)
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
TRACK_ELEMENT_SET_HIGHLIGHT_FALSE = (1 << 0),
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
constexpr uint8_t kRCT2DefaultBlockBrakeSpeed = 2;
|
||||
constexpr int32_t kBlockBrakeBaseSpeed = 0x20364;
|
||||
constexpr int32_t kBlockBrakeSpeedOffset = kBlockBrakeBaseSpeed - (kRCT2DefaultBlockBrakeSpeed << 16);
|
||||
constexpr auto kTrackDirectionDiagonalMask = 0b0100;
|
||||
|
||||
constexpr uint8_t kMaximumTrackSpeed = 30;
|
||||
|
||||
@@ -738,3 +739,8 @@ ResultWithMessage TrackRemoveStationElement(const CoordsXYZD& loc, RideId rideIn
|
||||
bool TrackTypeHasSpeedSetting(OpenRCT2::TrackElemType trackType);
|
||||
bool TrackTypeIsHelix(OpenRCT2::TrackElemType trackType);
|
||||
std::optional<CoordsXYZD> GetTrackSegmentOrigin(const CoordsXYE& posEl);
|
||||
|
||||
constexpr bool TrackPieceDirectionIsDiagonal(const uint8_t direction)
|
||||
{
|
||||
return direction & kTrackDirectionDiagonalMask;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user