SRules.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 SRULES_HH_
00018 # define SRULES_HH_
00019 
00020 # include "rules/BaseSRules.hh"
00021 # include "Constants.hh"
00022 
00023 class App;
00024 class OpStack;
00025 class SMatch;
00026 class SPlayerMsg;
00027 class STeamMsg;
00028 
00033 class CoachErrorCustom {};
00034 
00044 class SRules : public BaseSRules
00045 {
00046 public:
00047   SRules(App* app);
00048   virtual ~SRules();
00049 
00051   void sendIllegal(int token, int from, enum eError error);
00052   
00053   OpStack*   getOpStack();
00054   App*              getApp();
00055   SMatch*           getMatch();
00056   SPlayerMsg*       getPlayerMsg();
00057   STeamMsg*         getTeamMsg();
00058 
00060   virtual void setState(int new_state);
00061 
00064   virtual void serverStartup();
00065 
00068   virtual void serverProcess();
00069 
00071   virtual bool coachKilled(int coach_id, CoachErrorCustom*& cec);
00072 
00073   virtual void serialize(std::ostream& os) const;
00074   virtual void unserialize(std::istream& is);
00075 
00076   friend std::ostream& operator<< (std::ostream& os, const SRules& r);
00077 
00078 private:
00080   const char* tokenToString(unsigned token) const;
00081   
00082   void msgForwardChat(const MsgChat* m);
00083   void msgForwardDebug(const MsgDebug* m);
00084 
00085   App*      app_;
00086   SMatch*   match_;
00087   STeamMsg* team_msg_;
00088   SPlayerMsg* player_msg_;
00089   OpStack* op_stack_;
00090 };
00091 
00092 # include "SRules.hxx"
00093 
00094 #endif /* !SRULES_HH_ */
Generated on Mon Apr 5 21:17:13 2010 for Stechec/TBT by  doxygen 1.6.3