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

File diff suppressed because it is too large Load Diff

View File

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