From 256b94a03d7eb3c2c0264b6c93f5d83c299ada8a Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Sun, 27 Jan 2019 01:34:30 +0000 Subject: [PATCH] Fix: Ignore company colour selection when showing different company's colour scheme. --- src/company_gui.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/company_gui.cpp b/src/company_gui.cpp index c62c6d61cf..208b798a7a 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))) {