00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef ARMAGETRONAD_H_VALIDATOR
00029 #define ARMAGETRONAD_H_VALIDATOR
00030
00031
00032 #include <vector>
00033 #include <boost/shared_ptr.hpp>
00034 #include "gVectorExtra.h"
00035 #include "ePlayer.h"
00036 #include "gCycle.h"
00037 #include "eTeam.h"
00038 #include "zone/zMisc.h"
00039 #include <boost/shared_ptr.hpp>
00040 #include "tPolynomial.h"
00041
00042 class zSelector;
00043 typedef boost::shared_ptr<zSelector> zSelectorPtr;
00044 typedef std::vector< zSelectorPtr > zSelectorPtrs;
00045
00046 class zMonitorInfluence;
00047 typedef boost::shared_ptr<zMonitorInfluence> zMonitorInfluencePtr;
00048 typedef std::vector< zMonitorInfluencePtr > zMonitorInfluencePtrs;
00049
00050 class zZoneInfluence;
00051 typedef boost::shared_ptr<zZoneInfluence> zZoneInfluencePtr;
00052 typedef std::vector< zZoneInfluencePtr > zZoneInfluencePtrs;
00053
00054 class zValidator
00055 {
00056 public:
00057 static zValidator* create(Triad _positive, Triad _marked);
00058 zValidator(Triad _positive, Triad _marked);
00059 zValidator(zValidator const &other);
00060 void operator=(zValidator const &other);
00061 virtual zValidator *copy(void) const;
00062 virtual ~zValidator() {};
00063
00064 void validate(gVectorExtra< nNetObjectID > &owners, gVectorExtra< nNetObjectID > &teamOwners, Triggerer possibleUser, const tPolynomial<nMessage> &tp);
00065
00066 void addSelector(zSelectorPtr _selector) {
00067 selectors.push_back(_selector);
00068 };
00069 void addMonitorInfluence(zMonitorInfluencePtr newInfluence) {
00070 monitorInfluences.push_back( newInfluence );
00071 };
00072 void addZoneInfluence(zZoneInfluencePtr newInfluence) {
00073 zoneInfluences.push_back( newInfluence );
00074 };
00075
00076 Triad getPositive(void) const {
00077 return positive;
00078 };
00079 Triad getMarked(void) const {
00080 return marked;
00081 };
00082
00083 protected:
00084 zSelectorPtrs selectors;
00085 zMonitorInfluencePtrs monitorInfluences;
00086 zZoneInfluencePtrs zoneInfluences;
00087
00088 Triad positive;
00089 Triad marked;
00090
00091
00092 bool isOwner(ePlayerNetID *possibleOwner, gVectorExtra< nNetObjectID > &owners);
00093 bool isTeamOwner(eTeam *possibleTeamOwner, gVectorExtra< nNetObjectID > &teamOwners);
00094 virtual bool isValid(gVectorExtra< nNetObjectID > &owners, gVectorExtra< nNetObjectID > &teamOwners, gCycle* possibleUser) {
00095 return false;
00096 };
00097 };
00098
00099
00100 class zValidatorAll : public zValidator
00101 {
00102 public:
00103 static zValidator* create(Triad _positive, Triad _marked);
00104 zValidatorAll(Triad _positive, Triad _marked);
00105 zValidatorAll(zValidatorAll const &other);
00106 void operator=(zValidatorAll const &other);
00107 virtual ~zValidatorAll() {};
00108 zValidator *copy(void) const;
00109 protected:
00110 bool isValid(gVectorExtra< nNetObjectID > &owners, gVectorExtra< nNetObjectID > &teamOwners, gCycle* possibleUser) {
00111 return true ;
00112 };
00113 };
00114
00115 class zValidatorOwner : public zValidator
00116 {
00117 public:
00118 static zValidator* create(Triad _positive, Triad _marked);
00119 zValidatorOwner(Triad _positive, Triad _marked);
00120 zValidatorOwner(zValidatorOwner const &other);
00121 void operator=(zValidatorOwner const &other);
00122 virtual ~zValidatorOwner() {};
00123 zValidator *copy(void) const;
00124 protected:
00125 bool isValid(gVectorExtra< nNetObjectID > &owners, gVectorExtra< nNetObjectID > &teamOwners, gCycle* possibleUser);
00126 };
00127
00128 class zValidatorOwnerTeam : public zValidator
00129 {
00130 public:
00131 static zValidator* create(Triad _positive, Triad _marked);
00132 zValidatorOwnerTeam(Triad _positive, Triad _marked);
00133 zValidatorOwnerTeam(zValidatorOwnerTeam const &other);
00134 void operator=(zValidatorOwnerTeam const &other);
00135 virtual ~zValidatorOwnerTeam() {};
00136 zValidator *copy(void) const;
00137 protected:
00138 bool isValid(gVectorExtra< nNetObjectID > &owners, gVectorExtra< nNetObjectID > &teamOwners, gCycle* possibleUser);
00139 };
00140
00141 class zValidatorAllButOwner : public zValidator
00142 {
00143 public:
00144 static zValidator* create(Triad _positive, Triad _marked);
00145 zValidatorAllButOwner(Triad _positive, Triad _marked);
00146 zValidatorAllButOwner(zValidatorAllButOwner const &other);
00147 void operator=(zValidatorAllButOwner const &other);
00148 virtual ~zValidatorAllButOwner() {};
00149 zValidator *copy(void) const;
00150 protected:
00151 bool isValid(gVectorExtra< nNetObjectID > &owners, gVectorExtra< nNetObjectID > &teamOwners, gCycle* possibleUser);
00152 };
00153
00154 class zValidatorAllButTeamOwner : public zValidator
00155 {
00156 public:
00157 static zValidator* create(Triad _positive, Triad _marked);
00158 zValidatorAllButTeamOwner(Triad _positive, Triad _marked);
00159 zValidatorAllButTeamOwner(zValidatorAllButTeamOwner const &other);
00160 void operator=(zValidatorAllButTeamOwner const &other);
00161 virtual ~zValidatorAllButTeamOwner() {};
00162 zValidator *copy(void) const;
00163 protected:
00164 bool isValid(gVectorExtra< nNetObjectID > &owners, gVectorExtra< nNetObjectID > &teamOwners, gCycle* possibleUser);
00165 };
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181 #include "zone/zMonitor.h"
00182 #include "zone/zSelector.h"
00183 #include "zone/zZoneInfluence.h"
00184
00185 #endif