summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Nelson <peter1138@openttd.org>2019-01-27 01:34:30 +0000
committerNiels Martin Hansen <nielsm@indvikleren.dk>2019-01-27 12:34:49 +0100
commit256b94a03d7eb3c2c0264b6c93f5d83c299ada8a (patch)
tree3f86c18676e64dc476abcb2cd9f6f25e7b11c200
parent3e0e3cfac150d7a63a714a0af073caaabfffbaa2 (diff)
downloadopenttd-256b94a03d7eb3c2c0264b6c93f5d83c299ada8a.tar.xz
Fix: Ignore company colour selection when showing different company's colour scheme.
-rw-r--r--src/company_gui.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/company_gui.cpp b/src/company_gui.cpp
index c62c6d61c..208b798a7 100644
--- a/src/company_gui.cpp
+++ b/src/company_gui.cpp
@@ -648,9 +648,11 @@ public:
virtual void OnPaint()
{
+ bool local = (CompanyID)this->window_number == _local_company;
+
/* Disable dropdown controls if no scheme is selected */
- this->SetWidgetDisabledState(WID_SCL_PRI_COL_DROPDOWN, this->sel == 0);
- this->SetWidgetDisabledState(WID_SCL_SEC_COL_DROPDOWN, this->sel == 0);
+ this->SetWidgetDisabledState(WID_SCL_PRI_COL_DROPDOWN, !local || this->sel == 0);
+ this->SetWidgetDisabledState(WID_SCL_SEC_COL_DROPDOWN, !local || this->sel == 0);
this->DrawWidgets();
}
@@ -789,6 +791,9 @@ public:
virtual void OnDropdownSelect(int widget, int index)
{
+ bool local = (CompanyID)this->window_number == _local_company;
+ if (!local) return;
+
for (LiveryScheme scheme = LS_DEFAULT; scheme < LS_END; scheme++) {
/* Changed colour for the selected scheme, or all visible schemes if CTRL is pressed. */
if (HasBit(this->sel, scheme) || (_ctrl_pressed && _livery_class[scheme] == this->livery_class && HasBit(_loaded_newgrf_features.used_liveries, scheme))) {