Example #1
0
void CTaxasPokerPeer::OnWaitActionTimeOut()
{
	if ( GetPlayer()->GetState() == CPlayer::ePlayerState_WillLeavingRoom )
	{
		LeaveRoom();
		return ;
	}

	++m_nContinueNoneAct;

	stMsgTaxasPokerPeerAction msg ;
	msg.ePeerAct = eRoomPeerAction_GiveUp ;
	CRoomTexasPoker*pRoom = (CRoomTexasPoker*)GetRoom() ;
	if ( pRoom->GetCurMostBetCoinThisRound() == GetBetCoinThisRound() )
	{
		msg.ePeerAct = eRoomPeerAction_Pass ;
	}
	
	if ( m_nContinueNoneAct > MAX_NONE_ACT_TIMES )
	{
		msg.ePeerAct = eRoomPeerAction_StandUp ;
		m_nContinueNoneAct = 0 ;
	}
	unsigned nNoneActTimes = m_nContinueNoneAct ;
	OnMessage( &msg ) ;
	m_nContinueNoneAct = nNoneActTimes;
}
Example #2
0
/*
 * Start proper action for command
 */
int ProcessCommand(char* command, char *content) {
   // printf("Entered command: %s\n", command);
    if(strcmp(command, "!connect")==0)
    {
       // printf("%s %s\n",command, content);
        return ConnectToServer(content);
    }
    else if(g_serverFd < 0)
    {
        printf("You must be connected!\n");
        return -1;
    }
    else if(strcmp(command, "!bye")==0)
    {
      //  printf("%s\n",command);
        return Disconnect();
    }
    else if(strcmp(command, "!rooms")==0)
    {
        //printf("%s\n",command);
        return GetRooms(command);
    }
    else if(strcmp(command, "!open")==0)
    {
       // printf("%s\n",command);
        return OpenRoom(command, content);
    }
    else if(strcmp(command, "!close")==0)
    {
        //printf("%s\n",command);
        return CloseRoom(content);
    }
    else if(strcmp(command, "!enter")==0)
    {
        //printf("%s\n",command);
        return EnterRoom(command, content);
    }
    else if(strcmp(command, "!leave")==0)
    {
        //printf("%s\n",command);
        return LeaveRoom();
    }
    else if(strcmp(command, "!files")==0)
    {
        //printf("%s\n",command);
        return CheckFiles();
    }
    else if(strcmp(command, "!push")==0)
    {
    //    printf("%s\n",command);
        return UploadFile(content);
    }
    else if(strcmp(command, "!pull")==0)
    {
      //  printf("%s\n",command);
        return DownloadFile(content);
    }
    else if(strcmp(command, "!rm")==0)
    {
        //printf("%s\n",command);
        return 1;
    }
    else if(strcmp(command, "!send")==0)
    {
        //printf("%s\n", command);
        return SendMessageToRoom(content);
    }
    else
        return -1;
}