mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-23 15:52:55 +01:00
Reduce scope of some variables
This commit is contained in:
@@ -515,8 +515,7 @@ namespace OpenRCT2::Ui::Windows
|
|||||||
// If normal peep set sprite to normal (no food)
|
// If normal peep set sprite to normal (no food)
|
||||||
// If staff set sprite to staff sprite
|
// If staff set sprite to staff sprite
|
||||||
auto spriteType = PeepAnimationGroup::Normal;
|
auto spriteType = PeepAnimationGroup::Normal;
|
||||||
auto* staff = peep->As<Staff>();
|
if (auto* staff = peep->As<Staff>(); staff != nullptr)
|
||||||
if (staff != nullptr)
|
|
||||||
{
|
{
|
||||||
spriteType = staff->AnimationGroup;
|
spriteType = staff->AnimationGroup;
|
||||||
if (staff->AssignedStaffType == StaffType::Entertainer)
|
if (staff->AssignedStaffType == StaffType::Entertainer)
|
||||||
|
|||||||
@@ -460,8 +460,7 @@ std::optional<CoordsXY> Peep::UpdateAction(int16_t& xy_distance)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Should we throw up, and are we at the frame where sick appears?
|
// Should we throw up, and are we at the frame where sick appears?
|
||||||
auto* guest = As<Guest>();
|
if (Action == PeepActionType::ThrowUp && AnimationFrameNum == 15 && Is<Guest>())
|
||||||
if (Action == PeepActionType::ThrowUp && AnimationFrameNum == 15 && guest != nullptr)
|
|
||||||
{
|
{
|
||||||
ThrowUp();
|
ThrowUp();
|
||||||
}
|
}
|
||||||
@@ -626,8 +625,7 @@ void PeepWindowStateUpdate(Peep* peep)
|
|||||||
|
|
||||||
void Peep::Pickup()
|
void Peep::Pickup()
|
||||||
{
|
{
|
||||||
auto* guest = As<Guest>();
|
if (auto* guest = As<Guest>(); guest != nullptr)
|
||||||
if (guest != nullptr)
|
|
||||||
{
|
{
|
||||||
guest->RemoveFromRide();
|
guest->RemoveFromRide();
|
||||||
}
|
}
|
||||||
@@ -701,8 +699,7 @@ GameActions::Result Peep::Place(const TileCoordsXYZ& location, bool apply)
|
|||||||
AnimationType = PeepAnimationType::Walking;
|
AnimationType = PeepAnimationType::Walking;
|
||||||
PathCheckOptimisation = 0;
|
PathCheckOptimisation = 0;
|
||||||
EntityTweener::Get().Reset();
|
EntityTweener::Get().Reset();
|
||||||
auto* guest = As<Guest>();
|
if (auto* guest = As<Guest>(); guest != nullptr)
|
||||||
if (guest != nullptr)
|
|
||||||
{
|
{
|
||||||
AnimationType = PeepAnimationType::Invalid;
|
AnimationType = PeepAnimationType::Invalid;
|
||||||
guest->HappinessTarget = std::max(guest->HappinessTarget - 10, 0);
|
guest->HappinessTarget = std::max(guest->HappinessTarget - 10, 0);
|
||||||
@@ -834,8 +831,7 @@ void Peep::UpdateFalling()
|
|||||||
// Looks like we are drowning!
|
// Looks like we are drowning!
|
||||||
MoveTo({ x, y, height });
|
MoveTo({ x, y, height });
|
||||||
|
|
||||||
auto* guest = As<Guest>();
|
if (auto* guest = As<Guest>(); guest != nullptr)
|
||||||
if (guest != nullptr)
|
|
||||||
{
|
{
|
||||||
// Drop balloon if held
|
// Drop balloon if held
|
||||||
GuestReleaseBalloon(guest, height);
|
GuestReleaseBalloon(guest, height);
|
||||||
@@ -1333,8 +1329,7 @@ void Peep::FormatActionTo(Formatter& ft) const
|
|||||||
case PeepState::Walking:
|
case PeepState::Walking:
|
||||||
case PeepState::UsingBin:
|
case PeepState::UsingBin:
|
||||||
{
|
{
|
||||||
auto* guest = As<Guest>();
|
if (auto* guest = As<Guest>(); guest != nullptr)
|
||||||
if (guest != nullptr)
|
|
||||||
{
|
{
|
||||||
if (!guest->GuestHeadingToRideId.IsNull())
|
if (!guest->GuestHeadingToRideId.IsNull())
|
||||||
{
|
{
|
||||||
@@ -1567,8 +1562,7 @@ bool Peep::IsActionInterruptable() const
|
|||||||
void PeepSetMapTooltip(Peep* peep)
|
void PeepSetMapTooltip(Peep* peep)
|
||||||
{
|
{
|
||||||
auto ft = Formatter();
|
auto ft = Formatter();
|
||||||
auto* guest = peep->As<Guest>();
|
if (auto* guest = peep->As<Guest>(); guest != nullptr)
|
||||||
if (guest != nullptr)
|
|
||||||
{
|
{
|
||||||
ft.Add<StringId>((peep->PeepFlags & PEEP_FLAGS_TRACKING) ? STR_TRACKED_GUEST_MAP_TIP : STR_GUEST_MAP_TIP);
|
ft.Add<StringId>((peep->PeepFlags & PEEP_FLAGS_TRACKING) ? STR_TRACKED_GUEST_MAP_TIP : STR_GUEST_MAP_TIP);
|
||||||
ft.Add<uint32_t>(GetPeepFaceSpriteSmall(guest));
|
ft.Add<uint32_t>(GetPeepFaceSpriteSmall(guest));
|
||||||
|
|||||||
Reference in New Issue
Block a user