zSelector Class Reference

#include <zSelector.h>

Inheritance diagram for zSelector:

Inheritance graph
[legend]

List of all members.

Public Member Functions

 zSelector ()
 zSelector (zSelector const &other)
void operator= (zSelector const &other)
 overloaded assignment operator
virtual zSelectorcopy (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 zSelectorcreate ()

Protected Member Functions

virtual gVectorExtra
< ePlayerNetID * > 
select (gVectorExtra< nNetObjectID > &owners, gVectorExtra< nNetObjectID > &teamOwners, gCycle *triggerer)
template<typename 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


Detailed Description

Definition at line 51 of file zSelector.h.


Constructor & Destructor Documentation

zSelector::zSelector (  ) 

Definition at line 64 of file zSelector.cpp.

Referenced by copy().

00065 { }

Here is the caller graph for this function:

zSelector::zSelector ( zSelector const &  other  ) 

Definition at line 67 of file zSelector.cpp.

00068 { }

virtual zSelector::~zSelector (  )  [inline, virtual]

Definition at line 59 of file zSelector.h.

00059 {};


Member Function Documentation

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=().

00071 {
00072     if(this != &other) {
00073     }
00074 }

Here is the caller graph for this function:

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 }

Here is the call graph for this function:

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 }

Here is the call graph for this function:

void zSelector::setCount ( int  _count  )  [inline]

Definition at line 62 of file zSelector.h.

References count.

00062 {count = _count;};

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 }

Here is the caller graph for this function:

template<typename T>
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 }

Here is the call graph for this function:

Here is the caller graph for this function:

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 }

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

zEffectorPtrs zSelector::effectors [protected]

Definition at line 68 of file zSelector.h.

Referenced by addEffector(), and apply().

int zSelector::count [protected]

Definition at line 69 of file zSelector.h.

Referenced by apply(), and setCount().


The documentation for this class was generated from the following files:
Generated on Sun Mar 16 00:01:49 2008 for Armagetron Advanced by  doxygen 1.5.4