本文整理汇总了C++中PlayerPtr::GetPID方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerPtr::GetPID方法的具体用法?C++ PlayerPtr::GetPID怎么用?C++ PlayerPtr::GetPID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerPtr
的用法示例。
在下文中一共展示了PlayerPtr::GetPID方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnPacket
int CPlayer::OnPacket(CRecvMsgPacket& msgPack)
{
//DebugInfo("CPlayer::OnPacket Start PID XYID=%d Len=%d",m_PID,msgPack.m_XYID,msgPack.m_nLen );
int nRet = 0;
switch ( msgPack.m_XYID )
{
case GameXY::ReqRoomInfo::XY_ID:
case GameXY::ReqRoomTableInfo::XY_ID:
case GameXY::ReqJoinRoom::XY_ID:
case GameXY::ReqLeaveRoom::XY_ID:
case GameXY::ReqJoinTable::XY_ID:
case GameXY::ReqChangeTable::XY_ID:
case GameXY::ReqTailInfo::XY_ID:
case GameXY::ChangeUserInfo::XY_ID:
case GameXY::ReqPlayerAward::XY_ID:
case GameXY::ReqTracePlayer::XY_ID:
case GameXY::Game_MsgFlag::XY_ID:
case GameXY::Game_Test::XY_ID:
{
if( m_pServer )
{
nRet = m_pServer->OnServerMsg(this,msgPack);
}
else
{
DebugError("CPlayer::OnPacket Server=NULL PID=%d AID=%d id=%d len=%d",m_PID,m_AID,msgPack.m_XYID,msgPack.m_nLen);
}
}
break;
case GameXY::ClientToServerMessage::XY_ID:
case GameXY::ReqPlayerAct::XY_ID:
case GameXY::ReqLeaveTable::XY_ID:
{
if( m_pTable && m_TableID )
{
nRet = m_pTable->OnTableMsg(this,msgPack);
}
else
{
DebugError("CPlayer::OnPacket PID=%d m_pRoom=%d m_RoomID=%d m_pTable=NULL TableID=%d msgid=%d msglen=%d",
m_PID,m_pRoom,m_RoomID,m_TableID,msgPack.m_XYID,msgPack.m_nLen );
if ( msgPack.m_XYID == GameXY::ClientToServerMessage::XY_ID )
{
GameXY::ClientToServerMessage CTSMsg;
ExplainMsg(msgPack,CTSMsg);
DebugError("CPlayer::OnPacket GameMsg XYID=%d XYLEN=%d",CTSMsg.m_MsgID,CTSMsg.m_MsgLen);
}
else if ( msgPack.m_XYID == GameXY::ReqPlayerAct::XY_ID )
{
GameXY::ReqPlayerAct rpa;
TransplainMsg(msgPack,rpa);
DebugError("PlayerAct Action=%d SitID=%d TableID=%d TakeMoney=%s",
rpa.m_Action,rpa.m_SitID,rpa.m_TableID,N2S(rpa.m_nTakeMoney.get()).c_str());
if ( m_pRoom )
{
CGameTable* pTable = m_pRoom->GetTableByID(rpa.m_TableID);
if ( pTable )
{
PlayerPtr pPlayer = pTable->GetTablePlayerByPID(m_PID);
if ( pPlayer )
{
DebugError("Player In Table PID=%d TableID=%d",pPlayer->GetPID(),pTable->GetTableID() );
}
}
}
GameXY::PlayerLeaveTableInfo lt;
lt.m_RoomID = m_RoomID;
lt.m_TableID = rpa.m_TableID;
lt.m_PID = m_PID;
SendMsg(lt);
}
else if ( msgPack.m_XYID == GameXY::ReqLeaveTable::XY_ID )
{
GameXY::ReqLeaveTable rlv;
TransplainMsg(msgPack,rlv);
DebugError("LeaveTable RoomID=%d TableID=%d pRoom=%d pTable=%d",rlv.m_RoomID,rlv.m_TableID,m_pRoom,m_pTable);
if ( m_pRoom )
{
CGameTable* pTable = m_pRoom->GetTableByID(rlv.m_TableID);
if ( pTable )
{
PlayerPtr pPlayer = pTable->GetTablePlayerByPID(m_PID);
if ( pPlayer )
{
DebugError("Player In Table PID=%d TableID=%d",pPlayer->GetPID(),pTable->GetTableID() );
}
}
}
GameXY::PlayerLeaveTableInfo lt;
lt.m_RoomID = rlv.m_RoomID;
lt.m_TableID = rlv.m_TableID;
//.........这里部分代码省略.........