1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-24 00:03:11 +01:00

Make construction and removal buttons holdable (#21950)

* Footpath: make construction button holdable

* RideConstruction: make construction button holdable

* Allow repeated removal as well

* Amend changelog
This commit is contained in:
Aaron van Geffen
2024-05-05 13:38:49 +02:00
committed by GitHub
parent 489ae58c5c
commit fa90a84d22
3 changed files with 24 additions and 19 deletions

View File

@@ -9,6 +9,7 @@
- Change: [#21715] [Plugin] Remove access to the internal `owner` property. Note: `ownership` is still accessible.
- Change: [#21855] Cheats menu dropdown no longer requires dragging.
- Change: [#21866] Hide the FPS Counter when the top toolbar/widgets have been toggled off.
- Change: [#21950] Construction and removal buttons can now be held down for repeated placement.
- Fix: [#866] Boat Hire boats get stuck entering track (original bug).
- Fix: [#10701] No reason specified when placing door over unsuitable track.
- Fix: [#18723, #21870] Attempting to demolish a flat ride in pause mode allows you to place multiple copies.

View File

@@ -177,6 +177,8 @@ static constexpr uint8_t ConstructionPreviewImages[][4] = {
InputSetFlag(INPUT_FLAG_6, true);
_footpathErrorOccured = false;
WindowFootpathSetEnabledAndPressedWidgets();
hold_down_widgets = (1u << WIDX_CONSTRUCT) | (1u << WIDX_REMOVE);
}
void OnClose() override
@@ -269,6 +271,12 @@ static constexpr uint8_t ConstructionPreviewImages[][4] = {
case WIDX_SLOPEUP:
WindowFootpathMousedownSlope(2);
break;
case WIDX_CONSTRUCT:
WindowFootpathConstruct();
break;
case WIDX_REMOVE:
WindowFootpathRemove();
break;
}
}
@@ -279,12 +287,6 @@ static constexpr uint8_t ConstructionPreviewImages[][4] = {
case WIDX_CLOSE:
Close();
break;
case WIDX_CONSTRUCT:
WindowFootpathConstruct();
break;
case WIDX_REMOVE:
WindowFootpathRemove();
break;
case WIDX_CONSTRUCT_ON_LAND:
if (_footpathConstructionMode == PATH_CONSTRUCTION_MODE_LAND)
{
@@ -1411,7 +1413,7 @@ static constexpr uint8_t ConstructionPreviewImages[][4] = {
return;
}
OnMouseUp(WIDX_CONSTRUCT);
OnMouseDown(WIDX_CONSTRUCT);
}
void OnResize() override

View File

@@ -978,14 +978,6 @@ static Widget _rideConstructionWidgets[] = {
case WIDX_PREVIOUS_SECTION:
RideSelectPreviousSection();
break;
case WIDX_CONSTRUCT:
Construct();
// Force any footpath construction to recheck the area.
gProvisionalFootpath.Flags |= PROVISIONAL_PATH_FLAG_2;
break;
case WIDX_DEMOLISH:
MouseUpDemolish();
break;
case WIDX_ROTATE:
Rotate();
break;
@@ -1021,6 +1013,16 @@ static Widget _rideConstructionWidgets[] = {
WindowRideConstructionUpdateEnabledTrackPieces();
switch (widgetIndex)
{
case WIDX_CONSTRUCT:
{
Construct();
// Force any footpath construction to recheck the area.
gProvisionalFootpath.Flags |= PROVISIONAL_PATH_FLAG_2;
break;
}
case WIDX_DEMOLISH:
MouseUpDemolish();
break;
case WIDX_LEFT_CURVE:
RideConstructionInvalidateCurrentTrack();
_currentTrackCurve = EnumValue(TrackCurve::Left);
@@ -1595,7 +1597,7 @@ static Widget _rideConstructionWidgets[] = {
const auto& rtd = GetRideTypeDescriptor(currentRide->type);
auto trackDrawerDescriptor = getCurrentTrackDrawerDescriptor(rtd);
hold_down_widgets = 0;
hold_down_widgets = (1u << WIDX_CONSTRUCT) | (1u << WIDX_DEMOLISH);
if (rtd.HasFlag(RIDE_TYPE_FLAG_IS_SHOP_OR_FACILITY) || !currentRide->HasStation())
{
widgets[WIDX_ENTRANCE_EXIT_GROUPBOX].type = WindowWidgetType::Empty;
@@ -3623,7 +3625,7 @@ static Widget _rideConstructionWidgets[] = {
break;
gDisableErrorWindowSound = true;
w->OnMouseUp(WIDX_CONSTRUCT);
w->OnMouseDown(WIDX_CONSTRUCT);
gDisableErrorWindowSound = false;
if (_trackPlaceCost == kMoney64Undefined)
@@ -4532,7 +4534,7 @@ static Widget _rideConstructionWidgets[] = {
return;
}
w->OnMouseUp(WIDX_CONSTRUCT);
w->OnMouseDown(WIDX_CONSTRUCT);
}
void WindowRideConstructionKeyboardShortcutDemolishCurrent()
@@ -4543,7 +4545,7 @@ static Widget _rideConstructionWidgets[] = {
return;
}
w->OnMouseUp(WIDX_DEMOLISH);
w->OnMouseDown(WIDX_DEMOLISH);
}
static void WindowRideConstructionMouseUpDemolishNextPiece(const CoordsXYZD& piecePos, int32_t type)