Base rules class for all kind of game. More...
#include <BaseRules.hh>

Public Member Functions | |
Rules external public methods. | |
This set of methods must _only_ be called by the owner of BaseRules, not by the derived classes. | |
| void | setSendPacketObject (PacketSender *ps) |
| Set the object that will manage packet sending. | |
| void | handlePacket (const Packet *p) |
| Called on each recieved packet. | |
| void | setTeamNumber (int coach_nb, int team_nb) |
| Set the team/coach number. | |
| virtual void | serialize (std::ostream &os) const |
| virtual void | unserialize (std::istream &is) |
Protected Types | |
|
typedef std::vector< std::pair < int, BasePacketHandler * > > | PktHList |
Protected Member Functions | |
| virtual const char * | tokenToString (unsigned token) const |
Protected Attributes | |
| PacketSender * | packet_sender_ |
| PktHList | pkt_hdl_ [MAX_TOKEN] |
| PacketHistory | pkt_history_ |
Rules internal public methods. | |
Methods that should only be used by the derived classes of BaseRules, and all classes that are related to rule management. | |
| void | sendPacket (const Packet &p) const |
| Send a packet to the other side. | |
| void | handleWith (BasePacketHandler *bph, int when=0) |
| Register a packet handler. | |
| const PacketHistory & | getHistory () const |
| Get the history of rules-related packets. | |
| int | getCoachNumber () const |
| Get the number of teams. | |
| int | getTeamNumber () const |
| Get the number of teams. | |
| int | getState () const |
| Get the current game state. | |
| void | setState (int new_state) |
| Set the current game state. | |
| const char * | stringifyToken (unsigned token) const |
| Debug function. Return a stringified packet token. | |
| static const char * | stringifyGameState (int game_state) |
| Debug function. Return a stringified game state. | |
Base rules class for all kind of game.
This class takes care of:
| void BaseRules::sendPacket | ( | const Packet & | p | ) | const |
Send a packet to the other side.
| p | A packet to send. |
Reimplemented in BaseCRules.
1.6.3