src/tron/zone/zEffector.h

Go to the documentation of this file.
00001 /*
00002 
00003 *************************************************************************
00004 
00005 ArmageTron -- Just another Tron Lightcycle Game in 3D.
00006 Copyright (C) 2000  Manuel Moos (manuel@moosnet.de)
00007 
00008 **************************************************************************
00009 
00010 This program is free software; you can redistribute it and/or
00011 modify it under the terms of the GNU General Public License
00012 as published by the Free Software Foundation; either version 2
00013 of the License, or (at your option) any later version.
00014 
00015 This program is distributed in the hope that it will be useful,
00016 but WITHOUT ANY WARRANTY; without even the implied warranty of
00017 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018 GNU General Public License for more details.
00019 
00020 You should have received a copy of the GNU General Public License
00021 along with this program; if not, write to the Free Software
00022 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00023   
00024 ***************************************************************************
00025 
00026 */
00027 
00028 #ifndef ARMAGETRONAD_H_EFFECTOR
00029 #define ARMAGETRONAD_H_EFFECTOR
00030 
00031 class gCycle;
00032 #include <vector>
00033 #include <memory>
00034 #include "gVectorExtra.h"
00035 #include "ePlayer.h"
00036 #include "gCycle.h"
00037 #include "eTeam.h"
00038 #include "tLocale.h"
00039 #include "tFunction.h"
00040 
00041 class zEffector
00042 {
00043 public:
00044     static zEffector* create() { return new zEffector(); };
00045     zEffector():count(0),message() { }; //<! Constructor
00046     zEffector(zEffector const &other) { };
00047     void operator=(zEffector const &other) { this->zEffector::operator=(other); }; 
00048     virtual zEffector *copy(void) const { return new zEffector(*this); };
00049     virtual ~zEffector() {};
00050 
00051     void apply(gVectorExtra<ePlayerNetID *> &d_calculatedTargets);
00052     virtual void effect(gVectorExtra<ePlayerNetID *> &d_calculatedTargets) { };
00053 
00054     void setCount(int _count) {count = _count;};
00055     void setMessage(tString unformated);
00056 
00057 protected:
00058     template <typename T>
00059     T pickOne(std::vector <T> const &sources);
00060 
00061     int count;
00062     tOutput message;
00063 
00064 };
00065 
00066 
00067 class zEffectorWin : public zEffector
00068 {
00069 public:
00070     static zEffector* create() { return new zEffectorWin(); };
00071     zEffectorWin():zEffector(){ }; //<! Constructor
00072     zEffectorWin(zEffectorWin const &other):zEffector(other) { };
00073     void operator=(zEffectorWin const &other) { this->zEffector::operator=(other); }; 
00074     virtual zEffectorWin *copy(void) const { return new zEffectorWin(*this); };
00075     virtual ~zEffectorWin() {};
00076 
00077     virtual void effect(gVectorExtra<ePlayerNetID *> &d_calculatedTargets);
00078 };
00079 
00080 class zEffectorDeath : public zEffector
00081 {
00082 public:
00083     static zEffector* create() { return new zEffectorDeath(); };
00084     zEffectorDeath():zEffector(){ }; //<! Constructor
00085     zEffectorDeath(zEffectorDeath const &other):zEffector(other) { };
00086     void operator=(zEffectorDeath const &other) { this->zEffector::operator=(other); }; 
00087     virtual zEffectorDeath *copy(void) const { return new zEffectorDeath(*this); };
00088     virtual ~zEffectorDeath() {};
00089 
00090     virtual void effect(gVectorExtra<ePlayerNetID *> &d_calculatedTargets);
00091 };
00092 
00093 class zEffectorPoint : public zEffector
00094 {
00095 public:
00096     static zEffector* create() { return new zEffectorPoint(); };
00097     zEffectorPoint():zEffector(){ }; //<! Constructor
00098     zEffectorPoint(zEffectorPoint const &other):zEffector(other),d_score(other.getPoint()) { };
00099     void operator=(zEffectorPoint const &other) { this->zEffector::operator=(other); }; 
00100     virtual zEffectorPoint *copy(void) const { return new zEffectorPoint(*this); };
00101     virtual ~zEffectorPoint() {};
00102 
00103     void setPoint(int p) {d_score = p;};
00104     int getPoint() const {return d_score;};
00105 
00106     virtual void effect(gVectorExtra<ePlayerNetID *> &d_calculatedTargets);
00107 protected:
00108     int d_score;
00109 };
00110 
00111 class zEffectorCycleRubber : public zEffector
00112 {
00113 public:
00114     static zEffector* create() { return new zEffectorCycleRubber(); };
00115     zEffectorCycleRubber():zEffector(){ }; //<! Constructor
00116     zEffectorCycleRubber(zEffectorCycleRubber const &other):zEffector(other) { };
00117     void operator=(zEffectorCycleRubber const &other) { this->zEffector::operator=(other); }; 
00118     virtual zEffectorCycleRubber *copy(void) const { return new zEffectorCycleRubber(*this); };
00119     virtual ~zEffectorCycleRubber() {};
00120 
00121     virtual void effect(gVectorExtra<ePlayerNetID *> &d_calculatedTargets);
00122 };
00123 
00124 class zEffectorCycleBrake : public zEffector
00125 {
00126 public:
00127     static zEffector* create() { return new zEffectorCycleBrake(); };
00128     zEffectorCycleBrake():zEffector(){ }; //<! Constructor
00129     zEffectorCycleBrake(zEffectorCycleBrake const &other):zEffector(other) { };
00130     void operator=(zEffectorCycleBrake const &other) { this->zEffector::operator=(other); }; 
00131     virtual zEffectorCycleBrake *copy(void) const { return new zEffectorCycleBrake(*this); };
00132     virtual ~zEffectorCycleBrake() {};
00133 
00134     virtual void effect(gVectorExtra<ePlayerNetID *> &d_calculatedTargets);
00135 };
00136 
00137 class zEffectorCycleAcceleration : public zEffector
00138 {
00139 public:
00140     static zEffector* create() { return new zEffectorCycleAcceleration(); };
00141     zEffectorCycleAcceleration():zEffector(),acceleration(1.0, 1.0) { }; //<! Constructor
00142     //zEffectorCycleAcceleration(zEffectorCycleAcceleration const &other):zEffector(other) { acceleration = other.acceleration};
00143     //    void operator=(zEffectorCycleAcceleration const &other) { this->zEffector::operator=(other); }; //!< overloaded assignment operator
00144     virtual zEffectorCycleAcceleration *copy(void) const { return new zEffectorCycleAcceleration(*this); };
00145     virtual ~zEffectorCycleAcceleration() {};
00146 
00147     virtual void effect(gVectorExtra<ePlayerNetID *> &d_calculatedTargets);
00148 
00149     virtual void setValue(tFunction const &accel) { acceleration = accel; };
00150 protected:
00151     tFunction acceleration;
00152 };
00153 
00154 class gArena;
00155 
00156 class zEffectorSpawnPlayer : public zEffector
00157 {
00158 public:
00159     static zEffector* create() { return new zEffectorSpawnPlayer(); };
00160     zEffectorSpawnPlayer():zEffector(){ }; //<! Constructor
00161     zEffectorSpawnPlayer(zEffectorSpawnPlayer const &other):zEffector(other) { };
00162     void operator=(zEffectorSpawnPlayer const &other) { this->zEffector::operator=(other); }; 
00163     virtual zEffectorSpawnPlayer *copy(void) const { return new zEffectorSpawnPlayer(*this); };
00164     virtual ~zEffectorSpawnPlayer() {};
00165 
00166     void setGrid(eGrid *_grid) {grid = _grid;};
00167     void setArena(gArena *_arena) {arena = _arena;};
00168 
00169     virtual void effect(gVectorExtra<ePlayerNetID *> &d_calculatedTargets);
00170 protected:
00171     eGrid *grid;
00172     gArena *arena;
00173 };
00174 
00175 class zEffectorSetting : public zEffector
00176 {
00177 public:
00178     static zEffector* create() { return new zEffectorSetting(); };
00179     zEffectorSetting():zEffector(),settingName(),settingValue() { }; //<! Constructor
00180     zEffectorSetting(zEffectorSetting const &other):
00181             zEffector(other),
00182             settingName(other.getSettingName()),
00183     settingValue(other.getSettingValue())  { };
00184     void operator=(zEffectorSetting const &other) { this->zEffector::operator=(other); }; 
00185     virtual zEffectorSetting *copy(void) const { return new zEffectorSetting(*this); };
00186     virtual ~zEffectorSetting() {};
00187 
00188     void setSettingName(tString name) {settingName = name;};
00189     void setSettingValue(tString value) {settingValue = value;};
00190     tString getSettingName() const {return settingName;};
00191     tString getSettingValue() const {return settingValue;};
00192 
00193     virtual void effect(gVectorExtra<ePlayerNetID *> &d_calculatedTargets);
00194 protected:
00195     tString settingName;
00196     tString settingValue;
00197 };
00198 
00199 
00200 
00201 
00202 #endif

Generated on Sat Mar 15 22:56:12 2008 for Armagetron Advanced by  doxygen 1.5.4