(svn r16327) -Codechange: replace IsValidPoolItemID(index) by PoolItem::IsValidID(index)

This commit is contained in:
smatz
2009-05-17 01:00:56 +00:00
parent cf986c3099
commit 0c10daa243
78 changed files with 242 additions and 303 deletions

View File

@@ -83,12 +83,12 @@ struct Company : PoolItem<Company, CompanyByte, &_Company_pool> {
uint16 *num_engines; ///< caches the number of engines of each type the company owns (no need to save this)
inline bool IsValid() const { return this->name_1 != 0; }
};
static inline bool IsValidCompanyID(CompanyID company)
{
return company < MAX_COMPANIES && (uint)company < Company::GetPoolSize() && Company::Get(company)->IsValid();
}
static inline bool IsValidID(CompanyID company)
{
return company < MAX_COMPANIES && (uint)company < Company::GetPoolSize() && Company::Get(company)->IsValid();
}
};
#define FOR_ALL_COMPANIES_FROM(d, start) for (d = Company::Get(start); d != NULL; d = (d->index + 1U < Company::GetPoolSize()) ? Company::Get(d->index + 1U) : NULL) if (d->IsValid())
#define FOR_ALL_COMPANIES(d) FOR_ALL_COMPANIES_FROM(d, 0)