BaseRules Class Reference

Base rules class for all kind of game. More...

#include <BaseRules.hh>

Inheritance diagram for BaseRules:
Inheritance graph
[legend]

List of all members.

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

PacketSenderpacket_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 PacketHistorygetHistory () 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.

Detailed Description

Base rules class for all kind of game.

This class takes care of:

Author:
victor
Date:
30/12/2005

Member Function Documentation

void BaseRules::sendPacket ( const Packet p  )  const

Send a packet to the other side.

Parameters:
p A packet to send.
See also:
setSendPacketObject

Reimplemented in BaseCRules.


The documentation for this class was generated from the following files:
Generated on Mon Apr 5 21:17:30 2010 for Stechec/TBT by  doxygen 1.6.3