mirror of https://github.com/OpenRCT2/OpenRCT2.git
Remove snakes from construction clear (#18185)
This commit is contained in:
parent
d93b714a34
commit
85929e5914
|
@ -301,7 +301,7 @@ GameActions::Result FootpathPlaceAction::ElementInsertQuery(GameActions::Result
|
|||
uint8_t crossingMode = isQueue || (_slope != TILE_ELEMENT_SLOPE_FLAT) ? CREATE_CROSSING_MODE_NONE
|
||||
: CREATE_CROSSING_MODE_PATH_OVER_TRACK;
|
||||
auto canBuild = MapCanConstructWithClearAt(
|
||||
{ _loc, zLow, zHigh }, &map_place_non_scenery_clear_func, quarterTile, GetFlags(), crossingMode);
|
||||
{ _loc, zLow, zHigh }, &MapPlaceNonSceneryClearFunc, quarterTile, GetFlags(), crossingMode);
|
||||
if (!entrancePath && canBuild.Error != GameActions::Status::Ok)
|
||||
{
|
||||
canBuild.ErrorTitle = STR_CANT_BUILD_FOOTPATH_HERE;
|
||||
|
@ -370,8 +370,7 @@ GameActions::Result FootpathPlaceAction::ElementInsertExecute(GameActions::Resul
|
|||
uint8_t crossingMode = isQueue || (_slope != TILE_ELEMENT_SLOPE_FLAT) ? CREATE_CROSSING_MODE_NONE
|
||||
: CREATE_CROSSING_MODE_PATH_OVER_TRACK;
|
||||
auto canBuild = MapCanConstructWithClearAt(
|
||||
{ _loc, zLow, zHigh }, &map_place_non_scenery_clear_func, quarterTile, GAME_COMMAND_FLAG_APPLY | GetFlags(),
|
||||
crossingMode);
|
||||
{ _loc, zLow, zHigh }, &MapPlaceNonSceneryClearFunc, quarterTile, GAME_COMMAND_FLAG_APPLY | GetFlags(), crossingMode);
|
||||
if (!entrancePath && canBuild.Error != GameActions::Status::Ok)
|
||||
{
|
||||
canBuild.ErrorTitle = STR_CANT_BUILD_FOOTPATH_HERE;
|
||||
|
|
|
@ -143,7 +143,7 @@ GameActions::Result FootpathPlaceFromTrackAction::ElementInsertQuery(GameActions
|
|||
uint8_t crossingMode = isQueue || (_slope != TILE_ELEMENT_SLOPE_FLAT) ? CREATE_CROSSING_MODE_NONE
|
||||
: CREATE_CROSSING_MODE_PATH_OVER_TRACK;
|
||||
auto canBuild = MapCanConstructWithClearAt(
|
||||
{ _loc, zLow, zHigh }, &map_place_non_scenery_clear_func, quarterTile, GetFlags(), crossingMode);
|
||||
{ _loc, zLow, zHigh }, &MapPlaceNonSceneryClearFunc, quarterTile, GetFlags(), crossingMode);
|
||||
if (!entrancePath && canBuild.Error != GameActions::Status::Ok)
|
||||
{
|
||||
canBuild.ErrorTitle = STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE;
|
||||
|
@ -213,8 +213,7 @@ GameActions::Result FootpathPlaceFromTrackAction::ElementInsertExecute(GameActio
|
|||
uint8_t crossingMode = isQueue || (_slope != TILE_ELEMENT_SLOPE_FLAT) ? CREATE_CROSSING_MODE_NONE
|
||||
: CREATE_CROSSING_MODE_PATH_OVER_TRACK;
|
||||
auto canBuild = MapCanConstructWithClearAt(
|
||||
{ _loc, zLow, zHigh }, &map_place_non_scenery_clear_func, quarterTile, GAME_COMMAND_FLAG_APPLY | GetFlags(),
|
||||
crossingMode);
|
||||
{ _loc, zLow, zHigh }, &MapPlaceNonSceneryClearFunc, quarterTile, GAME_COMMAND_FLAG_APPLY | GetFlags(), crossingMode);
|
||||
if (!entrancePath && canBuild.Error != GameActions::Status::Ok)
|
||||
{
|
||||
canBuild.ErrorTitle = STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE;
|
||||
|
|
|
@ -76,7 +76,7 @@ GameActions::Result LandSetHeightAction::Query() const
|
|||
if (tileElement != nullptr)
|
||||
{
|
||||
auto res = GameActions::Result(GameActions::Status::Disallowed, STR_NONE, STR_NONE);
|
||||
map_obstruction_set_error_text(tileElement, res);
|
||||
MapGetObstructionErrorText(tileElement, res);
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ GameActions::Result LandSetHeightAction::Query() const
|
|||
if (tileElement != nullptr)
|
||||
{
|
||||
auto res = GameActions::Result(GameActions::Status::Disallowed, STR_NONE, STR_NONE);
|
||||
map_obstruction_set_error_text(tileElement, res);
|
||||
MapGetObstructionErrorText(tileElement, res);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
|
@ -120,8 +120,7 @@ GameActions::Result LargeSceneryPlaceAction::Query() const
|
|||
QuarterTile quarterTile = QuarterTile{ static_cast<uint8_t>(tile->flags >> 12), 0 }.Rotate(_loc.direction);
|
||||
const auto isTree = (sceneryEntry->flags & LARGE_SCENERY_FLAG_IS_TREE) != 0;
|
||||
auto canBuild = MapCanConstructWithClearAt(
|
||||
{ curTile, zLow, zHigh }, &map_place_scenery_clear_func, quarterTile, GetFlags(), CREATE_CROSSING_MODE_NONE,
|
||||
isTree);
|
||||
{ curTile, zLow, zHigh }, &MapPlaceSceneryClearFunc, quarterTile, GetFlags(), CREATE_CROSSING_MODE_NONE, isTree);
|
||||
if (canBuild.Error != GameActions::Status::Ok)
|
||||
{
|
||||
canBuild.ErrorTitle = STR_CANT_POSITION_THIS_HERE;
|
||||
|
@ -257,8 +256,7 @@ GameActions::Result LargeSceneryPlaceAction::Execute() const
|
|||
QuarterTile quarterTile = QuarterTile{ static_cast<uint8_t>(tile->flags >> 12), 0 }.Rotate(_loc.direction);
|
||||
const auto isTree = (sceneryEntry->flags & LARGE_SCENERY_FLAG_IS_TREE) != 0;
|
||||
auto canBuild = MapCanConstructWithClearAt(
|
||||
{ curTile, zLow, zHigh }, &map_place_scenery_clear_func, quarterTile, GetFlags(), CREATE_CROSSING_MODE_NONE,
|
||||
isTree);
|
||||
{ curTile, zLow, zHigh }, &MapPlaceSceneryClearFunc, quarterTile, GetFlags(), CREATE_CROSSING_MODE_NONE, isTree);
|
||||
if (canBuild.Error != GameActions::Status::Ok)
|
||||
{
|
||||
if (banner != nullptr)
|
||||
|
|
|
@ -90,7 +90,7 @@ GameActions::Result MazePlaceTrackAction::Query() const
|
|||
}
|
||||
|
||||
auto canBuild = MapCanConstructWithClearAt(
|
||||
{ _loc.ToTileStart(), baseHeight, clearanceHeight }, &map_place_non_scenery_clear_func, { 0b1111, 0 }, GetFlags());
|
||||
{ _loc.ToTileStart(), baseHeight, clearanceHeight }, &MapPlaceNonSceneryClearFunc, { 0b1111, 0 }, GetFlags());
|
||||
if (canBuild.Error != GameActions::Status::Ok)
|
||||
{
|
||||
canBuild.ErrorTitle = STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE;
|
||||
|
@ -152,7 +152,7 @@ GameActions::Result MazePlaceTrackAction::Execute() const
|
|||
auto clearanceHeight = _loc.z + MAZE_CLEARANCE_HEIGHT;
|
||||
|
||||
auto canBuild = MapCanConstructWithClearAt(
|
||||
{ _loc.ToTileStart(), baseHeight, clearanceHeight }, &map_place_non_scenery_clear_func, { 0b1111, 0 },
|
||||
{ _loc.ToTileStart(), baseHeight, clearanceHeight }, &MapPlaceNonSceneryClearFunc, { 0b1111, 0 },
|
||||
GetFlags() | GAME_COMMAND_FLAG_APPLY);
|
||||
if (canBuild.Error != GameActions::Status::Ok)
|
||||
{
|
||||
|
|
|
@ -102,8 +102,7 @@ GameActions::Result RideEntranceExitPlaceAction::Query() const
|
|||
return GameActions::Result(GameActions::Status::NoFreeElements, errorTitle, STR_TILE_ELEMENT_LIMIT_REACHED);
|
||||
}
|
||||
auto clear_z = z + (_isExit ? RideExitHeight : RideEntranceHeight);
|
||||
auto canBuild = MapCanConstructWithClearAt(
|
||||
{ _loc, z, clear_z }, &map_place_non_scenery_clear_func, { 0b1111, 0 }, GetFlags());
|
||||
auto canBuild = MapCanConstructWithClearAt({ _loc, z, clear_z }, &MapPlaceNonSceneryClearFunc, { 0b1111, 0 }, GetFlags());
|
||||
if (canBuild.Error != GameActions::Status::Ok)
|
||||
{
|
||||
canBuild.ErrorTitle = errorTitle;
|
||||
|
@ -171,7 +170,7 @@ GameActions::Result RideEntranceExitPlaceAction::Execute() const
|
|||
|
||||
auto clear_z = z + (_isExit ? RideExitHeight : RideEntranceHeight);
|
||||
auto canBuild = MapCanConstructWithClearAt(
|
||||
{ _loc, z, clear_z }, &map_place_non_scenery_clear_func, { 0b1111, 0 }, GetFlags() | GAME_COMMAND_FLAG_APPLY);
|
||||
{ _loc, z, clear_z }, &MapPlaceNonSceneryClearFunc, { 0b1111, 0 }, GetFlags() | GAME_COMMAND_FLAG_APPLY);
|
||||
if (canBuild.Error != GameActions::Status::Ok)
|
||||
{
|
||||
canBuild.ErrorTitle = errorTitle;
|
||||
|
@ -237,7 +236,7 @@ GameActions::Result RideEntranceExitPlaceAction::TrackPlaceQuery(const CoordsXYZ
|
|||
}
|
||||
int16_t baseZ = loc.z;
|
||||
int16_t clearZ = baseZ + (isExit ? RideExitHeight : RideEntranceHeight);
|
||||
auto canBuild = MapCanConstructWithClearAt({ loc, baseZ, clearZ }, &map_place_non_scenery_clear_func, { 0b1111, 0 }, 0);
|
||||
auto canBuild = MapCanConstructWithClearAt({ loc, baseZ, clearZ }, &MapPlaceNonSceneryClearFunc, { 0b1111, 0 }, 0);
|
||||
if (canBuild.Error != GameActions::Status::Ok)
|
||||
{
|
||||
canBuild.ErrorTitle = errorTitle;
|
||||
|
|
|
@ -259,7 +259,7 @@ GameActions::Result SmallSceneryPlaceAction::Query() const
|
|||
QuarterTile quarterTile = QuarterTile{ collisionQuadrants, supports }.Rotate(quadRotation);
|
||||
const auto isTree = sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_IS_TREE);
|
||||
auto canBuild = MapCanConstructWithClearAt(
|
||||
{ _loc, zLow, zHigh }, &map_place_scenery_clear_func, quarterTile, GetFlags(), CREATE_CROSSING_MODE_NONE, isTree);
|
||||
{ _loc, zLow, zHigh }, &MapPlaceSceneryClearFunc, quarterTile, GetFlags(), CREATE_CROSSING_MODE_NONE, isTree);
|
||||
if (canBuild.Error != GameActions::Status::Ok)
|
||||
{
|
||||
canBuild.ErrorTitle = STR_CANT_POSITION_THIS_HERE;
|
||||
|
@ -396,7 +396,7 @@ GameActions::Result SmallSceneryPlaceAction::Execute() const
|
|||
QuarterTile quarterTile = QuarterTile{ collisionQuadrants, supports }.Rotate(quadRotation);
|
||||
const auto isTree = sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_IS_TREE);
|
||||
auto canBuild = MapCanConstructWithClearAt(
|
||||
{ _loc, zLow, zHigh }, &map_place_scenery_clear_func, quarterTile, GetFlags() | GAME_COMMAND_FLAG_APPLY,
|
||||
{ _loc, zLow, zHigh }, &MapPlaceSceneryClearFunc, quarterTile, GetFlags() | GAME_COMMAND_FLAG_APPLY,
|
||||
CREATE_CROSSING_MODE_NONE, isTree);
|
||||
if (canBuild.Error != GameActions::Status::Ok)
|
||||
{
|
||||
|
|
|
@ -250,7 +250,7 @@ GameActions::Result TrackPlaceAction::Query() const
|
|||
? CREATE_CROSSING_MODE_TRACK_OVER_PATH
|
||||
: CREATE_CROSSING_MODE_NONE;
|
||||
auto canBuild = MapCanConstructWithClearAt(
|
||||
{ mapLoc, baseZ, clearanceZ }, &map_place_non_scenery_clear_func, quarterTile, GetFlags(), crossingMode);
|
||||
{ mapLoc, baseZ, clearanceZ }, &MapPlaceNonSceneryClearFunc, quarterTile, GetFlags(), crossingMode);
|
||||
if (canBuild.Error != GameActions::Status::Ok)
|
||||
{
|
||||
canBuild.ErrorTitle = STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE;
|
||||
|
@ -468,8 +468,7 @@ GameActions::Result TrackPlaceAction::Execute() const
|
|||
? CREATE_CROSSING_MODE_TRACK_OVER_PATH
|
||||
: CREATE_CROSSING_MODE_NONE;
|
||||
auto canBuild = MapCanConstructWithClearAt(
|
||||
mapLocWithClearance, &map_place_non_scenery_clear_func, quarterTile, GetFlags() | GAME_COMMAND_FLAG_APPLY,
|
||||
crossingMode);
|
||||
mapLocWithClearance, &MapPlaceNonSceneryClearFunc, quarterTile, GetFlags() | GAME_COMMAND_FLAG_APPLY, crossingMode);
|
||||
if (canBuild.Error != GameActions::Status::Ok)
|
||||
{
|
||||
canBuild.ErrorTitle = STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE;
|
||||
|
|
|
@ -521,7 +521,7 @@ GameActions::Result WallPlaceAction::WallCheckObstruction(
|
|||
if (_edge == direction)
|
||||
{
|
||||
auto res = GameActions::Result(GameActions::Status::NoClearance, STR_CANT_BUILD_THIS_HERE, STR_NONE);
|
||||
map_obstruction_set_error_text(tileElement, res);
|
||||
MapGetObstructionErrorText(tileElement, res);
|
||||
return res;
|
||||
}
|
||||
continue;
|
||||
|
@ -532,12 +532,12 @@ GameActions::Result WallPlaceAction::WallCheckObstruction(
|
|||
switch (elementType)
|
||||
{
|
||||
case TileElementType::Entrance:
|
||||
map_obstruction_set_error_text(tileElement, res);
|
||||
MapGetObstructionErrorText(tileElement, res);
|
||||
return res;
|
||||
case TileElementType::Path:
|
||||
if (tileElement->AsPath()->GetEdges() & (1 << _edge))
|
||||
{
|
||||
map_obstruction_set_error_text(tileElement, res);
|
||||
MapGetObstructionErrorText(tileElement, res);
|
||||
return res;
|
||||
}
|
||||
break;
|
||||
|
@ -556,7 +556,7 @@ GameActions::Result WallPlaceAction::WallCheckObstruction(
|
|||
int32_t direction = ((_edge - tileElement->GetDirection()) & TILE_ELEMENT_DIRECTION_MASK) + 8;
|
||||
if (!(tile.flags & (1 << direction)))
|
||||
{
|
||||
map_obstruction_set_error_text(tileElement, res);
|
||||
MapGetObstructionErrorText(tileElement, res);
|
||||
return res;
|
||||
}
|
||||
break;
|
||||
|
@ -566,7 +566,7 @@ GameActions::Result WallPlaceAction::WallCheckObstruction(
|
|||
auto sceneryEntry = tileElement->AsSmallScenery()->GetEntry();
|
||||
if (sceneryEntry != nullptr && sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_NO_WALLS))
|
||||
{
|
||||
map_obstruction_set_error_text(tileElement, res);
|
||||
MapGetObstructionErrorText(tileElement, res);
|
||||
return res;
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include "SmallScenery.h"
|
||||
#include "Surface.h"
|
||||
|
||||
static int32_t map_place_clear_func(
|
||||
static int32_t MapPlaceClearFunc(
|
||||
TileElement** tile_element, const CoordsXY& coords, uint8_t flags, money32* price, bool is_scenery)
|
||||
{
|
||||
if ((*tile_element)->GetType() != TileElementType::SmallScenery)
|
||||
|
@ -57,18 +57,18 @@ static int32_t map_place_clear_func(
|
|||
*
|
||||
* rct2: 0x006E0D6E, 0x006B8D88
|
||||
*/
|
||||
int32_t map_place_scenery_clear_func(TileElement** tile_element, const CoordsXY& coords, uint8_t flags, money32* price)
|
||||
int32_t MapPlaceSceneryClearFunc(TileElement** tile_element, const CoordsXY& coords, uint8_t flags, money32* price)
|
||||
{
|
||||
return map_place_clear_func(tile_element, coords, flags, price, /*is_scenery=*/true);
|
||||
return MapPlaceClearFunc(tile_element, coords, flags, price, /*is_scenery=*/true);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006C5A4F, 0x006CDE57, 0x006A6733, 0x0066637E
|
||||
*/
|
||||
int32_t map_place_non_scenery_clear_func(TileElement** tile_element, const CoordsXY& coords, uint8_t flags, money32* price)
|
||||
int32_t MapPlaceNonSceneryClearFunc(TileElement** tile_element, const CoordsXY& coords, uint8_t flags, money32* price)
|
||||
{
|
||||
return map_place_clear_func(tile_element, coords, flags, price, /*is_scenery=*/false);
|
||||
return MapPlaceClearFunc(tile_element, coords, flags, price, /*is_scenery=*/false);
|
||||
}
|
||||
|
||||
static bool MapLoc68BABCShouldContinue(
|
||||
|
@ -160,7 +160,7 @@ GameActions::Result MapCanConstructWithClearAt(
|
|||
continue;
|
||||
}
|
||||
|
||||
map_obstruction_set_error_text(tileElement, res);
|
||||
MapGetObstructionErrorText(tileElement, res);
|
||||
res.Error = GameActions::Status::NoClearance;
|
||||
return res;
|
||||
}
|
||||
|
@ -257,7 +257,7 @@ GameActions::Result MapCanConstructWithClearAt(
|
|||
continue;
|
||||
}
|
||||
|
||||
map_obstruction_set_error_text(tileElement, res);
|
||||
MapGetObstructionErrorText(tileElement, res);
|
||||
res.Error = GameActions::Status::NoClearance;
|
||||
return res;
|
||||
}
|
||||
|
@ -278,7 +278,7 @@ GameActions::Result MapCanConstructAt(const CoordsXYRangedZ& pos, QuarterTile bl
|
|||
*
|
||||
* rct2: 0x0068BB18
|
||||
*/
|
||||
void map_obstruction_set_error_text(TileElement* tileElement, GameActions::Result& res)
|
||||
void MapGetObstructionErrorText(TileElement* tileElement, GameActions::Result& res)
|
||||
{
|
||||
Ride* ride;
|
||||
|
||||
|
|
|
@ -22,8 +22,8 @@ class QuarterTile;
|
|||
|
||||
using CLEAR_FUNC = int32_t (*)(TileElement** tile_element, const CoordsXY& coords, uint8_t flags, money32* price);
|
||||
|
||||
int32_t map_place_non_scenery_clear_func(TileElement** tile_element, const CoordsXY& coords, uint8_t flags, money32* price);
|
||||
int32_t map_place_scenery_clear_func(TileElement** tile_element, const CoordsXY& coords, uint8_t flags, money32* price);
|
||||
int32_t MapPlaceNonSceneryClearFunc(TileElement** tile_element, const CoordsXY& coords, uint8_t flags, money32* price);
|
||||
int32_t MapPlaceSceneryClearFunc(TileElement** tile_element, const CoordsXY& coords, uint8_t flags, money32* price);
|
||||
|
||||
struct ConstructClearResult
|
||||
{
|
||||
|
@ -36,4 +36,4 @@ struct ConstructClearResult
|
|||
|
||||
[[nodiscard]] GameActions::Result MapCanConstructAt(const CoordsXYRangedZ& pos, QuarterTile bl);
|
||||
|
||||
void map_obstruction_set_error_text(TileElement* tileElement, GameActions::Result& res);
|
||||
void MapGetObstructionErrorText(TileElement* tileElement, GameActions::Result& res);
|
||||
|
|
Loading…
Reference in New Issue