mirror of https://github.com/OpenRCT2/OpenRCT2.git
Apply review suggestions
This commit is contained in:
parent
62baee3adb
commit
571bf0dab1
|
@ -155,15 +155,15 @@ static int32_t peep_move_one_tile(Direction direction, Peep* peep)
|
|||
if (direction == 0 || direction == 2)
|
||||
{
|
||||
// Peep is moving along X, so apply the offset to the X position of the destination and clamp their current Y
|
||||
const int32_t centerLine = (peep->y & 0xFFE0) + COORDS_XY_HALF_TILE;
|
||||
const int32_t centreLine = (peep->y & 0xFFE0) + COORDS_XY_HALF_TILE;
|
||||
newTile.x += offset;
|
||||
newTile.y = std::clamp<int32_t>(peep->y, centerLine - 3, centerLine + 3);
|
||||
newTile.y = std::clamp<int32_t>(peep->y, centreLine - 3, centreLine + 3);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Peep is moving along Y, so apply the offset to the Y position of the destination and clamp their current X
|
||||
const int32_t centerLine = (peep->x & 0xFFE0) + COORDS_XY_HALF_TILE;
|
||||
newTile.x = std::clamp<int32_t>(peep->x, centerLine - 3, centerLine + 3);
|
||||
const int32_t centreLine = (peep->x & 0xFFE0) + COORDS_XY_HALF_TILE;
|
||||
newTile.x = std::clamp<int32_t>(peep->x, centreLine - 3, centreLine + 3);
|
||||
newTile.y += offset;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -606,11 +606,11 @@ std::optional<CoordsXY> Peep::UpdateAction(int16_t& xy_distance)
|
|||
Action = PeepActionType::None2;
|
||||
}
|
||||
|
||||
CoordsXY diffrenceLoc = GetLocation();
|
||||
diffrenceLoc -= GetDestination();
|
||||
CoordsXY differenceLoc = GetLocation();
|
||||
differenceLoc -= GetDestination();
|
||||
|
||||
int32_t x_delta = abs(diffrenceLoc.x);
|
||||
int32_t y_delta = abs(diffrenceLoc.y);
|
||||
int32_t x_delta = abs(differenceLoc.x);
|
||||
int32_t y_delta = abs(differenceLoc.y);
|
||||
|
||||
xy_distance = x_delta + y_delta;
|
||||
|
||||
|
@ -624,7 +624,7 @@ std::optional<CoordsXY> Peep::UpdateAction(int16_t& xy_distance)
|
|||
if (x_delta < y_delta)
|
||||
{
|
||||
nextDirection = 8;
|
||||
if (diffrenceLoc.y >= 0)
|
||||
if (differenceLoc.y >= 0)
|
||||
{
|
||||
nextDirection = 24;
|
||||
}
|
||||
|
@ -632,7 +632,7 @@ std::optional<CoordsXY> Peep::UpdateAction(int16_t& xy_distance)
|
|||
else
|
||||
{
|
||||
nextDirection = 16;
|
||||
if (diffrenceLoc.x >= 0)
|
||||
if (differenceLoc.x >= 0)
|
||||
{
|
||||
nextDirection = 0;
|
||||
}
|
||||
|
@ -3390,5 +3390,5 @@ void Peep::SetDestination(const CoordsXY& coords, int32_t tolerance)
|
|||
|
||||
CoordsXY Peep::GetDestination() const
|
||||
{
|
||||
return CoordsXY{ static_cast<int16_t>(DestinationX), static_cast<int16_t>(DestinationY) };
|
||||
return CoordsXY{ DestinationX, DestinationY };
|
||||
}
|
||||
|
|
|
@ -1442,10 +1442,8 @@ void Staff::UpdateHeadingToInspect()
|
|||
|
||||
PeepDirection = rideEntranceExitElement->GetDirection();
|
||||
|
||||
int32_t destX = NextLoc.x + 16 + DirectionOffsets[PeepDirection].x * 53;
|
||||
int32_t destY = NextLoc.y + 16 + DirectionOffsets[PeepDirection].y * 53;
|
||||
|
||||
SetDestination({ destX, destY }, 2);
|
||||
auto newDestination = CoordsXY{ 16, 16 } + NextLoc + (DirectionOffsets[PeepDirection] * 53);
|
||||
SetDestination(newDestination, 2);
|
||||
sprite_direction = PeepDirection << 3;
|
||||
|
||||
z = rideEntranceExitElement->base_height * 4;
|
||||
|
@ -1453,7 +1451,7 @@ void Staff::UpdateHeadingToInspect()
|
|||
// Falls through into SubState 4
|
||||
}
|
||||
|
||||
int16_t delta_y = abs(y - GetDestination().y);
|
||||
int16_t delta_y = abs(GetLocation().y - GetDestination().y);
|
||||
if (auto loc = UpdateAction())
|
||||
{
|
||||
int32_t newZ = ride->stations[CurrentRideStation].GetBaseZ();
|
||||
|
|
|
@ -721,7 +721,6 @@ Peep* Park::GenerateGuest()
|
|||
{
|
||||
peep->sprite_direction = direction << 3;
|
||||
|
||||
// Get the centre point of the tile the peep is on
|
||||
auto destination = peep->GetLocation().ToTileCentre();
|
||||
peep->SetDestination(destination, 5);
|
||||
peep->PeepDirection = direction;
|
||||
|
|
Loading…
Reference in New Issue