Changeset - r23390:9489373edb9a
[Not reviewed]
master
0 1 0
peter1138 - 6 years ago 2019-02-26 22:13:24
peter1138@openttd.org
Fix 23960d0f2c: Company livery window shows incorrect groups when opened from group window in multiplayer.
1 file changed with 4 insertions and 4 deletions:
0 comments (0 inline, 0 general)
src/company_gui.cpp
Show inline comments
 
@@ -704,21 +704,21 @@ public:
 
			this->livery_class = LC_OTHER;
 
			this->sel = 1;
 
			this->LowerWidget(WID_SCL_CLASS_GENERAL);
 
			this->BuildGroupList(company);
 
			this->SetRows();
 
		} else {
 
			this->SetSelectedGroup(group);
 
			this->SetSelectedGroup(company, group);
 
		}
 

	
 
		this->FinishInitNested(company);
 
		this->owner = company;
 
		this->InvalidateData(1);
 
	}
 

	
 
	void SetSelectedGroup(GroupID group)
 
	void SetSelectedGroup(CompanyID company, GroupID group)
 
	{
 
		this->RaiseWidget(this->livery_class + WID_SCL_CLASS_GENERAL);
 
		const Group *g = Group::Get(group);
 
		switch (g->vehicle_type) {
 
			case VEH_TRAIN: this->livery_class = LC_GROUP_RAIL; break;
 
			case VEH_ROAD: this->livery_class = LC_GROUP_ROAD; break;
 
@@ -727,13 +727,13 @@ public:
 
			default: NOT_REACHED();
 
		}
 
		this->sel = group;
 
		this->LowerWidget(this->livery_class + WID_SCL_CLASS_GENERAL);
 

	
 
		this->groups.ForceRebuild();
 
		this->BuildGroupList((CompanyID)this->window_number);
 
		this->BuildGroupList(company);
 
		this->SetRows();
 

	
 
		/* Position scrollbar to selected group */
 
		for (uint i = 0; i < this->rows; i++) {
 
			if (this->groups[i]->index == sel) {
 
				this->vscroll->SetPosition(Clamp(i - this->vscroll->GetCapacity() / 2, 0, max(this->vscroll->GetCount() - this->vscroll->GetCapacity(), 0)));
 
@@ -1102,13 +1102,13 @@ static WindowDesc _select_company_livery
 
void ShowCompanyLiveryWindow(CompanyID company, GroupID group)
 
{
 
	SelectCompanyLiveryWindow *w = (SelectCompanyLiveryWindow *)BringWindowToFrontById(WC_COMPANY_COLOUR, company);
 
	if (w == NULL) {
 
		new SelectCompanyLiveryWindow(&_select_company_livery_desc, company, group);
 
	} else if (group != INVALID_GROUP) {
 
		w->SetSelectedGroup(group);
 
		w->SetSelectedGroup(company, group);
 
	}
 
}
 

	
 
/**
 
 * Draws the face of a company manager's face.
 
 * @param cmf   the company manager's face
0 comments (0 inline, 0 general)