Fix peep pickup. Mistake made during refactor. (#11978)

PeepPickupAction assumed that all locations that are passed into the function would be valid locations or null locations. This is not the case when picking up as a dummy value is passed into the function. The caller was fixed by passing a null location as expected by PeepPickupAction.
This commit is contained in:
Duncan 2020-06-17 21:11:50 +01:00 committed by GitHub
parent e2b187c24a
commit 33298d2bde
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View File

@ -700,7 +700,9 @@ void window_guest_overview_mouse_up(rct_window* w, rct_widgetindex widgetIndex)
return;
}
w->picked_peep_old_x = peep->x;
PeepPickupAction pickupAction{ PeepPickupType::Pickup, w->number, {}, network_get_current_player_id() };
CoordsXYZ nullLoc{};
nullLoc.setNull();
PeepPickupAction pickupAction{ PeepPickupType::Pickup, w->number, nullLoc, network_get_current_player_id() };
pickupAction.SetCallback([peepnum = w->number](const GameAction* ga, const GameActionResult* result) {
if (result->Error != GA_ERROR::OK)
return;

View File

@ -460,8 +460,9 @@ void window_staff_overview_mouseup(rct_window* w, rct_widgetindex widgetIndex)
case WIDX_PICKUP:
{
w->picked_peep_old_x = peep->x;
PeepPickupAction pickupAction{ PeepPickupType::Pickup, w->number, {}, network_get_current_player_id() };
CoordsXYZ nullLoc{};
nullLoc.setNull();
PeepPickupAction pickupAction{ PeepPickupType::Pickup, w->number, nullLoc, network_get_current_player_id() };
pickupAction.SetCallback([peepnum = w->number](const GameAction* ga, const GameActionResult* result) {
if (result->Error != GA_ERROR::OK)
return;