#include <zValidator.h>
Public Member Functions | |
zValidator (Triad _positive, Triad _marked) | |
zValidator (zValidator const &other) | |
void | operator= (zValidator const &other) |
overloaded assignment operator | |
virtual zValidator * | copy (void) const |
virtual | ~zValidator () |
void | validate (gVectorExtra< nNetObjectID > &owners, gVectorExtra< nNetObjectID > &teamOwners, Triggerer possibleUser, const tPolynomial< nMessage > &tp) |
void | addSelector (zSelectorPtr _selector) |
void | addMonitorInfluence (zMonitorInfluencePtr newInfluence) |
void | addZoneInfluence (zZoneInfluencePtr newInfluence) |
Triad | getPositive (void) const |
Triad | getMarked (void) const |
Static Public Member Functions | |
static zValidator * | create (Triad _positive, Triad _marked) |
Protected Member Functions | |
bool | isOwner (ePlayerNetID *possibleOwner, gVectorExtra< nNetObjectID > &owners) |
bool | isTeamOwner (eTeam *possibleTeamOwner, gVectorExtra< nNetObjectID > &teamOwners) |
virtual bool | isValid (gVectorExtra< nNetObjectID > &owners, gVectorExtra< nNetObjectID > &teamOwners, gCycle *possibleUser) |
Protected Attributes | |
zSelectorPtrs | selectors |
zMonitorInfluencePtrs | monitorInfluences |
zZoneInfluencePtrs | zoneInfluences |
Triad | positive |
Triad | marked |
Definition at line 54 of file zValidator.h.
Definition at line 33 of file zValidator.cpp.
Referenced by copy().
00034 : selectors(), 00035 monitorInfluences(), 00036 zoneInfluences(), 00037 positive(_positive), 00038 marked(_marked) 00039 { }
zValidator::zValidator | ( | zValidator const & | other | ) |
Definition at line 41 of file zValidator.cpp.
00041 : 00042 selectors( other.selectors ), 00043 monitorInfluences( other.monitorInfluences ), 00044 zoneInfluences( other.zoneInfluences ), 00045 positive( other.getPositive() ), 00046 marked( other.getMarked() ) 00047 { }
virtual zValidator::~zValidator | ( | ) | [inline, virtual] |
static zValidator* zValidator::create | ( | Triad | _positive, | |
Triad | _marked | |||
) | [static] |
Reimplemented in zValidatorAll, zValidatorOwner, zValidatorOwnerTeam, zValidatorAllButOwner, and zValidatorAllButTeamOwner.
void zValidator::operator= | ( | zValidator const & | other | ) |
overloaded assignment operator
Definition at line 50 of file zValidator.cpp.
References getMarked(), getPositive(), marked, and positive.
Referenced by zValidatorAllButTeamOwner::operator=(), zValidatorAllButOwner::operator=(), zValidatorOwnerTeam::operator=(), zValidatorOwner::operator=(), and zValidatorAll::operator=().
00051 { 00052 if (this != &other) { 00053 positive = other.getPositive(); 00054 marked = other.getMarked(); 00055 } 00056 }
zValidator * zValidator::copy | ( | void | ) | const [virtual] |
Reimplemented in zValidatorAll, zValidatorOwner, zValidatorOwnerTeam, zValidatorAllButOwner, and zValidatorAllButTeamOwner.
Definition at line 58 of file zValidator.cpp.
References zValidator().
00058 { 00059 return new zValidator(*this); 00060 }
void zValidator::validate | ( | gVectorExtra< nNetObjectID > & | owners, | |
gVectorExtra< nNetObjectID > & | teamOwners, | |||
Triggerer | possibleUser, | |||
const tPolynomial< nMessage > & | tp | |||
) |
Definition at line 93 of file zValidator.cpp.
References isValid(), marked, Triggerer::marked, monitorInfluences, positive, Triggerer::positive, selectors, validateTriad(), Triggerer::who, and zoneInfluences.
00093 { 00094 00095 if (isValid(owners, teamOwners, possibleUser.who) && validateTriad(possibleUser.positive, positive) && validateTriad(possibleUser.marked, marked)) { 00096 zSelectorPtrs::const_iterator iterSelector; 00097 for (iterSelector=selectors.begin(); 00098 iterSelector!=selectors.end(); 00099 ++iterSelector) 00100 { 00101 (*iterSelector)->apply(owners, teamOwners, possibleUser.who); 00102 } 00103 00104 zMonitorInfluencePtrs::const_iterator iterMonitorInfluence; 00105 for (iterMonitorInfluence=monitorInfluences.begin(); 00106 iterMonitorInfluence!=monitorInfluences.end(); 00107 ++iterMonitorInfluence) 00108 { 00109 (*iterMonitorInfluence)->apply(owners, teamOwners, possibleUser.who, tpValue); 00110 } 00111 00112 zZoneInfluencePtrs::const_iterator iterZoneInfluence; 00113 for (iterZoneInfluence=zoneInfluences.begin(); 00114 iterZoneInfluence!=zoneInfluences.end(); 00115 ++iterZoneInfluence) 00116 { 00117 // TODO: 00118 (*iterZoneInfluence)->apply( tpValue ); 00119 } 00120 } 00121 }
void zValidator::addSelector | ( | zSelectorPtr | _selector | ) | [inline] |
Definition at line 66 of file zValidator.h.
References selectors.
00066 { 00067 selectors.push_back(_selector); 00068 };
void zValidator::addMonitorInfluence | ( | zMonitorInfluencePtr | newInfluence | ) | [inline] |
Definition at line 69 of file zValidator.h.
References monitorInfluences.
00069 { 00070 monitorInfluences.push_back( newInfluence ); 00071 };
void zValidator::addZoneInfluence | ( | zZoneInfluencePtr | newInfluence | ) | [inline] |
Definition at line 72 of file zValidator.h.
References zoneInfluences.
00072 { 00073 zoneInfluences.push_back( newInfluence ); 00074 };
Triad zValidator::getPositive | ( | void | ) | const [inline] |
Definition at line 76 of file zValidator.h.
References positive.
Referenced by operator=().
00076 { 00077 return positive; 00078 };
Triad zValidator::getMarked | ( | void | ) | const [inline] |
Definition at line 79 of file zValidator.h.
References marked.
Referenced by operator=().
00079 { 00080 return marked; 00081 };
bool zValidator::isOwner | ( | ePlayerNetID * | possibleOwner, | |
gVectorExtra< nNetObjectID > & | owners | |||
) | [protected] |
Definition at line 63 of file zValidator.cpp.
References nNetObject::ID(), and sn_netObjects.
Referenced by zValidatorAllButOwner::isValid(), and zValidatorOwner::isValid().
00064 { 00065 gVectorExtra< nNetObjectID >::iterator iter; 00066 for (iter = owners.begin(); 00067 iter != owners.end(); 00068 ++iter) 00069 { 00070 if (bool(sn_netObjects[(*iter)]) && (*iter == possibleOwner->ID()) ) 00071 return true; 00072 } 00073 return false; 00074 }
bool zValidator::isTeamOwner | ( | eTeam * | possibleTeamOwner, | |
gVectorExtra< nNetObjectID > & | teamOwners | |||
) | [protected] |
Definition at line 77 of file zValidator.cpp.
References nNetObject::ID(), and sn_netObjects.
Referenced by zValidatorAllButTeamOwner::isValid(), and zValidatorOwnerTeam::isValid().
00078 { 00079 gVectorExtra< nNetObjectID >::iterator iter; 00080 for (iter = teamOwners.begin(); 00081 iter != teamOwners.end(); 00082 ++iter) 00083 { 00084 // When in local game, the team id of all players is 0, which while not a valid reference, it still ok 00085 bool isValidID = ( (*iter) == 0 || bool(sn_netObjects[(*iter)])); 00086 if ( isValidID && (*iter == possibleTeamOwner->ID()) ) 00087 return true; 00088 } 00089 return false; 00090 }
virtual bool zValidator::isValid | ( | gVectorExtra< nNetObjectID > & | owners, | |
gVectorExtra< nNetObjectID > & | teamOwners, | |||
gCycle * | possibleUser | |||
) | [inline, protected, virtual] |
Reimplemented in zValidatorAll, zValidatorOwner, zValidatorOwnerTeam, zValidatorAllButOwner, and zValidatorAllButTeamOwner.
Definition at line 94 of file zValidator.h.
Referenced by validate().
zSelectorPtrs zValidator::selectors [protected] |
zMonitorInfluencePtrs zValidator::monitorInfluences [protected] |
zZoneInfluencePtrs zValidator::zoneInfluences [protected] |
Triad zValidator::positive [protected] |
Definition at line 88 of file zValidator.h.
Referenced by getPositive(), operator=(), and validate().
Triad zValidator::marked [protected] |