Ball.hh
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef _BALL_HH_
00018 # define _BALL_HH_
00019
00020 # include "Constants.hh"
00021 # include "rules/PacketHandler.hh"
00022
00030 DECLARE_PACKET(MSG_BALLCOORD, MsgBallCoord)
00031 int old_row;
00032 int old_col;
00033 int row;
00034 int col;
00035 END_PACKET
00036
00044 DECLARE_PACKET(MSG_BALLOWNER, MsgBallOwner)
00045 int old_team_id;
00046 int old_player_id;
00047 int player_id;
00048 END_PACKET;
00049
00054 template <typename T>
00055 class Ball
00056 {
00057 public:
00058 Ball();
00059 virtual ~Ball();
00060
00062 const Coordinates& getCoordinates() const;
00064 virtual void setCoordinates(const Coordinates& pt);
00065
00067 T* getOwner() const;
00069 virtual void setOwner(T* player);
00070
00071 template <typename U>
00072 friend std::ostream& operator<< (std::ostream& os, const Ball<U>& b);
00073
00074 protected:
00075 virtual void printDebug(std::ostream& os) const;
00076
00077 Coordinates coord_;
00078 T* owner_;
00079
00080 private:
00082 Ball(const Ball&)
00083 {
00084 ERR("Unexpected call to Ball copy constructor.");
00085 }
00087 Ball& operator=(const Ball&)
00088 {
00089 ERR("Unexpected call to Ball assignment operator.");
00090 return *this;
00091 }
00092 };
00093
00094 # include "Ball.hxx"
00095
00096 #endif // !_BALL_HH_