SMatch.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 SMATCH_HH_
00018 # define SMATCH_HH_
00019 
00020 # include "Match.hh"
00021 # include "SBall.hh"
00022 # include "SField.hh"
00023 # include "SPlayer.hh"
00024 # include "STeam.hh"
00025 
00026 class App;
00027 class Dice;
00028 class OpStack;
00029 class SPlayerMsg;
00030 class STeamMsg;
00031 
00042 class SMatch : public Match<SPlayer>
00043 {
00044 public:
00045   SMatch(SRules* r);
00046   virtual ~SMatch();
00047   
00048   virtual SBall* getBall();
00049   virtual STeam* getTeam(int team_id);
00050 
00051   Dice* getDice();
00052 
00055   int getCurrentTeamId() const;
00056 
00059   STeam* getCurrentTeam();
00060 
00063   int getCurrentOpponentTeamId() const;
00064 
00067   STeam* getCurrentOpponentTeam();
00068 
00069   int getOpponentTeamId(int team_id) const;
00070   int getOpponentTeamId(STeam* team) const;
00071   STeam* getOpponentTeam(int team_id);
00072   STeam* getOpponentTeam(STeam* team);
00073 
00075   void waitForCurrentOpponentChoice(int team_id);
00077   void checkForCurrentOpponentChoice(int team_id);
00078 
00080   void finishKickoff();
00081 
00083   void nextTurn();
00084 
00086   void turnover(enum eTurnOverMotive motive);
00087 
00089   void touchdooown(SPlayer* p);
00091   void afterTouchdooown();
00092 
00093   virtual void serialize(std::ostream& os) const;
00094   virtual void unserialize(std::istream& is);
00095 
00096   friend std::ostream& operator<< (std::ostream& os, const SMatch& m);
00097 
00098 private:
00100   void initHalf();
00102   void initKickoff();
00103   
00104   bool checkGameEnd();
00105 
00106   void msgInitGame(const MsgInitGame* m);
00107   void msgEndGame(const MsgEndGame* m);
00108   void msgDrawKicker(const MsgDrawKicker* m);
00109   void msgInitKickoff(const MsgInitKickoff* m);
00110   void msgPlayTurn(const MsgEndTurn* m);
00111   void msgTouchdooown(const MsgTouchdooown* m);
00112   void msgMoveTurnMarker(const MsgMoveTurnMarker* m);
00113   void msgIllegalProcedure(const MsgIllegalProc* m);
00114 
00115   Dice*     dice_;
00116   SRules*   r_;
00117 };
00118 
00119 # include "SMatch.hxx"
00120 
00121 #endif /* !SMATCH_HH_ */
Generated on Mon Apr 5 21:17:13 2010 for Stechec/TBT by  doxygen 1.6.3