Refactor action result passing for StaffHireNewAction

This commit is contained in:
ζeh Matt committed 2021-10-04 17:01:27 +03:00
1 parent cf7b4ded08
commit 8effeb26b0
4 files changed
+22 -31

No files matched your search

+6 -3
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);
}
}
}