Skip to content

Commit

Permalink
Use VALUE_OUF_OF_RANGE for spriteId checks
Browse files Browse the repository at this point in the history
Co-authored-by: Tulio Leao <[email protected]>
  • Loading branch information
pfroud and tupaschoal committed Jan 29, 2024
1 parent 21bda5e commit a382e4b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/openrct2/actions/StaffFireAction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ GameActions::Result StaffFireAction::Query() const
if (_spriteId.ToUnderlying() >= MAX_ENTITIES || _spriteId.IsNull())
{
LOG_ERROR("Invalid spriteId. spriteId = %u", _spriteId);
return GameActions::Result(GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_STAFF_NOT_FOUND);
return GameActions::Result(
GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_VALUE_OUT_OF_RANGE);
}

auto staff = TryGetEntity<Staff>(_spriteId);
Expand Down
3 changes: 2 additions & 1 deletion src/openrct2/actions/StaffSetCostumeAction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ GameActions::Result StaffSetCostumeAction::Query() const
{
if (_spriteIndex.ToUnderlying() >= MAX_ENTITIES || _spriteIndex.IsNull())
{
return GameActions::Result(GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_STAFF_NOT_FOUND);
return GameActions::Result(
GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_VALUE_OUT_OF_RANGE);
}

auto* staff = TryGetEntity<Staff>(_spriteIndex);
Expand Down
3 changes: 2 additions & 1 deletion src/openrct2/actions/StaffSetOrdersAction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ GameActions::Result StaffSetOrdersAction::Query() const
{
if (_spriteIndex.ToUnderlying() >= MAX_ENTITIES || _spriteIndex.IsNull())
{
return GameActions::Result(GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_STAFF_NOT_FOUND);
return GameActions::Result(
GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_VALUE_OUT_OF_RANGE);
}

auto* staff = TryGetEntity<Staff>(_spriteIndex);
Expand Down

0 comments on commit a382e4b

Please sign in to comment.