1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-15 11:03:00 +01:00

Close #12389: Refactor PeepSittingSubState (#12908)

* Refactor PeepSittingSubState

* Fix formatting
This commit is contained in:
rpstester
2020-09-14 15:11:17 -04:00
committed by GitHub
parent 2857f9d276
commit f7348b1f06
2 changed files with 12 additions and 8 deletions

View File

@@ -1228,7 +1228,7 @@ void Guest::TryGetUpFromSitting()
*/
void Guest::UpdateSitting()
{
if (SubState == PEEP_SITTING_TRYING_TO_SIT)
if (SittingSubState == PeepSittingSubState::TryingToSit)
{
if (!CheckForPath())
return;
@@ -1248,12 +1248,12 @@ void Guest::UpdateSitting()
NextActionSpriteType = PEEP_ACTION_SPRITE_TYPE_SITTING_IDLE;
SwitchNextActionSpriteType();
SubState = PEEP_SITTING_SAT_DOWN;
SittingSubState = PeepSittingSubState::SatDown;
// Sets time to sit on seat
TimeToSitdown = (129 - Energy) * 16 + 50;
}
else if (SubState == PEEP_SITTING_SAT_DOWN)
else if (SittingSubState == PeepSittingSubState::SatDown)
{
if (Action < PEEP_ACTION_NONE_1)
{
@@ -6106,7 +6106,7 @@ bool Guest::UpdateWalkingFindBench()
SetState(PEEP_STATE_SITTING);
SubState = PEEP_SITTING_TRYING_TO_SIT;
SittingSubState = PeepSittingSubState::TryingToSit;
int32_t benchX = (x & 0xFFE0) + BenchUseOffsets[Var37 & 0x7].x;
int32_t benchY = (y & 0xFFE0) + BenchUseOffsets[Var37 & 0x7].y;

View File

@@ -242,10 +242,10 @@ enum PeepState : uint8_t
PEEP_STATE_INSPECTING = 23
};
enum PeepSittingSubState
enum class PeepSittingSubState : uint8_t
{
PEEP_SITTING_TRYING_TO_SIT = 0,
PEEP_SITTING_SAT_DOWN
TryingToSit, // was = 0
SatDown // was unassigned
};
enum PeepRideSubState
@@ -614,7 +614,11 @@ struct Peep : SpriteBase
uint8_t NextFlags;
bool OutsideOfPark;
PeepState State;
uint8_t SubState;
union
{
uint8_t SubState;
PeepSittingSubState SittingSubState;
};
PeepSpriteType SpriteType;
PeepType AssignedPeepType;
union