// $Id: HandleOsRequestDelta.htm 119 2004-05-16 00:02:24Z ggs_mburo $ // This is a GGS file, licensed under the GPL
ggsstream::HandleOsRequestDelta(const CMsgOsRequestDelta* pmsg)
This function is called both when a new challenge is issued and when an old challenge is cancelled. Challenges are normally directed at a specific player but can also be generic.
Challenges are cancelled if the are accepted, declined, or one of the players leaves GGS.
Override this function in CODKStream:
This is designed to be easy; see the commented-out sample code in ODKStream.cpp. CMsgOsRequest has a number of RequireXXX() functions to help you. If the request is of the proper type they will return true otherwise they return false and send a reason back to the challenger.
void CODKStream::HandleOsRequestDelta(const CMsgOsRequestDelta* pmsg) { BaseOsRequestDelta(pmsg); if (pmsg->fPlus && pmsg->IAmChallenged()) { if (pmsg->RequireBoardSize(8) && pmsg->RequireKomi(false) && pmsg->RequireAnti(false)) (*this) << "t /os accept " << pmsg->idr << "\n"; else (*this) << "t /os decline " << pmsg->idr << "\n"; flush(); } }
This rejects requests for anti games (player with the most discs loses), komi games (where the players must guess the outcome of the game) and any game not played on an 8x8 board.