Codechange: Defer refreshing company finance windows. (#14111)

During each game tick every cargo payment will issue an Invalidate of the status bar and company finance window. While this doesn't paint the window yet, it does need to search for open windows, and then mark a area of dirty blocks, which is done for every Invalidate.

Instead, set a bit in a CompanyMask, and test these bits once after the game tick is complete.

This reduces the amount of dirtying, and allows more specific widgets to be dirtied instead of the whole window.
This commit is contained in:
Peter Nelson
2025-04-26 11:50:51 +01:00
committed by GitHub
parent a1f086e60c
commit dfd9fbf873
3 changed files with 25 additions and 3 deletions
+3
View File
@@ -27,6 +27,7 @@
#include "saveload/saveload.h"
#include "company_cmd.h"
#include "company_func.h"
#include "company_gui.h"
#include "command_func.h"
#include "news_func.h"
#include "fios.h"
@@ -1229,6 +1230,7 @@ void StateGameLoop()
CallWindowGameTickEvent();
NewsLoop();
InvalidateCompanyWindows();
} else {
if (_debug_desync_level > 2 && TimerGameEconomy::date_fract == 0 && (TimerGameEconomy::date.base() & 0x1F) == 0) {
/* Save the desync savegame if needed. */
@@ -1265,6 +1267,7 @@ void StateGameLoop()
CallWindowGameTickEvent();
NewsLoop();
InvalidateCompanyWindows();
cur_company.Restore();
}