mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-02-02 19:56:13 +01:00
* Refactor to result GameActions::Result as copy instead of unique_ptr * Remove alias GameActions::Result::Ptr * Remove MakeResult wrapper * Remove type forwarder in TileInspector
This commit is contained in:
@@ -65,28 +65,28 @@ void SetCheatAction::Serialise(DataSerialiser& stream)
|
||||
stream << DS_TAG(_cheatType) << DS_TAG(_param1) << DS_TAG(_param2);
|
||||
}
|
||||
|
||||
GameActions::Result::Ptr SetCheatAction::Query() const
|
||||
GameActions::Result SetCheatAction::Query() const
|
||||
{
|
||||
if (static_cast<uint32_t>(_cheatType) >= static_cast<uint32_t>(CheatType::Count))
|
||||
{
|
||||
MakeResult(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE);
|
||||
GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE);
|
||||
}
|
||||
|
||||
ParametersRange validRange = GetParameterRange(static_cast<CheatType>(_cheatType.id));
|
||||
|
||||
if (_param1 < validRange.first.first || _param1 > validRange.first.second)
|
||||
{
|
||||
MakeResult(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE);
|
||||
GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE);
|
||||
}
|
||||
if (_param2 < validRange.second.first || _param2 > validRange.second.second)
|
||||
{
|
||||
MakeResult(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE);
|
||||
GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE);
|
||||
}
|
||||
|
||||
return MakeResult();
|
||||
return GameActions::Result();
|
||||
}
|
||||
|
||||
GameActions::Result::Ptr SetCheatAction::Execute() const
|
||||
GameActions::Result SetCheatAction::Execute() const
|
||||
{
|
||||
switch (static_cast<CheatType>(_cheatType.id))
|
||||
{
|
||||
@@ -243,7 +243,7 @@ GameActions::Result::Ptr SetCheatAction::Execute() const
|
||||
default:
|
||||
{
|
||||
log_error("Unabled cheat: %d", _cheatType.id);
|
||||
MakeResult(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE);
|
||||
GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -254,7 +254,7 @@ GameActions::Result::Ptr SetCheatAction::Execute() const
|
||||
}
|
||||
|
||||
window_invalidate_by_class(WC_CHEATS);
|
||||
return MakeResult();
|
||||
return GameActions::Result();
|
||||
}
|
||||
|
||||
ParametersRange SetCheatAction::GetParameterRange(CheatType cheatType) const
|
||||
|
||||
Reference in New Issue
Block a user