#include <zSelector.h>
Public Member Functions | |
zSelector () | |
zSelector (zSelector const &other) | |
void | operator= (zSelector const &other) |
overloaded assignment operator | |
virtual zSelector * | copy (void) const |
virtual | ~zSelector () |
void | apply (gVectorExtra< nNetObjectID > &owners, gVectorExtra< nNetObjectID > &teamOwners, gCycle *triggerer) |
void | setCount (int _count) |
void | addEffector (zEffectorPtr newEffector) |
Static Public Member Functions | |
static zSelector * | create () |
Protected Member Functions | |
virtual gVectorExtra < ePlayerNetID * > | select (gVectorExtra< nNetObjectID > &owners, gVectorExtra< nNetObjectID > &teamOwners, gCycle *triggerer) |
template<typename T> | |
T | pickOne (std::vector< T > const &sources) |
std::vector< ePlayerNetID * > | getAllValid (std::vector< ePlayerNetID * > &results, std::vector< ePlayerNetID * > const &sources, LivingStatus living) |
Protected Attributes | |
zEffectorPtrs | effectors |
int | count |
Definition at line 51 of file zSelector.h.
zSelector::zSelector | ( | ) |
Definition at line 64 of file zSelector.cpp.
Referenced by copy().
zSelector::zSelector | ( | zSelector const & | other | ) |
virtual zSelector::~zSelector | ( | ) | [inline, virtual] |
static zSelector* zSelector::create | ( | ) | [static] |
Reimplemented in zSelectorSelf, zSelectorTeammate, zSelectorTeam, zSelectorAll, zSelectorAllButSelf, zSelectorAnother, zSelectorOwner, zSelectorOwnerTeam, zSelectorOwnerTeamTeammate, zSelectorAnyDead, zSelectorAllDead, zSelectorSingleDeadOwner, zSelectorAnotherTeammateDead, and zSelectorAnotherNotTeammateDead.
void zSelector::operator= | ( | zSelector const & | other | ) |
overloaded assignment operator
Definition at line 70 of file zSelector.cpp.
Referenced by zSelectorAnotherNotTeammateDead::operator=(), zSelectorAnotherTeammateDead::operator=(), zSelectorSingleDeadOwner::operator=(), zSelectorAllDead::operator=(), zSelectorAnyDead::operator=(), zSelectorOwnerTeamTeammate::operator=(), zSelectorOwnerTeam::operator=(), zSelectorOwner::operator=(), zSelectorAnother::operator=(), zSelectorAllButSelf::operator=(), zSelectorAll::operator=(), zSelectorTeam::operator=(), zSelectorTeammate::operator=(), and zSelectorSelf::operator=().
zSelector * zSelector::copy | ( | void | ) | const [virtual] |
Reimplemented in zSelectorSelf, zSelectorTeammate, zSelectorTeam, zSelectorAll, zSelectorAllButSelf, zSelectorAnother, zSelectorOwner, zSelectorOwnerTeam, zSelectorOwnerTeamTeammate, zSelectorAnyDead, zSelectorAllDead, zSelectorSingleDeadOwner, zSelectorAnotherTeammateDead, and zSelectorAnotherNotTeammateDead.
Definition at line 76 of file zSelector.cpp.
References zSelector().
00077 { 00078 return new zSelector(*this); 00079 }
void zSelector::apply | ( | gVectorExtra< nNetObjectID > & | owners, | |
gVectorExtra< nNetObjectID > & | teamOwners, | |||
gCycle * | triggerer | |||
) |
Definition at line 88 of file zSelector.cpp.
References count, effectors, and select().
00089 { 00090 if (count == -1 || count > 0) 00091 { 00092 gVectorExtra<ePlayerNetID *> d_calculatedTargets = select(owners, teamOwners, triggerer); 00093 zEffectorPtrs::const_iterator iter; 00094 for(iter=effectors.begin(); 00095 iter!=effectors.end(); 00096 ++iter) 00097 { 00098 (*iter)->apply(d_calculatedTargets); 00099 } 00100 if (count > 0) 00101 count --; 00102 } 00103 }
void zSelector::setCount | ( | int | _count | ) | [inline] |
void zSelector::addEffector | ( | zEffectorPtr | newEffector | ) | [inline] |
Definition at line 64 of file zSelector.h.
References effectors.
00064 {effectors.push_back( newEffector );};
gVectorExtra< ePlayerNetID * > zSelector::select | ( | gVectorExtra< nNetObjectID > & | owners, | |
gVectorExtra< nNetObjectID > & | teamOwners, | |||
gCycle * | triggerer | |||
) | [protected, virtual] |
Reimplemented in zSelectorSelf, zSelectorTeammate, zSelectorTeam, zSelectorAll, zSelectorAllButSelf, zSelectorAnother, zSelectorOwner, zSelectorOwnerTeam, zSelectorOwnerTeamTeammate, zSelectorAnyDead, zSelectorAllDead, zSelectorSingleDeadOwner, zSelectorAnotherTeammateDead, and zSelectorAnotherNotTeammateDead.
Definition at line 81 of file zSelector.cpp.
Referenced by apply().
00082 { 00083 gVectorExtra<ePlayerNetID *> empty; 00084 return empty; 00085 }
T zSelector::pickOne | ( | std::vector< T > const & | sources | ) | [inline, protected] |
Definition at line 917 of file zSelector.cpp.
References tRandomizer::Get(), and tRandomizer::GetInstance().
Referenced by zSelectorAnotherNotTeammateDead::select(), zSelectorAnotherTeammateDead::select(), zSelectorSingleDeadOwner::select(), zSelectorAnyDead::select(), zSelectorOwnerTeamTeammate::select(), zSelectorAnother::select(), and zSelectorTeammate::select().
00918 { 00919 int number = sources.size(); 00920 tRandomizer & randomizer = tRandomizer::GetInstance(); 00921 int ran = randomizer.Get(number); 00922 00923 return sources[ran]; 00924 }
std::vector< ePlayerNetID * > zSelector::getAllValid | ( | std::vector< ePlayerNetID * > & | results, | |
std::vector< ePlayerNetID * > const & | sources, | |||
LivingStatus | living | |||
) | [protected] |
Definition at line 37 of file zSelector.cpp.
References _alive, _dead, _either, eGameObject::Alive(), max(), and ePlayerNetID::Object().
Referenced by zSelectorAnotherNotTeammateDead::select(), zSelectorAnotherTeammateDead::select(), zSelectorSingleDeadOwner::select(), zSelectorAllDead::select(), zSelectorAnyDead::select(), zSelectorOwnerTeamTeammate::select(), zSelectorOwnerTeam::select(), zSelectorAnother::select(), zSelectorAllButSelf::select(), zSelectorAll::select(), zSelectorTeam::select(), and zSelectorTeammate::select().
00038 { 00039 unsigned short int max = sources.size(); 00040 for(unsigned short int i=0;i<max;i++) 00041 { 00042 ePlayerNetID *p=sources[i]; 00043 switch (living) { 00044 case _either: 00045 results.push_back(p); 00046 break; 00047 case _alive: 00048 if ( p->Object() && p->Object()->Alive() ) 00049 { 00050 results.push_back(p); 00051 } 00052 break; 00053 case _dead: 00054 if( !(p->Object()) || !(p->Object()->Alive()) ) 00055 { 00056 results.push_back(p); 00057 } 00058 break; 00059 } 00060 } 00061 return results; 00062 }
zEffectorPtrs zSelector::effectors [protected] |
int zSelector::count [protected] |