mirror of https://github.com/OpenTTD/OpenTTD
Fix #11442: "default" colour in group colour window is not updated when changing master colour (#11614)
Updated SelectCompanyLiveryWindow.DrawWidget method to check if a group's livery.in_use 0 bit is set, rendering the company's default colour if it has not been.pull/11619/head
parent
fd0aa3dd19
commit
acfe367507
|
@ -924,9 +924,10 @@ public:
|
||||||
y += this->line_height;
|
y += this->line_height;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const Company *c = Company::Get((CompanyID)this->window_number);
|
||||||
|
|
||||||
if (livery_class < LC_GROUP_RAIL) {
|
if (livery_class < LC_GROUP_RAIL) {
|
||||||
int pos = this->vscroll->GetPosition();
|
int pos = this->vscroll->GetPosition();
|
||||||
const Company *c = Company::Get((CompanyID)this->window_number);
|
|
||||||
for (LiveryScheme scheme = LS_DEFAULT; scheme < LS_END; scheme++) {
|
for (LiveryScheme scheme = LS_DEFAULT; scheme < LS_END; scheme++) {
|
||||||
if (_livery_class[scheme] == this->livery_class && HasBit(_loaded_newgrf_features.used_liveries, scheme)) {
|
if (_livery_class[scheme] == this->livery_class && HasBit(_loaded_newgrf_features.used_liveries, scheme)) {
|
||||||
if (pos-- > 0) continue;
|
if (pos-- > 0) continue;
|
||||||
|
@ -937,8 +938,9 @@ public:
|
||||||
uint max = static_cast<uint>(std::min<size_t>(this->vscroll->GetPosition() + this->vscroll->GetCapacity(), this->groups.size()));
|
uint max = static_cast<uint>(std::min<size_t>(this->vscroll->GetPosition() + this->vscroll->GetCapacity(), this->groups.size()));
|
||||||
for (uint i = this->vscroll->GetPosition(); i < max; ++i) {
|
for (uint i = this->vscroll->GetPosition(); i < max; ++i) {
|
||||||
const Group *g = this->groups[i];
|
const Group *g = this->groups[i];
|
||||||
|
const bool livery_set = HasBit(g->livery.in_use, 0);
|
||||||
SetDParam(0, g->index);
|
SetDParam(0, g->index);
|
||||||
draw_livery(STR_GROUP_NAME, g->livery, this->sel == g->index, false, this->indents[i] * WidgetDimensions::scaled.hsep_indent);
|
draw_livery(STR_GROUP_NAME, livery_set ? g->livery : c->livery[LS_DEFAULT], this->sel == g->index, livery_set, this->indents[i] * WidgetDimensions::scaled.hsep_indent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue