Fix #6617. Maze deletion no longer costs 0x800000 for certain mazes.

When a maze does not have a completely hollowed out hedge the game command would return 0x8000000 as it tries to remove an element that has already been deleted. As game actions no longer use 0x80000000 to indicate a failure this would get interpreted as the refund price and cause the issue.

Fix was to introduce checks when adding up the refund price. This was done rather than changing the game action so that it can be properly fixed when get_refund_price is converted into a game action
This commit is contained in:
duncanspumpkin 2017-11-06 21:21:08 +00:00 committed by Michael Steenbeek
parent 49dbdefe0f
commit 55aea7188b
2 changed files with 28 additions and 4 deletions

View File

@ -51,7 +51,7 @@ typedef struct GameAction GameAction;
// This define 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 "19"
#define NETWORK_STREAM_VERSION "20"
#define NETWORK_STREAM_ID OPENRCT2_VERSION "-" NETWORK_STREAM_VERSION
#ifdef __cplusplus

View File

@ -5576,8 +5576,10 @@ sint32 ride_get_refund_price(sint32 ride_id)
GAME_COMMAND_SET_MAZE_TRACK,
z,
0);
// Above gamecommand may remove the tile element which will cause the next game command to
// return MONEY32_UNDEFINED as it does not need to be called.
refundPrice += game_do_command(
money32 removePrice = game_do_command(
x,
GAME_COMMAND_FLAG_5 | GAME_COMMAND_FLAG_APPLY | GAME_COMMAND_FLAG_2 | (1 << 8),
y + 16,
@ -5586,7 +5588,16 @@ sint32 ride_get_refund_price(sint32 ride_id)
z,
0);
refundPrice += game_do_command(
if (removePrice == MONEY32_UNDEFINED &&
gGameCommandErrorText == 0)
{
tile_element_iterator_restart_for_tile(&it);
continue;
}
refundPrice += removePrice;
removePrice = game_do_command(
x + 16,
GAME_COMMAND_FLAG_5 | GAME_COMMAND_FLAG_APPLY | GAME_COMMAND_FLAG_2 | (2 << 8),
y + 16,
@ -5594,8 +5605,16 @@ sint32 ride_get_refund_price(sint32 ride_id)
GAME_COMMAND_SET_MAZE_TRACK,
z,
0);
if (refundPrice == MONEY32_UNDEFINED &&
gGameCommandErrorText == 0)
{
tile_element_iterator_restart_for_tile(&it);
continue;
}
refundPrice += game_do_command(
refundPrice += removePrice;
removePrice = game_do_command(
x + 16,
GAME_COMMAND_FLAG_5 | GAME_COMMAND_FLAG_APPLY | GAME_COMMAND_FLAG_2 | (3 << 8),
y,
@ -5603,6 +5622,11 @@ sint32 ride_get_refund_price(sint32 ride_id)
GAME_COMMAND_SET_MAZE_TRACK,
z,
0);
if (removePrice != MONEY32_UNDEFINED)
{
refundPrice += removePrice;
}
tile_element_iterator_restart_for_tile(&it);
}
gGamePaused = oldpaused;