summaryrefslogtreecommitdiff
path: root/src/industry_gui.cpp
diff options
context:
space:
mode:
authorJonathan G Rennison <j.g.rennison@gmail.com>2020-01-06 20:31:57 +0000
committerCharles Pigott <charlespigott@googlemail.com>2020-01-12 19:37:43 +0000
commitf1734e7815653829d42ebd4def8c0d7d5aeae986 (patch)
treed87b30fd8f96bdb1fc9e5dfed8cfe7b854befbde /src/industry_gui.cpp
parent22ba048c89c4b594a1bf18b4d0ea9e09f38e6dbc (diff)
downloadopenttd-f1734e7815653829d42ebd4def8c0d7d5aeae986.tar.xz
Change: Only resort industry directory window on production change if necessary
Diffstat (limited to 'src/industry_gui.cpp')
-rw-r--r--src/industry_gui.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp
index 7a45c1192..7410cb3a3 100644
--- a/src/industry_gui.cpp
+++ b/src/industry_gui.cpp
@@ -1708,11 +1708,19 @@ public:
*/
void OnInvalidateData(int data = 0, bool gui_scope = true) override
{
- if (data == 0) {
- /* This needs to be done in command-scope to enforce rebuilding before resorting invalid data */
- this->industries.ForceRebuild();
- } else {
- this->industries.ForceResort();
+ switch (data) {
+ case IDIWD_FORCE_REBUILD:
+ /* This needs to be done in command-scope to enforce rebuilding before resorting invalid data */
+ this->industries.ForceRebuild();
+ break;
+
+ case IDIWD_PRODUCTION_CHANGE:
+ if (this->industries.SortType() == 2) this->industries.ForceResort();
+ break;
+
+ default:
+ this->industries.ForceResort();
+ break;
}
}
};