From 33298d2bdeb611ebbaf73cc10190f2fcd6e862cb Mon Sep 17 00:00:00 2001 From: Duncan Date: Wed, 17 Jun 2020 21:11:50 +0100 Subject: [PATCH] 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. --- src/openrct2-ui/windows/Guest.cpp | 4 +++- src/openrct2-ui/windows/Staff.cpp | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/openrct2-ui/windows/Guest.cpp b/src/openrct2-ui/windows/Guest.cpp index ff7e72bb16..dbaf26b4ac 100644 --- a/src/openrct2-ui/windows/Guest.cpp +++ b/src/openrct2-ui/windows/Guest.cpp @@ -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; diff --git a/src/openrct2-ui/windows/Staff.cpp b/src/openrct2-ui/windows/Staff.cpp index 1b69fc1424..f709bef568 100644 --- a/src/openrct2-ui/windows/Staff.cpp +++ b/src/openrct2-ui/windows/Staff.cpp @@ -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;