CRules.hxx

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 # include "CMatch.hh"
00018 # include "SendingQueue.hh"
00019 
00020 inline Api*    CRules::getApi()
00021 {
00022   return api_;
00023 }
00024 
00025 inline App*    CRules::getApp()
00026 {
00027   return app_;
00028 }
00029 
00030 inline CMatch* CRules::getMatch()
00031 {
00032   return match_;
00033 }
00034 
00035 inline CPlayerMsg* CRules::getPlayerMsg()
00036 {
00037   return player_msg_;
00038 }
00039 
00040 inline SendingQueue* CRules::getSendingQueue()
00041 {
00042   return sq_;
00043 }
00044 
00045 inline CTeamMsg* CRules::getTeamMsg()
00046 {
00047   return team_msg_;
00048 }
00049 
00050 inline void    CRules::countRequestSending() 
00051 {
00052   if (nb_requests_sent_ == -1)
00053     return;
00054   nb_requests_sent_ ++;
00055   LOG3("Count of sent requests up to %1.", nb_requests_sent_);
00056 }
00057 
00058 inline void    CRules::countRequestProcessed() 
00059 {
00060   if (nb_requests_sent_ == -1)
00061     return;
00062   nb_requests_sent_ --;
00063   LOG3("Count of sent requests down to %1.", nb_requests_sent_);
00064 }
00065 
00066 inline void    CRules::countQueryReceived() 
00067 {
00068 
00069   nb_server_queries_ ++;
00070   LOG3("Count of queries rec. up to %1.", nb_server_queries_);
00071 }
00072 
00073 inline void    CRules::countQueryProcessed() 
00074 {
00075   nb_server_queries_ --;
00076   LOG3("Count of queries rec. down to %1.", nb_server_queries_);
00077 }
00078 
00079 inline void    CRules::sendPacketLater(const MsgMove& m)
00080 {
00081   sq_->push(&m);
00082 }
00083 
00084 inline void    CRules::freezeRequestSending() 
00085 {
00086   nb_requests_sent_ = -1;
00087   LOG3("Request sending freezed to %1.", nb_requests_sent_);
00088 }
00089 
00090 inline void    CRules::unfreezeRequestSending() 
00091 {
00092   nb_requests_sent_ = 0;
00093   LOG3("Request Sending unfreezed to %1.", nb_requests_sent_);
00094 }
00095 
00096 inline int     CRules::getNbRequestsSent() const
00097 {
00098   return nb_requests_sent_;
00099 }
00100 
00101 inline std::ostream& operator<< (std::ostream& os, const CRules& r)
00102 {
00103   return os << *r.match_;
00104 }
00105 
Generated on Mon Apr 5 21:17:11 2010 for Stechec/TBT by  doxygen 1.6.3