Skip to content

TimePanel.cpp - remove loco global and invalidate less#3194

Merged
AaronVanGeffen merged 6 commits intoOpenLoco:masterfrom
LeeSpork:minor-TimePanel-refactor
Oct 5, 2025
Merged

TimePanel.cpp - remove loco global and invalidate less#3194
AaronVanGeffen merged 6 commits intoOpenLoco:masterfrom
LeeSpork:minor-TimePanel-refactor

Conversation

@LeeSpork
Copy link
Copy Markdown
Contributor

@LeeSpork LeeSpork commented Aug 9, 2025

  • Removes loco global 0x0050A004 from this file.
  • Replaced some magic numbers with a new constant.
  • The onUpdate() method now only invalidates it when it needs to: Previously its inner frame widget was invalidated on every update when the game was paused, but it only needs to do this once every 30 ticks to facilitate the text alternating between the in-game date and "* paused *". (Also now it cannot invalidate it twice in one update in some cases!)

}

if (SceneManager::isPaused())
if (frameInvalid || (SceneManager::isPaused() && (w.numTicksVisible == 30 || w.numTicksVisible == 0)))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is this (w.numTicksVisible == 30 || w.numTicksVisible == 0)?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those are the two moments that the time panel actually needs to be invalidated while paused, to change whether it shows "* paused *" or the date.

if (self.numTicksVisible >= 30)

@LeeSpork LeeSpork marked this pull request as draft August 11, 2025 07:40
@LeeSpork LeeSpork marked this pull request as ready for review August 14, 2025 12:56
@LeeSpork LeeSpork changed the title Remove loco global from TimePanel.cpp and small optimization TimePanel.cpp - remove loco global and invalidate less Aug 14, 2025
@AaronVanGeffen AaronVanGeffen added this to the v25.09+ milestone Sep 30, 2025
Copy link
Copy Markdown
Member

@AaronVanGeffen AaronVanGeffen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this is working fine.

@AaronVanGeffen AaronVanGeffen enabled auto-merge (squash) October 5, 2025 15:26
@AaronVanGeffen AaronVanGeffen merged commit 1929108 into OpenLoco:master Oct 5, 2025
11 checks passed
LeeSpork added a commit to LeeSpork/OpenLoco that referenced this pull request Oct 5, 2025
LeeSpork added a commit to LeeSpork/OpenLoco that referenced this pull request Oct 27, 2025
LeeSpork added a commit to LeeSpork/OpenLoco that referenced this pull request Nov 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants