mirror of https://github.com/OpenRCT2/OpenRCT2.git
Refactor out references to compatibility function wall_remove
This commit is contained in:
parent
8cb76cd969
commit
5e4cdeb78b
|
@ -29,6 +29,7 @@
|
||||||
#include <openrct2/sprites.h>
|
#include <openrct2/sprites.h>
|
||||||
#include <openrct2/world/Banner.h>
|
#include <openrct2/world/Banner.h>
|
||||||
#include <openrct2/actions/SignSetNameAction.hpp>
|
#include <openrct2/actions/SignSetNameAction.hpp>
|
||||||
|
#include <openrct2/actions/WallRemoveAction.hpp>
|
||||||
|
|
||||||
#define WW 113
|
#define WW 113
|
||||||
#define WH 96
|
#define WH 96
|
||||||
|
@ -499,18 +500,23 @@ static void window_sign_small_mouseup(rct_window *w, rct_widgetindex widgetIndex
|
||||||
window_close(w);
|
window_close(w);
|
||||||
break;
|
break;
|
||||||
case WIDX_SIGN_DEMOLISH:
|
case WIDX_SIGN_DEMOLISH:
|
||||||
while (1){
|
{
|
||||||
if (tile_element->GetType() == TILE_ELEMENT_TYPE_WALL) {
|
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);
|
rct_scenery_entry* scenery_entry = get_wall_entry(tile_element->properties.wall.type);
|
||||||
if (scenery_entry->wall.scrolling_mode != 0xFF){
|
if (scenery_entry->wall.scrolling_mode != 0xFF)
|
||||||
|
{
|
||||||
if (tile_element->properties.wall.banner_index == w->number)
|
if (tile_element->properties.wall.banner_index == w->number)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tile_element++;
|
tile_element++;
|
||||||
}
|
}
|
||||||
gGameCommandErrorTitle = STR_CANT_REMOVE_THIS;
|
auto wallRemoveAction = WallRemoveAction(x, y, tile_element->base_height, tile_element_get_direction(tile_element));
|
||||||
wall_remove(x, y, tile_element->base_height, tile_element_get_direction(tile_element), GAME_COMMAND_FLAG_APPLY);
|
GameActions::Execute(&wallRemoveAction);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case WIDX_SIGN_TEXT:
|
case WIDX_SIGN_TEXT:
|
||||||
if (banner->flags & BANNER_FLAG_LINKED_TO_RIDE){
|
if (banner->flags & BANNER_FLAG_LINKED_TO_RIDE){
|
||||||
|
|
|
@ -347,28 +347,6 @@
|
||||||
#pragma endregion
|
#pragma endregion
|
||||||
|
|
||||||
#pragma region RemoveWall
|
#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
|
* rct2: 0x006E5597
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#include "../OpenRCT2.h"
|
#include "../OpenRCT2.h"
|
||||||
#include "../core/MemoryStream.h"
|
#include "../core/MemoryStream.h"
|
||||||
#include "../localisation/StringIds.h"
|
#include "../localisation/StringIds.h"
|
||||||
|
#include "../management/Finance.h"
|
||||||
#include "GameAction.h"
|
#include "GameAction.h"
|
||||||
|
|
||||||
#include "../Cheats.h"
|
#include "../Cheats.h"
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
#include "Viewport.h"
|
#include "Viewport.h"
|
||||||
#include "Window_internal.h"
|
#include "Window_internal.h"
|
||||||
#include "../Context.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_scenery(rct_tile_element *tileElement, sint32 x, sint32 y);
|
||||||
static void viewport_interaction_remove_footpath(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)
|
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);
|
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);
|
context_open_detail_window(WD_SIGN_SMALL, tileElement->properties.wall.banner_index);
|
||||||
} else {
|
}
|
||||||
gGameCommandErrorTitle = STR_CANT_REMOVE_THIS;
|
else
|
||||||
wall_remove(x, y, tileElement->base_height, tile_element_get_direction(tileElement), GAME_COMMAND_FLAG_APPLY);
|
{
|
||||||
|
auto wallRemoveAction = WallRemoveAction(x, y, tileElement->base_height, tile_element_get_direction(tileElement));
|
||||||
|
GameActions::Execute(&wallRemoveAction);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,7 @@
|
||||||
#include "../world/SmallScenery.h"
|
#include "../world/SmallScenery.h"
|
||||||
#include "../world/Surface.h"
|
#include "../world/Surface.h"
|
||||||
#include "../world/Wall.h"
|
#include "../world/Wall.h"
|
||||||
|
#include "../actions/WallRemoveAction.hpp"
|
||||||
|
|
||||||
struct map_backup
|
struct map_backup
|
||||||
{
|
{
|
||||||
|
@ -859,8 +860,16 @@ track_design_place_scenery(rct_td6_scenery_element * scenery_start, sint32 origi
|
||||||
0);
|
0);
|
||||||
break;
|
break;
|
||||||
case OBJECT_TYPE_WALLS:
|
case OBJECT_TYPE_WALLS:
|
||||||
|
{
|
||||||
z = (scenery->z * 8 + originZ) / 8;
|
z = (scenery->z * 8 + originZ) / 8;
|
||||||
wall_remove(mapCoord.x, mapCoord.y, z, (rotation + scenery->flags) & TILE_ELEMENT_DIRECTION_MASK, flags);
|
|
||||||
|
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;
|
break;
|
||||||
case OBJECT_TYPE_PATHS:
|
case OBJECT_TYPE_PATHS:
|
||||||
z = (scenery->z * 8 + originZ) / 8;
|
z = (scenery->z * 8 + originZ) / 8;
|
||||||
|
|
|
@ -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);
|
viewport_interaction_remove_park_entrance(element, x, y);
|
||||||
break;
|
break;
|
||||||
case TILE_ELEMENT_TYPE_WALL:
|
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;
|
break;
|
||||||
case TILE_ELEMENT_TYPE_LARGE_SCENERY:
|
case TILE_ELEMENT_TYPE_LARGE_SCENERY:
|
||||||
gGameCommandErrorTitle = STR_CANT_REMOVE_THIS;
|
gGameCommandErrorTitle = STR_CANT_REMOVE_THIS;
|
||||||
|
|
Loading…
Reference in New Issue