Ball.hh

00001 /*
00002 ** TowBowlTactics, a turn-based strategy football game.
00003 **
00004 ** Copyright (C) 2006-2010 The TBT Team.
00005 **
00006 ** This program is free software; you can redistribute it and/or
00007 ** modify it under the terms of the GNU General Public License
00008 ** as published by the Free Software Foundation; either version 2
00009 ** of the License, or (at your option) any later version.
00010 **
00011 ** The complete GNU General Public Licence Notice can be found as the
00012 ** `NOTICE' file in the root directory.
00013 **
00014 ** The TBT Team consists of people listed in the `AUTHORS' file.
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_
Generated on Mon Apr 5 21:17:11 2010 for Stechec/TBT by  doxygen 1.6.3