mirror of
https://github.com/OpenTTD/OpenTTD
synced 2026-01-19 10:22:39 +01:00
Codechange: replace INVALID_X with XID::Invalid() for PoolIDs
This commit is contained in:
@@ -54,7 +54,7 @@ struct GraphLegendWindow : Window {
|
||||
{
|
||||
this->InitNested(window_number);
|
||||
|
||||
for (CompanyID c = COMPANY_FIRST; c < MAX_COMPANIES; ++c) {
|
||||
for (CompanyID c = CompanyID::Begin(); c < MAX_COMPANIES; ++c) {
|
||||
if (!_legend_excluded_companies.Test(c)) this->LowerWidget(WID_GL_FIRST_COMPANY + c);
|
||||
|
||||
this->OnInvalidateData(c.base());
|
||||
@@ -676,7 +676,7 @@ public:
|
||||
CompanyMask excluded_companies = _legend_excluded_companies;
|
||||
|
||||
/* Exclude the companies which aren't valid */
|
||||
for (CompanyID c = COMPANY_FIRST; c < MAX_COMPANIES; ++c) {
|
||||
for (CompanyID c = CompanyID::Begin(); c < MAX_COMPANIES; ++c) {
|
||||
if (!Company::IsValidID(c)) excluded_companies.Set(c);
|
||||
}
|
||||
|
||||
@@ -704,7 +704,7 @@ public:
|
||||
this->month = mo;
|
||||
|
||||
this->data.clear();
|
||||
for (CompanyID k = COMPANY_FIRST; k < MAX_COMPANIES; ++k) {
|
||||
for (CompanyID k = CompanyID::Begin(); k < MAX_COMPANIES; ++k) {
|
||||
const Company *c = Company::GetIfValid(k);
|
||||
if (c == nullptr) continue;
|
||||
|
||||
@@ -1269,7 +1269,7 @@ struct PerformanceRatingDetailWindow : Window {
|
||||
this->UpdateCompanyStats();
|
||||
|
||||
this->InitNested(window_number);
|
||||
this->OnInvalidateData(INVALID_COMPANY.base());
|
||||
this->OnInvalidateData(CompanyID::Invalid().base());
|
||||
}
|
||||
|
||||
void UpdateCompanyStats()
|
||||
@@ -1353,7 +1353,7 @@ struct PerformanceRatingDetailWindow : Window {
|
||||
void DrawWidget(const Rect &r, WidgetID widget) const override
|
||||
{
|
||||
/* No need to draw when there's nothing to draw */
|
||||
if (this->company == INVALID_COMPANY) return;
|
||||
if (this->company == CompanyID::Invalid()) return;
|
||||
|
||||
if (IsInsideMM(widget, WID_PRD_COMPANY_FIRST, WID_PRD_COMPANY_LAST + 1)) {
|
||||
if (this->IsWidgetDisabled(widget)) return;
|
||||
@@ -1460,18 +1460,18 @@ struct PerformanceRatingDetailWindow : Window {
|
||||
{
|
||||
if (!gui_scope) return;
|
||||
/* Disable the companies who are not active */
|
||||
for (CompanyID i = COMPANY_FIRST; i < MAX_COMPANIES; ++i) {
|
||||
for (CompanyID i = CompanyID::Begin(); i < MAX_COMPANIES; ++i) {
|
||||
this->SetWidgetDisabledState(WID_PRD_COMPANY_FIRST + i, !Company::IsValidID(i));
|
||||
}
|
||||
|
||||
/* Check if the currently selected company is still active. */
|
||||
if (this->company != INVALID_COMPANY && !Company::IsValidID(this->company)) {
|
||||
if (this->company != CompanyID::Invalid() && !Company::IsValidID(this->company)) {
|
||||
/* Raise the widget for the previous selection. */
|
||||
this->RaiseWidget(WID_PRD_COMPANY_FIRST + this->company);
|
||||
this->company = INVALID_COMPANY;
|
||||
this->company = CompanyID::Invalid();
|
||||
}
|
||||
|
||||
if (this->company == INVALID_COMPANY) {
|
||||
if (this->company == CompanyID::Invalid()) {
|
||||
for (const Company *c : Company::Iterate()) {
|
||||
this->company = c->index;
|
||||
break;
|
||||
@@ -1479,13 +1479,13 @@ struct PerformanceRatingDetailWindow : Window {
|
||||
}
|
||||
|
||||
/* Make sure the widget is lowered */
|
||||
if (this->company != INVALID_COMPANY) {
|
||||
if (this->company != CompanyID::Invalid()) {
|
||||
this->LowerWidget(WID_PRD_COMPANY_FIRST + this->company);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
CompanyID PerformanceRatingDetailWindow::company = INVALID_COMPANY;
|
||||
CompanyID PerformanceRatingDetailWindow::company = CompanyID::Invalid();
|
||||
|
||||
/*******************************/
|
||||
/* INDUSTRY PRODUCTION HISTORY */
|
||||
|
||||
Reference in New Issue
Block a user