Skip to content

Prevent some unnecessary window invalidations #24433

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from 1 commit
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Prevent path window invalidating unnecessarily
  • Loading branch information
mixiate committed May 22, 2025
commit a27d9ccc07d01544a408cc64c9c0c03ef14335dc
10 changes: 6 additions & 4 deletions src/openrct2-ui/windows/Footpath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,6 @@ namespace OpenRCT2::Ui::Windows

void OnUpdate() override
{
InvalidateWidget(WIDX_CONSTRUCT);
WindowFootpathUpdateProvisionalPathForBridgeMode();

// #2502: The camera might have changed rotation, so we need to update which directional buttons are pressed
Expand Down Expand Up @@ -1056,11 +1055,14 @@ namespace OpenRCT2::Ui::Windows
// Set provisional path
auto pathType = gFootpathSelection.GetSelectedSurface();
auto constructFlags = FootpathCreateConstructFlags(pathType);
_windowFootpathCost = FootpathProvisionalSet(
const auto footpathCost = FootpathProvisionalSet(
pathType, gFootpathSelection.Railings, { *mapPos, baseZ }, slope, constructFlags);

auto* windowMgr = Ui::GetWindowManager();
windowMgr->InvalidateByClass(WindowClass::Footpath);
if (_windowFootpathCost != footpathCost)
{
_windowFootpathCost = footpathCost;
InvalidateWidget(WIDX_CONSTRUCT);
}
}

/**
Expand Down