1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-15 11:03:00 +01:00

Refactor action result passing for StaffHireNewAction

This commit is contained in:
ζeh Matt
2021-10-04 16:57:39 +03:00
parent cf7b4ded08
commit 8effeb26b0
4 changed files with 22 additions and 31 deletions

View File

@@ -892,10 +892,13 @@ DukValue ScriptEngine::GameActionResultToDuk(const GameAction& action, const std
}
else if (action.GetType() == GameCommand::HireNewStaffMember)
{
auto& staffHireResult = static_cast<StaffHireNewActionResult&>(*result.get());
if (staffHireResult.peepSriteIndex != SPRITE_INDEX_NULL)
if (result->Error == GameActions::Status::Ok)
{
obj.Set("peep", staffHireResult.peepSriteIndex);
const auto actionResult = result->GetData<StaffHireNewActionResult>();
if (actionResult.StaffEntityId != SPRITE_INDEX_NULL)
{
obj.Set("peep", actionResult.StaffEntityId);
}
}
}