Team.hh
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef TEAM_HH_
00018 # define TEAM_HH_
00019
00020 # include "Constants.hh"
00021 # include "rules/PacketHandler.hh"
00022
00029 DECLARE_PACKET(MSG_REROLL, MsgReroll)
00030 bool reroll;
00031 END_PACKET;
00032
00039 DECLARE_PACKET(MSG_TEAMINFO, MsgTeamInfo)
00040 int team_name[8];
00041 int nation_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& getNationName() const;
00072 std::string getNationId() const;
00073 const std::string& getCoachName() const;
00074 int getScore() const;
00075 int getReroll() const;
00076 int getRemainingReroll() const;
00077
00082 bool canUseReroll() const;
00083 void useReroll();
00084 void initReroll();
00085
00086 int getActivePlayerId() const;
00087 bool hasDoneAction(enum eAction action) const;
00088
00089 virtual void resetTurn();
00090 bool isPlacementValid() const;
00091
00092 void incrementScore();
00093
00094 template<typename U>
00095 friend std::ostream& operator<< (std::ostream& os, const Team<U>& t);
00096
00097 protected:
00098 virtual void printDebug(std::ostream& os) const;
00099
00100 int team_id_;
00101 T* player_[MAX_PLAYER];
00102
00103 std::string team_name_;
00104 std::string nation_name_;
00105 std::string coach_name_;
00106
00107 int score_;
00108 int reroll_;
00109 int reroll_remain_;
00110
00111 int active_player_id_;
00112 bool actions_done_[ACT_LAST];
00113 bool reroll_used_;
00114
00115 private:
00117 Team(const Team&)
00118 {
00119 ERR("Unexpected call to Team copy constructor.");
00120 }
00122 Team& operator=(const Team&)
00123 {
00124 ERR("Unexpected Team assignment.");
00125 return *this;
00126 }
00127 };
00128
00129 # include "Team.hxx"
00130
00131 #endif