|
|
|
|
@@ -31,8 +31,7 @@
|
|
|
|
|
|
|
|
|
|
using namespace OpenRCT2;
|
|
|
|
|
|
|
|
|
|
uint32_t windowTileInspectorTileX;
|
|
|
|
|
uint32_t windowTileInspectorTileY;
|
|
|
|
|
TileCoordsXY windowTileInspectorTile;
|
|
|
|
|
int32_t windowTileInspectorElementCount = 0;
|
|
|
|
|
int32_t windowTileInspectorSelectedIndex;
|
|
|
|
|
|
|
|
|
|
@@ -122,8 +121,7 @@ GameActionResult::Ptr tile_inspector_insert_corrupt_at(const CoordsXY& loc, int1
|
|
|
|
|
|
|
|
|
|
// Update the tile inspector's list for everyone who has the tile selected
|
|
|
|
|
rct_window* const tileInspectorWindow = window_find_by_class(WC_TILE_INSPECTOR);
|
|
|
|
|
if (tileInspectorWindow != nullptr && static_cast<uint32_t>(loc.x / 32) == windowTileInspectorTileX
|
|
|
|
|
&& static_cast<uint32_t>(loc.y / 32) == windowTileInspectorTileY)
|
|
|
|
|
if (tileInspectorWindow != nullptr && loc == windowTileInspectorTile.ToCoordsXY())
|
|
|
|
|
{
|
|
|
|
|
windowTileInspectorElementCount++;
|
|
|
|
|
|
|
|
|
|
@@ -224,8 +222,7 @@ GameActionResult::Ptr tile_inspector_remove_element_at(const CoordsXY& loc, int1
|
|
|
|
|
|
|
|
|
|
// Update the window
|
|
|
|
|
rct_window* const tileInspectorWindow = window_find_by_class(WC_TILE_INSPECTOR);
|
|
|
|
|
if (tileInspectorWindow != nullptr && static_cast<uint32_t>(loc.x / 32) == windowTileInspectorTileX
|
|
|
|
|
&& static_cast<uint32_t>(loc.y / 32) == windowTileInspectorTileY)
|
|
|
|
|
if (tileInspectorWindow != nullptr && loc == windowTileInspectorTile.ToCoordsXY())
|
|
|
|
|
{
|
|
|
|
|
windowTileInspectorElementCount--;
|
|
|
|
|
|
|
|
|
|
@@ -257,8 +254,7 @@ GameActionResult::Ptr tile_inspector_swap_elements_at(const CoordsXY& loc, int16
|
|
|
|
|
|
|
|
|
|
// Update the window
|
|
|
|
|
rct_window* const tileInspectorWindow = window_find_by_class(WC_TILE_INSPECTOR);
|
|
|
|
|
if (tileInspectorWindow != nullptr && static_cast<uint32_t>(loc.x / 32) == windowTileInspectorTileX
|
|
|
|
|
&& static_cast<uint32_t>(loc.y / 32) == windowTileInspectorTileY)
|
|
|
|
|
if (tileInspectorWindow != nullptr && loc == windowTileInspectorTile.ToCoordsXY())
|
|
|
|
|
{
|
|
|
|
|
// If one of them was selected, update selected list item
|
|
|
|
|
if (windowTileInspectorSelectedIndex == first)
|
|
|
|
|
@@ -345,8 +341,7 @@ GameActionResult::Ptr tile_inspector_rotate_element_at(const CoordsXY& loc, int3
|
|
|
|
|
|
|
|
|
|
map_invalidate_tile_full(loc);
|
|
|
|
|
|
|
|
|
|
if (static_cast<uint32_t>(loc.x / 32) == windowTileInspectorTileX
|
|
|
|
|
&& static_cast<uint32_t>(loc.y / 32) == windowTileInspectorTileY)
|
|
|
|
|
if (loc == windowTileInspectorTile.ToCoordsXY())
|
|
|
|
|
{
|
|
|
|
|
window_invalidate_by_class(WC_TILE_INSPECTOR);
|
|
|
|
|
}
|
|
|
|
|
@@ -396,8 +391,7 @@ GameActionResult::Ptr tile_inspector_paste_element_at(const CoordsXY& loc, TileE
|
|
|
|
|
map_invalidate_tile_full(loc);
|
|
|
|
|
|
|
|
|
|
rct_window* const tileInspectorWindow = window_find_by_class(WC_TILE_INSPECTOR);
|
|
|
|
|
if (tileInspectorWindow != nullptr && static_cast<uint32_t>(tileLoc.x) == windowTileInspectorTileX
|
|
|
|
|
&& static_cast<uint32_t>(tileLoc.y) == windowTileInspectorTileY)
|
|
|
|
|
if (tileInspectorWindow != nullptr && tileLoc == windowTileInspectorTile)
|
|
|
|
|
{
|
|
|
|
|
windowTileInspectorElementCount++;
|
|
|
|
|
|
|
|
|
|
@@ -463,8 +457,7 @@ GameActionResult::Ptr tile_inspector_sort_elements_at(const CoordsXY& loc, bool
|
|
|
|
|
|
|
|
|
|
// Deselect tile for clients who had it selected
|
|
|
|
|
rct_window* const tileInspectorWindow = window_find_by_class(WC_TILE_INSPECTOR);
|
|
|
|
|
if (tileInspectorWindow != nullptr && static_cast<uint32_t>(loc.x / 32) == windowTileInspectorTileX
|
|
|
|
|
&& static_cast<uint32_t>(loc.y / 32) == windowTileInspectorTileY)
|
|
|
|
|
if (tileInspectorWindow != nullptr && loc == windowTileInspectorTile.ToCoordsXY())
|
|
|
|
|
{
|
|
|
|
|
windowTileInspectorSelectedIndex = -1;
|
|
|
|
|
tileInspectorWindow->Invalidate();
|
|
|
|
|
@@ -474,6 +467,29 @@ GameActionResult::Ptr tile_inspector_sort_elements_at(const CoordsXY& loc, bool
|
|
|
|
|
return std::make_unique<GameActionResult>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static GameActionResult::Ptr ValidateTileHeight(TileElement* const tileElement, int8_t heightOffset)
|
|
|
|
|
{
|
|
|
|
|
int16_t newBaseHeight = static_cast<int16_t>(tileElement->base_height + heightOffset);
|
|
|
|
|
int16_t newClearanceHeight = static_cast<int16_t>(tileElement->clearance_height + heightOffset);
|
|
|
|
|
if (newBaseHeight < 0)
|
|
|
|
|
{
|
|
|
|
|
return std::make_unique<GameActionResult>(GA_ERROR::TOO_LOW, STR_CANT_LOWER_ELEMENT_HERE, STR_TOO_LOW);
|
|
|
|
|
}
|
|
|
|
|
else if (newBaseHeight > MAX_ELEMENT_HEIGHT)
|
|
|
|
|
{
|
|
|
|
|
return std::make_unique<GameActionResult>(GA_ERROR::TOO_HIGH, STR_CANT_RAISE_ELEMENT_HERE, STR_TOO_HIGH);
|
|
|
|
|
}
|
|
|
|
|
else if (newClearanceHeight < 0)
|
|
|
|
|
{
|
|
|
|
|
return std::make_unique<GameActionResult>(GA_ERROR::NO_CLEARANCE, STR_CANT_LOWER_ELEMENT_HERE, STR_NO_CLEARANCE);
|
|
|
|
|
}
|
|
|
|
|
else if (newClearanceHeight > MAX_ELEMENT_HEIGHT)
|
|
|
|
|
{
|
|
|
|
|
return std::make_unique<GameActionResult>(GA_ERROR::NO_CLEARANCE, STR_CANT_RAISE_ELEMENT_HERE, STR_NO_CLEARANCE);
|
|
|
|
|
}
|
|
|
|
|
return std::make_unique<GameActionResult>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GameActionResult::Ptr tile_inspector_any_base_height_offset(
|
|
|
|
|
const CoordsXY& loc, int16_t elementIndex, int8_t heightOffset, bool isExecuting)
|
|
|
|
|
{
|
|
|
|
|
@@ -481,13 +497,9 @@ GameActionResult::Ptr tile_inspector_any_base_height_offset(
|
|
|
|
|
if (tileElement == nullptr)
|
|
|
|
|
return std::make_unique<GameActionResult>(GA_ERROR::UNKNOWN, STR_NONE);
|
|
|
|
|
|
|
|
|
|
int16_t newBaseHeight = static_cast<int16_t>(tileElement->base_height + heightOffset);
|
|
|
|
|
int16_t newClearanceHeight = static_cast<int16_t>(tileElement->clearance_height + heightOffset);
|
|
|
|
|
if (newBaseHeight < 0 || newBaseHeight > MAX_ELEMENT_HEIGHT || newClearanceHeight < 0
|
|
|
|
|
|| newClearanceHeight > MAX_ELEMENT_HEIGHT)
|
|
|
|
|
{
|
|
|
|
|
return std::make_unique<GameActionResult>(GA_ERROR::UNKNOWN, STR_NONE);
|
|
|
|
|
}
|
|
|
|
|
auto heightValidationResult = ValidateTileHeight(tileElement, heightOffset);
|
|
|
|
|
if (heightValidationResult->Error != GA_ERROR::OK)
|
|
|
|
|
return heightValidationResult;
|
|
|
|
|
|
|
|
|
|
if (isExecuting)
|
|
|
|
|
{
|
|
|
|
|
@@ -506,12 +518,10 @@ GameActionResult::Ptr tile_inspector_any_base_height_offset(
|
|
|
|
|
uint8_t z = tileElement->base_height;
|
|
|
|
|
|
|
|
|
|
// Make sure this is the correct entrance or exit
|
|
|
|
|
if (entranceType == ENTRANCE_TYPE_RIDE_ENTRANCE && entrance.x == loc.x / 32 && entrance.y == loc.y / 32
|
|
|
|
|
&& entrance.z == z)
|
|
|
|
|
if (entranceType == ENTRANCE_TYPE_RIDE_ENTRANCE && entrance == TileCoordsXYZ{ loc, z })
|
|
|
|
|
ride_set_entrance_location(
|
|
|
|
|
ride, entranceIndex, { entrance.x, entrance.y, z + heightOffset, entrance.direction });
|
|
|
|
|
else if (
|
|
|
|
|
entranceType == ENTRANCE_TYPE_RIDE_EXIT && exit.x == loc.x / 32 && exit.y == loc.y / 32 && exit.z == z)
|
|
|
|
|
else if (entranceType == ENTRANCE_TYPE_RIDE_EXIT && exit == TileCoordsXYZ{ loc, z })
|
|
|
|
|
ride_set_exit_location(ride, entranceIndex, { exit.x, exit.y, z + heightOffset, exit.direction });
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@@ -523,8 +533,7 @@ GameActionResult::Ptr tile_inspector_any_base_height_offset(
|
|
|
|
|
map_invalidate_tile_full(loc);
|
|
|
|
|
|
|
|
|
|
rct_window* const tileInspectorWindow = window_find_by_class(WC_TILE_INSPECTOR);
|
|
|
|
|
if (tileInspectorWindow != nullptr && static_cast<uint32_t>(loc.x / 32) == windowTileInspectorTileX
|
|
|
|
|
&& static_cast<uint32_t>(loc.y / 32) == windowTileInspectorTileY)
|
|
|
|
|
if (tileInspectorWindow != nullptr && loc == windowTileInspectorTile.ToCoordsXY())
|
|
|
|
|
{
|
|
|
|
|
tileInspectorWindow->Invalidate();
|
|
|
|
|
}
|
|
|
|
|
@@ -551,8 +560,7 @@ GameActionResult::Ptr tile_inspector_surface_show_park_fences(const CoordsXY& lo
|
|
|
|
|
map_invalidate_tile_full(loc);
|
|
|
|
|
|
|
|
|
|
rct_window* const tileInspectorWindow = window_find_by_class(WC_TILE_INSPECTOR);
|
|
|
|
|
if (tileInspectorWindow != nullptr && static_cast<uint32_t>(loc.x / 32) == windowTileInspectorTileX
|
|
|
|
|
&& static_cast<uint32_t>(loc.y / 32) == windowTileInspectorTileY)
|
|
|
|
|
if (tileInspectorWindow != nullptr && loc == windowTileInspectorTile.ToCoordsXY())
|
|
|
|
|
{
|
|
|
|
|
tileInspectorWindow->Invalidate();
|
|
|
|
|
}
|
|
|
|
|
@@ -618,8 +626,7 @@ GameActionResult::Ptr tile_inspector_surface_toggle_corner(const CoordsXY& loc,
|
|
|
|
|
map_invalidate_tile_full(loc);
|
|
|
|
|
|
|
|
|
|
rct_window* const tileInspectorWindow = window_find_by_class(WC_TILE_INSPECTOR);
|
|
|
|
|
if (tileInspectorWindow != nullptr && static_cast<uint32_t>(loc.x / 32) == windowTileInspectorTileX
|
|
|
|
|
&& static_cast<uint32_t>(loc.y / 32) == windowTileInspectorTileY)
|
|
|
|
|
if (tileInspectorWindow != nullptr && loc == windowTileInspectorTile.ToCoordsXY())
|
|
|
|
|
{
|
|
|
|
|
tileInspectorWindow->Invalidate();
|
|
|
|
|
}
|
|
|
|
|
@@ -656,8 +663,7 @@ GameActionResult::Ptr tile_inspector_surface_toggle_diagonal(const CoordsXY& loc
|
|
|
|
|
map_invalidate_tile_full(loc);
|
|
|
|
|
|
|
|
|
|
rct_window* const tileInspectorWindow = window_find_by_class(WC_TILE_INSPECTOR);
|
|
|
|
|
if (tileInspectorWindow != nullptr && static_cast<uint32_t>(loc.x / 32) == windowTileInspectorTileX
|
|
|
|
|
&& static_cast<uint32_t>(loc.y / 32) == windowTileInspectorTileY)
|
|
|
|
|
if (tileInspectorWindow != nullptr && loc == windowTileInspectorTile.ToCoordsXY())
|
|
|
|
|
{
|
|
|
|
|
tileInspectorWindow->Invalidate();
|
|
|
|
|
}
|
|
|
|
|
@@ -680,8 +686,7 @@ GameActionResult::Ptr tile_inspector_path_set_sloped(const CoordsXY& loc, int32_
|
|
|
|
|
map_invalidate_tile_full(loc);
|
|
|
|
|
|
|
|
|
|
rct_window* const tileInspectorWindow = window_find_by_class(WC_TILE_INSPECTOR);
|
|
|
|
|
if (tileInspectorWindow != nullptr && static_cast<uint32_t>(loc.x / 32) == windowTileInspectorTileX
|
|
|
|
|
&& static_cast<uint32_t>(loc.y / 32) == windowTileInspectorTileY)
|
|
|
|
|
if (tileInspectorWindow != nullptr && loc == windowTileInspectorTile.ToCoordsXY())
|
|
|
|
|
{
|
|
|
|
|
tileInspectorWindow->Invalidate();
|
|
|
|
|
}
|
|
|
|
|
@@ -704,8 +709,7 @@ GameActionResult::Ptr tile_inspector_path_set_broken(const CoordsXY& loc, int32_
|
|
|
|
|
map_invalidate_tile_full(loc);
|
|
|
|
|
|
|
|
|
|
rct_window* const tileInspectorWindow = window_find_by_class(WC_TILE_INSPECTOR);
|
|
|
|
|
if (tileInspectorWindow != nullptr && static_cast<uint32_t>(loc.x / 32) == windowTileInspectorTileX
|
|
|
|
|
&& static_cast<uint32_t>(loc.y / 32) == windowTileInspectorTileY)
|
|
|
|
|
if (tileInspectorWindow != nullptr && loc == windowTileInspectorTile.ToCoordsXY())
|
|
|
|
|
{
|
|
|
|
|
tileInspectorWindow->Invalidate();
|
|
|
|
|
}
|
|
|
|
|
@@ -730,8 +734,7 @@ GameActionResult::Ptr tile_inspector_path_toggle_edge(
|
|
|
|
|
map_invalidate_tile_full(loc);
|
|
|
|
|
|
|
|
|
|
rct_window* const tileInspectorWindow = window_find_by_class(WC_TILE_INSPECTOR);
|
|
|
|
|
if (tileInspectorWindow != nullptr && static_cast<uint32_t>(loc.x / 32) == windowTileInspectorTileX
|
|
|
|
|
&& static_cast<uint32_t>(loc.y / 32) == windowTileInspectorTileY)
|
|
|
|
|
if (tileInspectorWindow != nullptr && loc == windowTileInspectorTile.ToCoordsXY())
|
|
|
|
|
{
|
|
|
|
|
tileInspectorWindow->Invalidate();
|
|
|
|
|
}
|
|
|
|
|
@@ -772,8 +775,7 @@ GameActionResult::Ptr tile_inspector_entrance_make_usable(const CoordsXY& loc, i
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
rct_window* const tileInspectorWindow = window_find_by_class(WC_TILE_INSPECTOR);
|
|
|
|
|
if (tileInspectorWindow != nullptr && static_cast<uint32_t>(loc.x / 32) == windowTileInspectorTileX
|
|
|
|
|
&& static_cast<uint32_t>(loc.y / 32) == windowTileInspectorTileY)
|
|
|
|
|
if (tileInspectorWindow != nullptr && loc == windowTileInspectorTile.ToCoordsXY())
|
|
|
|
|
{
|
|
|
|
|
tileInspectorWindow->Invalidate();
|
|
|
|
|
}
|
|
|
|
|
@@ -798,8 +800,7 @@ GameActionResult::Ptr tile_inspector_wall_set_slope(
|
|
|
|
|
map_invalidate_tile_full(loc);
|
|
|
|
|
|
|
|
|
|
rct_window* const tileInspectorWindow = window_find_by_class(WC_TILE_INSPECTOR);
|
|
|
|
|
if (tileInspectorWindow != nullptr && static_cast<uint32_t>(loc.x / 32) == windowTileInspectorTileX
|
|
|
|
|
&& static_cast<uint32_t>(loc.y / 32) == windowTileInspectorTileY)
|
|
|
|
|
if (tileInspectorWindow != nullptr && loc == windowTileInspectorTile.ToCoordsXY())
|
|
|
|
|
{
|
|
|
|
|
tileInspectorWindow->Invalidate();
|
|
|
|
|
}
|
|
|
|
|
@@ -824,8 +825,7 @@ GameActionResult::Ptr tile_inspector_wall_animation_frame_offset(
|
|
|
|
|
map_invalidate_tile_full(loc);
|
|
|
|
|
|
|
|
|
|
rct_window* const tileInspectorWindow = window_find_by_class(WC_TILE_INSPECTOR);
|
|
|
|
|
if (tileInspectorWindow != nullptr && static_cast<uint32_t>(loc.x / 32) == windowTileInspectorTileX
|
|
|
|
|
&& static_cast<uint32_t>(loc.y / 32) == windowTileInspectorTileY)
|
|
|
|
|
if (tileInspectorWindow != nullptr && loc == windowTileInspectorTile.ToCoordsXY())
|
|
|
|
|
{
|
|
|
|
|
tileInspectorWindow->Invalidate();
|
|
|
|
|
}
|
|
|
|
|
@@ -1057,8 +1057,7 @@ GameActionResult::Ptr tile_inspector_track_set_block_brake(
|
|
|
|
|
map_invalidate_tile_full(loc);
|
|
|
|
|
|
|
|
|
|
rct_window* const tileInspectorWindow = window_find_by_class(WC_TILE_INSPECTOR);
|
|
|
|
|
if (tileInspectorWindow != nullptr && static_cast<uint32_t>(loc.x / 32) == windowTileInspectorTileX
|
|
|
|
|
&& static_cast<uint32_t>(loc.y / 32) == windowTileInspectorTileY)
|
|
|
|
|
if (tileInspectorWindow != nullptr && loc == windowTileInspectorTile.ToCoordsXY())
|
|
|
|
|
{
|
|
|
|
|
tileInspectorWindow->Invalidate();
|
|
|
|
|
}
|
|
|
|
|
@@ -1082,8 +1081,7 @@ GameActionResult::Ptr tile_inspector_track_set_indestructible(
|
|
|
|
|
map_invalidate_tile_full(loc);
|
|
|
|
|
|
|
|
|
|
rct_window* const tileInspectorWindow = window_find_by_class(WC_TILE_INSPECTOR);
|
|
|
|
|
if (tileInspectorWindow != nullptr && static_cast<uint32_t>(loc.x / 32) == windowTileInspectorTileX
|
|
|
|
|
&& static_cast<uint32_t>(loc.y / 32) == windowTileInspectorTileY)
|
|
|
|
|
if (tileInspectorWindow != nullptr && loc == windowTileInspectorTile.ToCoordsXY())
|
|
|
|
|
{
|
|
|
|
|
tileInspectorWindow->Invalidate();
|
|
|
|
|
}
|
|
|
|
|
@@ -1109,8 +1107,7 @@ GameActionResult::Ptr tile_inspector_scenery_set_quarter_location(
|
|
|
|
|
tileElement->SetOccupiedQuadrants(1 << ((quarterIndex + 2) & 3));
|
|
|
|
|
|
|
|
|
|
map_invalidate_tile_full(loc);
|
|
|
|
|
if (static_cast<uint32_t>(loc.x / 32) == windowTileInspectorTileX
|
|
|
|
|
&& static_cast<uint32_t>(loc.y / 32) == windowTileInspectorTileY)
|
|
|
|
|
if (loc == windowTileInspectorTile.ToCoordsXY())
|
|
|
|
|
{
|
|
|
|
|
window_invalidate_by_class(WC_TILE_INSPECTOR);
|
|
|
|
|
}
|
|
|
|
|
@@ -1134,8 +1131,7 @@ GameActionResult::Ptr tile_inspector_scenery_set_quarter_collision(
|
|
|
|
|
tileElement->SetOccupiedQuadrants(occupiedQuadrants);
|
|
|
|
|
|
|
|
|
|
map_invalidate_tile_full(loc);
|
|
|
|
|
if (static_cast<uint32_t>(loc.x / 32) == windowTileInspectorTileX
|
|
|
|
|
&& static_cast<uint32_t>(loc.y / 32) == windowTileInspectorTileY)
|
|
|
|
|
if (loc == windowTileInspectorTile.ToCoordsXY())
|
|
|
|
|
{
|
|
|
|
|
window_invalidate_by_class(WC_TILE_INSPECTOR);
|
|
|
|
|
}
|
|
|
|
|
@@ -1158,8 +1154,7 @@ GameActionResult::Ptr tile_inspector_banner_toggle_blocking_edge(
|
|
|
|
|
edges ^= (1 << edgeIndex);
|
|
|
|
|
bannerElement->AsBanner()->SetAllowedEdges(edges);
|
|
|
|
|
|
|
|
|
|
if (static_cast<uint32_t>(loc.x / 32) == windowTileInspectorTileX
|
|
|
|
|
&& static_cast<uint32_t>(loc.y / 32) == windowTileInspectorTileY)
|
|
|
|
|
if (loc == windowTileInspectorTile.ToCoordsXY())
|
|
|
|
|
{
|
|
|
|
|
window_invalidate_by_class(WC_TILE_INSPECTOR);
|
|
|
|
|
}
|
|
|
|
|
@@ -1183,8 +1178,7 @@ GameActionResult::Ptr tile_inspector_corrupt_clamp(const CoordsXY& loc, int32_t
|
|
|
|
|
TileElement* const nextElement = corruptElement + 1;
|
|
|
|
|
corruptElement->base_height = corruptElement->clearance_height = nextElement->base_height;
|
|
|
|
|
|
|
|
|
|
if (static_cast<uint32_t>(loc.x / 32) == windowTileInspectorTileX
|
|
|
|
|
&& static_cast<uint32_t>(loc.y / 32) == windowTileInspectorTileY)
|
|
|
|
|
if (loc == windowTileInspectorTile.ToCoordsXY())
|
|
|
|
|
{
|
|
|
|
|
window_invalidate_by_class(WC_TILE_INSPECTOR);
|
|
|
|
|
}
|
|
|
|
|
|