1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-15 11:03:00 +01:00

Close #12078: Add shortcut key for sloping walls (#20860)

* Close OpenRCT2/OpenRCT2#12078: New shortcut key for sloping walls

* Close OpenRCT2/OpenRCT2#12078: New shortcut key for sloping walls

* Close OpenRCT2/OpenRCT2#12078: New shortcut key for sloping walls

* Close OpenRCT2/OpenRCT2#12078: New shortcut key for sloping walls

* Apply code formatting fixes

* Apply code formatting fixes

* Apply modulus operator to make code more concise

* Change string ID

* Apply code formatting fix

* Apply code formatting fix
This commit is contained in:
Fredrik Tegnell
2023-11-12 12:10:56 +01:00
committed by GitHub
parent 135c8b9f9b
commit af7086e283
6 changed files with 34 additions and 0 deletions

View File

@@ -109,6 +109,7 @@ The following people are not part of the development team, but have been contrib
* Nikolas Parshook (nparshook) - Misc.
* Wenzhao Qiu (qwzhaox) - Misc.
* Tiago Reul (reul) - Misc.
* Fredrik Tegnell (fredriktegnell) - Misc.
## Bug fixes
* (KirilAngelov)

View File

@@ -3696,6 +3696,7 @@ STR_6590 :Show the window buttons (e.g. to close the window) on the left of t
STR_6591 :Staff member is currently fixing a ride and cant be fired.
STR_6592 :Staff member is currently inspecting a ride and cant be fired.
STR_6593 :Remove park fences
STR_6594 :Tile Inspector: Toggle wall slope
#############
# Scenarios #

View File

@@ -1,5 +1,6 @@
0.4.7 (in development)
------------------------------------------------------------------------
- Feature: [#12078] Add shortcut key for toggling wall slope.
- Feature: [#19919] Add diagonal brakes and diagonal block brakes to most coaster types.
- Feature: [#20141] Add additional track pieces to the Giga Coaster.
- Feature: [OpenMusic#46] Added Mystic ride music style.

View File

@@ -117,6 +117,7 @@ namespace OpenRCT2::Ui::ShortcutId
constexpr std::string_view WindowTileInspectorDecreaseY = "window.tileinspector.decrease_y";
constexpr std::string_view WindowTileInspectorIncreaseHeight = "window.tileinspector.increase_height";
constexpr std::string_view WindowTileInspectorDecreaseHeight = "window.tileinspector.decrease_height";
constexpr std::string_view WindowTileInspectorChangeWallSlope = "window.tileinspector.toggle_wall_slope";
// Debug
constexpr std::string_view DebugToggleConsole = "debug.console";

View File

@@ -24,6 +24,7 @@
#include <openrct2/OpenRCT2.h>
#include <openrct2/actions/CheatSetAction.h>
#include <openrct2/actions/LoadOrQuitAction.h>
#include <openrct2/actions/TileModifyAction.h>
#include <openrct2/audio/audio.h>
#include <openrct2/config/Config.h>
#include <openrct2/interface/Chat.h>
@@ -40,6 +41,7 @@
#include <openrct2/windows/TileInspectorGlobals.h>
#include <openrct2/world/Park.h>
#include <openrct2/world/Scenery.h>
#include <openrct2/world/TileInspector.h>
using namespace OpenRCT2;
using namespace OpenRCT2::Ui;
@@ -515,6 +517,31 @@ static void TileInspectorMouseDown(WidgetIndex widgetIndex)
}
}
static void ShortcutToggleWallSlope()
{
WindowBase* window = WindowFindByClass(WindowClass::TileInspector);
if (window == nullptr)
{
return;
}
const TileElement* tileElement = OpenRCT2::TileInspector::GetSelectedElement();
// Ensure an element is selected and it's a wall
if (tileElement == nullptr || tileElement->GetType() != TileElementType::Wall)
{
return;
}
int32_t currSlopeValue = tileElement->AsWall()->GetSlope();
int32_t newSlopeValue = (currSlopeValue + 1) % 3;
extern TileCoordsXY windowTileInspectorTile;
auto modifyTile = TileModifyAction(
windowTileInspectorTile.ToCoordsXY(), TileModifyType::WallSetSlope, windowTileInspectorSelectedIndex, newSlopeValue);
GameActions::Execute(&modifyTile);
}
static void ShortcutIncreaseElementHeight()
{
WindowBase* w = WindowFindByClass(WindowClass::TileInspector);
@@ -871,6 +898,7 @@ void ShortcutManager::RegisterDefaultShortcuts()
RegisterShortcut(ShortcutId::WindowTileInspectorDecreaseY, STR_SHORTCUT_DECREASE_Y_COORD, std::bind(TileInspectorMouseDown, WC_TILE_INSPECTOR__WIDX_SPINNER_Y_DECREASE));
RegisterShortcut(ShortcutId::WindowTileInspectorIncreaseHeight, STR_SHORTCUT_INCREASE_ELEM_HEIGHT, ShortcutIncreaseElementHeight);
RegisterShortcut(ShortcutId::WindowTileInspectorDecreaseHeight, STR_SHORTCUT_DECREASE_ELEM_HEIGHT, ShortcutDecreaseElementHeight);
RegisterShortcut(ShortcutId::WindowTileInspectorChangeWallSlope, STR_SHORTCUT_TOGGLE_WALL_SLOPE, ShortcutToggleWallSlope);
// Debug
RegisterShortcut(ShortcutId::DebugToggleConsole, STR_CONSOLE, "`", ShortcutToggleConsole);

View File

@@ -4002,6 +4002,8 @@ enum : uint16_t
STR_CHEAT_REMOVE_PARK_FENCES = 6593,
STR_SHORTCUT_TOGGLE_WALL_SLOPE = 6594,
// Have to include resource strings (from scenarios and objects) for the time being now that language is partially working
/* MAX_STR_COUNT = 32768 */ // MAX_STR_COUNT - upper limit for number of strings, not the current count strings
};