diff --git a/src/linkgraph/linkgraph_gui.cpp b/src/linkgraph/linkgraph_gui.cpp --- a/src/linkgraph/linkgraph_gui.cpp +++ b/src/linkgraph/linkgraph_gui.cpp @@ -666,9 +666,9 @@ bool LinkGraphLegendWindow::OnTooltip([[ void LinkGraphLegendWindow::UpdateOverlayCompanies() { uint32_t mask = 0; - for (uint c = 0; c < MAX_COMPANIES; c++) { - if (this->IsWidgetDisabled(c + WID_LGL_COMPANY_FIRST)) continue; - if (!this->IsWidgetLowered(c + WID_LGL_COMPANY_FIRST)) continue; + for (CompanyID c = COMPANY_FIRST; c < MAX_COMPANIES; c++) { + if (this->IsWidgetDisabled(WID_LGL_COMPANY_FIRST + c)) continue; + if (!this->IsWidgetLowered(WID_LGL_COMPANY_FIRST + c)) continue; SetBit(mask, c); } this->overlay->SetCompanyMask(mask); @@ -680,8 +680,8 @@ void LinkGraphLegendWindow::UpdateOverla void LinkGraphLegendWindow::UpdateOverlayCargoes() { CargoTypes mask = 0; - for (uint c = 0; c < num_cargo; c++) { - if (!this->IsWidgetLowered(c + WID_LGL_CARGO_FIRST)) continue; + for (CompanyID c = COMPANY_FIRST; c < MAX_COMPANIES; c++) { + if (!this->IsWidgetLowered(WID_LGL_CARGO_FIRST + c)) continue; SetBit(mask, _sorted_cargo_specs[c]->Index()); } this->overlay->SetCargoMask(mask); @@ -696,8 +696,8 @@ void LinkGraphLegendWindow::OnClick([[ma this->UpdateOverlayCompanies(); } } else if (widget == WID_LGL_COMPANIES_ALL || widget == WID_LGL_COMPANIES_NONE) { - for (uint c = 0; c < MAX_COMPANIES; c++) { - if (this->IsWidgetDisabled(c + WID_LGL_COMPANY_FIRST)) continue; + for (CompanyID c = COMPANY_FIRST; c < MAX_COMPANIES; c++) { + if (this->IsWidgetDisabled(WID_LGL_COMPANY_FIRST + c)) continue; this->SetWidgetLoweredState(WID_LGL_COMPANY_FIRST + c, widget == WID_LGL_COMPANIES_ALL); } this->UpdateOverlayCompanies(); @@ -728,6 +728,6 @@ void LinkGraphLegendWindow::OnInvalidate /* Disable the companies who are not active */ for (CompanyID i = COMPANY_FIRST; i < MAX_COMPANIES; i++) { - this->SetWidgetDisabledState(i + WID_LGL_COMPANY_FIRST, !Company::IsValidID(i)); + this->SetWidgetDisabledState(WID_LGL_COMPANY_FIRST + i, !Company::IsValidID(i)); } }