Merge pull request #15637 from ZehMatt/refactor/explicit-gameactionresult

#15636: Refactor explicit construction on GameAction::Result
This commit is contained in:
ζeh Matt authored and GitHub committed 2021-10-27 10:15:25 -07:00
commit 1cfa4f8a9e
59 files changed
+280 -290

No files matched your search

+2 -2
View File
@@ -40,7 +40,7 @@ GameActions::Result::Ptr BalloonPressAction::Query() const
if (balloon == nullptr)
{
log_error("Tried getting invalid sprite for balloon: %u", _spriteIndex);
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE);
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE);
}
return MakeResult();
}
@@ -51,7 +51,7 @@ GameActions::Result::Ptr BalloonPressAction::Execute() const
if (balloon == nullptr)
{
log_error("Tried getting invalid sprite for balloon: %u", _spriteIndex);
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE);
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE);
}
balloon->Press();
+7 -7
View File
@@ -55,13 +55,13 @@ GameActions::Result::Ptr BannerPlaceAction::Query() const
if (!LocationValid(_loc))
{
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_NONE);
}
if (!MapCheckCapacityAndReorganise(_loc))
{
log_error("No free map elements.");
return MakeResult(GameActions::Status::NoFreeElements, STR_CANT_POSITION_THIS_HERE);
return MakeResult(GameActions::Status::NoFreeElements, STR_CANT_POSITION_THIS_HERE, STR_TILE_ELEMENT_LIMIT_REACHED);
}
auto pathElement = GetValidPathElement();
@@ -87,14 +87,14 @@ GameActions::Result::Ptr BannerPlaceAction::Query() const
if (HasReachedBannerLimit())
{
log_error("No free banners available");
return MakeResult(GameActions::Status::InvalidParameters, STR_TOO_MANY_BANNERS_IN_GAME);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_TOO_MANY_BANNERS_IN_GAME);
}
auto* bannerEntry = get_banner_entry(_bannerType);
if (bannerEntry == nullptr)
{
log_error("Invalid banner object type. bannerType = ", _bannerType);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_NONE);
}
res->Cost = bannerEntry->price;
@@ -113,21 +113,21 @@ GameActions::Result::Ptr BannerPlaceAction::Execute() const
if (!MapCheckCapacityAndReorganise(_loc))
{
log_error("No free map elements.");
return MakeResult(GameActions::Status::NoFreeElements, STR_CANT_POSITION_THIS_HERE);
return MakeResult(GameActions::Status::NoFreeElements, STR_CANT_POSITION_THIS_HERE, STR_TILE_ELEMENT_LIMIT_REACHED);
}
auto* bannerEntry = get_banner_entry(_bannerType);
if (bannerEntry == nullptr)
{
log_error("Invalid banner object type. bannerType = ", _bannerType);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_NONE);
}
auto banner = CreateBanner();
if (banner == nullptr)
{
log_error("No free banners available");
return MakeResult(GameActions::Status::InvalidParameters, STR_TOO_MANY_BANNERS_IN_GAME);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_TOO_MANY_BANNERS_IN_GAME);
}
banner->flags = 0;
banner->text = {};
+6 -6
View File
@@ -58,21 +58,21 @@ GameActions::Result::Ptr BannerRemoveAction::Query() const
if (bannerElement == nullptr)
{
log_error("Invalid banner location, x = %d, y = %d, z = %d, direction = %d", _loc.x, _loc.y, _loc.z, _loc.direction);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS, STR_NONE);
}
auto bannerIndex = bannerElement->GetIndex();
if (bannerIndex == BANNER_INDEX_NULL)
{
log_error("Invalid banner index. index = ", bannerIndex);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS, STR_NONE);
}
auto banner = bannerElement->GetBanner();
if (banner == nullptr)
{
log_error("Invalid banner index. index = ", bannerIndex);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS, STR_NONE);
}
auto* bannerEntry = get_banner_entry(banner->type);
@@ -97,21 +97,21 @@ GameActions::Result::Ptr BannerRemoveAction::Execute() const
if (bannerElement == nullptr)
{
log_error("Invalid banner location, x = %d, y = %d, z = %d, direction = %d", _loc.x, _loc.y, _loc.z, _loc.direction);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS, STR_NONE);
}
auto bannerIndex = bannerElement->GetIndex();
if (bannerIndex == BANNER_INDEX_NULL)
{
log_error("Invalid banner index. index = ", bannerIndex);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS, STR_NONE);
}
auto banner = bannerElement->GetBanner();
if (banner == nullptr)
{
log_error("Invalid banner index. index = ", bannerIndex);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS, STR_NONE);
}
auto* bannerEntry = get_banner_entry(banner->type);
@@ -61,13 +61,13 @@ GameActions::Result::Ptr BannerSetColourAction::QueryExecute(bool isExecuting) c
if (!LocationValid(_loc))
{
log_error("Invalid x / y coordinates: x = %d, y = %d", _loc.x, _loc.y);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_NONE);
}
if (_primaryColour > 31)
{
log_error("Invalid primary colour: colour = %u", _primaryColour);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_NONE);
}
if (!map_can_build_at({ _loc.x, _loc.y, _loc.z - 16 }))
@@ -80,7 +80,7 @@ GameActions::Result::Ptr BannerSetColourAction::QueryExecute(bool isExecuting) c
if (bannerElement == nullptr)
{
log_error("Could not find banner at: x = %d, y = %d, z = %d, direction = %u", _loc.x, _loc.y, _loc.z, _loc.direction);
return MakeResult(GameActions::Status::Unknown, STR_CANT_REPAINT_THIS);
return MakeResult(GameActions::Status::Unknown, STR_CANT_REPAINT_THIS, STR_NONE);
}
auto index = bannerElement->GetIndex();
@@ -88,7 +88,7 @@ GameActions::Result::Ptr BannerSetColourAction::QueryExecute(bool isExecuting) c
if (banner == nullptr)
{
log_error("Invalid banner index: index = %u", index);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_NONE);
}
if (isExecuting)
+10 -10
View File
@@ -50,7 +50,7 @@ GameActions::Result::Ptr BannerSetStyleAction::Query() const
if (banner == nullptr)
{
log_error("Invalid banner index: index = %u", _bannerIndex);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_NONE);
}
res->Expenditure = ExpenditureType::Landscaping;
@@ -62,7 +62,7 @@ GameActions::Result::Ptr BannerSetStyleAction::Query() const
if (tileElement == nullptr)
{
log_error("Could not find banner index = %u", _bannerIndex);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_NONE);
}
switch (_type)
@@ -71,7 +71,7 @@ GameActions::Result::Ptr BannerSetStyleAction::Query() const
if (_parameter > 31)
{
log_error("Invalid primary colour: colour = %u", _parameter);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_NONE);
}
break;
@@ -79,19 +79,19 @@ GameActions::Result::Ptr BannerSetStyleAction::Query() const
if (_parameter > 13)
{
log_error("Invalid text colour: colour = %u", _parameter);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_NONE);
}
break;
case BannerSetStyleType::NoEntry:
if (tileElement->AsBanner() == nullptr)
{
log_error("Tile element was not a banner.");
return MakeResult(GameActions::Status::Unknown, STR_CANT_REPAINT_THIS);
return MakeResult(GameActions::Status::Unknown, STR_CANT_REPAINT_THIS, STR_NONE);
}
break;
default:
log_error("Invalid type: %u", _type);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_NONE);
}
return res;
}
@@ -104,7 +104,7 @@ GameActions::Result::Ptr BannerSetStyleAction::Execute() const
if (banner == nullptr)
{
log_error("Invalid banner index: index = %u", _bannerIndex);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_NONE);
}
res->Expenditure = ExpenditureType::Landscaping;
@@ -116,7 +116,7 @@ GameActions::Result::Ptr BannerSetStyleAction::Execute() const
if (tileElement == nullptr)
{
log_error("Could not find banner index = %u", _bannerIndex);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_NONE);
}
switch (_type)
@@ -133,7 +133,7 @@ GameActions::Result::Ptr BannerSetStyleAction::Execute() const
if (bannerElement == nullptr)
{
log_error("Tile element was not a banner.");
return MakeResult(GameActions::Status::Unknown, STR_CANT_REPAINT_THIS);
return MakeResult(GameActions::Status::Unknown, STR_CANT_REPAINT_THIS, STR_NONE);
}
banner->flags &= ~BANNER_FLAG_NO_ENTRY;
@@ -148,7 +148,7 @@ GameActions::Result::Ptr BannerSetStyleAction::Execute() const
}
default:
log_error("Invalid type: %u", _type);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_NONE);
}
auto intent = Intent(INTENT_ACTION_UPDATE_BANNER);
@@ -74,7 +74,7 @@ GameActions::Result::Ptr FootpathAdditionPlaceAction::Query() const
if (tileElement == nullptr)
{
log_error("Could not find path element.");
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_NONE);
}
auto pathElement = tileElement->AsPath();
@@ -96,7 +96,7 @@ GameActions::Result::Ptr FootpathAdditionPlaceAction::Query() const
auto* pathBitEntry = get_footpath_item_entry(_pathItemType - 1);
if (pathBitEntry == nullptr)
{
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_NONE);
}
uint16_t sceneryFlags = pathBitEntry->flags;
@@ -115,7 +115,7 @@ GameActions::Result::Ptr FootpathAdditionPlaceAction::Query() const
if (!(sceneryFlags & (PATH_BIT_FLAG_JUMPING_FOUNTAIN_WATER | PATH_BIT_FLAG_JUMPING_FOUNTAIN_SNOW))
&& (pathElement->GetEdges()) == 0x0F)
{
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_NONE);
}
if ((sceneryFlags & PATH_BIT_FLAG_IS_QUEUE_SCREEN) && !pathElement->IsQueue())
@@ -133,7 +133,7 @@ GameActions::Result::Ptr FootpathAdditionPlaceAction::Query() const
// Check if there is something on the path already
if (pathElement->HasAddition())
{
return MakeResult(GameActions::Status::ItemAlreadyPlaced, STR_CANT_POSITION_THIS_HERE);
return MakeResult(GameActions::Status::ItemAlreadyPlaced, STR_CANT_POSITION_THIS_HERE, STR_NONE);
}
}
return res;
@@ -151,7 +151,7 @@ GameActions::Result::Ptr FootpathAdditionPlaceAction::Execute() const
if (pathElement == nullptr)
{
log_error("Could not find path element.");
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_NONE);
}
// No change
@@ -166,7 +166,7 @@ GameActions::Result::Ptr FootpathAdditionPlaceAction::Execute() const
auto* pathBitEntry = get_footpath_item_entry(_pathItemType - 1);
if (pathBitEntry == nullptr)
{
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_NONE);
}
res->Cost = pathBitEntry->price;
@@ -68,20 +68,20 @@ GameActions::Result::Ptr FootpathAdditionRemoveAction::Query() const
if (tileElement == nullptr)
{
log_warning("Could not find path element.");
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS, STR_NONE);
}
auto pathElement = tileElement->AsPath();
if (pathElement == nullptr)
{
log_warning("Could not find path element.");
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS, STR_NONE);
}
if (!pathElement->AdditionIsGhost() && (GetFlags() & GAME_COMMAND_FLAG_GHOST))
{
log_warning("Tried to remove non ghost during ghost removal.");
return MakeResult(GameActions::Status::Disallowed, STR_CANT_REMOVE_THIS);
return MakeResult(GameActions::Status::Disallowed, STR_CANT_REMOVE_THIS, STR_NONE);
}
auto res = MakeResult();
res->Position = _loc;
@@ -102,7 +102,7 @@ GameActions::Result::Ptr FootpathAdditionRemoveAction::Execute() const
if (pathElement == nullptr)
{
log_error("Could not find path element.");
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS, STR_NONE);
}
pathElement->SetAddition(0);
+5 -5
View File
@@ -98,7 +98,7 @@ GameActions::Result::Ptr FootpathPlaceAction::Query() const
if (_direction != INVALID_DIRECTION && !direction_valid(_direction))
{
log_error("Direction invalid. direction = %u", _direction);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_BUILD_FOOTPATH_HERE);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_BUILD_FOOTPATH_HERE, STR_NONE);
}
footpath_provisional_remove();
@@ -205,7 +205,7 @@ GameActions::Result::Ptr FootpathPlaceAction::ElementUpdateQuery(PathElement* pa
if (GetFlags() & GAME_COMMAND_FLAG_GHOST && !pathElement->IsGhost())
{
return MakeResult(GameActions::Status::Unknown, STR_CANT_BUILD_FOOTPATH_HERE);
return MakeResult(GameActions::Status::Unknown, STR_CANT_BUILD_FOOTPATH_HERE, STR_NONE);
}
return res;
}
@@ -269,7 +269,7 @@ GameActions::Result::Ptr FootpathPlaceAction::ElementInsertQuery(GameActions::Re
if (!MapCheckCapacityAndReorganise(_loc))
{
return MakeResult(GameActions::Status::NoFreeElements, STR_CANT_BUILD_FOOTPATH_HERE);
return MakeResult(GameActions::Status::NoFreeElements, STR_CANT_BUILD_FOOTPATH_HERE, STR_NONE);
}
res->Cost = MONEY(12, 00);
@@ -319,7 +319,7 @@ GameActions::Result::Ptr FootpathPlaceAction::ElementInsertQuery(GameActions::Re
auto surfaceElement = map_get_surface_element_at(_loc);
if (surfaceElement == nullptr)
{
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_BUILD_FOOTPATH_HERE);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_BUILD_FOOTPATH_HERE, STR_NONE);
}
int32_t supportHeight = zLow - surfaceElement->GetBaseZ();
res->Cost += supportHeight < 0 ? MONEY(20, 00) : (supportHeight / PATH_HEIGHT_STEP) * MONEY(5, 00);
@@ -383,7 +383,7 @@ GameActions::Result::Ptr FootpathPlaceAction::ElementInsertExecute(GameActions::
auto surfaceElement = map_get_surface_element_at(_loc);
if (surfaceElement == nullptr)
{
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_BUILD_FOOTPATH_HERE);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_BUILD_FOOTPATH_HERE, STR_NONE);
}
int32_t supportHeight = zLow - surfaceElement->GetBaseZ();
res->Cost += supportHeight < 0 ? MONEY(20, 00) : (supportHeight / PATH_HEIGHT_STEP) * MONEY(5, 00);
@@ -107,7 +107,9 @@ GameActions::Result::Ptr FootpathPlaceFromTrackAction::ElementInsertQuery(GameAc
if (!MapCheckCapacityAndReorganise(_loc))
{
return MakeResult(GameActions::Status::NoFreeElements, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE);
return MakeResult(
GameActions::Status::NoFreeElements, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE,
STR_TILE_ELEMENT_LIMIT_REACHED);
}
res->Cost = MONEY(12, 00);
@@ -158,7 +160,7 @@ GameActions::Result::Ptr FootpathPlaceFromTrackAction::ElementInsertQuery(GameAc
auto surfaceElement = map_get_surface_element_at(_loc);
if (surfaceElement == nullptr)
{
return MakeResult(GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE);
return MakeResult(GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_NONE);
}
int32_t supportHeight = zLow - surfaceElement->GetBaseZ();
res->Cost += supportHeight < 0 ? MONEY(20, 00) : (supportHeight / PATH_HEIGHT_STEP) * MONEY(5, 00);
@@ -222,7 +224,7 @@ GameActions::Result::Ptr FootpathPlaceFromTrackAction::ElementInsertExecute(Game
auto surfaceElement = map_get_surface_element_at(_loc);
if (surfaceElement == nullptr)
{
return MakeResult(GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE);
return MakeResult(GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_NONE);
}
int32_t supportHeight = zLow - surfaceElement->GetBaseZ();
res->Cost += supportHeight < 0 ? MONEY(20, 00) : (supportHeight / PATH_HEIGHT_STEP) * MONEY(5, 00);
@@ -63,7 +63,7 @@ GameActions::Result::Ptr FootpathRemoveAction::Query() const
TileElement* footpathElement = GetFootpathElement();
if (footpathElement == nullptr)
{
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REMOVE_FOOTPATH_FROM_HERE);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REMOVE_FOOTPATH_FROM_HERE, STR_NONE);
}
res->Cost = GetRefundPrice(footpathElement);
@@ -111,7 +111,7 @@ GameActions::Result::Ptr FootpathRemoveAction::Execute() const
}
else
{
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REMOVE_FOOTPATH_FROM_HERE);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REMOVE_FOOTPATH_FROM_HERE, STR_NONE);
}
res->Cost += GetRefundPrice(footpathElement);
+5 -15
View File
@@ -4,25 +4,15 @@
namespace GameActions
{
Result::Result(GameActions::Status error, rct_string_id message)
{
Error = error;
ErrorMessage = message;
}
Result::Result(GameActions::Status error, rct_string_id title, rct_string_id message)
Result::Result(GameActions::Status error, rct_string_id title, rct_string_id message, uint8_t* args /*= nullptr*/)
{
Error = error;
ErrorTitle = title;
ErrorMessage = message;
}
Result::Result(GameActions::Status error, rct_string_id title, rct_string_id message, uint8_t* args)
{
Error = error;
ErrorTitle = title;
ErrorMessage = message;
std::copy_n(args, ErrorMessageArgs.size(), ErrorMessageArgs.begin());
if (args != nullptr)
{
std::copy_n(args, ErrorMessageArgs.size(), ErrorMessageArgs.begin());
}
}
struct StringVariantVisitor
+2 -6
View File
@@ -58,7 +58,7 @@ namespace GameActions
/**
* Represents the result of a game action query or execution.
*/
class Result
class Result final
{
public:
using Ptr = std::unique_ptr<GameActions::Result>;
@@ -74,11 +74,7 @@ namespace GameActions
std::any ResultData;
Result() = default;
Result(GameActions::Status error, rct_string_id message);
Result(GameActions::Status error, rct_string_id title, rct_string_id message);
Result(GameActions::Status error, rct_string_id title, rct_string_id message, uint8_t* args);
Result(const GameActions::Result&) = delete;
virtual ~Result(){};
Result(GameActions::Status error, rct_string_id title, rct_string_id message, uint8_t* args = nullptr);
std::string GetErrorTitle() const;
std::string GetErrorMessage() const;
+2 -2
View File
@@ -43,7 +43,7 @@ GameActions::Result::Ptr GuestSetFlagsAction::Query() const
if (peep == nullptr)
{
log_error("Used invalid sprite index for peep: %u", static_cast<uint32_t>(_peepId));
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_THIS);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_THIS, STR_NONE);
}
return std::make_unique<GameActions::Result>();
}
@@ -54,7 +54,7 @@ GameActions::Result::Ptr GuestSetFlagsAction::Execute() const
if (peep == nullptr)
{
log_error("Used invalid sprite index for peep: %u", static_cast<uint32_t>(_peepId));
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_THIS);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_THIS, STR_NONE);
}
peep->PeepFlags = _newFlags;
+1 -1
View File
@@ -83,7 +83,7 @@ GameActions::Result::Ptr GuestSetNameAction::Execute() const
auto curName = guest->GetName();
if (curName == _name)
{
return std::make_unique<GameActions::Result>(GameActions::Status::Ok, STR_NONE);
return std::make_unique<GameActions::Result>();
}
if (!guest->SetName(_name))
+2 -4
View File
@@ -134,10 +134,8 @@ GameActions::Result::Ptr LandLowerAction::QueryExecute(bool isExecuting) const
if (!withinOwnership)
{
GameActions::Result::Ptr ownerShipResult = std::make_unique<GameActions::Result>(
GameActions::Status::Disallowed, STR_LAND_NOT_OWNED_BY_PARK);
ownerShipResult->ErrorTitle = STR_CANT_LOWER_LAND_HERE;
return ownerShipResult;
return std::make_unique<GameActions::Result>(
GameActions::Status::Disallowed, STR_CANT_LOWER_LAND_HERE, STR_LAND_NOT_OWNED_BY_PARK);
}
// Force ride construction to recheck area
+2 -4
View File
@@ -130,10 +130,8 @@ GameActions::Result::Ptr LandRaiseAction::QueryExecute(bool isExecuting) const
if (!withinOwnership)
{
GameActions::Result::Ptr ownerShipResult = std::make_unique<GameActions::Result>(
GameActions::Status::Disallowed, STR_LAND_NOT_OWNED_BY_PARK);
ownerShipResult->ErrorTitle = STR_CANT_RAISE_LAND_HERE;
return ownerShipResult;
return std::make_unique<GameActions::Result>(
GameActions::Status::Disallowed, STR_CANT_RAISE_LAND_HERE, STR_LAND_NOT_OWNED_BY_PARK);
}
// Force ride construction to recheck area
+11 -10
View File
@@ -49,20 +49,21 @@ GameActions::Result::Ptr LandSetHeightAction::Query() const
{
if (gParkFlags & PARK_FLAGS_FORBID_LANDSCAPE_CHANGES)
{
return std::make_unique<GameActions::Result>(GameActions::Status::Disallowed, STR_FORBIDDEN_BY_THE_LOCAL_AUTHORITY);
return std::make_unique<GameActions::Result>(
GameActions::Status::Disallowed, STR_FORBIDDEN_BY_THE_LOCAL_AUTHORITY, STR_NONE);
}
rct_string_id errorTitle = CheckParameters();
if (errorTitle != STR_NONE)
{
return std::make_unique<GameActions::Result>(GameActions::Status::Disallowed, errorTitle);
return std::make_unique<GameActions::Result>(GameActions::Status::Disallowed, errorTitle, STR_NONE);
}
if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode)
{
if (!map_is_location_in_park(_coords))
{
return std::make_unique<GameActions::Result>(GameActions::Status::Disallowed, STR_LAND_NOT_OWNED_BY_PARK);
return std::make_unique<GameActions::Result>(GameActions::Status::Disallowed, STR_LAND_NOT_OWNED_BY_PARK, STR_NONE);
}
}
@@ -75,7 +76,7 @@ GameActions::Result::Ptr LandSetHeightAction::Query() const
TileElement* tileElement = CheckTreeObstructions();
if (tileElement != nullptr)
{
auto res = MakeResult(GameActions::Status::Disallowed, STR_NONE);
auto res = MakeResult(GameActions::Status::Disallowed, STR_NONE, STR_NONE);
map_obstruction_set_error_text(tileElement, *res);
return res;
}
@@ -89,13 +90,13 @@ GameActions::Result::Ptr LandSetHeightAction::Query() const
errorTitle = CheckRideSupports();
if (errorTitle != STR_NONE)
{
return std::make_unique<GameActions::Result>(GameActions::Status::Disallowed, errorTitle);
return std::make_unique<GameActions::Result>(GameActions::Status::Disallowed, errorTitle, STR_NONE);
}
}
auto* surfaceElement = map_get_surface_element_at(_coords);
if (surfaceElement == nullptr)
return std::make_unique<GameActions::Result>(GameActions::Status::Unknown, STR_NONE);
return std::make_unique<GameActions::Result>(GameActions::Status::Unknown, STR_NONE, STR_NONE);
// We need to check if there is _currently_ a level crossing on the tile.
// For that, we need the old height, so we can't use the _height variable.
@@ -103,13 +104,13 @@ GameActions::Result::Ptr LandSetHeightAction::Query() const
auto* pathElement = map_get_footpath_element(oldCoords);
if (pathElement != nullptr && pathElement->AsPath()->IsLevelCrossing(oldCoords))
{
return MakeResult(GameActions::Status::Disallowed, STR_REMOVE_LEVEL_CROSSING_FIRST);
return MakeResult(GameActions::Status::Disallowed, STR_REMOVE_LEVEL_CROSSING_FIRST, STR_NONE);
}
TileElement* tileElement = CheckFloatingStructures(reinterpret_cast<TileElement*>(surfaceElement), _height);
if (tileElement != nullptr)
{
auto res = MakeResult(GameActions::Status::Disallowed, STR_NONE);
auto res = MakeResult(GameActions::Status::Disallowed, STR_NONE, STR_NONE);
map_obstruction_set_error_text(tileElement, *res);
return res;
}
@@ -138,7 +139,7 @@ GameActions::Result::Ptr LandSetHeightAction::Query() const
tileElement = CheckUnremovableObstructions(reinterpret_cast<TileElement*>(surfaceElement), zCorner);
if (tileElement != nullptr)
{
auto res = MakeResult(GameActions::Status::Disallowed, STR_NONE);
auto res = MakeResult(GameActions::Status::Disallowed, STR_NONE, STR_NONE);
map_obstruction_set_error_text(tileElement, *res);
return res;
}
@@ -164,7 +165,7 @@ GameActions::Result::Ptr LandSetHeightAction::Execute() const
auto* surfaceElement = map_get_surface_element_at(_coords);
if (surfaceElement == nullptr)
return std::make_unique<GameActions::Result>(GameActions::Status::Unknown, STR_NONE);
return std::make_unique<GameActions::Result>(GameActions::Status::Unknown, STR_NONE, STR_NONE);
cost += GetSurfaceHeightChangeCost(surfaceElement);
SetSurfaceHeight(reinterpret_cast<TileElement*>(surfaceElement));
+1 -1
View File
@@ -608,7 +608,7 @@ GameActions::Result::Ptr LandSmoothAction::SmoothLand(bool isExecuting) const
}
default:
log_error("Invalid map selection %u", _selectionType);
return MakeResult(GameActions::Status::InvalidParameters, std::get<rct_string_id>(res->ErrorTitle));
return MakeResult(GameActions::Status::InvalidParameters, std::get<rct_string_id>(res->ErrorTitle), STR_NONE);
} // switch selectionType
// Raise / lower the land tool selection area
@@ -97,7 +97,8 @@ GameActions::Result::Ptr LargeSceneryPlaceAction::Query() const
if (HasReachedBannerLimit())
{
log_error("No free banners available");
return MakeResult(GameActions::Status::InvalidParameters, STR_TOO_MANY_BANNERS_IN_GAME);
return MakeResult(
GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_TOO_MANY_BANNERS_IN_GAME);
}
}
@@ -65,13 +65,13 @@ GameActions::Result::Ptr LargeSceneryRemoveAction::Query() const
if (tileElement == nullptr)
{
log_warning("Invalid game command for scenery removal, x = %d, y = %d", _loc.x, _loc.y);
return MakeResult(GameActions::Status::InvalidParameters, STR_INVALID_SELECTION_OF_OBJECTS);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS, STR_INVALID_SELECTION_OF_OBJECTS);
}
auto* sceneryEntry = tileElement->AsLargeScenery()->GetEntry();
// If we have a bugged scenery entry, do not touch the tile element.
if (sceneryEntry == nullptr)
return MakeResult(GameActions::Status::Unknown, STR_CANT_REMOVE_THIS);
return MakeResult(GameActions::Status::Unknown, STR_CANT_REMOVE_THIS, STR_NONE);
auto rotatedOffsets = CoordsXYZ{
CoordsXY{ sceneryEntry->tiles[_tileIndex].x_offset, sceneryEntry->tiles[_tileIndex].y_offset }.Rotate(_loc.direction),
@@ -135,13 +135,13 @@ GameActions::Result::Ptr LargeSceneryRemoveAction::Execute() const
if (tileElement == nullptr)
{
log_warning("Invalid game command for scenery removal, x = %d, y = %d", _loc.x, _loc.y);
return MakeResult(GameActions::Status::InvalidParameters, STR_INVALID_SELECTION_OF_OBJECTS);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS, STR_INVALID_SELECTION_OF_OBJECTS);
}
auto* sceneryEntry = tileElement->AsLargeScenery()->GetEntry();
// If we have a bugged scenery entry, do not touch the tile element.
if (sceneryEntry == nullptr)
return MakeResult(GameActions::Status::Unknown, STR_CANT_REMOVE_THIS);
return MakeResult(GameActions::Status::Unknown, STR_CANT_REMOVE_THIS, STR_NONE);
tileElement->RemoveBannerEntry();
@@ -56,19 +56,19 @@ GameActions::Result::Ptr LargeScenerySetColourAction::QueryExecute(bool isExecut
if (_loc.x < 0 || _loc.y < 0 || _loc.x > GetMapSizeMaxXY() || _loc.y > GetMapSizeMaxXY())
{
log_error("Invalid x / y coordinates: x = %d, y = %d", _loc.x, _loc.y);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_NONE);
}
if (_primaryColour > 31)
{
log_error("Invalid primary colour: colour = %u", _primaryColour);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_NONE);
}
if (_secondaryColour > 31)
{
log_error("Invalid primary colour: colour = %u", _secondaryColour);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_NONE);
}
auto largeElement = map_get_large_scenery_segment(_loc, _tileIndex);
@@ -78,7 +78,7 @@ GameActions::Result::Ptr LargeScenerySetColourAction::QueryExecute(bool isExecut
log_error(
"Could not find large scenery at: x = %d, y = %d, z = %d, direction = %d, tileIndex = %u", _loc.x, _loc.y, _loc.z,
_loc.direction, _tileIndex);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_NONE);
}
if ((GetFlags() & GAME_COMMAND_FLAG_GHOST) && !(largeElement->IsGhost()))
@@ -91,7 +91,7 @@ GameActions::Result::Ptr LargeScenerySetColourAction::QueryExecute(bool isExecut
if (sceneryEntry == nullptr)
{
log_error("Could not find scenery object. type = %u", largeElement->GetEntryIndex());
return MakeResult(GameActions::Status::Unknown, STR_CANT_REPAINT_THIS);
return MakeResult(GameActions::Status::Unknown, STR_CANT_REPAINT_THIS, STR_NONE);
}
// Work out the base tile coordinates (Tile with index 0)
auto rotatedBaseCoordsOffset = CoordsXYZ{
@@ -128,7 +128,7 @@ GameActions::Result::Ptr LargeScenerySetColourAction::QueryExecute(bool isExecut
log_error(
"Large scenery element not found at: x = %d, y = %d, z = %d, direction = %d", _loc.x, _loc.y, _loc.z,
_loc.direction);
return MakeResult(GameActions::Status::Unknown, STR_CANT_REPAINT_THIS);
return MakeResult(GameActions::Status::Unknown, STR_CANT_REPAINT_THIS, STR_NONE);
}
if (isExecuting)
{
@@ -35,7 +35,7 @@ GameActions::Result::Ptr ParkEntranceRemoveAction::Query() const
{
if (!(gScreenFlags & SCREEN_FLAGS_EDITOR) && !gCheatsSandboxMode)
{
return MakeResult(GameActions::Status::NotInEditorMode, STR_CANT_REMOVE_THIS);
return MakeResult(GameActions::Status::NotInEditorMode, STR_CANT_REMOVE_THIS, STR_NONE);
}
auto res = MakeResult();
@@ -47,7 +47,7 @@ GameActions::Result::Ptr ParkEntranceRemoveAction::Query() const
if (!LocationValid(_loc) || entranceIndex == -1)
{
log_error("Could not find entrance at x = %d, y = %d, z = %d", _loc.x, _loc.y, _loc.z);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS, STR_NONE);
}
return res;
}
@@ -63,7 +63,7 @@ GameActions::Result::Ptr ParkEntranceRemoveAction::Execute() const
if (entranceIndex == -1)
{
log_error("Could not find entrance at x = %d, y = %d, z = %d", _loc.x, _loc.y, _loc.z);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS, STR_NONE);
}
auto direction = (gParkEntrances[entranceIndex].direction - 1) & 3;
+1 -1
View File
@@ -50,7 +50,7 @@ GameActions::Result::Ptr ParkMarketingAction::Query() const
{
if (static_cast<size_t>(_type) >= std::size(AdvertisingCampaignPricePerWeek) || _numWeeks >= 256)
{
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_START_MARKETING_CAMPAIGN);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_START_MARKETING_CAMPAIGN, STR_NONE);
}
if (gParkFlags & PARK_FLAGS_FORBID_MARKETING_CAMPAIGN)
{
+1 -1
View File
@@ -46,7 +46,7 @@ GameActions::Result::Ptr ParkSetDateAction::Query() const
{
if (_year <= 0 || _year > MAX_YEAR || _month <= 0 || _month > MONTH_COUNT || _day <= 0 || _day > 31)
{
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE);
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE);
}
return MakeResult();
@@ -35,7 +35,7 @@ GameActions::Result::Ptr ParkSetParameterAction::Query() const
{
if (_parameter >= ParkParameter::Count)
{
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE);
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE);
}
auto res = MakeResult();
@@ -66,7 +66,7 @@ GameActions::Result::Ptr ParkSetParameterAction::Execute() const
window_invalidate_by_class(WC_RIDE);
break;
default:
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE);
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE);
}
auto res = MakeResult();
@@ -38,7 +38,7 @@ GameActions::Result::Ptr ParkSetResearchFundingAction::Query() const
{
if (_fundingAmount >= RESEARCH_FUNDING_COUNT)
{
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE);
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE);
}
return MakeResult();
}
+8 -8
View File
@@ -40,19 +40,19 @@ GameActions::Result::Ptr PeepPickupAction::Query() const
if (_spriteId >= MAX_ENTITIES || _spriteId == SPRITE_INDEX_NULL)
{
log_error("Failed to pick up peep for sprite %d", _spriteId);
return MakeResult(GameActions::Status::InvalidParameters, STR_ERR_CANT_PLACE_PERSON_HERE);
return MakeResult(GameActions::Status::InvalidParameters, STR_ERR_CANT_PLACE_PERSON_HERE, STR_NONE);
}
if (!_loc.IsNull() && !LocationValid(_loc))
{
return MakeResult(GameActions::Status::InvalidParameters, STR_ERR_CANT_PLACE_PERSON_HERE);
return MakeResult(GameActions::Status::InvalidParameters, STR_ERR_CANT_PLACE_PERSON_HERE, STR_NONE);
}
auto* const peep = TryGetEntity<Peep>(_spriteId);
if (peep == nullptr)
{
log_error("Failed to pick up peep for sprite %d", _spriteId);
return MakeResult(GameActions::Status::InvalidParameters, STR_ERR_CANT_PLACE_PERSON_HERE);
return MakeResult(GameActions::Status::InvalidParameters, STR_ERR_CANT_PLACE_PERSON_HERE, STR_NONE);
}
auto res = MakeResult();
@@ -64,7 +64,7 @@ GameActions::Result::Ptr PeepPickupAction::Query() const
res->Position = peep->GetLocation();
if (!peep->CanBePickedUp())
{
return MakeResult(GameActions::Status::Disallowed, STR_ERR_CANT_PLACE_PERSON_HERE);
return MakeResult(GameActions::Status::Disallowed, STR_ERR_CANT_PLACE_PERSON_HERE, STR_NONE);
}
Peep* existing = network_get_pickup_peep(_owner);
if (existing != nullptr)
@@ -89,7 +89,7 @@ GameActions::Result::Ptr PeepPickupAction::Query() const
res->Position = _loc;
if (network_get_pickup_peep(_owner) != peep)
{
return MakeResult(GameActions::Status::Unknown, STR_ERR_CANT_PLACE_PERSON_HERE);
return MakeResult(GameActions::Status::Unknown, STR_ERR_CANT_PLACE_PERSON_HERE, STR_NONE);
}
if (auto res2 = peep->Place(TileCoordsXYZ(_loc), false); res2->Error != GameActions::Status::Ok)
@@ -99,7 +99,7 @@ GameActions::Result::Ptr PeepPickupAction::Query() const
break;
default:
log_error("Invalid pickup type: %u", _type);
return MakeResult(GameActions::Status::InvalidParameters, STR_ERR_CANT_PLACE_PERSON_HERE);
return MakeResult(GameActions::Status::InvalidParameters, STR_ERR_CANT_PLACE_PERSON_HERE, STR_NONE);
}
return res;
}
@@ -110,7 +110,7 @@ GameActions::Result::Ptr PeepPickupAction::Execute() const
if (peep == nullptr)
{
log_error("Failed to pick up peep for sprite %d", _spriteId);
return MakeResult(GameActions::Status::InvalidParameters, STR_ERR_CANT_PLACE_PERSON_HERE);
return MakeResult(GameActions::Status::InvalidParameters, STR_ERR_CANT_PLACE_PERSON_HERE, STR_NONE);
}
auto res = MakeResult();
@@ -169,7 +169,7 @@ GameActions::Result::Ptr PeepPickupAction::Execute() const
break;
default:
log_error("Invalid pickup type: %u", _type);
return MakeResult(GameActions::Status::InvalidParameters, STR_ERR_CANT_PLACE_PERSON_HERE);
return MakeResult(GameActions::Status::InvalidParameters, STR_ERR_CANT_PLACE_PERSON_HERE, STR_NONE);
}
return res;
}
+1 -1
View File
@@ -118,7 +118,7 @@ GameActions::Result::Ptr RideDemolishAction::Execute() const
return RefurbishRide(ride);
}
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, STR_CANT_DO_THIS);
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, STR_CANT_DO_THIS, STR_NONE);
}
GameActions::Result::Ptr RideDemolishAction::DemolishRide(Ride* ride) const
@@ -49,20 +49,20 @@ void RideEntranceExitPlaceAction::Serialise(DataSerialiser& stream)
GameActions::Result::Ptr RideEntranceExitPlaceAction::Query() const
{
auto errorTitle = _isExit ? STR_CANT_BUILD_MOVE_EXIT_FOR_THIS_RIDE_ATTRACTION
: STR_CANT_BUILD_MOVE_ENTRANCE_FOR_THIS_RIDE_ATTRACTION;
const auto errorTitle = _isExit ? STR_CANT_BUILD_MOVE_EXIT_FOR_THIS_RIDE_ATTRACTION
: STR_CANT_BUILD_MOVE_ENTRANCE_FOR_THIS_RIDE_ATTRACTION;
auto ride = get_ride(_rideIndex);
if (ride == nullptr)
{
log_warning("Invalid game command for ride %d", EnumValue(_rideIndex));
return MakeResult(GameActions::Status::InvalidParameters, errorTitle);
return MakeResult(GameActions::Status::InvalidParameters, errorTitle, STR_NONE);
}
if (_stationNum >= MAX_STATIONS)
{
log_warning("Invalid station number for ride. stationNum: %u", _stationNum);
return MakeResult(GameActions::Status::InvalidParameters, errorTitle);
return MakeResult(GameActions::Status::InvalidParameters, errorTitle, STR_NONE);
}
if (ride->status != RideStatus::Closed && ride->status != RideStatus::Simulating)
@@ -85,6 +85,7 @@ GameActions::Result::Ptr RideEntranceExitPlaceAction::Query() const
auto result = GameActions::QueryNested(&rideEntranceExitRemove);
if (result->Error != GameActions::Status::Ok)
{
result->ErrorTitle = errorTitle;
return result;
}
}
@@ -92,12 +93,12 @@ GameActions::Result::Ptr RideEntranceExitPlaceAction::Query() const
auto z = ride->stations[_stationNum].GetBaseZ();
if (!LocationValid(_loc) || (!gCheatsSandboxMode && !map_is_location_owned({ _loc, z })))
{
return MakeResult(GameActions::Status::NotOwned, errorTitle);
return MakeResult(GameActions::Status::NotOwned, errorTitle, STR_NONE);
}
if (!MapCheckCapacityAndReorganise(_loc))
{
return MakeResult(GameActions::Status::NoFreeElements, errorTitle);
return MakeResult(GameActions::Status::NoFreeElements, errorTitle, STR_TILE_ELEMENT_LIMIT_REACHED);
}
auto clear_z = z + (_isExit ? RideExitHeight : RideEntranceHeight);
auto canBuild = MapCanConstructWithClearAt(
@@ -129,13 +130,13 @@ GameActions::Result::Ptr RideEntranceExitPlaceAction::Execute() const
{
// Remember when in unknown station num mode rideIndex is unknown and z is set
// When in known station num mode rideIndex is known and z is unknown
auto errorTitle = _isExit ? STR_CANT_BUILD_MOVE_EXIT_FOR_THIS_RIDE_ATTRACTION
: STR_CANT_BUILD_MOVE_ENTRANCE_FOR_THIS_RIDE_ATTRACTION;
const auto errorTitle = _isExit ? STR_CANT_BUILD_MOVE_EXIT_FOR_THIS_RIDE_ATTRACTION
: STR_CANT_BUILD_MOVE_ENTRANCE_FOR_THIS_RIDE_ATTRACTION;
auto ride = get_ride(_rideIndex);
if (ride == nullptr)
{
log_warning("Invalid game command for ride %d", EnumValue(_rideIndex));
return MakeResult(GameActions::Status::InvalidParameters, errorTitle);
return MakeResult(GameActions::Status::InvalidParameters, errorTitle, STR_NONE);
}
if (!(GetFlags() & GAME_COMMAND_FLAG_GHOST))
@@ -153,6 +154,7 @@ GameActions::Result::Ptr RideEntranceExitPlaceAction::Execute() const
auto result = GameActions::ExecuteNested(&rideEntranceExitRemove);
if (result->Error != GameActions::Status::Ok)
{
result->ErrorTitle = errorTitle;
return result;
}
}
@@ -217,17 +219,17 @@ GameActions::Result::Ptr RideEntranceExitPlaceAction::Execute() const
GameActions::Result::Ptr RideEntranceExitPlaceAction::TrackPlaceQuery(const CoordsXYZ& loc, const bool isExit)
{
auto errorTitle = isExit ? STR_CANT_BUILD_MOVE_EXIT_FOR_THIS_RIDE_ATTRACTION
: STR_CANT_BUILD_MOVE_ENTRANCE_FOR_THIS_RIDE_ATTRACTION;
const auto errorTitle = isExit ? STR_CANT_BUILD_MOVE_EXIT_FOR_THIS_RIDE_ATTRACTION
: STR_CANT_BUILD_MOVE_ENTRANCE_FOR_THIS_RIDE_ATTRACTION;
if (!gCheatsSandboxMode && !map_is_location_owned(loc))
{
return MakeResult(GameActions::Status::NotOwned, errorTitle);
return MakeResult(GameActions::Status::NotOwned, errorTitle, STR_NONE);
}
if (!MapCheckCapacityAndReorganise(loc))
{
return MakeResult(GameActions::Status::NoFreeElements, errorTitle);
return MakeResult(GameActions::Status::NoFreeElements, errorTitle, STR_TILE_ELEMENT_LIMIT_REACHED);
}
int16_t baseZ = loc.z;
int16_t clearZ = baseZ + (isExit ? RideExitHeight : RideEntranceHeight);
@@ -75,22 +75,22 @@ GameActions::Result::Ptr RideEntranceExitRemoveAction::Query() const
if (ride == nullptr)
{
log_warning("Invalid ride id %d for entrance/exit removal", EnumValue(_rideIndex));
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, STR_NONE);
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE);
}
if (ride->status != RideStatus::Closed && ride->status != RideStatus::Simulating)
{
return MakeResult(GameActions::Status::InvalidParameters, STR_MUST_BE_CLOSED_FIRST);
return MakeResult(GameActions::Status::InvalidParameters, STR_MUST_BE_CLOSED_FIRST, STR_NONE);
}
if (ride->lifecycle_flags & RIDE_LIFECYCLE_INDESTRUCTIBLE_TRACK)
{
return MakeResult(GameActions::Status::InvalidParameters, STR_NOT_ALLOWED_TO_MODIFY_STATION);
return MakeResult(GameActions::Status::InvalidParameters, STR_NOT_ALLOWED_TO_MODIFY_STATION, STR_NONE);
}
if (!LocationValid(_loc))
{
return MakeResult(GameActions::Status::InvalidParameters, STR_LAND_NOT_OWNED_BY_PARK);
return MakeResult(GameActions::Status::InvalidParameters, STR_LAND_NOT_OWNED_BY_PARK, STR_NONE);
}
auto* entranceElement = FindEntranceElement(
@@ -101,7 +101,7 @@ GameActions::Result::Ptr RideEntranceExitRemoveAction::Query() const
log_warning(
"Track Element not found. x = %d, y = %d, ride = %d, station = %d", _loc.x, _loc.y, EnumValue(_rideIndex),
_stationNum);
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE);
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE);
}
return MakeResult();
@@ -113,7 +113,7 @@ GameActions::Result::Ptr RideEntranceExitRemoveAction::Execute() const
if (ride == nullptr)
{
log_warning("Invalid ride id %d for entrance/exit removal", EnumValue(_rideIndex));
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, STR_NONE);
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE);
}
const bool isGhost = GetFlags() & GAME_COMMAND_FLAG_GHOST;
@@ -132,7 +132,7 @@ GameActions::Result::Ptr RideEntranceExitRemoveAction::Execute() const
log_warning(
"Track Element not found. x = %d, y = %d, ride = %d, station = %d", _loc.x, _loc.y, EnumValue(_rideIndex),
_stationNum);
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE);
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE);
}
auto res = MakeResult();
@@ -55,7 +55,7 @@ GameActions::Result::Ptr RideSetAppearanceAction::Query() const
if (ride == nullptr)
{
log_warning("Invalid game command, ride_id = %u", uint32_t(_rideIndex));
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, STR_NONE);
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE);
}
switch (_type)
@@ -66,7 +66,7 @@ GameActions::Result::Ptr RideSetAppearanceAction::Query() const
if (_index >= std::size(ride->track_colour))
{
log_warning("Invalid game command, index %d out of bounds", _index);
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, STR_NONE);
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE);
}
break;
case RideSetAppearanceType::VehicleColourBody:
@@ -75,7 +75,7 @@ GameActions::Result::Ptr RideSetAppearanceAction::Query() const
if (_index >= std::size(ride->vehicle_colours))
{
log_warning("Invalid game command, index %d out of bounds", _index);
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, STR_NONE);
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE);
}
break;
case RideSetAppearanceType::VehicleColourScheme:
@@ -83,7 +83,7 @@ GameActions::Result::Ptr RideSetAppearanceAction::Query() const
break;
default:
log_warning("Invalid game command, type %d not recognised", _type);
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, STR_NONE);
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE);
}
return std::make_unique<GameActions::Result>();
@@ -95,7 +95,7 @@ GameActions::Result::Ptr RideSetAppearanceAction::Execute() const
if (ride == nullptr)
{
log_warning("Invalid game command, ride_id = %u", uint32_t(_rideIndex));
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, STR_NONE);
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE);
}
switch (_type)
@@ -50,7 +50,7 @@ GameActions::Result::Ptr RideSetColourSchemeAction::Query() const
{
if (!LocationValid(_loc))
{
return MakeResult(GameActions::Status::InvalidParameters, STR_LAND_NOT_OWNED_BY_PARK);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_SET_COLOUR_SCHEME, STR_LAND_NOT_OWNED_BY_PARK);
}
return std::make_unique<GameActions::Result>();
}
+4 -4
View File
@@ -55,14 +55,14 @@ GameActions::Result::Ptr RideSetPriceAction::Query() const
if (ride == nullptr)
{
log_warning("Invalid game command, ride_id = %u", uint32_t(_rideIndex));
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE);
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE);
}
rct_ride_entry* rideEntry = get_ride_entry(ride->subtype);
if (rideEntry == nullptr)
{
log_warning("Invalid game command for ride %u", uint32_t(_rideIndex));
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE);
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE);
}
return res;
@@ -77,14 +77,14 @@ GameActions::Result::Ptr RideSetPriceAction::Execute() const
if (ride == nullptr)
{
log_warning("Invalid game command, ride_id = %u", uint32_t(_rideIndex));
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE);
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE);
}
rct_ride_entry* rideEntry = get_ride_entry(ride->subtype);
if (rideEntry == nullptr)
{
log_warning("Invalid game command for ride %u", uint32_t(_rideIndex));
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE);
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE);
}
if (!ride->overall_view.IsNull())
+13 -12
View File
@@ -46,7 +46,7 @@ GameActions::Result::Ptr RideSetSettingAction::Query() const
if (ride == nullptr)
{
log_warning("Invalid ride: #%d.", EnumValue(_rideIndex));
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_OPERATING_MODE);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_OPERATING_MODE, STR_NONE);
}
switch (_setting)
@@ -66,7 +66,7 @@ GameActions::Result::Ptr RideSetSettingAction::Query() const
if (!ride_is_mode_valid(ride) && !gCheatsShowAllOperatingModes)
{
log_warning("Invalid ride mode: %u", _value);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_OPERATING_MODE);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_OPERATING_MODE, STR_NONE);
}
break;
case RideSetSetting::Departure:
@@ -75,28 +75,29 @@ GameActions::Result::Ptr RideSetSettingAction::Query() const
if (_value > 250)
{
log_warning("Invalid minimum waiting time: %u", _value);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_OPERATING_MODE);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_OPERATING_MODE, STR_NONE);
}
break;
case RideSetSetting::MaxWaitingTime:
if (_value > 250)
{
log_warning("Invalid maximum waiting time: %u", _value);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_OPERATING_MODE);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_OPERATING_MODE, STR_NONE);
}
break;
case RideSetSetting::Operation:
if (!ride_is_valid_operation_option(ride))
{
log_warning("Invalid operation option value: %u", _value);
return MakeResult(GameActions::Status::InvalidParameters, GetOperationErrorMessage(ride));
return MakeResult(
GameActions::Status::InvalidParameters, STR_CANT_CHANGE_OPERATING_MODE, GetOperationErrorMessage(ride));
}
break;
case RideSetSetting::InspectionInterval:
if (_value > RIDE_INSPECTION_NEVER)
{
log_warning("Invalid inspection interval: %u", _value);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_OPERATING_MODE);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_OPERATING_MODE, STR_NONE);
}
break;
case RideSetSetting::Music:
@@ -108,7 +109,7 @@ GameActions::Result::Ptr RideSetSettingAction::Query() const
if (musicObj == nullptr)
{
log_warning("Invalid music style: %u", _value);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_OPERATING_MODE);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_OPERATING_MODE, STR_NONE);
}
break;
}
@@ -116,7 +117,7 @@ GameActions::Result::Ptr RideSetSettingAction::Query() const
if (!ride_is_valid_lift_hill_speed(ride))
{
log_warning("Invalid lift hill speed: %u", _value);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_OPERATING_MODE);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_OPERATING_MODE, STR_NONE);
}
break;
case RideSetSetting::NumCircuits:
@@ -130,19 +131,19 @@ GameActions::Result::Ptr RideSetSettingAction::Query() const
if (!ride_is_valid_num_circuits())
{
log_warning("Invalid number of circuits: %u", _value);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_OPERATING_MODE);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_OPERATING_MODE, STR_NONE);
}
break;
case RideSetSetting::RideType:
if (!gCheatsAllowArbitraryRideTypeChanges)
{
log_warning("Arbitrary ride type changes not allowed.");
return MakeResult(GameActions::Status::Disallowed, STR_CANT_CHANGE_OPERATING_MODE);
return MakeResult(GameActions::Status::Disallowed, STR_CANT_CHANGE_OPERATING_MODE, STR_NONE);
}
break;
default:
log_warning("Invalid RideSetSetting: %u", static_cast<uint8_t>(_setting));
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_OPERATING_MODE);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_OPERATING_MODE, STR_NONE);
}
return std::make_unique<GameActions::Result>();
@@ -154,7 +155,7 @@ GameActions::Result::Ptr RideSetSettingAction::Execute() const
if (ride == nullptr)
{
log_warning("Invalid ride: #%d.", EnumValue(_rideIndex));
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_OPERATING_MODE);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_OPERATING_MODE, STR_NONE);
}
switch (_setting)
@@ -70,7 +70,7 @@ GameActions::Result::Ptr RideSetVehicleAction::Query() const
if (ride == nullptr)
{
log_warning("Invalid game command, ride_id = %u", uint32_t(_rideIndex));
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, errTitle);
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, errTitle, STR_NONE);
}
if (ride->lifecycle_flags & RIDE_LIFECYCLE_BROKEN_DOWN)
@@ -94,13 +94,13 @@ GameActions::Result::Ptr RideSetVehicleAction::Query() const
if (!ride_is_vehicle_type_valid(ride))
{
log_error("Invalid vehicle type. type = %d", _value);
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, errTitle);
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, errTitle, STR_NONE);
}
auto rideEntry = get_ride_entry(_value);
if (rideEntry == nullptr)
{
log_warning("Invalid ride entry, ride->subtype = %d", ride->subtype);
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, errTitle);
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, errTitle, STR_NONE);
}
// Validate preset
@@ -108,14 +108,14 @@ GameActions::Result::Ptr RideSetVehicleAction::Query() const
if (_colour >= presetList->count && _colour != 255 && _colour != 0)
{
log_error("Unknown vehicle colour preset. colour = %d", _colour);
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, errTitle);
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, errTitle, STR_NONE);
}
break;
}
default:
log_error("Unknown vehicle command. type = %d", _type);
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, errTitle);
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, errTitle, STR_NONE);
}
return std::make_unique<GameActions::Result>();
@@ -128,7 +128,7 @@ GameActions::Result::Ptr RideSetVehicleAction::Execute() const
if (ride == nullptr)
{
log_warning("Invalid game command, ride_id = %u", uint32_t(_rideIndex));
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, errTitle);
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, errTitle, STR_NONE);
}
switch (_type)
@@ -151,7 +151,7 @@ GameActions::Result::Ptr RideSetVehicleAction::Execute() const
if (rideEntry == nullptr)
{
log_warning("Invalid ride entry, ride->subtype = %d", ride->subtype);
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, errTitle);
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, errTitle, STR_NONE);
}
auto clampValue = _value;
if (!gCheatsDisableTrainLengthLimit)
@@ -173,7 +173,7 @@ GameActions::Result::Ptr RideSetVehicleAction::Execute() const
if (rideEntry == nullptr)
{
log_warning("Invalid ride entry, ride->subtype = %d", ride->subtype);
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, errTitle);
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, errTitle, STR_NONE);
}
ride_set_vehicle_colours_to_random_preset(ride, _colour);
@@ -187,7 +187,7 @@ GameActions::Result::Ptr RideSetVehicleAction::Execute() const
default:
log_error("Unknown vehicle command. type = %d", _type);
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, errTitle);
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, errTitle, STR_NONE);
}
ride->num_circuits = 1;
@@ -31,7 +31,7 @@ GameActions::Result::Ptr ScenarioSetSettingAction::Query() const
if (_setting >= ScenarioSetSetting::Count)
{
log_error("Invalid setting: %u", _setting);
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE);
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE);
}
return MakeResult();
@@ -242,7 +242,7 @@ GameActions::Result::Ptr ScenarioSetSettingAction::Execute() const
break;
default:
log_error("Invalid setting: %u", _setting);
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE);
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE);
}
window_invalidate_by_class(WC_EDITOR_SCENARIO_OPTIONS);
return MakeResult();
+4 -4
View File
@@ -68,18 +68,18 @@ GameActions::Result::Ptr SetCheatAction::Query() const
{
if (static_cast<uint32_t>(_cheatType) >= static_cast<uint32_t>(CheatType::Count))
{
MakeResult(GameActions::Status::InvalidParameters, STR_NONE);
MakeResult(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);
MakeResult(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE);
}
if (_param2 < validRange.second.first || _param2 > validRange.second.second)
{
MakeResult(GameActions::Status::InvalidParameters, STR_NONE);
MakeResult(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE);
}
return MakeResult();
@@ -242,7 +242,7 @@ GameActions::Result::Ptr SetCheatAction::Execute() const
default:
{
log_error("Unabled cheat: %d", _cheatType.id);
MakeResult(GameActions::Status::InvalidParameters, STR_NONE);
MakeResult(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE);
}
break;
}
@@ -43,11 +43,11 @@ GameActions::Result::Ptr SetParkEntranceFeeAction::Query() const
bool forceFreeEntry = !park_entry_price_unlocked();
if (noMoney || forceFreeEntry)
{
return std::make_unique<GameActions::Result>(GameActions::Status::Disallowed, STR_NONE);
return std::make_unique<GameActions::Result>(GameActions::Status::Disallowed, STR_NONE, STR_NONE);
}
if (_fee < MONEY_FREE || _fee > MAX_ENTRANCE_FEE)
{
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, STR_NONE);
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE);
}
return std::make_unique<GameActions::Result>();
}
+6 -6
View File
@@ -43,7 +43,7 @@ GameActions::Result::Ptr SignSetStyleAction::Query() const
if (banner == nullptr)
{
log_error("Invalid banner id. id = ", _bannerIndex);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_NONE);
}
if (_isLarge)
@@ -52,12 +52,12 @@ GameActions::Result::Ptr SignSetStyleAction::Query() const
if (tileElement == nullptr)
{
log_warning("Invalid game command for setting sign style, banner id '%d' not found", _bannerIndex);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_NONE);
}
if (tileElement->GetType() != TILE_ELEMENT_TYPE_LARGE_SCENERY)
{
log_warning("Invalid game command for setting sign style, banner id '%d' is not large", _bannerIndex);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_NONE);
}
}
else
@@ -67,7 +67,7 @@ GameActions::Result::Ptr SignSetStyleAction::Query() const
if (wallElement == nullptr)
{
log_warning("Invalid game command for setting sign style, banner id '%d' not found", _bannerIndex);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_NONE);
}
}
@@ -80,7 +80,7 @@ GameActions::Result::Ptr SignSetStyleAction::Execute() const
if (banner == nullptr)
{
log_error("Invalid banner id. id = ", _bannerIndex);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_NONE);
}
CoordsXY coords = banner->position.ToCoordsXY();
@@ -92,7 +92,7 @@ GameActions::Result::Ptr SignSetStyleAction::Execute() const
{ coords, tileElement->GetBaseZ(), tileElement->GetDirection() },
tileElement->AsLargeScenery()->GetSequenceIndex(), _mainColour, _textColour))
{
return MakeResult(GameActions::Status::Unknown, STR_CANT_REPAINT_THIS);
return MakeResult(GameActions::Status::Unknown, STR_CANT_REPAINT_THIS, STR_NONE);
}
}
else
@@ -111,7 +111,7 @@ GameActions::Result::Ptr SmallSceneryRemoveAction::Execute() const
auto* entry = get_small_scenery_entry(_sceneryType);
if (entry == nullptr)
{
return MakeResult(GameActions::Status::InvalidParameters, STR_INVALID_SELECTION_OF_OBJECTS);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS, STR_INVALID_SELECTION_OF_OBJECTS);
}
res->Cost = entry->removal_price * 10;
@@ -84,7 +84,7 @@ GameActions::Result::Ptr SmallScenerySetColourAction::QueryExecute(bool isExecut
if (sceneryElement == nullptr)
{
log_error("Small scenery not found at: x = %d, y = %d, z = %d", _loc.x, _loc.y, _loc.z);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_NONE);
}
if ((GetFlags() & GAME_COMMAND_FLAG_GHOST) && !(sceneryElement->IsGhost()))
+3 -3
View File
@@ -34,14 +34,14 @@ GameActions::Result::Ptr StaffFireAction::Query() const
if (_spriteId >= MAX_ENTITIES)
{
log_error("Invalid spriteId. spriteId = %u", _spriteId);
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE);
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE);
}
auto staff = TryGetEntity<Staff>(_spriteId);
if (staff == nullptr)
{
log_error("Invalid spriteId. spriteId = %u", _spriteId);
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE);
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE);
}
return MakeResult();
@@ -53,7 +53,7 @@ GameActions::Result::Ptr StaffFireAction::Execute() const
if (staff == nullptr)
{
log_error("Invalid spriteId. spriteId = %u", _spriteId);
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE);
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE);
}
window_close_by_class(WC_FIRE_PROMPT);
peep_sprite_remove(staff);
@@ -41,7 +41,7 @@ GameActions::Result::Ptr StaffSetColourAction::Query() const
auto staffType = static_cast<StaffType>(_staffType);
if (staffType != StaffType::Handyman && staffType != StaffType::Mechanic && staffType != StaffType::Security)
{
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE);
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE);
}
return MakeResult();
}
@@ -51,7 +51,7 @@ GameActions::Result::Ptr StaffSetColourAction::Execute() const
// Update global uniform colour property
if (!staff_set_colour(static_cast<StaffType>(_staffType), _colour))
{
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE);
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE);
}
// Update each staff member's uniform
@@ -58,21 +58,21 @@ GameActions::Result::Ptr StaffSetCostumeAction::Query() const
{
if (_spriteIndex >= MAX_ENTITIES)
{
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, STR_NONE);
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE);
}
auto* staff = TryGetEntity<Staff>(_spriteIndex);
if (staff == nullptr)
{
log_warning("Invalid game command for sprite %u", _spriteIndex);
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, STR_NONE);
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE);
}
auto spriteType = EntertainerCostumeToSprite(_costume);
if (EnumValue(spriteType) > std::size(peep_slow_walking_types))
{
log_warning("Invalid game command for sprite %u", _spriteIndex);
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, STR_NONE);
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE);
}
return std::make_unique<GameActions::Result>();
}
@@ -83,7 +83,7 @@ GameActions::Result::Ptr StaffSetCostumeAction::Execute() const
if (staff == nullptr)
{
log_warning("Invalid game command for sprite %u", _spriteIndex);
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, STR_NONE);
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE);
}
auto spriteType = EntertainerCostumeToSprite(_costume);
+1 -1
View File
@@ -71,7 +71,7 @@ GameActions::Result::Ptr StaffSetNameAction::Execute() const
auto curName = staff->GetName();
if (curName == _name)
{
return std::make_unique<GameActions::Result>(GameActions::Status::Ok, STR_NONE);
return std::make_unique<GameActions::Result>();
}
if (!staff->SetName(_name))
@@ -39,7 +39,7 @@ GameActions::Result::Ptr StaffSetOrdersAction::Query() const
{
if (_spriteIndex >= MAX_ENTITIES)
{
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, STR_NONE);
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE);
}
auto* staff = TryGetEntity<Staff>(_spriteIndex);
@@ -47,7 +47,7 @@ GameActions::Result::Ptr StaffSetOrdersAction::Query() const
|| (staff->AssignedStaffType != StaffType::Handyman && staff->AssignedStaffType != StaffType::Mechanic))
{
log_warning("Invalid game command for sprite %u", _spriteIndex);
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, STR_NONE);
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE);
}
return std::make_unique<GameActions::Result>();
@@ -59,7 +59,7 @@ GameActions::Result::Ptr StaffSetOrdersAction::Execute() const
if (staff == nullptr)
{
log_warning("Invalid game command for sprite %u", _spriteIndex);
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, STR_NONE);
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE);
}
staff->StaffOrders = _ordersId;
@@ -37,19 +37,19 @@ GameActions::Result::Ptr StaffSetPatrolAreaAction::Query() const
if (_spriteId >= MAX_ENTITIES)
{
log_error("Invalid spriteId. spriteId = %u", _spriteId);
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE);
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE);
}
if (!LocationValid(_loc))
{
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE);
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE);
}
auto staff = TryGetEntity<Staff>(_spriteId);
if (staff == nullptr)
{
log_error("Invalid spriteId. spriteId = %u", _spriteId);
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE);
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE);
}
return MakeResult();
@@ -97,7 +97,7 @@ GameActions::Result::Ptr StaffSetPatrolAreaAction::Execute() const
if (staff == nullptr)
{
log_error("Invalid spriteId. spriteId = %u", _spriteId);
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE);
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE);
}
switch (_mode)
@@ -53,7 +53,7 @@ GameActions::Result::Ptr SurfaceSetStyleAction::Query() const
if (_surfaceStyle > 0x1F)
{
log_error("Invalid surface style.");
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_LAND_TYPE);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_LAND_TYPE, STR_NONE);
}
const auto surfaceObj = static_cast<TerrainSurfaceObject*>(
@@ -62,7 +62,7 @@ GameActions::Result::Ptr SurfaceSetStyleAction::Query() const
if (surfaceObj == nullptr)
{
log_error("Invalid surface style.");
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_LAND_TYPE);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_LAND_TYPE, STR_NONE);
}
}
@@ -71,7 +71,7 @@ GameActions::Result::Ptr SurfaceSetStyleAction::Query() const
if (_edgeStyle > 0xF)
{
log_error("Invalid edge style.");
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_LAND_TYPE);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_LAND_TYPE, STR_NONE);
}
const auto edgeObj = static_cast<TerrainEdgeObject*>(objManager.GetLoadedObject(ObjectType::TerrainEdge, _edgeStyle));
@@ -79,7 +79,7 @@ GameActions::Result::Ptr SurfaceSetStyleAction::Query() const
if (edgeObj == nullptr)
{
log_error("Invalid edge style.");
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_LAND_TYPE);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_LAND_TYPE, STR_NONE);
}
}
+2 -2
View File
@@ -49,7 +49,7 @@ GameActions::Result::Ptr TileModifyAction::QueryExecute(bool isExecuting) const
{
if (!LocationValid(_loc))
{
return MakeResult(GameActions::Status::InvalidParameters, STR_LAND_NOT_OWNED_BY_PARK);
return MakeResult(GameActions::Status::InvalidParameters, STR_LAND_NOT_OWNED_BY_PARK, STR_NONE);
}
auto res = MakeResult();
switch (_setting)
@@ -218,7 +218,7 @@ GameActions::Result::Ptr TileModifyAction::QueryExecute(bool isExecuting) const
}
default:
log_error("invalid instruction");
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE);
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE);
}
res->Position.x = _loc.x;
+9 -9
View File
@@ -111,7 +111,7 @@ GameActions::Result::Ptr TrackRemoveAction::Query() const
log_warning(
"Track Element not found. x = %d, y = %d, z = %d, d = %d, seq = %d.", _origin.x, _origin.y, _origin.z,
_origin.direction, _sequence);
return MakeResult(GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS);
return MakeResult(GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS, STR_NONE);
}
if (tileElement->AsTrack()->IsIndestructible())
@@ -128,13 +128,13 @@ GameActions::Result::Ptr TrackRemoveAction::Query() const
if (ride == nullptr)
{
log_warning("Ride not found. ride index = %d.", rideIndex);
return MakeResult(GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS);
return MakeResult(GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS, STR_NONE);
}
if (ride->type >= RIDE_TYPE_COUNT)
{
log_warning("Ride type not found. ride type = %d.", ride->type);
return MakeResult(GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS);
return MakeResult(GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS, STR_NONE);
}
const auto& ted = GetTrackElementDescriptor(trackType);
const rct_preview_track* trackBlock = ted.Block;
@@ -200,7 +200,7 @@ GameActions::Result::Ptr TrackRemoveAction::Query() const
log_warning(
"Track Element not found. x = %d, y = %d, z = %d, d = %d, seq = %d.", mapLoc.x, mapLoc.y, mapLoc.z,
_origin.direction, trackBlock->index);
return MakeResult(GameActions::Status::Unknown, STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS);
return MakeResult(GameActions::Status::Unknown, STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS, STR_NONE);
}
int32_t entranceDirections = ted.SequenceProperties[0];
@@ -216,7 +216,7 @@ GameActions::Result::Ptr TrackRemoveAction::Query() const
if (surfaceElement == nullptr)
{
log_warning("Surface Element not found. x = %d, y = %d", mapLoc.x, mapLoc.y);
return MakeResult(GameActions::Status::Unknown, STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS);
return MakeResult(GameActions::Status::Unknown, STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS, STR_NONE);
}
int8_t _support_height = tileElement->base_height - surfaceElement->base_height;
@@ -304,7 +304,7 @@ GameActions::Result::Ptr TrackRemoveAction::Execute() const
log_warning(
"Track Element not found. x = %d, y = %d, z = %d, d = %d, seq = %d.", _origin.x, _origin.y, _origin.z,
_origin.direction, _sequence);
return MakeResult(GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS);
return MakeResult(GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS, STR_NONE);
}
ride_id_t rideIndex = tileElement->AsTrack()->GetRideIndex();
@@ -315,7 +315,7 @@ GameActions::Result::Ptr TrackRemoveAction::Execute() const
if (ride == nullptr)
{
log_warning("Ride not found. ride index = %d.", rideIndex);
return MakeResult(GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS);
return MakeResult(GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS, STR_NONE);
}
const auto& ted = GetTrackElementDescriptor(trackType);
const rct_preview_track* trackBlock = ted.Block;
@@ -375,7 +375,7 @@ GameActions::Result::Ptr TrackRemoveAction::Execute() const
log_warning(
"Track Element not found. x = %d, y = %d, z = %d, d = %d, seq = %d.", mapLoc.x, mapLoc.y, mapLoc.z,
_origin.direction, trackBlock->index);
return MakeResult(GameActions::Status::Unknown, STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS);
return MakeResult(GameActions::Status::Unknown, STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS, STR_NONE);
}
int32_t entranceDirections = ted.SequenceProperties[0];
@@ -391,7 +391,7 @@ GameActions::Result::Ptr TrackRemoveAction::Execute() const
if (surfaceElement == nullptr)
{
log_warning("Surface Element not found. x = %d, y = %d", mapLoc.x, mapLoc.y);
return MakeResult(GameActions::Status::Unknown, STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS);
return MakeResult(GameActions::Status::Unknown, STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS, STR_NONE);
}
int8_t _support_height = tileElement->base_height - surfaceElement->base_height;
@@ -57,14 +57,14 @@ GameActions::Result::Ptr TrackSetBrakeSpeedAction::QueryExecute(bool isExecuting
if (!LocationValid(_loc))
{
return MakeResult(GameActions::Status::NotOwned, STR_NONE);
return MakeResult(GameActions::Status::NotOwned, STR_NONE, STR_NONE);
}
TileElement* tileElement = map_get_track_element_at_of_type(_loc, _trackType);
if (tileElement == nullptr)
{
log_warning("Invalid game command for setting brakes speed. x = %d, y = %d", _loc.x, _loc.y);
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE);
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE);
}
if (isExecuting)
+3 -3
View File
@@ -490,7 +490,7 @@ GameActions::Result::Ptr WallPlaceAction::WallCheckObstruction(
*wallAcrossTrack = false;
if (map_is_location_at_edge(_loc))
{
return MakeResult(GameActions::Status::InvalidParameters, STR_OFF_EDGE_OF_MAP);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_BUILD_THIS_HERE, STR_OFF_EDGE_OF_MAP);
}
TileElement* tileElement = map_get_first_element_at(_loc);
@@ -512,7 +512,7 @@ GameActions::Result::Ptr WallPlaceAction::WallCheckObstruction(
int32_t direction = tileElement->GetDirection();
if (_edge == direction)
{
auto res = MakeResult(GameActions::Status::NoClearance, STR_NONE);
auto res = MakeResult(GameActions::Status::NoClearance, STR_CANT_BUILD_THIS_HERE, STR_NONE);
map_obstruction_set_error_text(tileElement, *res);
return res;
}
@@ -520,7 +520,7 @@ GameActions::Result::Ptr WallPlaceAction::WallCheckObstruction(
}
if (tileElement->GetOccupiedQuadrants() == 0)
continue;
auto res = MakeResult(GameActions::Status::NoClearance, STR_NONE);
auto res = MakeResult(GameActions::Status::NoClearance, STR_CANT_BUILD_THIS_HERE, STR_NONE);
switch (elementType)
{
case TILE_ELEMENT_TYPE_ENTRANCE:
+7 -7
View File
@@ -66,7 +66,7 @@ GameActions::Result::Ptr WallSetColourAction::Query() const
{
log_error(
"Could not find wall element at: x = %d, y = %d, z = %d, direction = %u", _loc.x, _loc.y, _loc.z, _loc.direction);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_NONE);
}
if ((GetFlags() & GAME_COMMAND_FLAG_GHOST) && !(wallElement->IsGhost()))
@@ -78,19 +78,19 @@ GameActions::Result::Ptr WallSetColourAction::Query() const
if (wallEntry == nullptr)
{
log_error("Could not find wall object");
return MakeResult(GameActions::Status::Unknown, STR_CANT_REPAINT_THIS);
return MakeResult(GameActions::Status::Unknown, STR_CANT_REPAINT_THIS, STR_NONE);
}
if (_primaryColour > 31)
{
log_error("Primary colour invalid: colour = %d", _primaryColour);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_NONE);
}
if (_secondaryColour > 31)
{
log_error("Secondary colour invalid: colour = %d", _secondaryColour);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_NONE);
}
if (wallEntry->flags & WALL_SCENERY_HAS_TERNARY_COLOUR)
@@ -98,7 +98,7 @@ GameActions::Result::Ptr WallSetColourAction::Query() const
if (_tertiaryColour > 31)
{
log_error("Tertiary colour invalid: colour = %d", _tertiaryColour);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_NONE);
}
}
return res;
@@ -118,7 +118,7 @@ GameActions::Result::Ptr WallSetColourAction::Execute() const
{
log_error(
"Could not find wall element at: x = %d, y = %d, z = %d, direction = %u", _loc.x, _loc.y, _loc.z, _loc.direction);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS);
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_NONE);
}
if ((GetFlags() & GAME_COMMAND_FLAG_GHOST) && !(wallElement->IsGhost()))
@@ -130,7 +130,7 @@ GameActions::Result::Ptr WallSetColourAction::Execute() const
if (wallEntry == nullptr)
{
log_error("Could not find wall object");
return MakeResult(GameActions::Status::Unknown, STR_CANT_REPAINT_THIS);
return MakeResult(GameActions::Status::Unknown, STR_CANT_REPAINT_THIS, STR_NONE);
}
wallElement->SetPrimaryColour(_primaryColour);
+3 -4
View File
@@ -113,10 +113,9 @@ GameActions::Result::Ptr WaterLowerAction::QueryExecute(bool isExecuting) const
if (!withinOwnership)
{
GameActions::Result::Ptr ownerShipResult = std::make_unique<GameActions::Result>(
GameActions::Status::Disallowed, STR_LAND_NOT_OWNED_BY_PARK);
ownerShipResult->ErrorTitle = STR_CANT_LOWER_WATER_LEVEL_HERE;
return ownerShipResult;
return std::make_unique<GameActions::Result>(
GameActions::Status::Disallowed, STR_CANT_LOWER_WATER_LEVEL_HERE, STR_LAND_NOT_OWNED_BY_PARK);
;
}
if (isExecuting && hasChanged)
+2 -4
View File
@@ -120,10 +120,8 @@ GameActions::Result::Ptr WaterRaiseAction::QueryExecute(bool isExecuting) const
if (!withinOwnership)
{
GameActions::Result::Ptr ownerShipResult = std::make_unique<GameActions::Result>(
GameActions::Status::Disallowed, STR_LAND_NOT_OWNED_BY_PARK);
ownerShipResult->ErrorTitle = STR_CANT_RAISE_WATER_LEVEL_HERE;
return ownerShipResult;
return std::make_unique<GameActions::Result>(
GameActions::Status::Disallowed, STR_CANT_RAISE_WATER_LEVEL_HERE, STR_LAND_NOT_OWNED_BY_PARK);
}
if (isExecuting && hasChanged)
@@ -68,7 +68,7 @@ GameActions::Result::Ptr WaterSetHeightAction::Query() const
if (surfaceElement == nullptr)
{
log_error("Could not find surface element at: x %u, y %u", _coords.x, _coords.y);
return MakeResult(GameActions::Status::Unknown, STR_NONE);
return MakeResult(GameActions::Status::Unknown, STR_NONE, STR_NONE);
}
int32_t zHigh = surfaceElement->GetBaseZ();
@@ -90,7 +90,7 @@ GameActions::Result::Ptr WaterSetHeightAction::Query() const
}
if (surfaceElement->HasTrackThatNeedsWater())
{
return MakeResult(GameActions::Status::Disallowed, STR_NONE);
return MakeResult(GameActions::Status::Disallowed, STR_NONE, STR_NONE);
}
res->Cost = 250;
@@ -113,7 +113,7 @@ GameActions::Result::Ptr WaterSetHeightAction::Execute() const
if (surfaceElement == nullptr)
{
log_error("Could not find surface element at: x %u, y %u", _coords.x, _coords.y);
return std::make_unique<GameActions::Result>(GameActions::Status::Unknown, STR_NONE);
return std::make_unique<GameActions::Result>(GameActions::Status::Unknown, STR_NONE, STR_NONE);
}
if (_height > surfaceElement->base_height)
+15 -13
View File
@@ -3509,23 +3509,24 @@ GameActions::Result::Ptr network_set_player_group(
NetworkGroup* fromgroup = network.GetGroupByID(actionPlayerId);
if (player == nullptr)
{
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, STR_CANT_DO_THIS);
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, STR_CANT_DO_THIS, STR_NONE);
}
if (network.GetGroupByID(groupId) == nullptr)
{
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, STR_CANT_DO_THIS);
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, STR_CANT_DO_THIS, STR_NONE);
}
if (player->Flags & NETWORK_PLAYER_FLAG_ISSERVER)
{
return std::make_unique<GameActions::Result>(
GameActions::Status::InvalidParameters, STR_CANT_CHANGE_GROUP_THAT_THE_HOST_BELONGS_TO);
GameActions::Status::InvalidParameters, STR_CANT_CHANGE_GROUP_THAT_THE_HOST_BELONGS_TO, STR_NONE);
}
if (groupId == 0 && fromgroup != nullptr && fromgroup->Id != 0)
{
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, STR_CANT_SET_TO_THIS_GROUP);
return std::make_unique<GameActions::Result>(
GameActions::Status::InvalidParameters, STR_CANT_SET_TO_THIS_GROUP, STR_NONE);
}
if (isExecuting)
@@ -3573,7 +3574,7 @@ GameActions::Result::Ptr network_modify_groups(
NetworkGroup* newgroup = network.AddGroup();
if (newgroup == nullptr)
{
return std::make_unique<GameActions::Result>(GameActions::Status::Unknown, STR_CANT_DO_THIS);
return std::make_unique<GameActions::Result>(GameActions::Status::Unknown, STR_CANT_DO_THIS, STR_NONE);
}
}
}
@@ -3583,14 +3584,14 @@ GameActions::Result::Ptr network_modify_groups(
if (groupId == 0)
{
return std::make_unique<GameActions::Result>(
GameActions::Status::Disallowed, STR_THIS_GROUP_CANNOT_BE_MODIFIED);
GameActions::Status::Disallowed, STR_THIS_GROUP_CANNOT_BE_MODIFIED, STR_NONE);
}
for (const auto& it : network.player_list)
{
if ((it.get())->Group == groupId)
{
return std::make_unique<GameActions::Result>(
GameActions::Status::Disallowed, STR_CANT_REMOVE_GROUP_THAT_PLAYERS_BELONG_TO);
GameActions::Status::Disallowed, STR_CANT_REMOVE_GROUP_THAT_PLAYERS_BELONG_TO, STR_NONE);
}
}
if (isExecuting)
@@ -3604,7 +3605,7 @@ GameActions::Result::Ptr network_modify_groups(
if (groupId == 0)
{ // can't change admin group permissions
return std::make_unique<GameActions::Result>(
GameActions::Status::Disallowed, STR_THIS_GROUP_CANNOT_BE_MODIFIED);
GameActions::Status::Disallowed, STR_THIS_GROUP_CANNOT_BE_MODIFIED, STR_NONE);
}
NetworkGroup* mygroup = nullptr;
NetworkPlayer* player = network.GetPlayerByID(actionPlayerId);
@@ -3615,7 +3616,7 @@ GameActions::Result::Ptr network_modify_groups(
if (mygroup == nullptr || !mygroup->CanPerformAction(networkPermission))
{
return std::make_unique<GameActions::Result>(
GameActions::Status::Disallowed, STR_CANT_MODIFY_PERMISSION_THAT_YOU_DO_NOT_HAVE_YOURSELF);
GameActions::Status::Disallowed, STR_CANT_MODIFY_PERMISSION_THAT_YOU_DO_NOT_HAVE_YOURSELF, STR_NONE);
}
}
if (isExecuting)
@@ -3674,7 +3675,8 @@ GameActions::Result::Ptr network_modify_groups(
{
if (groupId == 0)
{
return std::make_unique<GameActions::Result>(GameActions::Status::Disallowed, STR_CANT_SET_TO_THIS_GROUP);
return std::make_unique<GameActions::Result>(
GameActions::Status::Disallowed, STR_CANT_SET_TO_THIS_GROUP, STR_NONE);
}
if (isExecuting)
{
@@ -3684,7 +3686,7 @@ GameActions::Result::Ptr network_modify_groups(
break;
default:
log_error("Invalid Modify Group Type: %u", static_cast<uint8_t>(type));
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, STR_NONE);
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE);
}
network.SaveGroups();
@@ -3700,12 +3702,12 @@ GameActions::Result::Ptr network_kick_player(NetworkPlayerId_t playerId, bool is
{
// Player might be already removed by the PLAYERLIST command, need to refactor non-game commands executing too
// early.
return std::make_unique<GameActions::Result>(GameActions::Status::Unknown, STR_NONE);
return std::make_unique<GameActions::Result>(GameActions::Status::Unknown, STR_NONE, STR_NONE);
}
if (player->Flags & NETWORK_PLAYER_FLAG_ISSERVER)
{
return std::make_unique<GameActions::Result>(GameActions::Status::Disallowed, STR_CANT_KICK_THE_HOST);
return std::make_unique<GameActions::Result>(GameActions::Status::Disallowed, STR_CANT_KICK_THE_HOST, STR_NONE);
}
if (isExecuting)
+3 -2
View File
@@ -582,7 +582,8 @@ std::unique_ptr<GameActions::Result> Peep::Place(const TileCoordsXYZ& location,
}
if (tileElement == nullptr)
{
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, STR_ERR_CANT_PLACE_PERSON_HERE);
return std::make_unique<GameActions::Result>(
GameActions::Status::InvalidParameters, STR_ERR_CANT_PLACE_PERSON_HERE, STR_NONE);
}
// Set the coordinate of destination to be exactly
@@ -591,7 +592,7 @@ std::unique_ptr<GameActions::Result> Peep::Place(const TileCoordsXYZ& location,
if (!map_is_location_owned(destination))
{
return std::make_unique<GameActions::Result>(GameActions::Status::NotOwned, STR_ERR_CANT_PLACE_PERSON_HERE);
return std::make_unique<GameActions::Result>(GameActions::Status::NotOwned, STR_ERR_CANT_PLACE_PERSON_HERE, STR_NONE);
}
if (auto res = MapCanConstructAt({ destination, destination.z, destination.z + (1 * 8) }, { 0b1111, 0 });
+34 -33
View File
@@ -96,7 +96,7 @@ namespace OpenRCT2::TileInspector
{
// Make sure there is enough space for the new element
if (!MapCheckCapacityAndReorganise(loc))
return std::make_unique<GameActions::Result>(GameActions::Status::NoFreeElements, STR_NONE);
return std::make_unique<GameActions::Result>(GameActions::Status::NoFreeElements, STR_NONE, STR_NONE);
if (isExecuting)
{
@@ -107,14 +107,14 @@ namespace OpenRCT2::TileInspector
if (corruptElement == nullptr)
{
log_warning("Failed to insert corrupt element.");
return std::make_unique<GameActions::Result>(GameActions::Status::Unknown, STR_NONE);
return std::make_unique<GameActions::Result>(GameActions::Status::Unknown, STR_NONE, STR_NONE);
}
// Set the base height to be the same as the selected element
TileElement* const selectedElement = map_get_nth_element_at(loc, elementIndex + 1);
if (selectedElement == nullptr)
{
return std::make_unique<GameActions::Result>(GameActions::Status::Unknown, STR_NONE);
return std::make_unique<GameActions::Result>(GameActions::Status::Unknown, STR_NONE, STR_NONE);
}
corruptElement->base_height = corruptElement->clearance_height = selectedElement->base_height;
@@ -208,7 +208,7 @@ namespace OpenRCT2::TileInspector
TileElement* const tileElement = map_get_nth_element_at(loc, elementIndex);
if (tileElement == nullptr)
{
return std::make_unique<GameActions::Result>(GameActions::Status::Unknown, STR_NONE);
return std::make_unique<GameActions::Result>(GameActions::Status::Unknown, STR_NONE, STR_NONE);
}
auto largeScenery = tileElement->AsLargeScenery();
@@ -256,7 +256,7 @@ namespace OpenRCT2::TileInspector
{
if (!SwapTileElements(loc, first, second))
{
return std::make_unique<GameActions::Result>(GameActions::Status::Unknown, STR_NONE);
return std::make_unique<GameActions::Result>(GameActions::Status::Unknown, STR_NONE, STR_NONE);
}
map_invalidate_tile_full(loc);
@@ -284,7 +284,7 @@ namespace OpenRCT2::TileInspector
TileElement* const tileElement = map_get_nth_element_at(loc, elementIndex);
if (tileElement == nullptr)
{
return std::make_unique<GameActions::Result>(GameActions::Status::Unknown, STR_NONE);
return std::make_unique<GameActions::Result>(GameActions::Status::Unknown, STR_NONE, STR_NONE);
}
switch (tileElement->GetType())
{
@@ -362,7 +362,7 @@ namespace OpenRCT2::TileInspector
// Make sure there is enough space for the new element
if (!MapCheckCapacityAndReorganise(loc))
{
return std::make_unique<GameActions::Result>(GameActions::Status::NoFreeElements, STR_NONE);
return std::make_unique<GameActions::Result>(GameActions::Status::NoFreeElements, STR_NONE, STR_NONE);
}
auto tileLoc = TileCoordsXY(loc);
@@ -378,7 +378,8 @@ namespace OpenRCT2::TileInspector
if (newBanner == nullptr)
{
log_error("No free banners available");
return std::make_unique<GameActions::Result>(GameActions::Status::Unknown, STR_TOO_MANY_BANNERS_IN_GAME);
return std::make_unique<GameActions::Result>(
GameActions::Status::Unknown, STR_TOO_MANY_BANNERS_IN_GAME, STR_NONE);
}
newBanner->position = tileLoc;
@@ -422,7 +423,7 @@ namespace OpenRCT2::TileInspector
{
const TileElement* const firstElement = map_get_first_element_at(loc);
if (firstElement == nullptr)
return std::make_unique<GameActions::Result>(GameActions::Status::Unknown, STR_NONE);
return std::make_unique<GameActions::Result>(GameActions::Status::Unknown, STR_NONE, STR_NONE);
// Count elements on tile
int32_t numElement = 0;
@@ -504,7 +505,7 @@ namespace OpenRCT2::TileInspector
{
TileElement* const tileElement = map_get_nth_element_at(loc, elementIndex);
if (tileElement == nullptr)
return std::make_unique<GameActions::Result>(GameActions::Status::Unknown, STR_NONE);
return std::make_unique<GameActions::Result>(GameActions::Status::Unknown, STR_NONE, STR_NONE);
auto heightValidationResult = ValidateTileHeight(tileElement, heightOffset);
if (heightValidationResult->Error != GameActions::Status::Ok)
@@ -556,7 +557,7 @@ namespace OpenRCT2::TileInspector
// No surface element on tile
if (surfaceelement == nullptr)
return std::make_unique<GameActions::Result>(GameActions::Status::Unknown, STR_NONE);
return std::make_unique<GameActions::Result>(GameActions::Status::Unknown, STR_NONE, STR_NONE);
if (isExecuting)
{
@@ -582,7 +583,7 @@ namespace OpenRCT2::TileInspector
// No surface element on tile
if (surfaceElement == nullptr)
return std::make_unique<GameActions::Result>(GameActions::Status::Unknown, STR_NONE);
return std::make_unique<GameActions::Result>(GameActions::Status::Unknown, STR_NONE, STR_NONE);
if (isExecuting)
{
@@ -635,7 +636,7 @@ namespace OpenRCT2::TileInspector
// No surface element on tile
if (surfaceElement == nullptr)
return std::make_unique<GameActions::Result>(GameActions::Status::Unknown, STR_NONE);
return std::make_unique<GameActions::Result>(GameActions::Status::Unknown, STR_NONE, STR_NONE);
if (isExecuting)
{
@@ -658,7 +659,7 @@ namespace OpenRCT2::TileInspector
TileElement* const pathElement = map_get_nth_element_at(loc, elementIndex);
if (pathElement == nullptr || pathElement->GetType() != TILE_ELEMENT_TYPE_PATH)
return std::make_unique<GameActions::Result>(GameActions::Status::Unknown, STR_NONE);
return std::make_unique<GameActions::Result>(GameActions::Status::Unknown, STR_NONE, STR_NONE);
if (isExecuting)
{
@@ -680,7 +681,7 @@ namespace OpenRCT2::TileInspector
TileElement* const pathElement = map_get_nth_element_at(loc, elementIndex);
if (pathElement == nullptr || pathElement->GetType() != TILE_ELEMENT_TYPE_PATH)
return std::make_unique<GameActions::Result>(GameActions::Status::Unknown, STR_NONE);
return std::make_unique<GameActions::Result>(GameActions::Status::Unknown, STR_NONE, STR_NONE);
if (isExecuting)
{
@@ -702,7 +703,7 @@ namespace OpenRCT2::TileInspector
TileElement* const pathElement = map_get_nth_element_at(loc, elementIndex);
if (pathElement == nullptr || pathElement->GetType() != TILE_ELEMENT_TYPE_PATH)
return std::make_unique<GameActions::Result>(GameActions::Status::Unknown, STR_NONE);
return std::make_unique<GameActions::Result>(GameActions::Status::Unknown, STR_NONE, STR_NONE);
if (isExecuting)
{
@@ -725,11 +726,11 @@ namespace OpenRCT2::TileInspector
TileElement* const entranceElement = map_get_nth_element_at(loc, elementIndex);
if (entranceElement == nullptr || entranceElement->GetType() != TILE_ELEMENT_TYPE_ENTRANCE)
return std::make_unique<GameActions::Result>(GameActions::Status::Unknown, STR_NONE);
return std::make_unique<GameActions::Result>(GameActions::Status::Unknown, STR_NONE, STR_NONE);
auto ride = get_ride(entranceElement->AsEntrance()->GetRideIndex());
if (ride == nullptr)
return std::make_unique<GameActions::Result>(GameActions::Status::Unknown, STR_NONE);
return std::make_unique<GameActions::Result>(GameActions::Status::Unknown, STR_NONE, STR_NONE);
if (isExecuting)
{
@@ -765,7 +766,7 @@ namespace OpenRCT2::TileInspector
TileElement* const wallElement = map_get_nth_element_at(loc, elementIndex);
if (wallElement == nullptr || wallElement->GetType() != TILE_ELEMENT_TYPE_WALL)
return std::make_unique<GameActions::Result>(GameActions::Status::Unknown, STR_NONE);
return std::make_unique<GameActions::Result>(GameActions::Status::Unknown, STR_NONE, STR_NONE);
if (isExecuting)
{
@@ -789,7 +790,7 @@ namespace OpenRCT2::TileInspector
TileElement* const wallElement = map_get_nth_element_at(loc, elementIndex);
if (wallElement == nullptr || wallElement->GetType() != TILE_ELEMENT_TYPE_WALL)
return std::make_unique<GameActions::Result>(GameActions::Status::Unknown, STR_NONE);
return std::make_unique<GameActions::Result>(GameActions::Status::Unknown, STR_NONE, STR_NONE);
if (isExecuting)
{
@@ -817,7 +818,7 @@ namespace OpenRCT2::TileInspector
TileElement* const trackElement = map_get_nth_element_at(loc, elementIndex);
if (trackElement == nullptr || trackElement->GetType() != TILE_ELEMENT_TYPE_TRACK)
return std::make_unique<GameActions::Result>(GameActions::Status::Unknown, STR_NONE);
return std::make_unique<GameActions::Result>(GameActions::Status::Unknown, STR_NONE, STR_NONE);
if (isExecuting)
{
@@ -829,7 +830,7 @@ namespace OpenRCT2::TileInspector
auto rideIndex = trackElement->AsTrack()->GetRideIndex();
auto ride = get_ride(rideIndex);
if (ride == nullptr)
return std::make_unique<GameActions::Result>(GameActions::Status::Unknown, STR_NONE);
return std::make_unique<GameActions::Result>(GameActions::Status::Unknown, STR_NONE, STR_NONE);
const auto& ted = GetTrackElementDescriptor(type);
const auto* trackBlock = ted.Block;
@@ -856,7 +857,7 @@ namespace OpenRCT2::TileInspector
if (tileElement == nullptr)
{
log_error("Track map element part not found!");
return std::make_unique<GameActions::Result>(GameActions::Status::Unknown, STR_NONE);
return std::make_unique<GameActions::Result>(GameActions::Status::Unknown, STR_NONE, STR_NONE);
}
// track_remove returns here on failure, not sure when this would ever be hit. Only thing I can think of is
@@ -890,7 +891,7 @@ namespace OpenRCT2::TileInspector
TileElement* const trackElement = map_get_nth_element_at(loc, elementIndex);
if (trackElement == nullptr || trackElement->GetType() != TILE_ELEMENT_TYPE_TRACK)
return std::make_unique<GameActions::Result>(GameActions::Status::Unknown, STR_NONE);
return std::make_unique<GameActions::Result>(GameActions::Status::Unknown, STR_NONE, STR_NONE);
if (isExecuting)
{
@@ -913,7 +914,7 @@ namespace OpenRCT2::TileInspector
auto rideIndex = trackElement->AsTrack()->GetRideIndex();
auto ride = get_ride(rideIndex);
if (ride == nullptr)
return std::make_unique<GameActions::Result>(GameActions::Status::Unknown, STR_NONE);
return std::make_unique<GameActions::Result>(GameActions::Status::Unknown, STR_NONE, STR_NONE);
const auto& ted = GetTrackElementDescriptor(type);
auto trackBlock = ted.Block;
@@ -940,7 +941,7 @@ namespace OpenRCT2::TileInspector
if (tileElement == nullptr)
{
log_error("Track map element part not found!");
return std::make_unique<GameActions::Result>(GameActions::Status::Unknown, STR_NONE);
return std::make_unique<GameActions::Result>(GameActions::Status::Unknown, STR_NONE, STR_NONE);
}
// track_remove returns here on failure, not sure when this would ever be hit. Only thing I can think of is
@@ -972,7 +973,7 @@ namespace OpenRCT2::TileInspector
TileElement* const trackElement = map_get_nth_element_at(loc, elementIndex);
if (trackElement == nullptr || trackElement->GetType() != TILE_ELEMENT_TYPE_TRACK)
return std::make_unique<GameActions::Result>(GameActions::Status::Unknown, STR_NONE);
return std::make_unique<GameActions::Result>(GameActions::Status::Unknown, STR_NONE, STR_NONE);
if (isExecuting)
{
@@ -995,7 +996,7 @@ namespace OpenRCT2::TileInspector
TileElement* const trackElement = map_get_nth_element_at(loc, elementIndex);
if (trackElement == nullptr || trackElement->GetType() != TILE_ELEMENT_TYPE_TRACK)
return std::make_unique<GameActions::Result>(GameActions::Status::Unknown, STR_NONE);
return std::make_unique<GameActions::Result>(GameActions::Status::Unknown, STR_NONE, STR_NONE);
if (isExecuting)
{
@@ -1018,7 +1019,7 @@ namespace OpenRCT2::TileInspector
TileElement* const tileElement = map_get_nth_element_at(loc, elementIndex);
if (tileElement == nullptr || tileElement->GetType() != TILE_ELEMENT_TYPE_SMALL_SCENERY)
return std::make_unique<GameActions::Result>(GameActions::Status::Unknown, STR_NONE);
return std::make_unique<GameActions::Result>(GameActions::Status::Unknown, STR_NONE, STR_NONE);
if (isExecuting)
{
@@ -1045,7 +1046,7 @@ namespace OpenRCT2::TileInspector
TileElement* const tileElement = map_get_nth_element_at(loc, elementIndex);
if (tileElement == nullptr || tileElement->GetType() != TILE_ELEMENT_TYPE_SMALL_SCENERY)
return std::make_unique<GameActions::Result>(GameActions::Status::Unknown, STR_NONE);
return std::make_unique<GameActions::Result>(GameActions::Status::Unknown, STR_NONE, STR_NONE);
if (isExecuting)
{
@@ -1069,7 +1070,7 @@ namespace OpenRCT2::TileInspector
TileElement* const bannerElement = map_get_nth_element_at(loc, elementIndex);
if (bannerElement == nullptr || bannerElement->GetType() != TILE_ELEMENT_TYPE_BANNER)
return std::make_unique<GameActions::Result>(GameActions::Status::Unknown, STR_NONE);
return std::make_unique<GameActions::Result>(GameActions::Status::Unknown, STR_NONE, STR_NONE);
if (isExecuting)
{
@@ -1091,10 +1092,10 @@ namespace OpenRCT2::TileInspector
TileElement* const corruptElement = map_get_nth_element_at(loc, elementIndex);
if (corruptElement == nullptr || corruptElement->GetType() != TILE_ELEMENT_TYPE_CORRUPT)
return std::make_unique<GameActions::Result>(GameActions::Status::Unknown, STR_NONE);
return std::make_unique<GameActions::Result>(GameActions::Status::Unknown, STR_NONE, STR_NONE);
if (corruptElement->IsLastForTile())
return std::make_unique<GameActions::Result>(GameActions::Status::Unknown, STR_NONE);
return std::make_unique<GameActions::Result>(GameActions::Status::Unknown, STR_NONE, STR_NONE);
if (isExecuting)
{