Refactor out references to compatibility function wall_remove

This commit is contained in:
ZehMatt 2018-04-22 19:11:06 +02:00 committed by Aaron van Geffen
parent 8cb76cd969
commit 5e4cdeb78b
6 changed files with 39 additions and 39 deletions

View File

@ -29,6 +29,7 @@
#include <openrct2/sprites.h>
#include <openrct2/world/Banner.h>
#include <openrct2/actions/SignSetNameAction.hpp>
#include <openrct2/actions/WallRemoveAction.hpp>
#define WW 113
#define WH 96
@ -499,18 +500,23 @@ static void window_sign_small_mouseup(rct_window *w, rct_widgetindex widgetIndex
window_close(w);
break;
case WIDX_SIGN_DEMOLISH:
while (1){
if (tile_element->GetType() == TILE_ELEMENT_TYPE_WALL) {
rct_scenery_entry* scenery_entry = get_wall_entry(tile_element->properties.wall.type);
if (scenery_entry->wall.scrolling_mode != 0xFF){
if (tile_element->properties.wall.banner_index == w->number)
break;
{
while (1)
{
if (tile_element_get_type(tile_element) == TILE_ELEMENT_TYPE_WALL)
{
rct_scenery_entry* scenery_entry = get_wall_entry(tile_element->properties.wall.type);
if (scenery_entry->wall.scrolling_mode != 0xFF)
{
if (tile_element->properties.wall.banner_index == w->number)
break;
}
}
tile_element++;
}
tile_element++;
auto wallRemoveAction = WallRemoveAction(x, y, tile_element->base_height, tile_element_get_direction(tile_element));
GameActions::Execute(&wallRemoveAction);
}
gGameCommandErrorTitle = STR_CANT_REMOVE_THIS;
wall_remove(x, y, tile_element->base_height, tile_element_get_direction(tile_element), GAME_COMMAND_FLAG_APPLY);
break;
case WIDX_SIGN_TEXT:
if (banner->flags & BANNER_FLAG_LINKED_TO_RIDE){

View File

@ -347,28 +347,6 @@
#pragma endregion
#pragma region RemoveWall
money32 wall_remove(sint16 x, sint16 y, uint8 baseHeight, uint8 direction, uint8 flags)
{
auto gameAction = WallRemoveAction(x, y, baseHeight, direction);
gameAction.SetFlags(flags);
// FIXME: The callee should probably use the game action directly
// once everything is compiled as cpp.
money32 cost = 0;
if (flags & GAME_COMMAND_FLAG_APPLY)
{
auto res = GameActions::Execute(&gameAction);
cost = res->Cost;
}
else
{
auto res = GameActions::Query(&gameAction);
cost = res->Cost;
}
return cost;
}
/**
*
* rct2: 0x006E5597

View File

@ -19,6 +19,7 @@
#include "../OpenRCT2.h"
#include "../core/MemoryStream.h"
#include "../localisation/StringIds.h"
#include "../management/Finance.h"
#include "GameAction.h"
#include "../Cheats.h"

View File

@ -37,6 +37,7 @@
#include "Viewport.h"
#include "Window_internal.h"
#include "../Context.h"
#include "../actions/WallRemoveAction.hpp"
static void viewport_interaction_remove_scenery(rct_tile_element *tileElement, sint32 x, sint32 y);
static void viewport_interaction_remove_footpath(rct_tile_element *tileElement, sint32 x, sint32 y);
@ -511,11 +512,14 @@ void viewport_interaction_remove_park_entrance(rct_tile_element *tileElement, si
static void viewport_interaction_remove_park_wall(rct_tile_element *tileElement, sint32 x, sint32 y)
{
rct_scenery_entry *sceneryEntry = get_wall_entry(tileElement->properties.wall.type);
if (sceneryEntry->wall.scrolling_mode != 0xFF){
if (sceneryEntry->wall.scrolling_mode != 0xFF)
{
context_open_detail_window(WD_SIGN_SMALL, tileElement->properties.wall.banner_index);
} else {
gGameCommandErrorTitle = STR_CANT_REMOVE_THIS;
wall_remove(x, y, tileElement->base_height, tile_element_get_direction(tileElement), GAME_COMMAND_FLAG_APPLY);
}
else
{
auto wallRemoveAction = WallRemoveAction(x, y, tileElement->base_height, tile_element_get_direction(tileElement));
GameActions::Execute(&wallRemoveAction);
}
}

View File

@ -45,6 +45,7 @@
#include "../world/SmallScenery.h"
#include "../world/Surface.h"
#include "../world/Wall.h"
#include "../actions/WallRemoveAction.hpp"
struct map_backup
{
@ -859,8 +860,16 @@ track_design_place_scenery(rct_td6_scenery_element * scenery_start, sint32 origi
0);
break;
case OBJECT_TYPE_WALLS:
z = (scenery->z * 8 + originZ) / 8;
wall_remove(mapCoord.x, mapCoord.y, z, (rotation + scenery->flags) & TILE_ELEMENT_DIRECTION_MASK, flags);
{
z = (scenery->z * 8 + originZ) / 8;
uint8_t direction = (rotation + scenery->flags) & TILE_ELEMENT_DIRECTION_MASK;
auto wallRemoveAction = WallRemoveAction(mapCoord.x, mapCoord.y, z, direction);
wallRemoveAction.SetFlags(flags);
GameActions::Execute(&wallRemoveAction);
}
break;
case OBJECT_TYPE_PATHS:
z = (scenery->z * 8 + originZ) / 8;

View File

@ -3761,8 +3761,10 @@ static void clear_element_at(sint32 x, sint32 y, rct_tile_element **elementPtr)
viewport_interaction_remove_park_entrance(element, x, y);
break;
case TILE_ELEMENT_TYPE_WALL:
gGameCommandErrorTitle = STR_CANT_REMOVE_THIS;
wall_remove(x, y, tile_element_get_direction(element), element->base_height, GAME_COMMAND_FLAG_APPLY);
{
auto wallRemoveAction = WallRemoveAction(x, y, element->base_height, tile_element_get_direction(element));
GameActions::Execute(&wallRemoveAction);
}
break;
case TILE_ELEMENT_TYPE_LARGE_SCENERY:
gGameCommandErrorTitle = STR_CANT_REMOVE_THIS;