$treeview $search $mathjax
Stratagus
2.2.6
$projectbrief
|
$projectbrief
|
$searchbox |
_________ __ __ / _____// |_____________ _/ |______ ____ __ __ ______ \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/ / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ \ /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ > \/ \/ \//_____/ \/ ______________________ ______________________ T H E W A R B E G I N S Stratagus - A free fantasy real time strategy game engine
#include <unit_cache.h>
Public Member Functions | |
CUnitCache () | |
size_t | size () const |
void | clear () |
CUnit * | operator[] (const unsigned int index) const |
CUnit * | operator[] (const unsigned int index) |
template<typename _T> | |
CUnit * | find (const _T &pred) const |
Find the first unit in a tile chache for which a predicate is true. | |
template<typename _T> | |
void | for_each (_T functor) |
Apply a function to every element of a cache. | |
template<typename _T> | |
int | for_each_if (_T &functor) |
Apply a function to every element of a cache. | |
CUnit * | Remove (const unsigned int index) |
bool | Remove (CUnit *const unit) |
void | RemoveS (CUnit *const unit) |
bool | InsertS (CUnit *unit) |
void | Insert (CUnit *unit) |
Public Attributes | |
std::vector< CUnit * > | Units |
CUnitCache::CUnitCache | ( | ) | [inline] |
size_t CUnitCache::size | ( | ) | const [inline] |
void CUnitCache::clear | ( | ) | [inline] |
CUnit* CUnitCache::operator[] | ( | const unsigned int | index | ) | const [inline] |
CUnit* CUnitCache::operator[] | ( | const unsigned int | index | ) | [inline] |
CUnit* CUnitCache::find | ( | const _T & | pred | ) | const [inline] |
Find the first unit in a tile chache for which a predicate is true.
pred | A predicate object vith bool operator()(const CUnit *). |
pred(*i)
is true, or NULL if no such iterator exists. void CUnitCache::for_each | ( | _T | functor | ) | [inline] |
Apply a function to every element of a cache.
functor | A unary function object vith void operator()(CUnit *). |
f
to each element in the cache. functor
must not modify the order of the cache.
int CUnitCache::for_each_if | ( | _T & | functor | ) | [inline] |
Apply a function to every element of a cache.
functor | A unary function object vith bool operator()(CUnit *). |
f
to each element in the cache. functor
must not modify the order of the cache. If functor
return false then loop is exited.
CUnit* CUnitCache::Remove | ( | const unsigned int | index | ) | [inline] |
Remove unit on index from unit cache.
index | Unit index to remove from container. |
bool CUnitCache::Remove | ( | CUnit *const | unit | ) | [inline] |
Remove unit from unit cache.
unit | Unit pointer to remove from container. |
void CUnitCache::RemoveS | ( | CUnit *const | unit | ) | [inline] |
Remove unit from unit cache.
unit | Unit pointer to remove from container. |
bool CUnitCache::InsertS | ( | CUnit * | unit | ) | [inline] |
Insert new unit into tile cache. Sorted version for binary searching.
unit | Unit pointer to place in cache. |
void CUnitCache::Insert | ( | CUnit * | unit | ) | [inline] |
Insert new unit into tile cache.
unit | Unit pointer to place in cache. |
std::vector<CUnit *> CUnitCache::Units |