Changeset - r23217:f4b33ef410d5
[Not reviewed]
master
0 1 0
Peter Nelson - 6 years ago 2019-01-27 01:34:30
peter1138@openttd.org
Fix: Ignore company colour selection when showing different company's colour scheme.
1 file changed with 7 insertions and 2 deletions:
0 comments (0 inline, 0 general)
src/company_gui.cpp
Show inline comments
 
@@ -645,15 +645,17 @@ 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();
 
	}
 

	
 
	virtual void SetStringParameters(int widget) const
 
	{
 
@@ -786,12 +788,15 @@ 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))) {
 
				DoCommandP(0, scheme | (widget == WID_SCL_PRI_COL_DROPDOWN ? 0 : 256), index, CMD_SET_COMPANY_COLOUR);
 
			}
 
		}
0 comments (0 inline, 0 general)