Fix review issues and formatting

This commit is contained in:
0cufox0 2019-07-07 04:53:59 +03:00 committed by duncanspumpkin
parent 8e33619b63
commit b4e0df2e5f
17 changed files with 78 additions and 90 deletions

View File

@ -496,8 +496,7 @@ int32_t viewport_interaction_right_click(int32_t x, int32_t y)
static void viewport_interaction_remove_scenery(TileElement* tileElement, int32_t x, int32_t y)
{
auto removeSceneryAction = SmallSceneryRemoveAction(
{x, y, tileElement->base_height * 8},
tileElement->AsSmallScenery()->GetSceneryQuadrant(),
{ x, y, tileElement->base_height * 8 }, tileElement->AsSmallScenery()->GetSceneryQuadrant(),
tileElement->AsSmallScenery()->GetEntryIndex());
GameActions::Execute(&removeSceneryAction);
@ -575,7 +574,7 @@ static void viewport_interaction_remove_park_wall(TileElement* tileElement, int3
}
else
{
CoordsXYZD wallLocation = { x, y, tileElement->base_height << 3, tileElement->GetDirection() };
CoordsXYZD wallLocation = { x, y, tileElement->base_height * 8, tileElement->GetDirection() };
auto wallRemoveAction = WallRemoveAction(wallLocation);
GameActions::Execute(&wallRemoveAction);
}
@ -597,8 +596,8 @@ static void viewport_interaction_remove_large_scenery(TileElement* tileElement,
else
{
auto removeSceneryAction = LargeSceneryRemoveAction(
{x, y, tileElement->base_height << 3, tileElement->GetDirection()}
, tileElement->AsLargeScenery()->GetSequenceIndex());
{ x, y, tileElement->base_height * 8, tileElement->GetDirection() },
tileElement->AsLargeScenery()->GetSequenceIndex());
GameActions::Execute(&removeSceneryAction);
}
}

View File

@ -4349,8 +4349,8 @@ static void window_ride_set_track_colour_scheme(rct_window* w, int32_t x, int32_
z = tileElement->base_height * 8;
direction = tileElement->GetDirection();
auto gameAction = RideSetColourSchemeAction( { x, y, z, (Direction)direction}
, tileElement->AsTrack()->GetTrackType(), newColourScheme);
auto gameAction = RideSetColourSchemeAction(
CoordsXYZD{ x, y, z, static_cast<Direction>(direction) }, tileElement->AsTrack()->GetTrackType(), newColourScheme);
GameActions::Execute(&gameAction);
}

View File

@ -232,10 +232,9 @@ static void window_sign_mouseup(rct_window* w, rct_widgetindex widgetIndex)
}
auto sceneryRemoveAction = LargeSceneryRemoveAction(
{x, y, tile_element->base_height * 8, tile_element->GetDirection()},
{ x, y, tile_element->base_height * 8, tile_element->GetDirection() },
tile_element->AsLargeScenery()->GetSequenceIndex());
GameActions::Execute(&sceneryRemoveAction);
break;
}
case WIDX_SIGN_TEXT:
@ -474,7 +473,7 @@ static void window_sign_small_mouseup(rct_window* w, rct_widgetindex widgetIndex
}
tile_element++;
}
CoordsXYZD wallLocation = { x , y , tile_element->base_height << 3, tile_element->GetDirection() };
CoordsXYZD wallLocation = { x, y, tile_element->base_height * 8, tile_element->GetDirection() };
auto wallRemoveAction = WallRemoveAction(wallLocation);
GameActions::Execute(&wallRemoveAction);
break;

View File

@ -152,7 +152,7 @@ private:
case TILE_ELEMENT_TYPE_PATH:
if (_itemsToClear & CLEARABLE_ITEMS::SCENERY_FOOTPATH)
{
auto footpathRemoveAction = FootpathRemoveAction(x * 32, y * 32, tileElement->base_height);
auto footpathRemoveAction = FootpathRemoveAction({ x * 32, y * 32, tileElement->base_height * 8 });
footpathRemoveAction.SetFlags(GetFlags());
auto res = executing ? GameActions::ExecuteNested(&footpathRemoveAction)
@ -169,7 +169,7 @@ private:
if (_itemsToClear & CLEARABLE_ITEMS::SCENERY_SMALL)
{
auto removeSceneryAction = SmallSceneryRemoveAction(
{x * 32, y * 32, tileElement->base_height * 8},
{ x * 32, y * 32, tileElement->base_height * 8 },
tileElement->AsSmallScenery()->GetSceneryQuadrant(),
tileElement->AsSmallScenery()->GetEntryIndex());
removeSceneryAction.SetFlags(GetFlags());
@ -187,7 +187,8 @@ private:
case TILE_ELEMENT_TYPE_WALL:
if (_itemsToClear & CLEARABLE_ITEMS::SCENERY_SMALL)
{
CoordsXYZD wallLocation = { x<<5, y<<5, tileElement->base_height << 3, tileElement->GetDirection() };
CoordsXYZD wallLocation = { x * 32, y * 32, tileElement->base_height * 8,
tileElement->GetDirection() };
auto wallRemoveAction = WallRemoveAction(wallLocation);
wallRemoveAction.SetFlags(GetFlags());
@ -205,7 +206,7 @@ private:
if (_itemsToClear & CLEARABLE_ITEMS::SCENERY_LARGE)
{
auto removeSceneryAction = LargeSceneryRemoveAction(
{x * 32, y * 32, tileElement->base_height * 8, tileElement->GetDirection()},
{ x * 32, y * 32, tileElement->base_height * 8, tileElement->GetDirection() },
tileElement->AsLargeScenery()->GetSequenceIndex());
removeSceneryAction.SetFlags(GetFlags() | GAME_COMMAND_FLAG_PATH_SCENERY);

View File

@ -25,16 +25,12 @@
DEFINE_GAME_ACTION(FootpathRemoveAction, GAME_COMMAND_REMOVE_PATH, GameActionResult)
{
private:
int32_t _x;
int32_t _y;
int32_t _z;
CoordsXYZ _loc;
public:
FootpathRemoveAction() = default;
FootpathRemoveAction(int32_t x, int32_t y, int32_t z)
: _x(x)
, _y(y)
, _z(z)
FootpathRemoveAction(CoordsXYZ location)
: _loc(location)
{
}
@ -47,7 +43,7 @@ public:
{
GameAction::Serialise(stream);
stream << DS_TAG(_x) << DS_TAG(_y) << DS_TAG(_z);
stream << DS_TAG(_loc);
}
GameActionResult::Ptr Query() const override
@ -55,9 +51,10 @@ public:
GameActionResult::Ptr res = std::make_unique<GameActionResult>();
res->Cost = 0;
res->ExpenditureType = RCT_EXPENDITURE_TYPE_LANDSCAPING;
res->Position = { _x + 16, _y + 16, _z * 8 };
res->Position = { _loc.x + 16, _loc.y + 16, _loc.z };
if (!((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || gCheatsSandboxMode) && !map_is_location_owned(_x, _y, _z * 8))
if (!((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || gCheatsSandboxMode)
&& !map_is_location_owned(_loc.x, _loc.y, _loc.z))
{
return MakeResult(GA_ERROR::NOT_OWNED, STR_CANT_REMOVE_FOOTPATH_FROM_HERE, STR_LAND_NOT_OWNED_BY_PARK);
}
@ -78,25 +75,25 @@ public:
GameActionResult::Ptr res = std::make_unique<GameActionResult>();
res->Cost = 0;
res->ExpenditureType = RCT_EXPENDITURE_TYPE_LANDSCAPING;
res->Position = { _x + 16, _y + 16, _z * 8 };
res->Position = { _loc.x + 16, _loc.y + 16, _loc.z };
if (!(GetFlags() & GAME_COMMAND_FLAG_GHOST))
{
footpath_interrupt_peeps(_x, _y, _z * 8);
footpath_remove_litter(_x, _y, _z * 8);
footpath_interrupt_peeps(_loc.x, _loc.y, _loc.z);
footpath_remove_litter(_loc.x, _loc.y, _loc.z);
}
TileElement* footpathElement = GetFootpathElement();
if (footpathElement != nullptr)
{
footpath_queue_chain_reset();
auto bannerRes = RemoveBannersAtElement(_x, _y, footpathElement);
auto bannerRes = RemoveBannersAtElement(_loc.x, _loc.y, footpathElement);
if (bannerRes->Error == GA_ERROR::OK)
{
res->Cost += bannerRes->Cost;
}
footpath_remove_edges_at(_x, _y, footpathElement);
map_invalidate_tile_full(_x, _y);
footpath_remove_edges_at(_loc.x, _loc.y, footpathElement);
map_invalidate_tile_full(_loc.x, _loc.y);
tile_element_remove(footpathElement);
footpath_update_queue_chains();
}
@ -115,7 +112,7 @@ private:
{
bool getGhostPath = GetFlags() & GAME_COMMAND_FLAG_GHOST;
TileElement* tileElement = map_get_footpath_element(_x / 32, _y / 32, _z);
TileElement* tileElement = map_get_footpath_element(_loc.x / 32, _loc.y / 32, _loc.z / 32);
TileElement* footpathElement = nullptr;
if (tileElement != nullptr)
{

View File

@ -23,7 +23,7 @@
#pragma region PlaceParkEntranceAction
money32 place_park_entrance(int16_t x, int16_t y, int16_t z, uint8_t direction)
{
auto gameAction = PlaceParkEntranceAction({x, y, z << 4, direction});
auto gameAction = PlaceParkEntranceAction({ x, y, z * 16, direction });
auto result = GameActions::Execute(&gameAction);
if (result->Error == GA_ERROR::OK)
{
@ -43,7 +43,7 @@ money32 park_entrance_place_ghost(int32_t x, int32_t y, int32_t z, int32_t direc
{
park_entrance_remove_ghost();
auto gameAction = PlaceParkEntranceAction({x, y, z << 4, (Direction)direction});
auto gameAction = PlaceParkEntranceAction({ x, y, z * 16, (Direction)direction });
gameAction.SetFlags(GAME_COMMAND_FLAG_GHOST);
auto result = GameActions::Execute(&gameAction);
@ -178,7 +178,7 @@ money32 maze_set_track(
uint16_t x, uint16_t y, uint16_t z, uint8_t flags, bool initialPlacement, uint8_t direction, ride_id_t rideIndex,
uint8_t mode)
{
auto gameAction = MazeSetTrackAction({x, y, z, direction}, initialPlacement, rideIndex, mode);
auto gameAction = MazeSetTrackAction({ x, y, z, direction }, initialPlacement, rideIndex, mode);
gameAction.SetFlags(flags);
GameActionResult::Ptr res;

View File

@ -59,7 +59,7 @@ public:
int32_t z = tile_element_height(_loc.x, _loc.x);
res->Position.x = _loc.x + 16;
res->Position.y = _loc.y + 16;
res->Position.z = z ;
res->Position.z = z;
res->ExpenditureType = RCT_EXPENDITURE_TYPE_LANDSCAPING;
res->Cost = 0;
@ -72,10 +72,9 @@ public:
rct_scenery_entry* scenery_entry = tileElement->AsLargeScenery()->GetEntry();
LocationXYZ16 firstTile = {
scenery_entry->large_scenery.tiles[_tileIndex].x_offset, scenery_entry->large_scenery.tiles[_tileIndex].y_offset,
static_cast<int16_t>((_loc.z) - scenery_entry->large_scenery.tiles[_tileIndex].z_offset)
};
LocationXYZ16 firstTile = { scenery_entry->large_scenery.tiles[_tileIndex].x_offset,
scenery_entry->large_scenery.tiles[_tileIndex].y_offset,
static_cast<int16_t>((_loc.z) - scenery_entry->large_scenery.tiles[_tileIndex].z_offset) };
rotate_map_coordinates(&firstTile.x, &firstTile.y, _loc.direction);
@ -145,10 +144,9 @@ public:
rct_scenery_entry* scenery_entry = tileElement->AsLargeScenery()->GetEntry();
LocationXYZ16 firstTile = {
scenery_entry->large_scenery.tiles[_tileIndex].x_offset, scenery_entry->large_scenery.tiles[_tileIndex].y_offset,
static_cast<int16_t>((_loc.z) - scenery_entry->large_scenery.tiles[_tileIndex].z_offset)
};
LocationXYZ16 firstTile = { scenery_entry->large_scenery.tiles[_tileIndex].x_offset,
scenery_entry->large_scenery.tiles[_tileIndex].y_offset,
static_cast<int16_t>((_loc.z) - scenery_entry->large_scenery.tiles[_tileIndex].z_offset) };
rotate_map_coordinates(&firstTile.x, &firstTile.y, _loc.direction);
@ -225,7 +223,7 @@ private:
if (tileElement->GetType() != TILE_ELEMENT_TYPE_LARGE_SCENERY)
continue;
if (tileElement->base_height != _loc.z >> 3)
if (tileElement->base_height != _loc.z / 8)
continue;
if (tileElement->AsLargeScenery()->GetSequenceIndex() != _tileIndex)

View File

@ -6,7 +6,6 @@
*
* OpenRCT2 is licensed under the GNU General Public License version 3.
*****************************************************************************/
#pragma once
#include "../Cheats.h"
@ -20,7 +19,6 @@
#include "../world/Footpath.h"
#include "../world/Park.h"
#include "GameAction.h"
// clang-format off
/** rct2: 0x00993CE9 */
static constexpr const uint8_t byte_993CE9[] = {
@ -60,8 +58,7 @@ public:
MazeSetTrackAction()
{
}
MazeSetTrackAction(
CoordsXYZD location, bool initialPlacement, NetworkRideId_t rideIndex, uint8_t mode)
MazeSetTrackAction(CoordsXYZD location, bool initialPlacement, NetworkRideId_t rideIndex, uint8_t mode)
: _loc(location)
, _initialPlacement(initialPlacement)
, _rideIndex(rideIndex)
@ -72,8 +69,7 @@ public:
void Serialise(DataSerialiser & stream) override
{
GameAction::Serialise(stream);
stream << DS_TAG(_loc) << DS_TAG(_initialPlacement) << DS_TAG(_rideIndex) << DS_TAG(_mode);
stream << DS_TAG(_loc) << DS_TAG(_loc.direction) << DS_TAG(_initialPlacement) << DS_TAG(_rideIndex) << DS_TAG(_mode);
}
GameActionResult::Ptr Query() const override
@ -85,14 +81,12 @@ public:
res->Position.z = _loc.z;
res->ExpenditureType = RCT_EXPENDITURE_TYPE_RIDE_CONSTRUCTION;
res->ErrorTitle = STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE;
if (!map_check_free_elements_and_reorganise(1))
{
res->Error = GA_ERROR::NO_FREE_ELEMENTS;
res->ErrorMessage = STR_TILE_ELEMENT_LIMIT_REACHED;
return res;
}
if ((_loc.z & 0xF) != 0)
{
res->Error = GA_ERROR::UNKNOWN;
@ -115,8 +109,8 @@ public:
return res;
}
uint8_t baseHeight = _loc.z >> 3;
uint8_t clearanceHeight = (_loc.z + 32) >> 3;
uint8_t baseHeight = _loc.z / 8;
uint8_t clearanceHeight = (_loc.z + 32) / 8;
int8_t heightDifference = baseHeight - tileElement->base_height;
if (heightDifference >= 0 && !gCheatsDisableSupportLimits)
@ -201,10 +195,11 @@ public:
wall_remove_at(floor2(_loc.x, 32), floor2(_loc.y, 32), _loc.z, _loc.z + 32);
}
uint8_t baseHeight = _loc.z >> 3;
uint8_t clearanceHeight = (_loc.z + 32) >> 3;
uint8_t baseHeight = _loc.z / 8;
uint8_t clearanceHeight = (_loc.z + 32) / 8;
TileElement* tileElement = map_get_track_element_at_of_type_from_ride(_loc.x, _loc.y, baseHeight, TRACK_ELEM_MAZE, _rideIndex);
TileElement* tileElement = map_get_track_element_at_of_type_from_ride(
_loc.x, _loc.y, baseHeight, TRACK_ELEM_MAZE, _rideIndex);
if (tileElement == nullptr)
{
Ride* ride = get_ride(_rideIndex);
@ -333,7 +328,8 @@ public:
break;
}
map_invalidate_tile(floor2(_loc.x, 32), floor2(_loc.y, 32), tileElement->base_height * 8, tileElement->clearance_height * 8);
map_invalidate_tile(
floor2(_loc.x, 32), floor2(_loc.y, 32), tileElement->base_height * 8, tileElement->clearance_height * 8);
if ((tileElement->AsTrack()->GetMazeEntry() & 0x8888) == 0x8888)
{

View File

@ -58,7 +58,7 @@ public:
auto res = std::make_unique<GameActionResult>();
res->ExpenditureType = RCT_EXPENDITURE_TYPE_LAND_PURCHASE;
res->Position = {_loc.x, _loc.y, _loc.z};
res->Position = { _loc.x, _loc.y, _loc.z };
if (!map_check_free_elements_and_reorganise(3))
{
@ -77,7 +77,7 @@ public:
GA_ERROR::INVALID_PARAMETERS, STR_CANT_BUILD_PARK_ENTRANCE_HERE, STR_ERR_TOO_MANY_PARK_ENTRANCES);
}
int8_t zLow = _loc.z >> 3;
int8_t zLow = _loc.z / 8;
int8_t zHigh = zLow + 12;
LocationXY16 entranceLoc = { (int16_t)_loc.x, (int16_t)_loc.y };
for (uint8_t index = 0; index < 3; index++)
@ -85,11 +85,11 @@ public:
if (index == 1)
{
entranceLoc.x += CoordsDirectionDelta[(_loc.direction - 1) & 0x3].x;
entranceLoc.y += CoordsDirectionDelta[(_loc.direction - 1) & 0x3].y;
entranceLoc.y += CoordsDirectionDelta[(_loc.direction - 1) & 0x3].y;
}
else if (index == 2)
{
entranceLoc.x += CoordsDirectionDelta[(_loc.direction + 1) & 0x3].x * 2;
entranceLoc.x += CoordsDirectionDelta[(_loc.direction + 1) & 0x3].x * 2;
entranceLoc.y += CoordsDirectionDelta[(_loc.direction + 1) & 0x3].y * 2;
}
@ -121,10 +121,10 @@ public:
CoordsXYZD parkEntrance;
parkEntrance = _loc;
gParkEntrances.push_back(parkEntrance);
int8_t zLow = _loc.z >> 3;
int8_t zLow = _loc.z / 8;
int8_t zHigh = zLow + 12;
CoordsXY entranceLoc = { _loc.x, _loc.y };
for (uint8_t index = 0; index < 3; index++)

View File

@ -268,7 +268,7 @@ private:
money32 MazeRemoveTrack(uint16_t x, uint16_t y, uint16_t z, uint8_t direction) const
{
auto setMazeTrack = MazeSetTrackAction({x, y, z, direction}, false, _rideIndex, GC_SET_MAZE_TRACK_FILL);
auto setMazeTrack = MazeSetTrackAction(CoordsXYZD{ x, y, z, direction }, false, _rideIndex, GC_SET_MAZE_TRACK_FILL);
setMazeTrack.SetFlags(GetFlags());
auto execRes = GameActions::ExecuteNested(&setMazeTrack);

View File

@ -24,7 +24,7 @@
DEFINE_GAME_ACTION(RideSetColourSchemeAction, GAME_COMMAND_SET_COLOUR_SCHEME, GameActionResult)
{
private:
CoordsXYZD _loc{0,0,0,0};
CoordsXYZD _loc{ 0, 0, 0, 0 };
int32_t _trackType = 0;
uint16_t _newColourScheme = 0;

View File

@ -145,7 +145,7 @@ private:
continue;
if ((tileElement->AsSmallScenery()->GetSceneryQuadrant()) != _quadrant)
continue;
if (tileElement->base_height != _loc.z >> 3)
if (tileElement->base_height != _loc.z / 8)
continue;
if (tileElement->AsSmallScenery()->GetEntryIndex() != _sceneryType)
continue;

View File

@ -44,7 +44,7 @@ public:
res->Cost = 0;
res->ExpenditureType = RCT_EXPENDITURE_TYPE_LANDSCAPING;
if (!map_is_location_valid({ _loc.x , _loc.y }))
if (!map_is_location_valid({ _loc.x, _loc.y }))
{
return std::make_unique<GameActionResult>(
GA_ERROR::INVALID_PARAMETERS, STR_CANT_REMOVE_THIS, STR_INVALID_SELECTION_OF_OBJECTS);
@ -52,7 +52,7 @@ public:
const bool isGhost = GetFlags() & GAME_COMMAND_FLAG_GHOST;
if (!isGhost && !(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode
&& !map_is_location_owned(_loc.x , _loc.y , _loc.z ))
&& !map_is_location_owned(_loc.x, _loc.y, _loc.z))
{
return std::make_unique<GameActionResult>(GA_ERROR::NOT_OWNED, STR_CANT_REMOVE_THIS, STR_LAND_NOT_OWNED_BY_PARK);
}
@ -88,8 +88,7 @@ public:
res->Position.z = tile_element_height(res->Position.x, res->Position.y);
tile_element_remove_banner_entry(wallElement);
map_invalidate_tile_zoom1(
_loc.x, _loc.y , wallElement->base_height , wallElement->base_height + 72);
map_invalidate_tile_zoom1(_loc.x, _loc.y, wallElement->base_height * 8, (wallElement->base_height * 8) + 72);
tile_element_remove(wallElement);
return res;
@ -98,7 +97,7 @@ public:
private:
TileElement* GetFirstWallElementAt(const CoordsXYZD& location, bool isGhost) const
{
TileElement* tileElement = map_get_first_element_at(location.x >> 5 , location.y >> 5 );
TileElement* tileElement = map_get_first_element_at(location.x / 32, location.y / 32);
if (!tileElement)
return nullptr;
@ -106,7 +105,7 @@ private:
{
if (tileElement->GetType() != TILE_ELEMENT_TYPE_WALL)
continue;
if (tileElement->base_height != location.z >> 3)
if (tileElement->base_height != location.z / 8)
continue;
if (tileElement->GetDirection() != location.direction)
continue;

View File

@ -776,17 +776,17 @@ static bool TrackDesignPlaceSceneryElementRemoveGhost(
quadrant = 0;
}
ga = std::make_unique<SmallSceneryRemoveAction>(CoordsXYZ{mapCoord.x, mapCoord.y, z * 8}, quadrant, entry_index);
ga = std::make_unique<SmallSceneryRemoveAction>(CoordsXYZ{ mapCoord.x, mapCoord.y, z * 8 }, quadrant, entry_index);
break;
}
case OBJECT_TYPE_LARGE_SCENERY:
ga = std::make_unique<LargeSceneryRemoveAction>(CoordsXYZD{mapCoord.x, mapCoord.y, z * 8, sceneryRotation}, 0);
ga = std::make_unique<LargeSceneryRemoveAction>(CoordsXYZD{ mapCoord.x, mapCoord.y, z * 8, sceneryRotation }, 0);
break;
case OBJECT_TYPE_WALLS:
ga = std::make_unique<WallRemoveAction>(CoordsXYZD{ mapCoord.x , mapCoord.y , z * 8, sceneryRotation });
ga = std::make_unique<WallRemoveAction>(CoordsXYZD{ mapCoord.x, mapCoord.y, z * 8, sceneryRotation });
break;
case OBJECT_TYPE_PATHS:
ga = std::make_unique<FootpathRemoveAction>(mapCoord.x, mapCoord.y, z);
ga = std::make_unique<FootpathRemoveAction>(CoordsXYZ{ mapCoord.x, mapCoord.y, z * 8 });
break;
default:
return true;

View File

@ -127,7 +127,7 @@ TileElement* map_get_footpath_element(int32_t x, int32_t y, int32_t z)
money32 footpath_remove(int32_t x, int32_t y, int32_t z, int32_t flags)
{
auto action = FootpathRemoveAction(x, y, z);
auto action = FootpathRemoveAction({ x, y, z * 8 });
action.SetFlags(flags);
if (flags & GAME_COMMAND_FLAG_APPLY)

View File

@ -1755,7 +1755,7 @@ static void clear_element_at(int32_t x, int32_t y, TileElement** elementPtr)
}
case TILE_ELEMENT_TYPE_WALL:
{
CoordsXYZD wallLocation = { x, y, element->base_height << 3, element->GetDirection() };
CoordsXYZD wallLocation = { x, y, element->base_height * 8, element->GetDirection() };
auto wallRemoveAction = WallRemoveAction(wallLocation);
GameActions::Execute(&wallRemoveAction);
}
@ -1763,8 +1763,7 @@ static void clear_element_at(int32_t x, int32_t y, TileElement** elementPtr)
case TILE_ELEMENT_TYPE_LARGE_SCENERY:
{
auto removeSceneryAction = LargeSceneryRemoveAction(
{x, y, element->base_height << 3, element->GetDirection()}
, element->AsLargeScenery()->GetSequenceIndex());
{ x, y, element->base_height * 8, element->GetDirection() }, element->AsLargeScenery()->GetSequenceIndex());
GameActions::Execute(&removeSceneryAction);
}
break;
@ -1794,7 +1793,7 @@ static void clear_elements_at(int32_t x, int32_t y)
[x, y](const auto& spawn) { return floor2(spawn.x, 32) == x && floor2(spawn.y, 32) == y; }),
gPeepSpawns.end());
TileElement* tileElement = map_get_first_element_at(x >> 5, y >> 5);
TileElement* tileElement = map_get_first_element_at(x / 32, y / 32);
// Remove all elements except the last one
while (!tileElement->IsLastForTile())
@ -1827,7 +1826,7 @@ int32_t map_get_highest_z(int32_t tileX, int32_t tileY)
LargeSceneryElement* map_get_large_scenery_segment(int32_t x, int32_t y, int32_t z, int32_t direction, int32_t sequence)
{
TileElement* tileElement = map_get_first_element_at(x >> 5, y >> 5);
TileElement* tileElement = map_get_first_element_at(x / 32, y / 32);
if (tileElement == nullptr)
{
return nullptr;
@ -1850,7 +1849,7 @@ LargeSceneryElement* map_get_large_scenery_segment(int32_t x, int32_t y, int32_t
EntranceElement* map_get_park_entrance_element_at(int32_t x, int32_t y, int32_t z, bool ghost)
{
TileElement* tileElement = map_get_first_element_at(x >> 5, y >> 5);
TileElement* tileElement = map_get_first_element_at(x / 32, y / 32);
if (tileElement != nullptr)
{
do
@ -1875,7 +1874,7 @@ EntranceElement* map_get_park_entrance_element_at(int32_t x, int32_t y, int32_t
EntranceElement* map_get_ride_entrance_element_at(int32_t x, int32_t y, int32_t z, bool ghost)
{
TileElement* tileElement = map_get_first_element_at(x >> 5, y >> 5);
TileElement* tileElement = map_get_first_element_at(x / 32, y / 32);
if (tileElement != nullptr)
{
do
@ -1900,7 +1899,7 @@ EntranceElement* map_get_ride_entrance_element_at(int32_t x, int32_t y, int32_t
EntranceElement* map_get_ride_exit_element_at(int32_t x, int32_t y, int32_t z, bool ghost)
{
TileElement* tileElement = map_get_first_element_at(x >> 5, y >> 5);
TileElement* tileElement = map_get_first_element_at(x / 32, y / 32);
if (tileElement != nullptr)
{
do
@ -1925,7 +1924,7 @@ EntranceElement* map_get_ride_exit_element_at(int32_t x, int32_t y, int32_t z, b
SmallSceneryElement* map_get_small_scenery_element_at(int32_t x, int32_t y, int32_t z, int32_t type, uint8_t quadrant)
{
TileElement* tileElement = map_get_first_element_at(x >> 5, y >> 5);
TileElement* tileElement = map_get_first_element_at(x / 32, y / 32);
if (tileElement != nullptr)
{
do

View File

@ -186,7 +186,7 @@ void scenery_remove_ghost_tool_placement()
{
gSceneryGhostType &= ~SCENERY_GHOST_FLAG_0;
auto removeSceneryAction = SmallSceneryRemoveAction({x, y, z * 8}, gSceneryQuadrant, gSceneryPlaceObject);
auto removeSceneryAction = SmallSceneryRemoveAction({ x, y, z * 8 }, gSceneryQuadrant, gSceneryPlaceObject);
removeSceneryAction.SetFlags(
GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED | GAME_COMMAND_FLAG_NO_SPEND | GAME_COMMAND_FLAG_GHOST);
removeSceneryAction.Execute();
@ -216,7 +216,7 @@ void scenery_remove_ghost_tool_placement()
{
gSceneryGhostType &= ~SCENERY_GHOST_FLAG_2;
CoordsXYZD wallLocation = { x , y , z * 8, gSceneryGhostWallRotation };
CoordsXYZD wallLocation = { x, y, z * 8, gSceneryGhostWallRotation };
auto wallRemoveAction = WallRemoveAction(wallLocation);
wallRemoveAction.SetFlags(GAME_COMMAND_FLAG_APPLY | GAME_COMMAND_FLAG_GHOST | GAME_COMMAND_FLAG_PATH_SCENERY);
wallRemoveAction.Execute();
@ -226,7 +226,7 @@ void scenery_remove_ghost_tool_placement()
{
gSceneryGhostType &= ~SCENERY_GHOST_FLAG_3;
auto removeSceneryAction = LargeSceneryRemoveAction({x, y, z << 3, gSceneryPlaceRotation}, 0);
auto removeSceneryAction = LargeSceneryRemoveAction({ x, y, z * 8, gSceneryPlaceRotation }, 0);
removeSceneryAction.SetFlags(
GAME_COMMAND_FLAG_APPLY | GAME_COMMAND_FLAG_GHOST | GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED
| GAME_COMMAND_FLAG_NO_SPEND);