BaseCRules Class Reference

Inheritance diagram for BaseCRules:
Inheritance graph
[legend]

List of all members.

Public Member Functions

int getCoachId () const
 Get coach id.
int getLeagueId () const
 Get team id.
bool isBusy () const
 Check if rules is processing an order, ie when an order has been issued to the server, and waiting that the server send it last answer.
void sendPacket (const Packet &p) const
 Send a packet to the other side.
void setEventHandler (Event *evp)
 Register the class that will handle events.
void onEvent (int event)
 Send an event to the UI.
void onEvent (const Packet *pkt)
 Send an event to the UI.
virtual ApigetApi ()=0
 Get the real API for the contest (client-side only).

Member Function Documentation

int BaseCRules::getCoachId (  )  const [inline]

Get coach id.

Returns:
-1 when server, otherwise [|0..nb_coach-1|]

Referenced by Api::doBlockPush(), Api::doChooseBlockDice(), Api::doFollow(), Api::doPlaceBall(), Api::doReroll(), Api::doUseSkill(), Api::getActivePlayer(), and Api::myTeamId().

int BaseCRules::getLeagueId (  )  const [inline]

Get team id.

Returns:
-1 when server, otherwise a positive integer.
bool BaseCRules::isBusy (  )  const [inline]

Check if rules is processing an order, ie when an order has been issued to the server, and waiting that the server send it last answer.

When sending a sequence of commands, it is generally advised to wait that a command is finished before sending another one. It is not mandatory.

Returns:
true if rules
void BaseCRules::onEvent ( const Packet pkt  ) 

Send an event to the UI.

Parameters:
pkt Packet to send to the receiver.

References PacketHistory::addCopy(), BASE_TOKEN_START, and Packet::token.

void BaseCRules::onEvent ( int  event  ) 

Send an event to the UI.

Warning: Ugly kludge spotted. On contest Event dispatch(), you will receive a Packet with token == CUSTOM_EVENT, and client_id containing this parameter. Dispatch it as you like.

Referenced by CBall::setCoordinates(), and CBall::setOwner().

void BaseCRules::sendPacket ( const Packet p  )  const [inline]
void BaseCRules::setEventHandler ( Event evp  )  [inline]

Register the class that will handle events.

Parameters:
evp Class that will receive event. Contest-specific.

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