1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-24 23:34:37 +01:00

Close #12391: Refactor PeepUsingBinSubState to use strong enum (#13247)

Changed it to enum class and updated references.
This commit is contained in:
rpstester
2020-10-19 21:22:24 -04:00
committed by GitHub
parent f5790dce6f
commit 853f718aee
2 changed files with 9 additions and 8 deletions

View File

@@ -5849,9 +5849,9 @@ void Guest::UpdateWatching()
*/
void Guest::UpdateUsingBin()
{
switch (SubState)
switch (UsingBinSubState)
{
case PEEP_USING_BIN_WALKING_TO_BIN:
case PeepUsingBinSubState::WalkingToBin:
{
if (!CheckForPath())
return;
@@ -5860,11 +5860,11 @@ void Guest::UpdateUsingBin()
PerformNextAction(pathingResult);
if (pathingResult & PATHING_DESTINATION_REACHED)
{
SubState = PEEP_USING_BIN_GOING_BACK;
UsingBinSubState = PeepUsingBinSubState::GoingBack;
}
break;
}
case PEEP_USING_BIN_GOING_BACK:
case PeepUsingBinSubState::GoingBack:
{
if (Action != PeepActionType::None2)
{
@@ -6201,7 +6201,7 @@ bool Guest::UpdateWalkingFindBin()
peep->Var37 = chosen_edge;
peep->SetState(PeepState::UsingBin);
peep->SubState = PEEP_USING_BIN_WALKING_TO_BIN;
peep->UsingBinSubState = PeepUsingBinSubState::WalkingToBin;
int32_t binX = (peep->x & 0xFFE0) + BinUseOffsets[peep->Var37 & 0x3].x;
int32_t binY = (peep->y & 0xFFE0) + BinUseOffsets[peep->Var37 & 0x3].y;

View File

@@ -277,10 +277,10 @@ enum class PeepRideSubState : uint8_t
LeaveShop = 21
};
enum PeepUsingBinSubState
enum class PeepUsingBinSubState : uint8_t
{
PEEP_USING_BIN_WALKING_TO_BIN = 0,
PEEP_USING_BIN_GOING_BACK,
WalkingToBin = 0,
GoingBack,
};
enum class PeepActionType : uint8_t
@@ -623,6 +623,7 @@ struct Peep : SpriteBase
uint8_t SubState;
PeepSittingSubState SittingSubState;
PeepRideSubState RideSubState;
PeepUsingBinSubState UsingBinSubState;
};
PeepSpriteType SpriteType;
PeepType AssignedPeepType;