common/Team.hh

00001 /*
00002 ** TowBowlTactics, an adaptation of the tabletop game Blood Bowl.
00003 ** 
00004 ** Copyright (C) 2006 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 TEAM_HH_
00018 # define TEAM_HH_
00019 
00020 # include "Constants.hh"
00021 # include "PacketHandler.hh"
00022 
00029 DECLARE_PACKET(MSG_REROLL, MsgReroll)
00030   bool reroll; 
00031 END_PACKET;
00032 
00040 DECLARE_PACKET(MSG_TEAMINFO, MsgTeamInfo)
00041   int team_name[8];
00042   int coach_name[8];
00043   int reroll;
00044 END_PACKET;
00045 
00052 DECLARE_PACKET(MSG_TOUCHDOOOWN, MsgTouchdooown)
00053   int player_id;  
00054 END_PACKET;
00055 
00060 template <typename T>
00061 class Team
00062 {
00063 public:
00064   Team(int team_id);
00065   virtual ~Team();
00066   
00067   int getTeamId() const;
00068   int getNbPlayer() const;
00069   T* getPlayer(int id);
00070   const std::string& getTeamName() const;
00071   const std::string& getCoachName() const;
00072   int getScore() const;
00073   int getReroll() const;
00074   int getRemainingReroll() const;
00075 
00080   bool canUseReroll() const;
00081   void useReroll();
00082   void initReroll();
00083 
00084   bool hasDoneBlitz() const;
00085   bool hasDonePass() const;
00086 
00087   void resetTurn();
00088   bool isPlacementValid() const;
00089 
00090   void incrementScore();
00091   
00092 protected:
00093   int team_id_;   
00094   T* player_[MAX_PLAYER];  
00095 
00096   std::string team_name_;
00097   std::string coach_name_;
00098 
00099   int score_;
00100   int reroll_;
00101   int reroll_remain_;
00102 
00103   bool blitz_done_;
00104   bool pass_done_;
00105 
00106   bool reroll_used_;
00107 };  
00108 
00109 # include "Team.hxx"
00110 
00111 #endif /* !TEAM_HH_ */

Generated on Sat Jun 23 16:07:24 2007 for Stechec/TBT by  doxygen 1.4.7