(svn r16352) -Codechange: use PoolItem::GetIfValid() instead of PoolItem::IsValidID() and PoolItem::Get()
This commit is contained in:
@@ -286,6 +286,18 @@ struct PoolItem {
|
||||
return Tpool->Get(index);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get item with given index
|
||||
* @param index item to get
|
||||
* @return NULL for invalid items
|
||||
*/
|
||||
static FORCEINLINE T *GetIfValid(uint index)
|
||||
{
|
||||
if (index >= Tpool->GetSize()) return NULL;
|
||||
T *item = Tpool->Get(index);
|
||||
return item->IsValid() ? item : NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns size of the pool (in number of items)
|
||||
* @return size of the pool
|
||||
|
Reference in New Issue
Block a user