1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-23 15:52:55 +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,12 +158,12 @@ private:
auto res = executing ? GameActions::ExecuteNested(&footpathRemoveAction) auto res = executing ? GameActions::ExecuteNested(&footpathRemoveAction)
: GameActions::QueryNested(&footpathRemoveAction); : GameActions::QueryNested(&footpathRemoveAction);
if (res->Error != GA_ERROR::OK) if (res->Error == GA_ERROR::OK)
return MONEY32_UNDEFINED; {
totalCost += res->Cost; totalCost += res->Cost;
tileEdited = executing; tileEdited = executing;
} }
}
break; break;
case TILE_ELEMENT_TYPE_SMALL_SCENERY: case TILE_ELEMENT_TYPE_SMALL_SCENERY:
if (_itemsToClear & CLEARABLE_ITEMS::SCENERY_SMALL) if (_itemsToClear & CLEARABLE_ITEMS::SCENERY_SMALL)
@@ -176,12 +176,12 @@ private:
auto res = executing ? GameActions::ExecuteNested(&removeSceneryAction) auto res = executing ? GameActions::ExecuteNested(&removeSceneryAction)
: GameActions::QueryNested(&removeSceneryAction); : GameActions::QueryNested(&removeSceneryAction);
if (res->Error != GA_ERROR::OK) if (res->Error == GA_ERROR::OK)
return MONEY32_UNDEFINED; {
totalCost += res->Cost; totalCost += res->Cost;
tileEdited = executing; tileEdited = executing;
} }
}
break; break;
case TILE_ELEMENT_TYPE_WALL: case TILE_ELEMENT_TYPE_WALL:
if (_itemsToClear & CLEARABLE_ITEMS::SCENERY_SMALL) if (_itemsToClear & CLEARABLE_ITEMS::SCENERY_SMALL)
@@ -193,12 +193,12 @@ private:
auto res = executing ? GameActions::ExecuteNested(&wallRemoveAction) auto res = executing ? GameActions::ExecuteNested(&wallRemoveAction)
: GameActions::QueryNested(&wallRemoveAction); : GameActions::QueryNested(&wallRemoveAction);
if (res->Error != GA_ERROR::OK) if (res->Error == GA_ERROR::OK)
return MONEY32_UNDEFINED; {
totalCost += res->Cost; totalCost += res->Cost;
tileEdited = executing; tileEdited = executing;
} }
}
break; break;
case TILE_ELEMENT_TYPE_LARGE_SCENERY: case TILE_ELEMENT_TYPE_LARGE_SCENERY:
if (_itemsToClear & CLEARABLE_ITEMS::SCENERY_LARGE) if (_itemsToClear & CLEARABLE_ITEMS::SCENERY_LARGE)
@@ -211,12 +211,12 @@ private:
auto res = executing ? GameActions::ExecuteNested(&removeSceneryAction) auto res = executing ? GameActions::ExecuteNested(&removeSceneryAction)
: GameActions::QueryNested(&removeSceneryAction); : GameActions::QueryNested(&removeSceneryAction);
if (res->Error != GA_ERROR::OK) if (res->Error == GA_ERROR::OK)
return MONEY32_UNDEFINED; {
totalCost += res->Cost; totalCost += res->Cost;
tileEdited = executing; tileEdited = executing;
} }
}
break; break;
} }
} while (!tileEdited && !(tileElement++)->IsLastForTile()); } while (!tileEdited && !(tileElement++)->IsLastForTile());

View File

@@ -62,6 +62,11 @@ public:
} }
TileElement* footpathElement = GetFootpathElement(); TileElement* footpathElement = GetFootpathElement();
if (footpathElement == nullptr)
{
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_REMOVE_FOOTPATH_FROM_HERE);
}
res->Cost = GetRefundPrice(footpathElement); res->Cost = GetRefundPrice(footpathElement);
return res; return res;
@@ -90,6 +95,10 @@ public:
tile_element_remove(footpathElement); tile_element_remove(footpathElement);
footpath_update_queue_chains(); footpath_update_queue_chains();
} }
else
{
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_REMOVE_FOOTPATH_FROM_HERE);
}
res->Cost = GetRefundPrice(footpathElement); 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 (result->Error == GA_ERROR::OK)
{ {
if (topLevel) if (topLevel)

View File

@@ -104,8 +104,7 @@ public:
TileElement* tileElement = FindSceneryElement(); TileElement* tileElement = FindSceneryElement();
if (tileElement == nullptr) if (tileElement == nullptr)
{ {
res->Cost = 0; return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_REMOVE_THIS, STR_INVALID_SELECTION_OF_OBJECTS);
return res;
} }
return res; return res;
@@ -130,8 +129,7 @@ public:
TileElement* tileElement = FindSceneryElement(); TileElement* tileElement = FindSceneryElement();
if (tileElement == nullptr) if (tileElement == nullptr)
{ {
res->Cost = 0; return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_REMOVE_THIS, STR_INVALID_SELECTION_OF_OBJECTS);
return res;
} }
res->Position.z = tile_element_height(res->Position.x, res->Position.y); 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. // This string specifies which version of network stream current build uses.
// It is used for making sure only compatible builds get connected, even within // It is used for making sure only compatible builds get connected, even within
// single OpenRCT2 version. // single OpenRCT2 version.
#define NETWORK_STREAM_VERSION "37" #define NETWORK_STREAM_VERSION "38"
#define NETWORK_STREAM_ID OPENRCT2_VERSION "-" NETWORK_STREAM_VERSION #define NETWORK_STREAM_ID OPENRCT2_VERSION "-" NETWORK_STREAM_VERSION
static rct_peep* _pickup_peep = nullptr; static rct_peep* _pickup_peep = nullptr;