1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-04 13:42:55 +01:00

Avoid implicit capture of this in Footpath window

This commit is contained in:
Aaron van Geffen
2024-02-27 22:16:06 +01:00
parent 8bf848582b
commit 6edcd6d7a0

View File

@@ -1034,18 +1034,25 @@ private:
auto footpathPlaceAction = FootpathPlaceAction(
footpathLoc, slope, type, gFootpathSelection.Railings, _footpathConstructDirection, constructFlags);
footpathPlaceAction.SetCallback([=](const GameAction* ga, const GameActions::Result* result) {
footpathPlaceAction.SetCallback([footpathLoc](const GameAction* ga, const GameActions::Result* result) {
auto* self = static_cast<FootpathWindow*>(WindowFindByClass(WindowClass::Footpath));
if (self == nullptr)
{
return;
}
if (result->Error == GameActions::Status::Ok)
{
OpenRCT2::Audio::Play3D(OpenRCT2::Audio::SoundId::PlaceItem, result->Position);
if (gFootpathConstructSlope == 0)
{
_footpathConstructValidDirections = INVALID_DIRECTION;
self->_footpathConstructValidDirections = INVALID_DIRECTION;
}
else
{
_footpathConstructValidDirections = _footpathConstructDirection;
self->_footpathConstructValidDirections = self->_footpathConstructDirection;
}
if (gFootpathGroundFlags & ELEMENT_IS_UNDERGROUND)
@@ -1062,7 +1069,7 @@ private:
gFootpathConstructFromPosition.z += PATH_HEIGHT_STEP;
}
}
WindowFootpathSetEnabledAndPressedWidgets();
self->WindowFootpathSetEnabledAndPressedWidgets();
});
GameActions::Execute(&footpathPlaceAction);
}