summaryrefslogtreecommitdiff
path: root/src/industry_gui.cpp
diff options
context:
space:
mode:
authorstormcone <48624099+stormcone@users.noreply.github.com>2019-12-23 21:11:01 +0100
committerCharles Pigott <charlespigott@googlemail.com>2020-01-05 20:52:17 +0000
commit596fb5d54a27cb0e6ca51c2ddbed68a2c34e9426 (patch)
treede4f627b433712ed8708886d5629f2d3b3b08095 /src/industry_gui.cpp
parent808253c29c5b0f855a1d4cb230783cc2adb1451d (diff)
downloadopenttd-596fb5d54a27cb0e6ca51c2ddbed68a2c34e9426.tar.xz
Change: In the industry directory window an industry will be greyed out if it temporarily does not accept the cargo selected by the acceptance cargo filter.
Diffstat (limited to 'src/industry_gui.cpp')
-rw-r--r--src/industry_gui.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp
index c93dc5573..6be98e280 100644
--- a/src/industry_gui.cpp
+++ b/src/industry_gui.cpp
@@ -1565,8 +1565,17 @@ public:
DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, STR_INDUSTRY_DIRECTORY_NONE);
break;
}
+ TextColour tc;
+ const CargoID acf_cid = this->cargo_filter[this->accepted_cargo_filter_criteria];
for (uint i = this->vscroll->GetPosition(); i < this->industries.size(); i++) {
- DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, this->GetIndustryString(this->industries[i]));
+ tc = TC_FROMSTRING;
+ if (acf_cid != CF_ANY && acf_cid != CF_NONE) {
+ Industry *ind = const_cast<Industry *>(this->industries[i]);
+ if (IndustryTemporarilyRefusesCargo(ind, acf_cid)) {
+ tc = TC_GREY | TC_FORCED;
+ }
+ }
+ DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, this->GetIndustryString(this->industries[i]), tc);
y += this->resize.step_height;
if (++n == this->vscroll->GetCapacity()) break; // max number of industries in 1 window