diff options
author | smatz <smatz@openttd.org> | 2009-05-18 16:21:28 +0000 |
---|---|---|
committer | smatz <smatz@openttd.org> | 2009-05-18 16:21:28 +0000 |
commit | 8808f3beea881af5652716c883a21c8031b5e390 (patch) | |
tree | bc14c65d1e66c407b72d254fc926d105eea2f1e4 /src/ai/ai_gui.cpp | |
parent | 5fe906e14992f7a301ae94c357e80af076ab7a63 (diff) | |
download | openttd-8808f3beea881af5652716c883a21c8031b5e390.tar.xz |
(svn r16352) -Codechange: use PoolItem::GetIfValid() instead of PoolItem::IsValidID() and PoolItem::Get()
Diffstat (limited to 'src/ai/ai_gui.cpp')
-rw-r--r-- | src/ai/ai_gui.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/ai/ai_gui.cpp b/src/ai/ai_gui.cpp index f0ffee121..3f4746a02 100644 --- a/src/ai/ai_gui.cpp +++ b/src/ai/ai_gui.cpp @@ -641,7 +641,8 @@ struct AIDebugWindow : public Window { { /* Disable the companies who are not active or not an AI */ for (CompanyID i = COMPANY_FIRST; i < MAX_COMPANIES; i++) { - this->SetWidgetDisabledState(i + AID_WIDGET_COMPANY_BUTTON_START, !Company::IsValidID(i) || !Company::Get(i)->is_ai); + Company *c = Company::GetIfValid(i); + this->SetWidgetDisabledState(i + AID_WIDGET_COMPANY_BUTTON_START, c == NULL || !c->is_ai); } this->DisableWidget(AID_WIDGET_RELOAD_TOGGLE); @@ -669,7 +670,8 @@ struct AIDebugWindow : public Window { } for (CompanyID i = COMPANY_FIRST; i < MAX_COMPANIES; i++) { - if (Company::IsValidID(i) && Company::Get(i)->is_ai) { + Company *c = Company::GetIfValid(i); + if (c != NULL && c->is_ai) { /* Lower the widget corresponding to this company. */ this->LowerWidget(i + AID_WIDGET_COMPANY_BUTTON_START); @@ -690,7 +692,8 @@ struct AIDebugWindow : public Window { /* Paint the company icons */ for (CompanyID i = COMPANY_FIRST; i < MAX_COMPANIES; i++) { - if (!Company::IsValidID(i) || !Company::Get(i)->is_ai) { + Company *c = Company::GetIfValid(i); + if (c == NULL || !c->is_ai) { /* Check if we have the company as an active company */ if (!this->IsWidgetDisabled(i + AID_WIDGET_COMPANY_BUTTON_START)) { /* Bah, company gone :( */ |