mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-15 11:03:00 +01:00
* Fix #18839: New staff members now picked up correctly When "Automatically place staff" is disabled, new staff members were not automatically placed into the "picked" state as is the case with vanilla RCT. This change ensures that new staff members are automatically placed into the picker and that, in scenarios where multiple new staff members are queued up without having first placed one, the most recently created staff member will be the actively picked up peep (also the case with vanilla). * Fix #18839: Address networking issues * Fix #18839: Add else to pickup action intent.
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
#include <openrct2/Context.h>
|
||||
#include <openrct2/Game.h>
|
||||
#include <openrct2/Input.h>
|
||||
#include <openrct2/actions/PeepPickupAction.h>
|
||||
#include <openrct2/actions/StaffFireAction.h>
|
||||
#include <openrct2/actions/StaffHireNewAction.h>
|
||||
#include <openrct2/actions/StaffSetColourAction.h>
|
||||
@@ -526,11 +527,38 @@ private:
|
||||
return;
|
||||
|
||||
auto actionResult = res->GetData<StaffHireNewActionResult>();
|
||||
// Open window for new staff.
|
||||
auto* staff = GetEntity<Staff>(actionResult.StaffEntityId);
|
||||
auto intent = Intent(WindowClass::Peep);
|
||||
intent.PutExtra(INTENT_EXTRA_PEEP, staff);
|
||||
ContextOpenIntent(&intent);
|
||||
|
||||
// If autoposition of staff is disabled, pickup peep and then open the staff window
|
||||
if (staff->State == PeepState::Picked)
|
||||
{
|
||||
picked_peep_old_x = staff->x;
|
||||
CoordsXYZ nullLoc{};
|
||||
nullLoc.SetNull();
|
||||
|
||||
PeepPickupAction pickupAction{ PeepPickupType::Pickup, staff->sprite_index, nullLoc,
|
||||
NetworkGetCurrentPlayerId() };
|
||||
pickupAction.SetCallback([&staff](const GameAction* ga, const GameActions::Result* result) {
|
||||
if (result->Error != GameActions::Status::Ok)
|
||||
return;
|
||||
|
||||
auto intent = Intent(WindowClass::Peep);
|
||||
intent.PutExtra(INTENT_EXTRA_PEEP, staff);
|
||||
auto* wind = ContextOpenIntent(&intent);
|
||||
if (wind != nullptr)
|
||||
{
|
||||
ToolSet(*wind, WC_STAFF__WIDX_PICKUP, Tool::Picker);
|
||||
}
|
||||
});
|
||||
GameActions::Execute(&pickupAction);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Open window for new staff.
|
||||
auto intent = Intent(WindowClass::Peep);
|
||||
intent.PutExtra(INTENT_EXTRA_PEEP, staff);
|
||||
ContextOpenIntent(&intent);
|
||||
}
|
||||
});
|
||||
|
||||
GameActions::Execute(&hireStaffAction);
|
||||
|
||||
@@ -163,7 +163,6 @@ GameActions::Result PeepPickupAction::Execute() const
|
||||
{
|
||||
pickedUpPeep->PickupAbort(_loc.x);
|
||||
}
|
||||
|
||||
NetworkSetPickupPeep(_owner, nullptr);
|
||||
}
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user