1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-23 07:43:01 +01:00

Merge pull request #8717 from ZehMatt/ga-fixes3

GameAction fixes.
This commit is contained in:
Duncan
2019-02-18 08:16:08 +00:00
committed by GitHub
5 changed files with 33 additions and 26 deletions

View File

@@ -158,11 +158,11 @@ private:
auto res = executing ? GameActions::ExecuteNested(&footpathRemoveAction)
: GameActions::QueryNested(&footpathRemoveAction);
if (res->Error != GA_ERROR::OK)
return MONEY32_UNDEFINED;
totalCost += res->Cost;
tileEdited = executing;
if (res->Error == GA_ERROR::OK)
{
totalCost += res->Cost;
tileEdited = executing;
}
}
break;
case TILE_ELEMENT_TYPE_SMALL_SCENERY:
@@ -176,11 +176,11 @@ private:
auto res = executing ? GameActions::ExecuteNested(&removeSceneryAction)
: GameActions::QueryNested(&removeSceneryAction);
if (res->Error != GA_ERROR::OK)
return MONEY32_UNDEFINED;
totalCost += res->Cost;
tileEdited = executing;
if (res->Error == GA_ERROR::OK)
{
totalCost += res->Cost;
tileEdited = executing;
}
}
break;
case TILE_ELEMENT_TYPE_WALL:
@@ -193,11 +193,11 @@ private:
auto res = executing ? GameActions::ExecuteNested(&wallRemoveAction)
: GameActions::QueryNested(&wallRemoveAction);
if (res->Error != GA_ERROR::OK)
return MONEY32_UNDEFINED;
totalCost += res->Cost;
tileEdited = executing;
if (res->Error == GA_ERROR::OK)
{
totalCost += res->Cost;
tileEdited = executing;
}
}
break;
case TILE_ELEMENT_TYPE_LARGE_SCENERY:
@@ -211,11 +211,11 @@ private:
auto res = executing ? GameActions::ExecuteNested(&removeSceneryAction)
: GameActions::QueryNested(&removeSceneryAction);
if (res->Error != GA_ERROR::OK)
return MONEY32_UNDEFINED;
totalCost += res->Cost;
tileEdited = executing;
if (res->Error == GA_ERROR::OK)
{
totalCost += res->Cost;
tileEdited = executing;
}
}
break;
}

View File

@@ -62,6 +62,11 @@ public:
}
TileElement* footpathElement = GetFootpathElement();
if (footpathElement == nullptr)
{
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_REMOVE_FOOTPATH_FROM_HERE);
}
res->Cost = GetRefundPrice(footpathElement);
return res;
@@ -90,6 +95,10 @@ public:
tile_element_remove(footpathElement);
footpath_update_queue_chains();
}
else
{
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_REMOVE_FOOTPATH_FROM_HERE);
}
res->Cost = GetRefundPrice(footpathElement);

View File

@@ -261,7 +261,7 @@ namespace GameActions
}
}
GameActionResult::Ptr result = Query(action);
GameActionResult::Ptr result = QueryInternal(action, topLevel);
if (result->Error == GA_ERROR::OK)
{
if (topLevel)

View File

@@ -104,8 +104,7 @@ public:
TileElement* tileElement = FindSceneryElement();
if (tileElement == nullptr)
{
res->Cost = 0;
return res;
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_REMOVE_THIS, STR_INVALID_SELECTION_OF_OBJECTS);
}
return res;
@@ -130,8 +129,7 @@ public:
TileElement* tileElement = FindSceneryElement();
if (tileElement == nullptr)
{
res->Cost = 0;
return res;
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_REMOVE_THIS, STR_INVALID_SELECTION_OF_OBJECTS);
}
res->Position.z = tile_element_height(res->Position.x, res->Position.y);

View File

@@ -30,7 +30,7 @@
// This string specifies which version of network stream current build uses.
// It is used for making sure only compatible builds get connected, even within
// single OpenRCT2 version.
#define NETWORK_STREAM_VERSION "37"
#define NETWORK_STREAM_VERSION "38"
#define NETWORK_STREAM_ID OPENRCT2_VERSION "-" NETWORK_STREAM_VERSION
static rct_peep* _pickup_peep = nullptr;