From bea3fe2b8b2352d471149a4c914f93c58aa11b83 Mon Sep 17 00:00:00 2001 From: smatz Date: Wed, 10 Jun 2009 22:05:01 +0000 Subject: (svn r16559) -Codechange: introduce Company::IsValidAiID() and Company::IsValidHumanID(), don't use IsHumanCompany() where possible --- src/ai/ai_core.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/ai/ai_core.cpp') diff --git a/src/ai/ai_core.cpp b/src/ai/ai_core.cpp index 0eb4fe29d..b89d2064f 100644 --- a/src/ai/ai_core.cpp +++ b/src/ai/ai_core.cpp @@ -64,7 +64,7 @@ const Company *c; FOR_ALL_COMPANIES(c) { - if (!IsHumanCompany(c->index)) { + if (c->is_ai) { _current_company = c->index; c->ai_instance->GameLoop(); } @@ -74,8 +74,7 @@ * Effectively collecting garbage once every two months per AI. */ if ((AI::frame_counter & 255) == 0) { CompanyID cid = (CompanyID)GB(AI::frame_counter, 8, 4); - Company *com = Company::GetIfValid(cid); - if (com != NULL && !IsHumanCompany(cid)) com->ai_instance->CollectGarbage(); + if (Company::IsValidAiID(cid)) Company::Get(cid)->ai_instance->CollectGarbage(); } _current_company = OWNER_NONE; @@ -109,7 +108,7 @@ const Company *c; FOR_ALL_COMPANIES(c) { - if (!IsHumanCompany(c->index)) AI::Stop(c->index); + if (c->is_ai) AI::Stop(c->index); } } @@ -179,7 +178,7 @@ } /* Only AIs can have an event-queue */ - if (!Company::IsValidID(company) || IsHumanCompany(company)) { + if (!Company::IsValidAiID(company)) { event->Release(); return; } -- cgit v1.2.3-54-g00ecf