Match.hh

00001 /*
00002 ** TowBowlTactics, a turn-based strategy football game.
00003 ** 
00004 ** Copyright (C) 2008-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 MATCH_HH_
00018 # define MATCH_HH_
00019 
00020 # include "Constants.hh"
00021 
00022 template <typename T>
00023 class Ball;
00024 template <typename T>
00025 class Field;
00026 template <typename T>
00027 class Team;
00028 class Weather;
00029 
00034 template <typename T>
00035 class Match
00036 {
00037 public:
00038   Match();
00039   virtual ~Match();
00040 
00043   virtual Team<T>* getTeam(int team_id);
00045   virtual Field<T>* getField();
00047   virtual Ball<T>* getBall();
00049   virtual Weather* getWeather();
00050 
00051   int getHalf() const;
00052   int getTurn() const;
00053 
00055   int getActiveTeamId() const;
00057   int getBeginningTeamId() const;
00059   int getReceivingTeamId() const;
00061   int getScoringTeamId() const;
00062 
00064   enum eTurnOverMotive getTurnoverMotive() const;
00066   const Timer& getTimer() const;
00067 
00070   static const char* tokenToString(unsigned token);
00072   static const char* stringify(enum eTurnOverMotive motive);
00074   static const char* stringify(enum eError error);
00076   static const char* stringifyGameState(int game_state);
00078   static const char* stringifyPeriod(int period);
00079 
00080   template <typename U>
00081   friend std::ostream& operator<< (std::ostream& os, const Match<U>& m);
00082   
00083 protected:
00084   virtual void printDebug(std::ostream& os) const;
00085 
00086   Team<T>* team_[2];    
00087   Field<T>* field_;     
00088   Ball<T>* ball_;       
00089   Weather*  weather_;   
00090 
00091   int cur_half_;        
00092   int cur_turn_;        
00093   int active_team_id_;    
00094   int beginning_team_id_; 
00095   int receiving_team_id_; 
00096   int scoring_team_id_;   
00097   enum eTurnOverMotive turnover_; 
00098 
00099   Timer timer_;         
00100 
00101 private:
00103   Match(const Match&)
00104   {
00105     ERR("Unexpected call to Match copy constructor.");
00106   }
00108   Match& operator=(const Match&)
00109   {
00110     ERR("Unexpected Match assignment.");
00111     return *this;
00112   }
00113 };
00114 
00115 # include "Match.hxx"
00116 
00117 #endif /* !MATCH_HH_ */
Generated on Mon Apr 5 21:17:12 2010 for Stechec/TBT by  doxygen 1.6.3