Tank.h

Go to the documentation of this file.
00001 ////////////////////////////////////////////////////////////////////////////////
00002 //    Scorched3D (c) 2000-2009
00003 //
00004 //    This file is part of Scorched3D.
00005 //
00006 //    Scorched3D is free software; you can redistribute it and/or modify
00007 //    it under the terms of the GNU General Public License as published by
00008 //    the Free Software Foundation; either version 2 of the License, or
00009 //    (at your option) any later version.
00010 //
00011 //    Scorched3D is distributed in the hope that it will be useful,
00012 //    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 //    GNU General Public License for more details.
00015 //
00016 //    You should have received a copy of the GNU General Public License
00017 //    along with Scorched3D; if not, write to the Free Software
00018 //    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019 ////////////////////////////////////////////////////////////////////////////////
00020 
00021 #if !defined(AFX_TANK_H__52F37177_46EA_49C8_9B58_E6C57ABDB78A__INCLUDED_)
00022 #define AFX_TANK_H__52F37177_46EA_49C8_9B58_E6C57ABDB78A__INCLUDED_
00023 
00024 #include <target/Target.h>
00025 
00026 class TankAI;
00027 class TankAccessories;
00028 class TankScore;
00029 class TankState;
00030 class TankPosition;
00031 class TankModelContainer;
00032 class TankMod;
00033 class TankAvatar;
00034 class TankCamera;
00035 class Tank : public Target
00036 {
00037 public:
00038         // Constructor for tank
00039         // The name and color are copied
00040         Tank(ScorchedContext &context, 
00041                 unsigned int playerId, 
00042                 unsigned int destinationId,
00043                 const LangString &name, 
00044                 Vector &color, 
00045                 const char *modelName,
00046                 const char *typeName);
00047         virtual ~Tank();
00048 
00049         // Called when the state changes
00050         virtual void newMatch();
00051         virtual void newGame();
00052         virtual void clientNewGame();
00053         void rezTank();
00054 
00055         // Serialize the tank
00056         virtual bool writeMessage(NetBuffer &buffer, bool writeAccessories);
00057         virtual bool readMessage(NetBufferReader &reader);
00058 
00059         // The base attributes of the tank
00060         virtual bool getAlive();
00061         virtual bool isTarget() { return false; }
00062         unsigned int getDestinationId() { return destinationId_; }
00063         void setDestinationId(unsigned int id) { destinationId_ = id; }
00064         unsigned int getTeam() { return team_; }
00065         void setTeam(unsigned int team) { team_ = team; }
00066         unsigned int getKeepAlive() { return keepAlive_; }
00067         void setKeepAlive(unsigned int ka) { keepAlive_ = ka; }
00068         const char *getUniqueId() { return uniqueId_.c_str(); }
00069         void setUniqueId(const char *id) { uniqueId_ = id; }
00070         const char *getSUI() { return SUI_.c_str(); }
00071         void setSUI(const char *SecID) { SUI_ = SecID; }
00072         const char *getHostDesc() { return hostDesc_.c_str(); }
00073         void setHostDesc(const char *id) { hostDesc_ = id; }
00074         TankAI *getTankAI() { return tankAI_; }
00075         void setTankAI(TankAI *ai);
00076         Vector &getColor();
00077         void setColor(Vector &color) { color_ = color; }
00078         unsigned int getIpAddress() { return ipAddress_; }
00079         void setIpAddress(unsigned int ipAddress) { ipAddress_ = ipAddress; }
00080         virtual Weapon *getDeathAction();
00081 
00082         // Other attributes
00083         TankAccessories& getAccessories() { return *accessories_; }
00084         TankScore &getScore() { return *score_; }
00085         TankPosition &getPosition() { return *position_; }
00086         TankState &getState() { return *state_; }
00087         TankMod &getMod() { return *mod_; }
00088         TankAvatar &getAvatar() { return *avatar_; }
00089         TankCamera &getCamera() { return *camera_; }
00090         TankModelContainer &getModelContainer() { return *modelContainer_; }
00091 
00092 protected:
00093         ScorchedContext &context_;
00094         TankModelContainer *modelContainer_;
00095         TankAccessories *accessories_;
00096         TankScore *score_;
00097         TankPosition *position_;
00098         TankState *state_;
00099         TankMod *mod_;
00100         TankAvatar *avatar_;
00101         TankCamera *camera_;
00102         TankAI *tankAI_;
00103         Vector color_;
00104         std::string uniqueId_;
00105         std::string SUI_;
00106         std::string hostDesc_;
00107         unsigned int team_;
00108         unsigned int playerId_;
00109         unsigned int destinationId_;
00110         unsigned int ipAddress_;
00111         unsigned int keepAlive_;
00112 
00113 };
00114 
00115 #endif // !defined(AFX_TANK_H__52F37177_46EA_49C8_9B58_E6C57ABDB78A__INCLUDED_)

Generated on Mon Feb 16 15:14:51 2009 for Scorched3D by  doxygen 1.5.3