Merge pull request #14121 from ZehMatt/refactor/tileinspector

Refactor Tile Inspector
This commit is contained in:
Michael Steenbeek 2021-02-22 11:07:46 +01:00 committed by GitHub
commit 8e414a9d97
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 1038 additions and 1093 deletions

View File

@ -11,6 +11,8 @@
#include "../world/TileInspector.h"
using namespace OpenRCT2;
TileModifyAction::TileModifyAction(
CoordsXY loc, TileModifyType setting, uint32_t value1, uint32_t value2, TileElement pasteElement)
: _loc(loc)
@ -55,163 +57,163 @@ GameActions::Result::Ptr TileModifyAction::QueryExecute(bool isExecuting) const
case TileModifyType::AnyRemove:
{
const auto elementIndex = _value1;
res = tile_inspector_remove_element_at(_loc, elementIndex, isExecuting);
res = TileInspector::RemoveElementAt(_loc, elementIndex, isExecuting);
break;
}
case TileModifyType::AnySwap:
{
const auto firstIndex = _value1;
const auto secondIndex = _value2;
res = tile_inspector_swap_elements_at(_loc, firstIndex, secondIndex, isExecuting);
res = TileInspector::SwapElementsAt(_loc, firstIndex, secondIndex, isExecuting);
break;
}
case TileModifyType::AnyInsertCorrupt:
{
const auto elementIndex = _value1;
res = tile_inspector_insert_corrupt_at(_loc, elementIndex, isExecuting);
res = TileInspector::InsertCorruptElementAt(_loc, elementIndex, isExecuting);
break;
}
case TileModifyType::AnyRotate:
{
const auto elementIndex = _value1;
res = tile_inspector_rotate_element_at(_loc, elementIndex, isExecuting);
res = TileInspector::RotateElementAt(_loc, elementIndex, isExecuting);
break;
}
case TileModifyType::AnyPaste:
{
res = tile_inspector_paste_element_at(_loc, _pasteElement, isExecuting);
res = TileInspector::PasteElementAt(_loc, _pasteElement, isExecuting);
break;
}
case TileModifyType::AnySort:
{
res = tile_inspector_sort_elements_at(_loc, isExecuting);
res = TileInspector::SortElementsAt(_loc, isExecuting);
break;
}
case TileModifyType::AnyBaseHeightOffset:
{
const auto elementIndex = _value1;
const auto heightOffset = _value2;
res = tile_inspector_any_base_height_offset(_loc, elementIndex, heightOffset, isExecuting);
res = TileInspector::AnyBaseHeightOffset(_loc, elementIndex, heightOffset, isExecuting);
break;
}
case TileModifyType::SurfaceShowParkFences:
{
const bool showFences = _value1;
res = tile_inspector_surface_show_park_fences(_loc, showFences, isExecuting);
res = TileInspector::SurfaceShowParkFences(_loc, showFences, isExecuting);
break;
}
case TileModifyType::SurfaceToggleCorner:
{
const auto cornerIndex = _value1;
res = tile_inspector_surface_toggle_corner(_loc, cornerIndex, isExecuting);
res = TileInspector::SurfaceToggleCorner(_loc, cornerIndex, isExecuting);
break;
}
case TileModifyType::SurfaceToggleDiagonal:
{
res = tile_inspector_surface_toggle_diagonal(_loc, isExecuting);
res = TileInspector::SurfaceToggleDiagonal(_loc, isExecuting);
break;
}
case TileModifyType::PathSetSlope:
{
const auto elementIndex = _value1;
const bool sloped = _value2;
res = tile_inspector_path_set_sloped(_loc, elementIndex, sloped, isExecuting);
res = TileInspector::PathSetSloped(_loc, elementIndex, sloped, isExecuting);
break;
}
case TileModifyType::PathSetBroken:
{
const auto elementIndex = _value1;
const bool broken = _value2;
res = tile_inspector_path_set_broken(_loc, elementIndex, broken, isExecuting);
res = TileInspector::PathSetBroken(_loc, elementIndex, broken, isExecuting);
break;
}
case TileModifyType::PathToggleEdge:
{
const auto elementIndex = _value1;
const auto edgeIndex = _value2;
res = tile_inspector_path_toggle_edge(_loc, elementIndex, edgeIndex, isExecuting);
res = TileInspector::PathToggleEdge(_loc, elementIndex, edgeIndex, isExecuting);
break;
}
case TileModifyType::EntranceMakeUsable:
{
const auto elementIndex = _value1;
res = tile_inspector_entrance_make_usable(_loc, elementIndex, isExecuting);
res = TileInspector::EntranceMakeUsable(_loc, elementIndex, isExecuting);
break;
}
case TileModifyType::WallSetSlope:
{
const auto elementIndex = _value1;
const auto slopeValue = _value2;
res = tile_inspector_wall_set_slope(_loc, elementIndex, slopeValue, isExecuting);
res = TileInspector::WallSetSlope(_loc, elementIndex, slopeValue, isExecuting);
break;
}
case TileModifyType::WallSetAnimationFrame:
{
const auto elementIndex = _value1;
const auto animationFrameOffset = _value2;
res = tile_inspector_wall_animation_frame_offset(_loc, elementIndex, animationFrameOffset, isExecuting);
res = TileInspector::WallAnimationFrameOffset(_loc, elementIndex, animationFrameOffset, isExecuting);
break;
}
case TileModifyType::TrackBaseHeightOffset:
{
const auto elementIndex = _value1;
const auto heightOffset = _value2;
res = tile_inspector_track_base_height_offset(_loc, elementIndex, heightOffset, isExecuting);
res = TileInspector::TrackBaseHeightOffset(_loc, elementIndex, heightOffset, isExecuting);
break;
}
case TileModifyType::TrackSetChainBlock:
{
const auto elementIndex = _value1;
const bool setChain = _value2;
res = tile_inspector_track_set_chain(_loc, elementIndex, true, setChain, isExecuting);
res = TileInspector::TrackSetChain(_loc, elementIndex, true, setChain, isExecuting);
break;
}
case TileModifyType::TrackSetChain:
{
const auto elementIndex = _value1;
const bool setChain = _value2;
res = tile_inspector_track_set_chain(_loc, elementIndex, false, setChain, isExecuting);
res = TileInspector::TrackSetChain(_loc, elementIndex, false, setChain, isExecuting);
break;
}
case TileModifyType::TrackSetBlockBrake:
{
const auto elementIndex = _value1;
const bool blockBrake = _value2;
res = tile_inspector_track_set_block_brake(_loc, elementIndex, blockBrake, isExecuting);
res = TileInspector::TrackSetBlockBrake(_loc, elementIndex, blockBrake, isExecuting);
break;
}
case TileModifyType::TrackSetIndestructible:
{
const auto elementIndex = _value1;
const bool isIndestructible = _value2;
res = tile_inspector_track_set_indestructible(_loc, elementIndex, isIndestructible, isExecuting);
res = TileInspector::TrackSetIndestructible(_loc, elementIndex, isIndestructible, isExecuting);
break;
}
case TileModifyType::ScenerySetQuarterLocation:
{
const auto elementIndex = _value1;
const auto quarterIndex = _value2;
res = tile_inspector_scenery_set_quarter_location(_loc, elementIndex, quarterIndex, isExecuting);
res = TileInspector::ScenerySetQuarterLocation(_loc, elementIndex, quarterIndex, isExecuting);
break;
}
case TileModifyType::ScenerySetQuarterCollision:
{
const auto elementIndex = _value1;
const auto quarterIndex = _value2;
res = tile_inspector_scenery_set_quarter_collision(_loc, elementIndex, quarterIndex, isExecuting);
res = TileInspector::ScenerySetQuarterCollision(_loc, elementIndex, quarterIndex, isExecuting);
break;
}
case TileModifyType::BannerToggleBlockingEdge:
{
const auto elementIndex = _value1;
const auto edgeIndex = _value2;
res = tile_inspector_banner_toggle_blocking_edge(_loc, elementIndex, edgeIndex, isExecuting);
res = TileInspector::BannerToggleBlockingEdge(_loc, elementIndex, edgeIndex, isExecuting);
break;
}
case TileModifyType::CorruptClamp:
{
const auto elementIndex = _value1;
res = tile_inspector_corrupt_clamp(_loc, elementIndex, isExecuting);
res = TileInspector::CorruptClamp(_loc, elementIndex, isExecuting);
break;
}
default:

File diff suppressed because it is too large Load Diff

View File

@ -17,39 +17,39 @@ namespace GameActions
class Result;
}
using GameActionResultPtr = std::unique_ptr<GameActions::Result>;
GameActionResultPtr tile_inspector_insert_corrupt_at(const CoordsXY& loc, int16_t elementIndex, bool isExecuting);
GameActionResultPtr tile_inspector_remove_element_at(const CoordsXY& loc, int16_t elementIndex, bool isExecuting);
GameActionResultPtr tile_inspector_swap_elements_at(const CoordsXY& loc, int16_t first, int16_t second, bool isExecuting);
GameActionResultPtr tile_inspector_rotate_element_at(const CoordsXY& loc, int32_t elementIndex, bool isExecuting);
GameActionResultPtr tile_inspector_paste_element_at(const CoordsXY& loc, TileElement element, bool isExecuting);
GameActionResultPtr tile_inspector_sort_elements_at(const CoordsXY& loc, bool isExecuting);
GameActionResultPtr tile_inspector_any_base_height_offset(
const CoordsXY& loc, int16_t elementIndex, int8_t heightOffset, bool isExecuting);
GameActionResultPtr tile_inspector_surface_show_park_fences(const CoordsXY& loc, bool enabled, bool isExecuting);
GameActionResultPtr tile_inspector_surface_toggle_corner(const CoordsXY& loc, int32_t cornerIndex, bool isExecuting);
GameActionResultPtr tile_inspector_surface_toggle_diagonal(const CoordsXY& loc, bool isExecuting);
GameActionResultPtr tile_inspector_path_set_sloped(const CoordsXY& loc, int32_t elementIndex, bool sloped, bool isExecuting);
GameActionResultPtr tile_inspector_path_set_broken(const CoordsXY& loc, int32_t elementIndex, bool broken, bool isExecuting);
GameActionResultPtr tile_inspector_path_toggle_edge(
const CoordsXY& loc, int32_t elementIndex, int32_t cornerIndex, bool isExecuting);
GameActionResultPtr tile_inspector_entrance_make_usable(const CoordsXY& loc, int32_t elementIndex, bool isExecuting);
GameActionResultPtr tile_inspector_wall_set_slope(
const CoordsXY& loc, int32_t elementIndex, int32_t slopeValue, bool isExecuting);
GameActionResultPtr tile_inspector_wall_animation_frame_offset(
const CoordsXY& loc, int16_t elementIndex, int8_t animationFrameOffset, bool isExecuting);
GameActionResultPtr tile_inspector_track_base_height_offset(
const CoordsXY& loc, int32_t elementIndex, int8_t offset, bool isExecuting);
GameActionResultPtr tile_inspector_track_set_block_brake(
const CoordsXY& loc, int32_t elementIndex, bool blockBrake, bool isExecuting);
GameActionResultPtr tile_inspector_track_set_indestructible(
const CoordsXY& loc, int32_t elementIndex, bool isIndestructible, bool isExecuting);
GameActionResultPtr tile_inspector_track_set_chain(
const CoordsXY& loc, int32_t elementIndex, bool entireTrackBlock, bool setChain, bool isExecuting);
GameActionResultPtr tile_inspector_scenery_set_quarter_location(
const CoordsXY& loc, int32_t elementIndex, int32_t quarterIndex, bool isExecuting);
GameActionResultPtr tile_inspector_scenery_set_quarter_collision(
const CoordsXY& loc, int32_t elementIndex, int32_t quarterIndex, bool isExecuting);
GameActionResultPtr tile_inspector_banner_toggle_blocking_edge(
const CoordsXY& loc, int32_t elementIndex, int32_t edgeIndex, bool isExecuting);
GameActionResultPtr tile_inspector_corrupt_clamp(const CoordsXY& loc, int32_t elementIndex, bool isExecuting);
namespace OpenRCT2::TileInspector
{
using GameActionResultPtr = std::unique_ptr<GameActions::Result>;
GameActionResultPtr InsertCorruptElementAt(const CoordsXY& loc, int16_t elementIndex, bool isExecuting);
GameActionResultPtr RemoveElementAt(const CoordsXY& loc, int16_t elementIndex, bool isExecuting);
GameActionResultPtr SwapElementsAt(const CoordsXY& loc, int16_t first, int16_t second, bool isExecuting);
GameActionResultPtr RotateElementAt(const CoordsXY& loc, int32_t elementIndex, bool isExecuting);
GameActionResultPtr PasteElementAt(const CoordsXY& loc, TileElement element, bool isExecuting);
GameActionResultPtr SortElementsAt(const CoordsXY& loc, bool isExecuting);
GameActionResultPtr AnyBaseHeightOffset(const CoordsXY& loc, int16_t elementIndex, int8_t heightOffset, bool isExecuting);
GameActionResultPtr SurfaceShowParkFences(const CoordsXY& loc, bool enabled, bool isExecuting);
GameActionResultPtr SurfaceToggleCorner(const CoordsXY& loc, int32_t cornerIndex, bool isExecuting);
GameActionResultPtr SurfaceToggleDiagonal(const CoordsXY& loc, bool isExecuting);
GameActionResultPtr PathSetSloped(const CoordsXY& loc, int32_t elementIndex, bool sloped, bool isExecuting);
GameActionResultPtr PathSetBroken(const CoordsXY& loc, int32_t elementIndex, bool broken, bool isExecuting);
GameActionResultPtr PathToggleEdge(const CoordsXY& loc, int32_t elementIndex, int32_t cornerIndex, bool isExecuting);
GameActionResultPtr EntranceMakeUsable(const CoordsXY& loc, int32_t elementIndex, bool isExecuting);
GameActionResultPtr WallSetSlope(const CoordsXY& loc, int32_t elementIndex, int32_t slopeValue, bool isExecuting);
GameActionResultPtr WallAnimationFrameOffset(
const CoordsXY& loc, int16_t elementIndex, int8_t animationFrameOffset, bool isExecuting);
GameActionResultPtr TrackBaseHeightOffset(const CoordsXY& loc, int32_t elementIndex, int8_t offset, bool isExecuting);
GameActionResultPtr TrackSetBlockBrake(const CoordsXY& loc, int32_t elementIndex, bool blockBrake, bool isExecuting);
GameActionResultPtr TrackSetIndestructible(
const CoordsXY& loc, int32_t elementIndex, bool isIndestructible, bool isExecuting);
GameActionResultPtr TrackSetChain(
const CoordsXY& loc, int32_t elementIndex, bool entireTrackBlock, bool setChain, bool isExecuting);
GameActionResultPtr ScenerySetQuarterLocation(
const CoordsXY& loc, int32_t elementIndex, int32_t quarterIndex, bool isExecuting);
GameActionResultPtr ScenerySetQuarterCollision(
const CoordsXY& loc, int32_t elementIndex, int32_t quarterIndex, bool isExecuting);
GameActionResultPtr BannerToggleBlockingEdge(
const CoordsXY& loc, int32_t elementIndex, int32_t edgeIndex, bool isExecuting);
GameActionResultPtr CorruptClamp(const CoordsXY& loc, int32_t elementIndex, bool isExecuting);
} // namespace OpenRCT2::TileInspector