mirror of https://github.com/OpenRCT2/OpenRCT2.git
Move peep pickup test into Peep::CanBePickedUp
This commit is contained in:
parent
27b7657d1d
commit
7d517caced
|
@ -487,7 +487,7 @@ void window_guest_disable_widgets(rct_window* w)
|
|||
}
|
||||
uint64_t disabled_widgets = 0;
|
||||
|
||||
if (peep_can_be_picked_up(peep))
|
||||
if (peep->CanBePickedUp())
|
||||
{
|
||||
if (w->disabled_widgets & (1 << WIDX_PICKUP))
|
||||
w->Invalidate();
|
||||
|
@ -579,7 +579,7 @@ void window_guest_overview_mouse_up(rct_window* w, rct_widgetindex widgetIndex)
|
|||
break;
|
||||
case WIDX_PICKUP:
|
||||
{
|
||||
if (!peep_can_be_picked_up(peep))
|
||||
if (!peep->CanBePickedUp())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -314,7 +314,7 @@ void window_staff_disable_widgets(rct_window* w)
|
|||
|
||||
if (w->page == WINDOW_STAFF_OVERVIEW)
|
||||
{
|
||||
if (peep_can_be_picked_up(peep))
|
||||
if (peep->CanBePickedUp())
|
||||
{
|
||||
if (w->disabled_widgets & (1 << WIDX_PICKUP))
|
||||
w->Invalidate();
|
||||
|
|
|
@ -60,7 +60,7 @@ GameActions::Result::Ptr PeepPickupAction::Query() const
|
|||
case PeepPickupType::Pickup:
|
||||
{
|
||||
res->Position = { peep->x, peep->y, peep->z };
|
||||
if (!peep_can_be_picked_up(peep))
|
||||
if (!peep->CanBePickedUp())
|
||||
{
|
||||
return MakeResult(GameActions::Status::Disallowed, STR_ERR_CANT_PLACE_PERSON_HERE);
|
||||
}
|
||||
|
|
|
@ -353,6 +353,40 @@ void Peep::SetNextFlags(uint8_t next_direction, bool is_sloped, bool is_surface)
|
|||
NextFlags |= is_surface ? PEEP_NEXT_FLAG_IS_SURFACE : 0;
|
||||
}
|
||||
|
||||
bool Peep::CanBePickedUp() const
|
||||
{
|
||||
switch (State)
|
||||
{
|
||||
case PeepState::One:
|
||||
case PeepState::QueuingFront:
|
||||
case PeepState::OnRide:
|
||||
case PeepState::EnteringRide:
|
||||
case PeepState::LeavingRide:
|
||||
case PeepState::EnteringPark:
|
||||
case PeepState::LeavingPark:
|
||||
case PeepState::Fixing:
|
||||
case PeepState::Buying:
|
||||
case PeepState::Inspecting:
|
||||
return false;
|
||||
case PeepState::Falling:
|
||||
case PeepState::Walking:
|
||||
case PeepState::Queuing:
|
||||
case PeepState::Sitting:
|
||||
case PeepState::Picked:
|
||||
case PeepState::Patrolling:
|
||||
case PeepState::Mowing:
|
||||
case PeepState::Sweeping:
|
||||
case PeepState::Answering:
|
||||
case PeepState::Watching:
|
||||
case PeepState::EmptyingBin:
|
||||
case PeepState::UsingBin:
|
||||
case PeepState::Watering:
|
||||
case PeepState::HeadingToInspection:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Peep* try_get_guest(uint16_t spriteIndex)
|
||||
{
|
||||
return TryGetEntity<Guest>(spriteIndex);
|
||||
|
@ -2029,44 +2063,6 @@ void peep_thought_set_format_args(const rct_peep_thought* thought, Formatter& ft
|
|||
}
|
||||
}
|
||||
|
||||
/** rct2: 0x00982004 */
|
||||
static const std::map<PeepState, bool> peep_allow_pick_up{
|
||||
{ PeepState::Falling, true },
|
||||
{ PeepState::One, false },
|
||||
{ PeepState::QueuingFront, false },
|
||||
{ PeepState::OnRide, false },
|
||||
{ PeepState::LeavingRide, false },
|
||||
{ PeepState::Walking, true },
|
||||
{ PeepState::Queuing, true },
|
||||
{ PeepState::EnteringRide, false },
|
||||
{ PeepState::Sitting, true },
|
||||
{ PeepState::Picked, true },
|
||||
{ PeepState::Patrolling, true },
|
||||
{ PeepState::Mowing, true },
|
||||
{ PeepState::Sweeping, true },
|
||||
{ PeepState::EnteringPark, false },
|
||||
{ PeepState::LeavingPark, false },
|
||||
{ PeepState::Answering, true },
|
||||
{ PeepState::Fixing, false },
|
||||
{ PeepState::Buying, false },
|
||||
{ PeepState::Watching, true },
|
||||
{ PeepState::EmptyingBin, true },
|
||||
{ PeepState::UsingBin, true },
|
||||
{ PeepState::Watering, true },
|
||||
{ PeepState::HeadingToInspection, true },
|
||||
{ PeepState::Inspecting, false },
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x00698827
|
||||
* returns 1 on pickup (CF not set)
|
||||
*/
|
||||
bool peep_can_be_picked_up(Peep* peep)
|
||||
{
|
||||
return peep_allow_pick_up.find(peep->State)->second;
|
||||
}
|
||||
|
||||
enum
|
||||
{
|
||||
PEEP_FACE_OFFSET_ANGRY = 0,
|
||||
|
|
|
@ -743,6 +743,7 @@ public: // Peep
|
|||
bool GetNextIsSloped() const;
|
||||
bool GetNextIsSurface() const;
|
||||
void SetNextFlags(uint8_t next_direction, bool is_sloped, bool is_surface);
|
||||
bool CanBePickedUp() const;
|
||||
void Pickup();
|
||||
void PickupAbort(int32_t old_x);
|
||||
std::unique_ptr<GameActions::Result> Place(const TileCoordsXYZ& location, bool apply);
|
||||
|
@ -1010,7 +1011,6 @@ extern uint8_t gPeepWarningThrottle[16];
|
|||
|
||||
Peep* try_get_guest(uint16_t spriteIndex);
|
||||
int32_t peep_get_staff_count();
|
||||
bool peep_can_be_picked_up(Peep* peep);
|
||||
void peep_update_all();
|
||||
void peep_problem_warnings_update();
|
||||
void peep_stop_crowd_noise();
|
||||
|
|
Loading…
Reference in New Issue