2077 lines
55 KiB
C++
2077 lines
55 KiB
C++
|
|
#include "StdAfx.h"
|
|||
|
|
#include "TableFrameSink.h"
|
|||
|
|
#include "cmath"
|
|||
|
|
//////////////////////////////////////////////////////////////////////////
|
|||
|
|
|
|||
|
|
//<2F><>̬<EFBFBD><CCAC><EFBFBD><EFBFBD>
|
|||
|
|
const WORD CTableFrameSink::m_wPlayerCount = GAME_PLAYER; //<2F><>Ϸ<EFBFBD><CFB7><EFBFBD><EFBFBD>
|
|||
|
|
|
|||
|
|
// <20><>Ϸ<EFBFBD><CFB7>ʱ<EFBFBD><CAB1>
|
|||
|
|
enum tagServerTimerEnum
|
|||
|
|
{
|
|||
|
|
IDI_SEND_CARD = 1, //<2F><><EFBFBD>Ƽ<EFBFBD>ʱ<EFBFBD><CAB1>;
|
|||
|
|
|
|||
|
|
IDT_SEND_CARD = 5000, //<2F><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>;
|
|||
|
|
|
|||
|
|
IDI_OUT_CARD = 2, //<2F><><EFBFBD>Ƽ<EFBFBD>ʱ<EFBFBD><CAB1>;
|
|||
|
|
IDT_OUT_CARD = 2000, //<2F><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>;
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
//////////////////////////////////////////////////////////////////////////
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD>캯<EFBFBD><ECBAAF>
|
|||
|
|
CTableFrameSink::CTableFrameSink()
|
|||
|
|
{
|
|||
|
|
//<2F><>Ϸ<EFBFBD><CFB7><EFBFBD><EFBFBD>
|
|||
|
|
m_bNobodyCallScore = false;
|
|||
|
|
m_wFirstUser = INVALID_CHAIR;
|
|||
|
|
m_wBankerUser = INVALID_CHAIR;
|
|||
|
|
m_wCurrentUser = INVALID_CHAIR;
|
|||
|
|
m_etGameEndType = GAME_END_NULL;
|
|||
|
|
ZeroMemory(m_bTrustee, sizeof(m_bTrustee));
|
|||
|
|
|
|||
|
|
//<2F>з<EFBFBD><D0B7><EFBFBD>Ϣ;
|
|||
|
|
ZeroMemory(m_cbScoreInfo, sizeof(m_cbScoreInfo));
|
|||
|
|
|
|||
|
|
//ʤ<><CAA4><EFBFBD><EFBFBD>Ϣ
|
|||
|
|
m_wWinCount = 0;
|
|||
|
|
ZeroMemory(m_wWinOrder, sizeof(m_wWinOrder));
|
|||
|
|
ZeroMemory(m_cbGongxian, sizeof(m_cbGongxian));
|
|||
|
|
ZeroMemory(m_lBombScore, sizeof(m_lBombScore));
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
|||
|
|
m_wTurnWiner = INVALID_CHAIR;
|
|||
|
|
ZeroMemory(&m_TurnOutCard, sizeof(m_TurnOutCard));
|
|||
|
|
|
|||
|
|
//<2F>˿<EFBFBD><CBBF><EFBFBD>Ϣ
|
|||
|
|
ZeroMemory(m_cbHandCardData, sizeof(m_cbHandCardData));
|
|||
|
|
ZeroMemory(m_cbHandCardCount, sizeof(m_cbHandCardCount));
|
|||
|
|
|
|||
|
|
for (WORD i = 0; i < GAME_PLAYER; i++)
|
|||
|
|
{
|
|||
|
|
m_wFriendChairID[i] = INVALID_CHAIR;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
m_pITableFrame = NULL;
|
|||
|
|
m_pGameServiceOption = NULL;
|
|||
|
|
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
CTableFrameSink::~CTableFrameSink()
|
|||
|
|
{
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F>ӿڲ<D3BF>ѯ
|
|||
|
|
VOID * CTableFrameSink::QueryInterface(REFGUID Guid, DWORD dwQueryVer)
|
|||
|
|
{
|
|||
|
|
QUERYINTERFACE(ITableFrameSink, Guid, dwQueryVer);
|
|||
|
|
QUERYINTERFACE(ITableUserAction, Guid, dwQueryVer);
|
|||
|
|
QUERYINTERFACE_IUNKNOWNEX(ITableFrameSink, Guid, dwQueryVer);
|
|||
|
|
return NULL;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><>ʼ<EFBFBD><CABC>
|
|||
|
|
bool CTableFrameSink::Initialization(IUnknownEx * pIUnknownEx)
|
|||
|
|
{
|
|||
|
|
//<2F><>ѯ<EFBFBD>ӿ<EFBFBD>
|
|||
|
|
ASSERT(pIUnknownEx != NULL);
|
|||
|
|
m_pITableFrame = QUERY_OBJECT_PTR_INTERFACE(pIUnknownEx, ITableFrame);
|
|||
|
|
if (m_pITableFrame == NULL) return false;
|
|||
|
|
|
|||
|
|
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>
|
|||
|
|
m_pGameServiceOption = m_pITableFrame->GetGameServiceOption();
|
|||
|
|
ASSERT(m_pGameServiceOption != NULL);
|
|||
|
|
|
|||
|
|
//<2F><>ʼģʽ
|
|||
|
|
m_pITableFrame->SetStartMode(START_MODE_FULL_READY);
|
|||
|
|
|
|||
|
|
//BYTE cbCardData[MAX_COUNT] = {
|
|||
|
|
// 0x4f, 0x22, 0x02, 0x31, 0x21, 0x01, 0x3d, 0x2d, 0x3c, 0x0c,
|
|||
|
|
// 0x3b, 0x2b, 0x0b, 0x39, 0x29, 0x19, 0x38, 0x28, 0x07, 0x16,
|
|||
|
|
// 0x06, 0x15, 0x05, 0x05, 0x33, 0x23, 0x03};
|
|||
|
|
|
|||
|
|
//GetBombScore(0, cbCardData, MAX_COUNT);
|
|||
|
|
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>
|
|||
|
|
VOID CTableFrameSink::RepositionSink()
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
//<2F><>Ϸ<EFBFBD><CFB7><EFBFBD><EFBFBD>
|
|||
|
|
m_bNobodyCallScore = false;
|
|||
|
|
m_wCurrentUser = INVALID_CHAIR;
|
|||
|
|
m_wBankerUser = INVALID_CHAIR;
|
|||
|
|
m_etGameEndType = GAME_END_NULL;
|
|||
|
|
ZeroMemory(m_bTrustee, sizeof(m_bTrustee));
|
|||
|
|
|
|||
|
|
//<2F>з<EFBFBD><D0B7><EFBFBD>Ϣ;
|
|||
|
|
ZeroMemory(m_cbScoreInfo, sizeof(m_cbScoreInfo));
|
|||
|
|
|
|||
|
|
//ʤ<><CAA4><EFBFBD><EFBFBD>Ϣ
|
|||
|
|
m_wWinCount = 0;
|
|||
|
|
ZeroMemory(m_wWinOrder, sizeof(m_wWinOrder));
|
|||
|
|
ZeroMemory(m_cbGongxian, sizeof(m_cbGongxian));
|
|||
|
|
ZeroMemory(m_lBombScore, sizeof(m_lBombScore));
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
|||
|
|
m_wTurnWiner = INVALID_CHAIR;
|
|||
|
|
ZeroMemory(&m_TurnOutCard, sizeof(m_TurnOutCard));
|
|||
|
|
|
|||
|
|
//<2F>˿<EFBFBD><CBBF><EFBFBD>Ϣ
|
|||
|
|
ZeroMemory(m_cbHandCardData, sizeof(m_cbHandCardData));
|
|||
|
|
ZeroMemory(m_cbHandCardCount, sizeof(m_cbHandCardCount));
|
|||
|
|
|
|||
|
|
for (WORD i = 0; i < GAME_PLAYER; i++)
|
|||
|
|
{
|
|||
|
|
m_wFriendChairID[i] = INVALID_CHAIR;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><>Ϸ<EFBFBD><CFB7>ʼ
|
|||
|
|
bool CTableFrameSink::OnEventGameStart()
|
|||
|
|
{
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>˿<EFBFBD>
|
|||
|
|
srand((unsigned)time(NULL));
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD>״̬;
|
|||
|
|
m_pITableFrame->SetGameStatus(GAME_SCENE_SEND);
|
|||
|
|
|
|||
|
|
BYTE cbRandCard[FULL_COUNT] = {0};
|
|||
|
|
|
|||
|
|
if (IsHasGameRule(eDZRuleEnum_NO_JOKER))
|
|||
|
|
{
|
|||
|
|
////<2F><><EFBFBD><EFBFBD>״̬;
|
|||
|
|
//m_pITableFrame->SetGameStatus(GAME_SCENE_CALL_SCORE);
|
|||
|
|
|
|||
|
|
m_GameLogic.RandNoJokerCardList(cbRandCard, NO_JOKER_COUNT);
|
|||
|
|
|
|||
|
|
//<2F>û<EFBFBD><C3BB>˿<EFBFBD>
|
|||
|
|
for (WORD i = 0; i < GAME_PLAYER; i++)
|
|||
|
|
{
|
|||
|
|
m_cbHandCardCount[i] = MAX_NO_JOKER_COUNT;
|
|||
|
|
CopyMemory(&m_cbHandCardData[i], &cbRandCard[i*m_cbHandCardCount[i]], sizeof(BYTE)*m_cbHandCardCount[i]);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
////<2F><><EFBFBD><EFBFBD>״̬;
|
|||
|
|
//m_pITableFrame->SetGameStatus(GAME_SCENE_PLAY);
|
|||
|
|
|
|||
|
|
m_GameLogic.RandCardList(cbRandCard, FULL_COUNT);
|
|||
|
|
|
|||
|
|
//<2F>û<EFBFBD><C3BB>˿<EFBFBD>
|
|||
|
|
for (WORD i = 0; i < GAME_PLAYER; i++)
|
|||
|
|
{
|
|||
|
|
m_cbHandCardCount[i] = MAX_COUNT;
|
|||
|
|
CopyMemory(&m_cbHandCardData[i], &cbRandCard[i*m_cbHandCardCount[i]], sizeof(BYTE)*m_cbHandCardCount[i]);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (m_wFirstUser == INVALID_CHAIR) m_wFirstUser = 0;
|
|||
|
|
|
|||
|
|
m_wBankerUser = INVALID_CHAIR;
|
|||
|
|
m_wTurnWiner = m_wFirstUser;
|
|||
|
|
m_wCurrentUser = m_wFirstUser;
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
CMD_S_GameStart GameStart;
|
|||
|
|
ZeroMemory(&GameStart, sizeof(GameStart));
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD>ñ<EFBFBD><C3B1><EFBFBD>
|
|||
|
|
GameStart.wCurrentUser = m_wCurrentUser;
|
|||
|
|
GameStart.lCellScore = m_pGameServiceOption->lCellScore;
|
|||
|
|
GameStart.bHasJoker = !IsHasGameRule(eDZRuleEnum_NO_JOKER);
|
|||
|
|
CopyMemory(GameStart.cbCardCount, m_cbHandCardCount, sizeof(BYTE)*GAME_PLAYER);
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
for (WORD i = 0; i < GAME_PLAYER; i++)
|
|||
|
|
{
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>˿<EFBFBD>
|
|||
|
|
ASSERT(CountArray(GameStart.cbCardData) >= m_cbHandCardCount[i]);
|
|||
|
|
CopyMemory(GameStart.cbCardData, m_cbHandCardData[i], sizeof(BYTE)*m_cbHandCardCount[i]);
|
|||
|
|
GameStart.bTrustee[i] = m_bTrustee[i];
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
m_pITableFrame->SendTableData(i, SUB_S_GAME_START, &GameStart, sizeof(GameStart));
|
|||
|
|
m_pITableFrame->SendLookonData(i, SUB_S_GAME_START, &GameStart, sizeof(GameStart));
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// ¼<><C2BC><EFBFBD><EFBFBD>ʼ;
|
|||
|
|
starGameRecord();
|
|||
|
|
|
|||
|
|
// <20><>¼<EFBFBD><C2BC>ʼ<EFBFBD><CABC>Ϣ;
|
|||
|
|
CMD_Record_GameStart recordStart;
|
|||
|
|
recordStart.wStartUser = m_wFirstUser;
|
|||
|
|
recordStart.wCurrentUser = m_wCurrentUser;
|
|||
|
|
addGameRecordAction(SUB_S_GAME_START, &recordStart, sizeof(CMD_Record_GameStart));
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>˿<EFBFBD>
|
|||
|
|
for (WORD i = 0; i < GAME_PLAYER; i++)
|
|||
|
|
{
|
|||
|
|
m_GameLogic.SortCardList(m_cbHandCardData[i], m_cbHandCardCount[i], ST_ORDER);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;
|
|||
|
|
//if (GameStart.bHasJoker)
|
|||
|
|
//{
|
|||
|
|
// m_pITableFrame->SetGameTimer(IDI_SEND_CARD, IDT_SEND_CARD, 1, 0);
|
|||
|
|
//}
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD>ƽ<EFBFBD><C6BD><EFBFBD>;
|
|||
|
|
m_pITableFrame->SetGameTimer(IDI_SEND_CARD, IDT_SEND_CARD, 1, 0);
|
|||
|
|
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><>Ϸ<EFBFBD><CFB7><EFBFBD><EFBFBD>
|
|||
|
|
bool CTableFrameSink::OnEventGameConclude(WORD wChairID, IServerUserItem * pIServerUserItem, BYTE cbReason)
|
|||
|
|
{
|
|||
|
|
switch (cbReason)
|
|||
|
|
{
|
|||
|
|
case GER_BAOZI: // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¶<EFBFBD><C2B6>壬<EFBFBD><E5A3AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;
|
|||
|
|
{
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
CMD_S_GameEnd GameEnd;
|
|||
|
|
ZeroMemory(&GameEnd, sizeof(GameEnd));
|
|||
|
|
GameEnd.iGameEndType = m_etGameEndType;
|
|||
|
|
|
|||
|
|
//<2F>û<EFBFBD><C3BB>˿<EFBFBD>
|
|||
|
|
for (WORD i = 0; i < GAME_PLAYER; i++)
|
|||
|
|
{
|
|||
|
|
GameEnd.wWinOrder[i] = INVALID_CHAIR;
|
|||
|
|
GameEnd.wFriendChairID[i] = m_wFriendChairID[i];
|
|||
|
|
GameEnd.cbCardCount[i] = m_cbHandCardCount[i];
|
|||
|
|
CopyMemory(GameEnd.cbCardData[i], m_cbHandCardData[i], m_cbHandCardCount[i] * sizeof(BYTE));
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD>ͷ<EFBFBD>ӷ<EFBFBD>;
|
|||
|
|
if (m_cbHandCardCount[i] > 0)
|
|||
|
|
{
|
|||
|
|
GetBombScore(i, m_cbHandCardData[i], m_cbHandCardCount[i]);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD>ֱ<EFBFBD><D6B1><EFBFBD>
|
|||
|
|
tagScoreInfo ScoreInfoArray[GAME_PLAYER];
|
|||
|
|
ZeroMemory(&ScoreInfoArray, sizeof(ScoreInfoArray));
|
|||
|
|
for (WORD i = 0; i < GAME_PLAYER; i++)
|
|||
|
|
{
|
|||
|
|
GameEnd.lGameScore[i] = 0; // <20><>Ϸ<EFBFBD>÷<EFBFBD>;
|
|||
|
|
GameEnd.lBombScore[i] = m_lBombScore[i]; // ը<><D5A8><EFBFBD>÷<EFBFBD>;
|
|||
|
|
GameEnd.lAllScore[i] = m_lBombScore[i] + GameEnd.lGameScore[i]; // <20>ܵ÷<DCB5>;
|
|||
|
|
|
|||
|
|
ScoreInfoArray[i].lScore = GameEnd.lAllScore[i];
|
|||
|
|
|
|||
|
|
if (ScoreInfoArray[i].lScore > 0)
|
|||
|
|
{
|
|||
|
|
ScoreInfoArray[i].cbType = SCORE_TYPE_WIN;
|
|||
|
|
}
|
|||
|
|
else if (ScoreInfoArray[i].lScore < 0)
|
|||
|
|
{
|
|||
|
|
ScoreInfoArray[i].cbType = SCORE_TYPE_LOSE;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
ScoreInfoArray[i].cbType = SCORE_TYPE_DRAW;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/********************************˽<>˳<EFBFBD>ͳ<EFBFBD><CDB3>****************************************/
|
|||
|
|
tagPrivateFrameRecordInfo* pPrivateRecord = m_pITableFrame->GetPrivateFrameRecord();
|
|||
|
|
BYTE cbFinishCout = pPrivateRecord->cbFinishCout;
|
|||
|
|
|
|||
|
|
//ͳ<>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD><EFBFBD>ϸ
|
|||
|
|
for (WORD i = 0; i < GAME_PLAYER; i++)
|
|||
|
|
{
|
|||
|
|
if (cbFinishCout < 16)
|
|||
|
|
{
|
|||
|
|
m_PrivateEndInfo.lDetails[i][cbFinishCout] = GameEnd.lAllScore[i];
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD>
|
|||
|
|
m_PrivateEndInfo.cbFinishCout = cbFinishCout + 1;
|
|||
|
|
|
|||
|
|
m_pITableFrame->addPrivatePlayCout(1);
|
|||
|
|
/********************************˽<>˳<EFBFBD>ͳ<EFBFBD><CDB3>****************************************/
|
|||
|
|
|
|||
|
|
//<2F>ƾֽ<C6BE><D6BD><EFBFBD><EFBFBD><EFBFBD>,ÿ8<C3BF><38><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD>㾭<EFBFBD><E3BEAD>ֵ;
|
|||
|
|
if (IsPrivateEnd())
|
|||
|
|
{
|
|||
|
|
tagPrivateFrameParameter* pPrivateFrame = m_pITableFrame->GetPrivateFrameInfo();
|
|||
|
|
SCORE lGrade = pPrivateFrame->dwPlayCost;
|
|||
|
|
|
|||
|
|
for (WORD i = 0; i < GAME_PLAYER; i++)
|
|||
|
|
{
|
|||
|
|
ScoreInfoArray[i].lGrade = lGrade;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
GameEnd.isPrivateEnd = true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
|||
|
|
m_pITableFrame->SendTableData(INVALID_CHAIR, SUB_S_GAME_END, &GameEnd, sizeof(GameEnd));
|
|||
|
|
m_pITableFrame->SendLookonData(INVALID_CHAIR, SUB_S_GAME_END, &GameEnd, sizeof(GameEnd));
|
|||
|
|
|
|||
|
|
// <20><>¼<EFBFBD><C2BC>Ϸ<EFBFBD><CFB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ;
|
|||
|
|
addGameRecordAction(SUB_S_GAME_END, &GameEnd, sizeof(GameEnd));
|
|||
|
|
|
|||
|
|
//д<><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;
|
|||
|
|
DataStream kDataStream;
|
|||
|
|
m_kGameRecord.StreamValue(kDataStream, true);
|
|||
|
|
m_pITableFrame->WriteTableScore(ScoreInfoArray, CountArray(ScoreInfoArray), kDataStream);
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϸ
|
|||
|
|
m_pITableFrame->ConcludeGame(GAME_SCENE_FREE);
|
|||
|
|
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
case GER_DISMISS: //<2F><>Ϸ<EFBFBD><CFB7>ɢ
|
|||
|
|
{
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
CMD_S_GameEnd GameEnd;
|
|||
|
|
memset(&GameEnd, 0, sizeof(GameEnd));
|
|||
|
|
GameEnd.iGameEndType = GAME_END_DRAW;
|
|||
|
|
|
|||
|
|
//<2F>û<EFBFBD><C3BB>˿<EFBFBD>
|
|||
|
|
for (WORD i = 0; i < GAME_PLAYER; i++)
|
|||
|
|
{
|
|||
|
|
GameEnd.wFriendChairID[i] = m_wFriendChairID[i];
|
|||
|
|
GameEnd.cbCardCount[i] = m_cbHandCardCount[i];
|
|||
|
|
CopyMemory(GameEnd.cbCardData[i], m_cbHandCardData[i], m_cbHandCardCount[i] * sizeof(BYTE));
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD>ͷ<EFBFBD>ӷ<EFBFBD>;
|
|||
|
|
if (m_cbHandCardCount[i] > 0)
|
|||
|
|
{
|
|||
|
|
GetBombScore(i, m_cbHandCardData[i], m_cbHandCardCount[i]);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD>ֱ<EFBFBD><D6B1><EFBFBD>
|
|||
|
|
tagScoreInfo ScoreInfoArray[GAME_PLAYER];
|
|||
|
|
ZeroMemory(&ScoreInfoArray, sizeof(ScoreInfoArray));
|
|||
|
|
for (WORD i = 0; i < GAME_PLAYER; i++)
|
|||
|
|
{
|
|||
|
|
GameEnd.lGameScore[i] = 0; // <20><>Ϸ<EFBFBD>÷<EFBFBD>;
|
|||
|
|
GameEnd.lBombScore[i] = m_lBombScore[i]; // ը<><D5A8><EFBFBD>÷<EFBFBD>;
|
|||
|
|
GameEnd.lAllScore[i] = m_lBombScore[i] + GameEnd.lGameScore[i]; // <20>ܵ÷<DCB5>;
|
|||
|
|
|
|||
|
|
ScoreInfoArray[i].lScore = GameEnd.lAllScore[i];
|
|||
|
|
|
|||
|
|
if (ScoreInfoArray[i].lScore > 0)
|
|||
|
|
{
|
|||
|
|
ScoreInfoArray[i].cbType = SCORE_TYPE_WIN;
|
|||
|
|
}
|
|||
|
|
else if (ScoreInfoArray[i].lScore < 0)
|
|||
|
|
{
|
|||
|
|
ScoreInfoArray[i].cbType = SCORE_TYPE_LOSE;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
ScoreInfoArray[i].cbType = SCORE_TYPE_DRAW;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/********************************˽<>˳<EFBFBD>ͳ<EFBFBD><CDB3>****************************************/
|
|||
|
|
tagPrivateFrameRecordInfo* pPrivateRecord = m_pITableFrame->GetPrivateFrameRecord();
|
|||
|
|
BYTE cbFinishCout = pPrivateRecord->cbFinishCout;
|
|||
|
|
|
|||
|
|
//ͳ<>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD><EFBFBD>ϸ
|
|||
|
|
for (WORD i = 0; i < GAME_PLAYER; i++)
|
|||
|
|
{
|
|||
|
|
if (cbFinishCout < 16)
|
|||
|
|
{
|
|||
|
|
m_PrivateEndInfo.lDetails[i][cbFinishCout] = GameEnd.lAllScore[i];
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD>
|
|||
|
|
m_PrivateEndInfo.cbFinishCout = cbFinishCout + 1;
|
|||
|
|
|
|||
|
|
m_pITableFrame->addPrivatePlayCout(1);
|
|||
|
|
/********************************˽<>˳<EFBFBD>ͳ<EFBFBD><CDB3>****************************************/
|
|||
|
|
|
|||
|
|
// ˽<>˳<EFBFBD><CBB3><EFBFBD>Ϸ<EFBFBD><CFB7><EFBFBD><EFBFBD>Ԥ<EFBFBD>ж<EFBFBD>;
|
|||
|
|
if (IsRecordServerType() && IsPrivateEnd())
|
|||
|
|
{
|
|||
|
|
GameEnd.isPrivateEnd = true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
|||
|
|
m_pITableFrame->SendTableData(INVALID_CHAIR, SUB_S_GAME_END, &GameEnd, sizeof(GameEnd));
|
|||
|
|
m_pITableFrame->SendLookonData(INVALID_CHAIR, SUB_S_GAME_END, &GameEnd, sizeof(GameEnd));
|
|||
|
|
|
|||
|
|
// <20><>¼<EFBFBD><C2BC>Ϸ<EFBFBD><CFB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ;
|
|||
|
|
addGameRecordAction(SUB_S_GAME_END, &GameEnd, sizeof(GameEnd));
|
|||
|
|
|
|||
|
|
//д<><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;
|
|||
|
|
DataStream kDataStream;
|
|||
|
|
m_kGameRecord.StreamValue(kDataStream, true);
|
|||
|
|
m_pITableFrame->WriteTableScore(ScoreInfoArray, CountArray(ScoreInfoArray), kDataStream);
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϸ
|
|||
|
|
m_pITableFrame->ConcludeGame(GAME_SCENE_FREE);
|
|||
|
|
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
case GER_NORMAL:
|
|||
|
|
{
|
|||
|
|
// ֻ<><D6BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;
|
|||
|
|
if (IsHasGameRule(eDZRuleEnum_TO_TWO))
|
|||
|
|
{
|
|||
|
|
return ToTwoGameConclude(wChairID, pIServerUserItem);
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
return NormalGameConclude(wChairID, pIServerUserItem);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
case GER_USER_LEAVE: //<2F>û<EFBFBD>ǿ<EFBFBD><C7BF>
|
|||
|
|
case GER_NETWORK_ERROR: //<2F><><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>
|
|||
|
|
{
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
CMD_S_GameEnd GameEnd;
|
|||
|
|
memset(&GameEnd, 0, sizeof(GameEnd));
|
|||
|
|
|
|||
|
|
//<2F>û<EFBFBD><C3BB>˿<EFBFBD>
|
|||
|
|
for (WORD i = 0; i < GAME_PLAYER; i++)
|
|||
|
|
{
|
|||
|
|
GameEnd.wFriendChairID[i] = m_wFriendChairID[i];
|
|||
|
|
GameEnd.cbCardCount[i] = m_cbHandCardCount[i];
|
|||
|
|
CopyMemory(GameEnd.cbCardData[i], m_cbHandCardData[i], m_cbHandCardCount[i] * sizeof(BYTE));
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
|||
|
|
m_pITableFrame->SendTableData(INVALID_CHAIR, SUB_S_GAME_END, &GameEnd, sizeof(GameEnd));
|
|||
|
|
m_pITableFrame->SendLookonData(INVALID_CHAIR, SUB_S_GAME_END, &GameEnd, sizeof(GameEnd));
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD>ֱ<EFBFBD><D6B1><EFBFBD>
|
|||
|
|
tagScoreInfo ScoreInfoArray[GAME_PLAYER];
|
|||
|
|
ZeroMemory(&ScoreInfoArray, sizeof(ScoreInfoArray));
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD>ܷ<EFBFBD><DCB7><EFBFBD>
|
|||
|
|
ScoreInfoArray[wChairID].lScore = GameEnd.lGameScore[wChairID];
|
|||
|
|
ScoreInfoArray[wChairID].cbType = SCORE_TYPE_FLEE;
|
|||
|
|
|
|||
|
|
// <20><>¼<EFBFBD><C2BC>Ϸ<EFBFBD><CFB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ;
|
|||
|
|
addGameRecordAction(SUB_S_GAME_END, &GameEnd, sizeof(GameEnd));
|
|||
|
|
|
|||
|
|
//д<><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;
|
|||
|
|
DataStream kDataStream;
|
|||
|
|
m_kGameRecord.StreamValue(kDataStream, true);
|
|||
|
|
m_pITableFrame->WriteTableScore(ScoreInfoArray, CountArray(ScoreInfoArray), kDataStream);
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϸ
|
|||
|
|
m_pITableFrame->ConcludeGame(GAME_SCENE_FREE);
|
|||
|
|
|
|||
|
|
//<2F>л<EFBFBD>ׯ<EFBFBD><D7AF>
|
|||
|
|
m_wBankerUser = (m_wBankerUser + 1) % GAME_PLAYER;
|
|||
|
|
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
ASSERT(FALSE);
|
|||
|
|
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;
|
|||
|
|
bool CTableFrameSink::NormalGameConclude(WORD wChairID, IServerUserItem * pIServerUserItem)
|
|||
|
|
{
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
CMD_S_GameEnd GameEnd;
|
|||
|
|
ZeroMemory(&GameEnd, sizeof(GameEnd));
|
|||
|
|
|
|||
|
|
tagScoreInfo ScoreInfo[GAME_PLAYER];
|
|||
|
|
ZeroMemory(&ScoreInfo, sizeof(ScoreInfo));
|
|||
|
|
|
|||
|
|
//ʤ<><CAA4><EFBFBD><EFBFBD>Ϣ
|
|||
|
|
for (WORD i = 0; i < GAME_PLAYER; i++)
|
|||
|
|
{
|
|||
|
|
if (m_cbHandCardCount[i] != 0)
|
|||
|
|
{
|
|||
|
|
m_wWinOrder[m_wWinCount++] = i;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD>;
|
|||
|
|
CopyMemory(GameEnd.wWinOrder, m_wWinOrder, sizeof(m_wWinOrder));
|
|||
|
|
|
|||
|
|
//ʣ<><CAA3><EFBFBD>˿<EFBFBD>
|
|||
|
|
for (WORD i = 0; i < GAME_PLAYER; i++)
|
|||
|
|
{
|
|||
|
|
GameEnd.wFriendChairID[i] = m_wFriendChairID[i];
|
|||
|
|
GameEnd.cbCardCount[i] = m_cbHandCardCount[i];
|
|||
|
|
CopyMemory(GameEnd.cbCardData[i], m_cbHandCardData[i], m_cbHandCardCount[i] * sizeof(BYTE));
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD>Ҵ<EFBFBD><D2B4><EFBFBD>;
|
|||
|
|
if (!m_bNobodyCallScore)
|
|||
|
|
{
|
|||
|
|
// Ӯ<><D3AE><EFBFBD><EFBFBD>;
|
|||
|
|
SCORE lWinCellScore = 2 * m_pGameServiceOption->lCellScore;
|
|||
|
|
|
|||
|
|
// ׯ<><D7AF>Ӯ;
|
|||
|
|
if (wChairID == m_wBankerUser)
|
|||
|
|
{
|
|||
|
|
ScoreInfo[m_wBankerUser].lScore = 3 * lWinCellScore;
|
|||
|
|
ScoreInfo[m_wBankerUser].cbType = SCORE_TYPE_WIN;
|
|||
|
|
|
|||
|
|
for (WORD i = 0; i < GAME_PLAYER; i++)
|
|||
|
|
{
|
|||
|
|
if (i == m_wBankerUser) continue;
|
|||
|
|
|
|||
|
|
ScoreInfo[i].lScore = 0 - lWinCellScore;
|
|||
|
|
ScoreInfo[i].cbType = SCORE_TYPE_WIN;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
ScoreInfo[m_wBankerUser].lScore = 0 - 3 * lWinCellScore;
|
|||
|
|
ScoreInfo[m_wBankerUser].cbType = SCORE_TYPE_WIN;
|
|||
|
|
|
|||
|
|
for (WORD i = 0; i < GAME_PLAYER; i++)
|
|||
|
|
{
|
|||
|
|
if (i == m_wBankerUser) continue;
|
|||
|
|
|
|||
|
|
ScoreInfo[i].lScore = lWinCellScore;
|
|||
|
|
ScoreInfo[i].cbType = SCORE_TYPE_WIN;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F>л<EFBFBD>ׯ<EFBFBD><D7AF>
|
|||
|
|
m_wFirstUser = m_wBankerUser;
|
|||
|
|
GameEnd.iGameEndType = GAME_END_DRAW;
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD>ͷ<EFBFBD>ӷ<EFBFBD>;
|
|||
|
|
for (WORD i = 0; i < GAME_PLAYER; i++)
|
|||
|
|
{
|
|||
|
|
if (m_cbHandCardCount[i] <= 0) continue;
|
|||
|
|
|
|||
|
|
GetBombScore(i, m_cbHandCardData[i], m_cbHandCardCount[i]);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>;
|
|||
|
|
BYTE cbHasJoker = IsHasGameRule(eDZRuleEnum_NO_JOKER) ? 1 : 2;
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>(<28><>һ<EFBFBD><D2BB><EFBFBD>͵<EFBFBD><CDB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǻ<EFBFBD><C7BB><EFBFBD>)
|
|||
|
|
//if (m_wWinOrder[0] == (m_wWinOrder[2] + 2) % GAME_PLAYER)
|
|||
|
|
if (m_wWinOrder[0] == m_wFriendChairID[m_wWinOrder[2]])
|
|||
|
|
{
|
|||
|
|
GameEnd.iGameEndType = GAME_END_ONE_WIN;
|
|||
|
|
|
|||
|
|
//<2F><>Ϸ<EFBFBD><CFB7><EFBFBD><EFBFBD>
|
|||
|
|
ScoreInfo[m_wWinOrder[0]].lScore = 1 * m_pGameServiceOption->lCellScore*cbHasJoker;
|
|||
|
|
ScoreInfo[m_wWinOrder[0]].cbType = SCORE_TYPE_WIN;
|
|||
|
|
ScoreInfo[m_wWinOrder[2]].lScore = 1 * m_pGameServiceOption->lCellScore*cbHasJoker;
|
|||
|
|
ScoreInfo[m_wWinOrder[2]].cbType = SCORE_TYPE_WIN;
|
|||
|
|
ScoreInfo[m_wWinOrder[1]].lScore = -1 * m_pGameServiceOption->lCellScore*cbHasJoker;
|
|||
|
|
ScoreInfo[m_wWinOrder[1]].cbType = SCORE_TYPE_LOSE;
|
|||
|
|
ScoreInfo[m_wWinOrder[3]].lScore = -1 * m_pGameServiceOption->lCellScore*cbHasJoker;
|
|||
|
|
ScoreInfo[m_wWinOrder[3]].cbType = SCORE_TYPE_LOSE;
|
|||
|
|
|
|||
|
|
//<2F>л<EFBFBD>ׯ<EFBFBD><D7AF>
|
|||
|
|
m_wFirstUser = m_wWinOrder[0];
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
//˫<><CBAB><EFBFBD>ж<EFBFBD>(<28><>һ<EFBFBD><D2BB><EFBFBD>͵ڶ<CDB5><DAB6><EFBFBD><EFBFBD>ǻ<EFBFBD><C7BB><EFBFBD>)
|
|||
|
|
//else if (m_wWinOrder[0] == (m_wWinOrder[1] + 2) % GAME_PLAYER)
|
|||
|
|
else if (m_wWinOrder[0] == m_wFriendChairID[m_wWinOrder[1]])
|
|||
|
|
{
|
|||
|
|
GameEnd.iGameEndType = GAME_END_TWO_WIN;
|
|||
|
|
|
|||
|
|
//<2F><>Ϸ<EFBFBD><CFB7><EFBFBD><EFBFBD>
|
|||
|
|
ScoreInfo[m_wWinOrder[0]].lScore = 2 * m_pGameServiceOption->lCellScore*cbHasJoker;
|
|||
|
|
ScoreInfo[m_wWinOrder[0]].cbType = SCORE_TYPE_WIN;
|
|||
|
|
ScoreInfo[m_wWinOrder[1]].lScore = 2 * m_pGameServiceOption->lCellScore*cbHasJoker;
|
|||
|
|
ScoreInfo[m_wWinOrder[1]].cbType = SCORE_TYPE_WIN;
|
|||
|
|
ScoreInfo[m_wWinOrder[2]].lScore = -2 * m_pGameServiceOption->lCellScore*cbHasJoker;
|
|||
|
|
ScoreInfo[m_wWinOrder[2]].cbType = SCORE_TYPE_LOSE;
|
|||
|
|
ScoreInfo[m_wWinOrder[3]].lScore = -2 * m_pGameServiceOption->lCellScore*cbHasJoker;
|
|||
|
|
ScoreInfo[m_wWinOrder[3]].cbType = SCORE_TYPE_LOSE;
|
|||
|
|
|
|||
|
|
////<2F>л<EFBFBD>ׯ<EFBFBD><D7AF>
|
|||
|
|
//m_wFirstUser = m_wWinOrder[0];
|
|||
|
|
}
|
|||
|
|
else //ƽ<><C6BD><EFBFBD>ж<EFBFBD>
|
|||
|
|
{
|
|||
|
|
GameEnd.iGameEndType = GAME_END_DRAW;
|
|||
|
|
|
|||
|
|
//<2F><>Ϸ<EFBFBD><CFB7><EFBFBD><EFBFBD>
|
|||
|
|
ScoreInfo[m_wWinOrder[0]].lScore = 0;
|
|||
|
|
ScoreInfo[m_wWinOrder[0]].cbType = SCORE_TYPE_DRAW;
|
|||
|
|
ScoreInfo[m_wWinOrder[2]].lScore = 0;
|
|||
|
|
ScoreInfo[m_wWinOrder[2]].cbType = SCORE_TYPE_DRAW;
|
|||
|
|
ScoreInfo[m_wWinOrder[1]].lScore = 0;
|
|||
|
|
ScoreInfo[m_wWinOrder[1]].cbType = SCORE_TYPE_DRAW;
|
|||
|
|
ScoreInfo[m_wWinOrder[3]].lScore = 0;
|
|||
|
|
ScoreInfo[m_wWinOrder[3]].cbType = SCORE_TYPE_DRAW;
|
|||
|
|
|
|||
|
|
////<2F>л<EFBFBD>ׯ<EFBFBD><D7AF>
|
|||
|
|
//m_wFirstUser = (m_wFirstUser + 1) % 4;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F>л<EFBFBD>ׯ<EFBFBD><D7AF>
|
|||
|
|
m_wFirstUser = m_wWinOrder[0];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><>Ϸ<EFBFBD><CFB7><EFBFBD><EFBFBD>
|
|||
|
|
for (WORD i = 0; i < GAME_PLAYER; i++)
|
|||
|
|
{
|
|||
|
|
GameEnd.lGameScore[i] = ScoreInfo[i].lScore; // <20><>Ϸ<EFBFBD>÷<EFBFBD>;
|
|||
|
|
GameEnd.lBombScore[i] = m_lBombScore[i]; // ը<><D5A8><EFBFBD>÷<EFBFBD>;
|
|||
|
|
GameEnd.lAllScore[i] = GameEnd.lGameScore[i] + m_lBombScore[i]; // <20>ܵ÷<DCB5>;
|
|||
|
|
|
|||
|
|
ScoreInfo[i].lScore = GameEnd.lAllScore[i];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/********************************˽<>˳<EFBFBD>ͳ<EFBFBD><CDB3>****************************************/
|
|||
|
|
tagPrivateFrameRecordInfo* pPrivateRecord = m_pITableFrame->GetPrivateFrameRecord();
|
|||
|
|
BYTE cbFinishCout = pPrivateRecord->cbFinishCout;
|
|||
|
|
|
|||
|
|
//ͳ<>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD><EFBFBD>ϸ
|
|||
|
|
for (WORD i = 0; i < GAME_PLAYER; i++)
|
|||
|
|
{
|
|||
|
|
if (cbFinishCout < 16)
|
|||
|
|
{
|
|||
|
|
m_PrivateEndInfo.lDetails[i][cbFinishCout] = GameEnd.lAllScore[i];
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD>
|
|||
|
|
m_PrivateEndInfo.cbFinishCout = cbFinishCout + 1;
|
|||
|
|
|
|||
|
|
m_pITableFrame->addPrivatePlayCout(1);
|
|||
|
|
/********************************˽<>˳<EFBFBD>ͳ<EFBFBD><CDB3>****************************************/
|
|||
|
|
|
|||
|
|
//<2F>ƾֽ<C6BE><D6BD><EFBFBD><EFBFBD><EFBFBD>,ÿ8<C3BF><38><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD>㾭<EFBFBD><E3BEAD>ֵ;
|
|||
|
|
if (IsPrivateEnd())
|
|||
|
|
{
|
|||
|
|
tagPrivateFrameParameter* pPrivateFrame = m_pITableFrame->GetPrivateFrameInfo();
|
|||
|
|
SCORE lGrade = pPrivateFrame->dwPlayCost;
|
|||
|
|
|
|||
|
|
for (WORD i = 0; i < GAME_PLAYER; i++)
|
|||
|
|
{
|
|||
|
|
ScoreInfo[i].lGrade = lGrade;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
GameEnd.isPrivateEnd = true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
|||
|
|
m_pITableFrame->SendTableData(INVALID_CHAIR, SUB_S_GAME_END, &GameEnd, sizeof(GameEnd));
|
|||
|
|
m_pITableFrame->SendLookonData(INVALID_CHAIR, SUB_S_GAME_END, &GameEnd, sizeof(GameEnd));
|
|||
|
|
|
|||
|
|
// <20><>¼<EFBFBD><C2BC>Ϸ<EFBFBD><CFB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ;
|
|||
|
|
addGameRecordAction(SUB_S_GAME_END, &GameEnd, sizeof(GameEnd));
|
|||
|
|
|
|||
|
|
//д<><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;
|
|||
|
|
DataStream kDataStream;
|
|||
|
|
m_kGameRecord.StreamValue(kDataStream, true);
|
|||
|
|
m_pITableFrame->WriteTableScore(ScoreInfo, CountArray(ScoreInfo), kDataStream);
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϸ
|
|||
|
|
m_pITableFrame->ConcludeGame(GAME_SCENE_FREE);
|
|||
|
|
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// ֻ<><D6BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;
|
|||
|
|
bool CTableFrameSink::ToTwoGameConclude(WORD wChairID, IServerUserItem * pIServerUserItem)
|
|||
|
|
{
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
CMD_S_GameEnd GameEnd;
|
|||
|
|
ZeroMemory(&GameEnd, sizeof(GameEnd));
|
|||
|
|
|
|||
|
|
tagScoreInfo ScoreInfo[GAME_PLAYER];
|
|||
|
|
ZeroMemory(&ScoreInfo, sizeof(ScoreInfo));
|
|||
|
|
|
|||
|
|
//// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ;
|
|||
|
|
//for (WORD i = 0; i < GAME_PLAYER; i++)
|
|||
|
|
//{
|
|||
|
|
// if (m_cbHandCardCount[i] != 0)
|
|||
|
|
// {
|
|||
|
|
// m_wWinOrder[m_wWinCount++] = i;
|
|||
|
|
// }
|
|||
|
|
//}
|
|||
|
|
//CopyMemory(GameEnd.wWinOrder, m_wWinOrder, sizeof(m_wWinOrder));
|
|||
|
|
|
|||
|
|
//ʣ<><CAA3><EFBFBD>˿<EFBFBD>
|
|||
|
|
for (WORD i = 0; i < GAME_PLAYER; i++)
|
|||
|
|
{
|
|||
|
|
GameEnd.wFriendChairID[i] = m_wFriendChairID[i];
|
|||
|
|
GameEnd.cbCardCount[i] = m_cbHandCardCount[i];
|
|||
|
|
CopyMemory(GameEnd.cbCardData[i], m_cbHandCardData[i], m_cbHandCardCount[i] * sizeof(BYTE));
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD>Ҵ<EFBFBD><D2B4><EFBFBD>;
|
|||
|
|
if (!m_bNobodyCallScore)
|
|||
|
|
{
|
|||
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ;
|
|||
|
|
for (WORD i = 0; i < GAME_PLAYER; i++)
|
|||
|
|
{
|
|||
|
|
if (m_cbHandCardCount[i] != 0)
|
|||
|
|
{
|
|||
|
|
m_wWinOrder[m_wWinCount++] = i;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
CopyMemory(GameEnd.wWinOrder, m_wWinOrder, sizeof(m_wWinOrder));
|
|||
|
|
|
|||
|
|
// Ӯ<><D3AE><EFBFBD><EFBFBD>;
|
|||
|
|
SCORE lWinCellScore = 2 * m_pGameServiceOption->lCellScore;
|
|||
|
|
|
|||
|
|
// ׯ<><D7AF>Ӯ;
|
|||
|
|
if (wChairID == m_wBankerUser)
|
|||
|
|
{
|
|||
|
|
ScoreInfo[m_wBankerUser].lScore = 3 * lWinCellScore;
|
|||
|
|
ScoreInfo[m_wBankerUser].cbType = SCORE_TYPE_WIN;
|
|||
|
|
|
|||
|
|
for (WORD i = 0; i < GAME_PLAYER; i++)
|
|||
|
|
{
|
|||
|
|
if (i == m_wBankerUser) continue;
|
|||
|
|
|
|||
|
|
ScoreInfo[i].lScore = 0 - lWinCellScore;
|
|||
|
|
ScoreInfo[i].cbType = SCORE_TYPE_WIN;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
ScoreInfo[m_wBankerUser].lScore = 0 - 3 * lWinCellScore;
|
|||
|
|
ScoreInfo[m_wBankerUser].cbType = SCORE_TYPE_WIN;
|
|||
|
|
|
|||
|
|
for (WORD i = 0; i < GAME_PLAYER; i++)
|
|||
|
|
{
|
|||
|
|
if (i == m_wBankerUser) continue;
|
|||
|
|
|
|||
|
|
ScoreInfo[i].lScore = lWinCellScore;
|
|||
|
|
ScoreInfo[i].cbType = SCORE_TYPE_WIN;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F>л<EFBFBD>ׯ<EFBFBD><D7AF>
|
|||
|
|
m_wFirstUser = m_wBankerUser;
|
|||
|
|
GameEnd.iGameEndType = GAME_END_DRAW;
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD>ͷ<EFBFBD>ӷ<EFBFBD>;
|
|||
|
|
for (WORD i = 0; i < GAME_PLAYER; i++)
|
|||
|
|
{
|
|||
|
|
if (m_cbHandCardCount[i] <= 0) continue;
|
|||
|
|
|
|||
|
|
GetBombScore(i, m_cbHandCardData[i], m_cbHandCardCount[i]);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>;
|
|||
|
|
BYTE cbHasJoker = IsHasGameRule(eDZRuleEnum_NO_JOKER) ? 1 : 2;
|
|||
|
|
|
|||
|
|
//˫<><CBAB><EFBFBD>ж<EFBFBD>(<28><>һ<EFBFBD><D2BB><EFBFBD>͵ڶ<CDB5><DAB6><EFBFBD><EFBFBD>ǻ<EFBFBD><C7BB><EFBFBD>);
|
|||
|
|
if (m_wWinOrder[0] == m_wFriendChairID[m_wWinOrder[1]])
|
|||
|
|
{
|
|||
|
|
GameEnd.iGameEndType = GAME_END_TWO_WIN;
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ;
|
|||
|
|
for (WORD i = 0; i < GAME_PLAYER; i++)
|
|||
|
|
{
|
|||
|
|
if (m_cbHandCardCount[i] != 0)
|
|||
|
|
{
|
|||
|
|
m_wWinOrder[m_wWinCount++] = i;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
CopyMemory(GameEnd.wWinOrder, m_wWinOrder, sizeof(m_wWinOrder));
|
|||
|
|
|
|||
|
|
//<2F><>Ϸ<EFBFBD><CFB7><EFBFBD><EFBFBD>
|
|||
|
|
ScoreInfo[m_wWinOrder[0]].lScore = 2 * m_pGameServiceOption->lCellScore*cbHasJoker;
|
|||
|
|
ScoreInfo[m_wWinOrder[0]].cbType = SCORE_TYPE_WIN;
|
|||
|
|
ScoreInfo[m_wWinOrder[1]].lScore = 2 * m_pGameServiceOption->lCellScore*cbHasJoker;
|
|||
|
|
ScoreInfo[m_wWinOrder[1]].cbType = SCORE_TYPE_WIN;
|
|||
|
|
ScoreInfo[m_wWinOrder[2]].lScore = -2 * m_pGameServiceOption->lCellScore*cbHasJoker;
|
|||
|
|
ScoreInfo[m_wWinOrder[2]].cbType = SCORE_TYPE_LOSE;
|
|||
|
|
ScoreInfo[m_wWinOrder[3]].lScore = -2 * m_pGameServiceOption->lCellScore*cbHasJoker;
|
|||
|
|
ScoreInfo[m_wWinOrder[3]].cbType = SCORE_TYPE_LOSE;
|
|||
|
|
}
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>(<28><>һ<EFBFBD><D2BB><EFBFBD>͵ڶ<CDB5><DAB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǻ<EFBFBD><C7BB><EFBFBD>);
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
GameEnd.iGameEndType = GAME_END_ONE_WIN;
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD>۵<EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǵ<EFBFBD><C7B5><EFBFBD><EFBFBD><EFBFBD>;
|
|||
|
|
m_wWinOrder[m_wWinCount++] = m_wFriendChairID[m_wWinOrder[0]];
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD>۵ڶ<DBB5><DAB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǵ<EFBFBD><C7B5><EFBFBD><EFBFBD><EFBFBD>;
|
|||
|
|
m_wWinOrder[m_wWinCount++] = m_wFriendChairID[m_wWinOrder[1]];
|
|||
|
|
|
|||
|
|
CopyMemory(GameEnd.wWinOrder, m_wWinOrder, sizeof(m_wWinOrder));
|
|||
|
|
|
|||
|
|
//<2F><>Ϸ<EFBFBD><CFB7><EFBFBD><EFBFBD>
|
|||
|
|
ScoreInfo[m_wWinOrder[0]].lScore = 1 * m_pGameServiceOption->lCellScore*cbHasJoker;
|
|||
|
|
ScoreInfo[m_wWinOrder[0]].cbType = SCORE_TYPE_WIN;
|
|||
|
|
ScoreInfo[m_wWinOrder[2]].lScore = 1 * m_pGameServiceOption->lCellScore*cbHasJoker;
|
|||
|
|
ScoreInfo[m_wWinOrder[2]].cbType = SCORE_TYPE_WIN;
|
|||
|
|
ScoreInfo[m_wWinOrder[1]].lScore = -1 * m_pGameServiceOption->lCellScore*cbHasJoker;
|
|||
|
|
ScoreInfo[m_wWinOrder[1]].cbType = SCORE_TYPE_LOSE;
|
|||
|
|
ScoreInfo[m_wWinOrder[3]].lScore = -1 * m_pGameServiceOption->lCellScore*cbHasJoker;
|
|||
|
|
ScoreInfo[m_wWinOrder[3]].cbType = SCORE_TYPE_LOSE;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F>л<EFBFBD>ׯ<EFBFBD><D7AF>
|
|||
|
|
m_wFirstUser = m_wWinOrder[0];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><>Ϸ<EFBFBD><CFB7><EFBFBD><EFBFBD>
|
|||
|
|
for (WORD i = 0; i < GAME_PLAYER; i++)
|
|||
|
|
{
|
|||
|
|
GameEnd.lGameScore[i] = ScoreInfo[i].lScore; // <20><>Ϸ<EFBFBD>÷<EFBFBD>;
|
|||
|
|
GameEnd.lBombScore[i] = m_lBombScore[i]; // ը<><D5A8><EFBFBD>÷<EFBFBD>;
|
|||
|
|
GameEnd.lAllScore[i] = GameEnd.lGameScore[i] + m_lBombScore[i]; // <20>ܵ÷<DCB5>;
|
|||
|
|
|
|||
|
|
ScoreInfo[i].lScore = GameEnd.lAllScore[i];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/********************************˽<>˳<EFBFBD>ͳ<EFBFBD><CDB3>****************************************/
|
|||
|
|
tagPrivateFrameRecordInfo* pPrivateRecord = m_pITableFrame->GetPrivateFrameRecord();
|
|||
|
|
BYTE cbFinishCout = pPrivateRecord->cbFinishCout;
|
|||
|
|
|
|||
|
|
//ͳ<>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD><EFBFBD>ϸ
|
|||
|
|
for (WORD i = 0; i < GAME_PLAYER; i++)
|
|||
|
|
{
|
|||
|
|
if (cbFinishCout < 16)
|
|||
|
|
{
|
|||
|
|
m_PrivateEndInfo.lDetails[i][cbFinishCout] = GameEnd.lAllScore[i];
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD>
|
|||
|
|
m_PrivateEndInfo.cbFinishCout = cbFinishCout + 1;
|
|||
|
|
|
|||
|
|
m_pITableFrame->addPrivatePlayCout(1);
|
|||
|
|
/********************************˽<>˳<EFBFBD>ͳ<EFBFBD><CDB3>****************************************/
|
|||
|
|
|
|||
|
|
//<2F>ƾֽ<C6BE><D6BD><EFBFBD><EFBFBD><EFBFBD>,ÿ8<C3BF><38><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD>㾭<EFBFBD><E3BEAD>ֵ;
|
|||
|
|
if (IsPrivateEnd())
|
|||
|
|
{
|
|||
|
|
tagPrivateFrameParameter* pPrivateFrame = m_pITableFrame->GetPrivateFrameInfo();
|
|||
|
|
SCORE lGrade = pPrivateFrame->dwPlayCost;
|
|||
|
|
|
|||
|
|
for (WORD i = 0; i < GAME_PLAYER; i++)
|
|||
|
|
{
|
|||
|
|
ScoreInfo[i].lGrade = lGrade;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
GameEnd.isPrivateEnd = true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
|||
|
|
m_pITableFrame->SendTableData(INVALID_CHAIR, SUB_S_GAME_END, &GameEnd, sizeof(GameEnd));
|
|||
|
|
m_pITableFrame->SendLookonData(INVALID_CHAIR, SUB_S_GAME_END, &GameEnd, sizeof(GameEnd));
|
|||
|
|
|
|||
|
|
// <20><>¼<EFBFBD><C2BC>Ϸ<EFBFBD><CFB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ;
|
|||
|
|
addGameRecordAction(SUB_S_GAME_END, &GameEnd, sizeof(GameEnd));
|
|||
|
|
|
|||
|
|
//д<><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;
|
|||
|
|
DataStream kDataStream;
|
|||
|
|
m_kGameRecord.StreamValue(kDataStream, true);
|
|||
|
|
m_pITableFrame->WriteTableScore(ScoreInfo, CountArray(ScoreInfo), kDataStream);
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϸ
|
|||
|
|
m_pITableFrame->ConcludeGame(GAME_SCENE_FREE);
|
|||
|
|
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD>ͳ<EFBFBD><CDB3><EFBFBD>
|
|||
|
|
bool CTableFrameSink::OnEventSendGameScene(WORD wChairID, IServerUserItem * pIServerUserItem, BYTE cbGameStatus, bool bSendSecret)
|
|||
|
|
{
|
|||
|
|
switch (cbGameStatus)
|
|||
|
|
{
|
|||
|
|
case GAME_SCENE_FREE: //<2F><><EFBFBD><EFBFBD>״̬
|
|||
|
|
{
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
CMD_S_StatusFree StatusFree;
|
|||
|
|
memset(&StatusFree, 0, sizeof(StatusFree));
|
|||
|
|
|
|||
|
|
//<2F><>Ϸ<EFBFBD><CFB7><EFBFBD><EFBFBD>
|
|||
|
|
StatusFree.wBankerUser = m_wBankerUser;
|
|||
|
|
StatusFree.lCellScore = m_pGameServiceOption->lCellScore;
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD>ͳ<EFBFBD><CDB3><EFBFBD>
|
|||
|
|
return m_pITableFrame->SendGameScene(pIServerUserItem, &StatusFree, sizeof(StatusFree));
|
|||
|
|
}
|
|||
|
|
case GAME_SCENE_SEND:
|
|||
|
|
{
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;
|
|||
|
|
CMD_S_StatusSendCard StatusSend;
|
|||
|
|
ZeroMemory(&StatusSend, sizeof(StatusSend));
|
|||
|
|
|
|||
|
|
//<2F><>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD>;
|
|||
|
|
StatusSend.lCellScore = m_pITableFrame->GetCellScore();
|
|||
|
|
|
|||
|
|
//<2F><>Ϸ<EFBFBD><CFB7>Ϣ;
|
|||
|
|
StatusSend.wCurrentUser = m_wCurrentUser;
|
|||
|
|
CopyMemory(StatusSend.cbHandCardCount, m_cbHandCardCount, sizeof(m_cbHandCardCount));
|
|||
|
|
CopyMemory(StatusSend.cbHandCardData, m_cbHandCardData[wChairID], m_cbHandCardCount[wChairID] * sizeof(BYTE));
|
|||
|
|
|
|||
|
|
return m_pITableFrame->SendGameScene(pIServerUserItem, &StatusSend, sizeof(StatusSend));
|
|||
|
|
}
|
|||
|
|
case GAME_SCENE_CALL_SCORE:
|
|||
|
|
{
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;
|
|||
|
|
CMD_S_StatusCallScore StatusCall;
|
|||
|
|
ZeroMemory(&StatusCall, sizeof(StatusCall));
|
|||
|
|
|
|||
|
|
//<2F><>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD>;
|
|||
|
|
StatusCall.lCellScore = m_pITableFrame->GetCellScore();
|
|||
|
|
|
|||
|
|
//<2F><>Ϸ<EFBFBD><CFB7>Ϣ;
|
|||
|
|
StatusCall.wCurrentUser = m_wCurrentUser;
|
|||
|
|
CopyMemory(StatusCall.cbScoreInfo, m_cbScoreInfo, sizeof(m_cbScoreInfo));
|
|||
|
|
CopyMemory(StatusCall.cbHandCardCount, m_cbHandCardCount, sizeof(m_cbHandCardCount));
|
|||
|
|
CopyMemory(StatusCall.cbHandCardData, m_cbHandCardData[wChairID], m_cbHandCardCount[wChairID] * sizeof(BYTE));
|
|||
|
|
|
|||
|
|
return m_pITableFrame->SendGameScene(pIServerUserItem, &StatusCall, sizeof(StatusCall));
|
|||
|
|
}
|
|||
|
|
case GAME_SCENE_PLAY: //<2F><>Ϸ״̬
|
|||
|
|
{
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
CMD_S_StatusPlay StatusPlay;
|
|||
|
|
memset(&StatusPlay, 0, sizeof(StatusPlay));
|
|||
|
|
|
|||
|
|
//<2F><>Ϸ<EFBFBD><CFB7><EFBFBD><EFBFBD>
|
|||
|
|
StatusPlay.wCurrentUser = m_wCurrentUser;
|
|||
|
|
StatusPlay.lCellScore = m_pGameServiceOption->lCellScore;
|
|||
|
|
//StatusPlay.wFriendChairID = m_wFriendChairID[wChairID];
|
|||
|
|
StatusPlay.wBankerUser = m_wBankerUser;
|
|||
|
|
StatusPlay.bCallCard = m_bNobodyCallScore;
|
|||
|
|
|
|||
|
|
if (IsHasGameRule(eDZRuleEnum_MINGBIAN))
|
|||
|
|
{
|
|||
|
|
StatusPlay.wFriendChairID = m_wFriendChairID[wChairID];
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
StatusPlay.wFriendChairID = INVALID_CHAIR;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//ʤ<><CAA4><EFBFBD><EFBFBD>Ϣ
|
|||
|
|
StatusPlay.wWinCount = m_wWinCount;
|
|||
|
|
CopyMemory(StatusPlay.wWinOrder, m_wWinOrder, sizeof(StatusPlay.wWinOrder));
|
|||
|
|
CopyMemory(StatusPlay.bTrustee, m_bTrustee, sizeof(m_bTrustee));
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
|||
|
|
StatusPlay.wTurnWiner = m_wTurnWiner;
|
|||
|
|
StatusPlay.cbTurnCardType = m_TurnOutCard.cbCardType;
|
|||
|
|
StatusPlay.cbTurnCardCount = m_TurnOutCard.cbCardCount;
|
|||
|
|
StatusPlay.isLastCard = m_TurnOutCard.isLastCard;
|
|||
|
|
CopyMemory(StatusPlay.cbTurnCardData, m_TurnOutCard.cbCardData, m_TurnOutCard.cbCardCount*sizeof(BYTE));
|
|||
|
|
|
|||
|
|
//<2F>˿<EFBFBD><CBBF><EFBFBD>Ϣ
|
|||
|
|
CopyMemory(StatusPlay.cbHandCardCount, m_cbHandCardCount, sizeof(m_cbHandCardCount));
|
|||
|
|
CopyMemory(StatusPlay.cbHandCardData, m_cbHandCardData[wChairID], sizeof(BYTE)*m_cbHandCardCount[wChairID]);
|
|||
|
|
CopyMemory(StatusPlay.cbPartnerCardData, m_cbHandCardData[(wChairID + 2) % GAME_PLAYER], sizeof(BYTE)*m_cbHandCardCount[(wChairID + 2) % GAME_PLAYER]);
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD>ͳ<EFBFBD><CDB3><EFBFBD>
|
|||
|
|
return m_pITableFrame->SendGameScene(pIServerUserItem, &StatusPlay, sizeof(StatusPlay));
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><>ʱ<EFBFBD><CAB1><EFBFBD>¼<EFBFBD>
|
|||
|
|
bool CTableFrameSink::OnTimerMessage(DWORD wTimerID, WPARAM wBindParam)
|
|||
|
|
{
|
|||
|
|
if (IDI_SEND_CARD == wTimerID)
|
|||
|
|
{
|
|||
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD>ɢ<EFBFBD><C9A2>Ϸ;
|
|||
|
|
if (IsHasGameRule(eDZRuleEnum_NO_BOMB))
|
|||
|
|
{
|
|||
|
|
for (WORD i = 0; i < GAME_PLAYER; i++)
|
|||
|
|
{
|
|||
|
|
if (!IsHasBomb(m_cbHandCardData[i], m_cbHandCardCount[i]))
|
|||
|
|
{
|
|||
|
|
m_etGameEndType = GAME_END_NO_BOMB;
|
|||
|
|
return OnEventGameConclude(INVALID_CHAIR, nullptr, GER_BAOZI);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (IsHasGameRule(eDZRuleEnum_EIGHT_BOMB))
|
|||
|
|
{
|
|||
|
|
for (WORD i = 0; i < GAME_PLAYER; i++)
|
|||
|
|
{
|
|||
|
|
if (IsHas8Bomb(m_cbHandCardData[i], m_cbHandCardCount[i]))
|
|||
|
|
{
|
|||
|
|
m_etGameEndType = GAME_END_8_BOMB;
|
|||
|
|
return OnEventGameConclude(INVALID_CHAIR, nullptr, GER_BAOZI);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;
|
|||
|
|
if (IsHasGameRule(eDZRuleEnum_NO_JOKER))
|
|||
|
|
{
|
|||
|
|
//<2F><><EFBFBD><EFBFBD>״̬;
|
|||
|
|
m_pITableFrame->SetGameStatus(GAME_SCENE_CALL_SCORE);
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;
|
|||
|
|
CMD_S_CallScore CallScore;
|
|||
|
|
CallScore.wCallScoreUser = INVALID_CHAIR;
|
|||
|
|
CallScore.wCurrentUser = m_wCurrentUser;
|
|||
|
|
CallScore.cbCallScore = 0xff;
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ;
|
|||
|
|
m_pITableFrame->SendTableData(INVALID_CHAIR, SUB_S_CALL_SCORE, &CallScore, sizeof(CallScore));
|
|||
|
|
m_pITableFrame->SendLookonData(INVALID_CHAIR, SUB_S_CALL_SCORE, &CallScore, sizeof(CallScore));
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
// <20><><EFBFBD><EFBFBD>״̬;
|
|||
|
|
m_pITableFrame->SetGameStatus(GAME_SCENE_PLAY);
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD>;
|
|||
|
|
m_bNobodyCallScore = true;
|
|||
|
|
m_wBankerUser = m_wFirstUser;
|
|||
|
|
m_wTurnWiner = m_wBankerUser;
|
|||
|
|
m_wCurrentUser = m_wBankerUser;
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ;
|
|||
|
|
CMD_S_BankerInfo BankerInfo;
|
|||
|
|
ZeroMemory(&BankerInfo, sizeof(CMD_S_BankerInfo));
|
|||
|
|
BankerInfo.wBankerUser = m_wBankerUser;
|
|||
|
|
BankerInfo.wCurrentUser = m_wCurrentUser;
|
|||
|
|
BankerInfo.bCallCard = m_bNobodyCallScore;
|
|||
|
|
BankerInfo.cbFirendCardData = SearchFriendChairID();
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD>;
|
|||
|
|
if (IsHasGameRule(eDZRuleEnum_MINGBIAN))
|
|||
|
|
{
|
|||
|
|
for (WORD i = 0; i < m_wPlayerCount; i++)
|
|||
|
|
{
|
|||
|
|
BankerInfo.wFriendChairID[i] = m_wFriendChairID[i];
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else // <20><><EFBFBD><EFBFBD>;
|
|||
|
|
{
|
|||
|
|
for (WORD i = 0; i < m_wPlayerCount; i++)
|
|||
|
|
{
|
|||
|
|
BankerInfo.wFriendChairID[i] = INVALID_CHAIR;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
m_pITableFrame->SendTableData(INVALID_CHAIR, SUB_S_BANKER_INFO, &BankerInfo, sizeof(BankerInfo));
|
|||
|
|
m_pITableFrame->SendLookonData(INVALID_CHAIR, SUB_S_BANKER_INFO, &BankerInfo, sizeof(BankerInfo));
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD>Ӽ<EFBFBD>¼;
|
|||
|
|
addGameRecordAction(SUB_S_BANKER_INFO, &BankerInfo, sizeof(BankerInfo));
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD>
|
|||
|
|
bool CTableFrameSink::OnDataBaseMessage(WORD wRequestID, VOID * pData, WORD wDataSize)
|
|||
|
|
{
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD>
|
|||
|
|
bool CTableFrameSink::OnUserScroeNotify(WORD wChairID, IServerUserItem * pIServerUserItem, BYTE cbReason)
|
|||
|
|
{
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><>Ϸ<EFBFBD><CFB7>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>
|
|||
|
|
bool CTableFrameSink::OnGameMessage(WORD wSubCmdID, VOID * pDataBuffer, WORD wDataSize, IServerUserItem * pIServerUserItem)
|
|||
|
|
{
|
|||
|
|
switch (wSubCmdID)
|
|||
|
|
{
|
|||
|
|
case SUB_C_CALL_SCORE: //<2F>û<EFBFBD><C3BB>з<EFBFBD>;
|
|||
|
|
{
|
|||
|
|
//Ч<><D0A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;
|
|||
|
|
ASSERT(wDataSize == sizeof(CMD_C_CallScore));
|
|||
|
|
if (wDataSize != sizeof(CMD_C_CallScore)) return false;
|
|||
|
|
|
|||
|
|
//״̬Ч<CCAC><D0A7>;
|
|||
|
|
ASSERT(m_pITableFrame->GetGameStatus()==GAME_SCENE_CALL_SCORE);
|
|||
|
|
if (m_pITableFrame->GetGameStatus() != GAME_SCENE_CALL_SCORE) return true;
|
|||
|
|
|
|||
|
|
//<2F>û<EFBFBD>Ч<EFBFBD><D0A7>;
|
|||
|
|
ASSERT(pIServerUserItem->GetUserStatus()==US_PLAYING);
|
|||
|
|
if (pIServerUserItem->GetUserStatus() != US_PLAYING) return true;
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;
|
|||
|
|
CMD_C_CallScore * pCallScore = (CMD_C_CallScore *)pDataBuffer;
|
|||
|
|
|
|||
|
|
//<2F><>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>;
|
|||
|
|
WORD wChairID = pIServerUserItem->GetChairID();
|
|||
|
|
return OnUserCallScore(wChairID, pCallScore->cbCallScore);
|
|||
|
|
}
|
|||
|
|
case SUB_C_OUT_CARD: //<2F>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
{
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
CMD_C_OutCard * pOutCard = (CMD_C_OutCard *)pDataBuffer;
|
|||
|
|
WORD wHeadSize = sizeof(CMD_C_OutCard) - sizeof(pOutCard->cbCardData);
|
|||
|
|
|
|||
|
|
//Ч<><D0A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
ASSERT(wDataSize >= wHeadSize);
|
|||
|
|
if (wDataSize < wHeadSize) return false;
|
|||
|
|
ASSERT(wDataSize == (wHeadSize + pOutCard->cbCardCount*sizeof(pOutCard->cbCardData[0])));
|
|||
|
|
if (wDataSize != (wHeadSize + pOutCard->cbCardCount*sizeof(pOutCard->cbCardData[0]))) return false;
|
|||
|
|
|
|||
|
|
//<2F>û<EFBFBD>Ч<EFBFBD><D0A7>
|
|||
|
|
ASSERT(pIServerUserItem->GetUserStatus() == US_PLAYING);
|
|||
|
|
if (pIServerUserItem->GetUserStatus() != US_PLAYING) return true;
|
|||
|
|
|
|||
|
|
//<2F><>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>
|
|||
|
|
WORD wChairID = pIServerUserItem->GetChairID();
|
|||
|
|
//return OnUserOutCard(wChairID, pOutCard->cbCardData, pOutCard->cbCardType, pOutCard->cbCardCount);
|
|||
|
|
return OnUserOutCard(wChairID, pOutCard);
|
|||
|
|
}
|
|||
|
|
case SUB_C_PASS_CARD:
|
|||
|
|
{
|
|||
|
|
//<2F>û<EFBFBD>Ч<EFBFBD><D0A7>
|
|||
|
|
ASSERT(pIServerUserItem->GetUserStatus() == US_PLAYING);
|
|||
|
|
if (pIServerUserItem->GetUserStatus() != US_PLAYING) return true;
|
|||
|
|
|
|||
|
|
//<2F><>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>
|
|||
|
|
WORD wChairID = pIServerUserItem->GetChairID();
|
|||
|
|
return OnUserPassCard(wChairID);
|
|||
|
|
}
|
|||
|
|
case SUB_C_TRUSTEE:
|
|||
|
|
{
|
|||
|
|
CMD_C_Trustee *pTrustee = (CMD_C_Trustee *)pDataBuffer;
|
|||
|
|
if (wDataSize != sizeof(CMD_C_Trustee)) return false;
|
|||
|
|
|
|||
|
|
//<2F>û<EFBFBD>Ч<EFBFBD><D0A7>
|
|||
|
|
WORD wChairID = pIServerUserItem->GetChairID();
|
|||
|
|
|
|||
|
|
m_bTrustee[wChairID] = pTrustee->bTrustee;
|
|||
|
|
CMD_S_Trustee Trustee;
|
|||
|
|
Trustee.bTrustee = pTrustee->bTrustee;
|
|||
|
|
Trustee.wChairID = wChairID;
|
|||
|
|
m_pITableFrame->SendTableData(INVALID_CHAIR, SUB_S_TRUSTEE, &Trustee, sizeof(Trustee));
|
|||
|
|
m_pITableFrame->SendLookonData(INVALID_CHAIR, SUB_S_TRUSTEE, &Trustee, sizeof(Trustee));
|
|||
|
|
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
|||
|
|
bool CTableFrameSink::OnFrameMessage(WORD wSubCmdID, VOID * pData, WORD wDataSize, IServerUserItem * pIServerUserItem)
|
|||
|
|
{
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD>˽<EFBFBD>˳<EFBFBD><CBB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
|||
|
|
void CTableFrameSink::ResetPrivateEndInfo()
|
|||
|
|
{
|
|||
|
|
ZeroMemory(&m_PrivateEndInfo, sizeof(CMD_S_Private_End_Info));
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD>˽<EFBFBD>˳<EFBFBD><CBB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>
|
|||
|
|
void CTableFrameSink::GetPrivateEndInfo(DataStream &kDataStream, bool bSend)
|
|||
|
|
{
|
|||
|
|
for (WORD i = 0; i < GAME_PLAYER; i++)
|
|||
|
|
{
|
|||
|
|
// <20>ܻ<EFBFBD><DCBB><EFBFBD>
|
|||
|
|
IServerUserItem* pServerUserItem = m_pITableFrame->GetTableUserItem(i);
|
|||
|
|
if (pServerUserItem)
|
|||
|
|
{
|
|||
|
|
m_PrivateEndInfo.lAllScore[i] = pServerUserItem->GetUserScore();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
m_PrivateEndInfo.StreamValue(kDataStream, bSend);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F>ж<EFBFBD>˽<EFBFBD>˳<EFBFBD><CBB3>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
bool CTableFrameSink::IsPrivateEnd()
|
|||
|
|
{
|
|||
|
|
ASSERT(m_pITableFrame != nullptr);
|
|||
|
|
if (m_pITableFrame == nullptr) return false;
|
|||
|
|
|
|||
|
|
tagPrivateFrameParameter* pPrivateFrame = m_pITableFrame->GetPrivateFrameInfo();
|
|||
|
|
tagPrivateFrameRecordInfo* pPrivateRecord = m_pITableFrame->GetPrivateFrameRecord();
|
|||
|
|
|
|||
|
|
if ((pPrivateFrame == nullptr) || (pPrivateRecord == nullptr)) return false;
|
|||
|
|
|
|||
|
|
if (pPrivateFrame->cbGameCout <= pPrivateRecord->cbFinishCout)
|
|||
|
|
{
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
bool CTableFrameSink::IsHasGameRule(eDZRuleEnum eType)
|
|||
|
|
{
|
|||
|
|
ASSERT(m_pITableFrame != nullptr);
|
|||
|
|
if (m_pITableFrame == nullptr) return false;
|
|||
|
|
|
|||
|
|
const tagPrivateFrameParameter* pPrivateFrame = m_pITableFrame->GetPrivateFrameInfo();
|
|||
|
|
if (nullptr == pPrivateFrame) return false;
|
|||
|
|
return (pPrivateFrame->dwGameRule & eType) > 0;
|
|||
|
|
|
|||
|
|
//DWORD dwGameRule = (eDZRuleEnum_LOTTERY_7 | eDZRuleEnum_LOTTERY_10 | eDZRuleEnum_LOTTERY_J | eDZRuleEnum_LOTTERY_K);
|
|||
|
|
//return (dwGameRule & eType) > 0;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
bool CTableFrameSink::IsRecordServerType()
|
|||
|
|
{
|
|||
|
|
return ((m_pGameServiceOption->wServerType&GAME_GENRE_EDUCATE) == GAME_GENRE_EDUCATE);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
bool CTableFrameSink::OnActionUserSitDown(WORD wChairID, IServerUserItem * pIServerUserItem, bool bLookonUser)
|
|||
|
|
{
|
|||
|
|
//ׯ<><D7AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
if ((bLookonUser == false) && (m_wFirstUser == INVALID_CHAIR))
|
|||
|
|
{
|
|||
|
|
m_wFirstUser = pIServerUserItem->GetChairID();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
bool CTableFrameSink::OnActionUserStandUp(WORD wChairID, IServerUserItem * pIServerUserItem, bool bLookonUser)
|
|||
|
|
{
|
|||
|
|
//ׯ<><D7AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
if ((bLookonUser == false) && (m_wBankerUser == pIServerUserItem->GetChairID()))
|
|||
|
|
{
|
|||
|
|
m_wBankerUser = INVALID_CHAIR;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F>û<EFBFBD><C3BB>з<EFBFBD>;
|
|||
|
|
bool CTableFrameSink::OnUserCallScore(WORD wChairID, BYTE cbCallScore)
|
|||
|
|
{
|
|||
|
|
//Ч<><D0A7>״̬;
|
|||
|
|
ASSERT(wChairID == m_wCurrentUser);
|
|||
|
|
if (wChairID != m_wCurrentUser) return true;
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD>ýз<C3BD>;
|
|||
|
|
m_cbScoreInfo[wChairID] = cbCallScore;
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD>;
|
|||
|
|
if (cbCallScore != 0xFF)
|
|||
|
|
{
|
|||
|
|
m_wBankerUser = wChairID;
|
|||
|
|
m_wCurrentUser = INVALID_CHAIR;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
WORD wNextUser = (wChairID + 1) % GAME_PLAYER;
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD>˶<EFBFBD><CBB6><EFBFBD><EFBFBD><EFBFBD>;
|
|||
|
|
if (m_wFirstUser == wNextUser)
|
|||
|
|
{
|
|||
|
|
m_bNobodyCallScore = true;
|
|||
|
|
m_wBankerUser = m_wFirstUser;
|
|||
|
|
m_wCurrentUser = INVALID_CHAIR;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
m_wCurrentUser = wNextUser;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;
|
|||
|
|
CMD_S_CallScore CallScore;
|
|||
|
|
CallScore.wCallScoreUser = wChairID;
|
|||
|
|
CallScore.wCurrentUser = m_wCurrentUser;
|
|||
|
|
CallScore.cbCallScore = cbCallScore;
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ;
|
|||
|
|
m_pITableFrame->SendTableData(INVALID_CHAIR, SUB_S_CALL_SCORE, &CallScore, sizeof(CallScore));
|
|||
|
|
m_pITableFrame->SendLookonData(INVALID_CHAIR, SUB_S_CALL_SCORE, &CallScore, sizeof(CallScore));
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD>Ӽ<EFBFBD>¼;
|
|||
|
|
addGameRecordAction(SUB_S_CALL_SCORE, &CallScore, sizeof(CallScore));
|
|||
|
|
|
|||
|
|
//<2F><>ʼ<EFBFBD>ж<EFBFBD>;
|
|||
|
|
if (m_wBankerUser != INVALID_CHAIR)
|
|||
|
|
{
|
|||
|
|
//<2F><><EFBFBD><EFBFBD>״̬;
|
|||
|
|
m_pITableFrame->SetGameStatus(GAME_SCENE_PLAY);
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD>;
|
|||
|
|
m_wTurnWiner = m_wBankerUser;
|
|||
|
|
m_wCurrentUser = m_wBankerUser;
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ;
|
|||
|
|
CMD_S_BankerInfo BankerInfo;
|
|||
|
|
ZeroMemory(&BankerInfo, sizeof(CMD_S_BankerInfo));
|
|||
|
|
BankerInfo.wBankerUser = m_wBankerUser;
|
|||
|
|
BankerInfo.wCurrentUser = m_wCurrentUser;
|
|||
|
|
BankerInfo.bCallCard = m_bNobodyCallScore;
|
|||
|
|
|
|||
|
|
if (m_bNobodyCallScore)
|
|||
|
|
{
|
|||
|
|
BankerInfo.cbFirendCardData = SearchFriendChairID();
|
|||
|
|
//CopyMemory(BankerInfo.wFriendChairID, m_wFriendChairID, sizeof(WORD)*GAME_PLAYER);
|
|||
|
|
// <20><><EFBFBD><EFBFBD>;
|
|||
|
|
if (IsHasGameRule(eDZRuleEnum_MINGBIAN))
|
|||
|
|
{
|
|||
|
|
for (WORD i = 0; i < m_wPlayerCount; i++)
|
|||
|
|
{
|
|||
|
|
BankerInfo.wFriendChairID[i] = m_wFriendChairID[i];
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else // <20><><EFBFBD><EFBFBD>;
|
|||
|
|
{
|
|||
|
|
for (WORD i = 0; i < m_wPlayerCount; i++)
|
|||
|
|
{
|
|||
|
|
BankerInfo.wFriendChairID[i] = INVALID_CHAIR;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ;
|
|||
|
|
m_pITableFrame->SendTableData(INVALID_CHAIR, SUB_S_BANKER_INFO, &BankerInfo, sizeof(BankerInfo));
|
|||
|
|
m_pITableFrame->SendLookonData(INVALID_CHAIR, SUB_S_BANKER_INFO, &BankerInfo, sizeof(BankerInfo));
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD>Ӽ<EFBFBD>¼;
|
|||
|
|
addGameRecordAction(SUB_S_BANKER_INFO, &BankerInfo, sizeof(BankerInfo));
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
bool CTableFrameSink::OnUserOutCard(WORD wChairID, CMD_C_OutCard * pOutCard)
|
|||
|
|
{
|
|||
|
|
//Ч<><D0A7>״̬
|
|||
|
|
ASSERT(m_pITableFrame->GetGameStatus() == GAME_SCENE_PLAY);
|
|||
|
|
if (m_pITableFrame->GetGameStatus() != GAME_SCENE_PLAY) return true;
|
|||
|
|
|
|||
|
|
ASSERT(wChairID == m_wCurrentUser);
|
|||
|
|
if (wChairID != m_wCurrentUser) return false;
|
|||
|
|
|
|||
|
|
ASSERT(pOutCard != nullptr);
|
|||
|
|
if (pOutCard == nullptr) return false;
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD>У<EFBFBD><D0A3>;
|
|||
|
|
ASSERT(pOutCard->cbCardType != CT_ERROR);
|
|||
|
|
|
|||
|
|
// <20>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>;
|
|||
|
|
bool isLastCard = (pOutCard->cbCardCount == m_cbHandCardCount[wChairID]);
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD>;
|
|||
|
|
m_GameLogic.SortCardList(pOutCard->cbCardData, pOutCard->cbCardCount, ST_ORDER);
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>
|
|||
|
|
int bCardType = m_GameLogic.GetCardType(pOutCard->cbCardData, pOutCard->cbCardCount, isLastCard);
|
|||
|
|
if ((bCardType&pOutCard->cbCardType) == CT_ERROR)
|
|||
|
|
{
|
|||
|
|
ASSERT(FALSE);
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
if (m_TurnOutCard.cbCardCount > 0 && m_GameLogic.CompareCard(&m_TurnOutCard, pOutCard) == false)
|
|||
|
|
{
|
|||
|
|
ASSERT(FALSE);
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//ɾ<><C9BE><EFBFBD>˿<EFBFBD>
|
|||
|
|
if (m_GameLogic.RemoveCard(pOutCard->cbCardData, pOutCard->cbCardCount, m_cbHandCardData[wChairID], m_cbHandCardCount[wChairID]) == false)
|
|||
|
|
{
|
|||
|
|
ASSERT(FALSE);
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// ͳ<><CDB3>ը<EFBFBD><D5A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
if ((bCardType >> CT_BOMB_4) > 0)
|
|||
|
|
{
|
|||
|
|
BYTE cbBombCardData = pOutCard->cbCardData[pOutCard->cbCardCount - 1];
|
|||
|
|
GetBombScore(wChairID, cbBombCardData, bCardType);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD>ñ<EFBFBD><C3B1><EFBFBD>
|
|||
|
|
m_cbHandCardCount[wChairID] -= pOutCard->cbCardCount;
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҳ<EFBFBD><D2B3><EFBFBD>;
|
|||
|
|
m_TurnOutCard.cbCardCount = pOutCard->cbCardCount;
|
|||
|
|
m_TurnOutCard.isLastCard = isLastCard;
|
|||
|
|
m_TurnOutCard.cbCardType = pOutCard->cbCardType;
|
|||
|
|
CopyMemory(m_TurnOutCard.cbCardData, pOutCard->cbCardData, sizeof(BYTE)*pOutCard->cbCardCount);
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>Ұ<EFBFBD><D2B0><EFBFBD>;
|
|||
|
|
if (m_bNobodyCallScore)
|
|||
|
|
{
|
|||
|
|
if (m_cbHandCardCount[wChairID] == 0)
|
|||
|
|
{
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD>
|
|||
|
|
m_wWinOrder[m_wWinCount++] = wChairID;
|
|||
|
|
|
|||
|
|
CMD_S_Ranking mRanking;
|
|||
|
|
mRanking.wChairID = wChairID;
|
|||
|
|
mRanking.cbRanking = (BYTE)m_wWinCount;
|
|||
|
|
m_pITableFrame->SendTableData(INVALID_CHAIR, SUB_S_RANKING, &mRanking, sizeof(mRanking));
|
|||
|
|
m_pITableFrame->SendLookonData(INVALID_CHAIR, SUB_S_RANKING, &mRanking, sizeof(mRanking));
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD>Ӽ<EFBFBD>¼;
|
|||
|
|
addGameRecordAction(SUB_S_RANKING, &mRanking, sizeof(mRanking));
|
|||
|
|
|
|||
|
|
//<2F>û<EFBFBD>ͳ<EFBFBD><CDB3>
|
|||
|
|
WORD wFriendChairID = m_wFriendChairID[wChairID];
|
|||
|
|
if (m_cbHandCardCount[wFriendChairID] == 0)
|
|||
|
|
{
|
|||
|
|
m_wCurrentUser = INVALID_CHAIR;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// ֻ<><D6BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;
|
|||
|
|
if (IsHasGameRule(eDZRuleEnum_TO_TWO) && (2 == m_wWinCount))
|
|||
|
|
{
|
|||
|
|
m_wCurrentUser = INVALID_CHAIR;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F>л<EFBFBD><D0BB>û<EFBFBD>
|
|||
|
|
if (m_wCurrentUser != INVALID_CHAIR)
|
|||
|
|
{
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD>
|
|||
|
|
m_wTurnWiner = wChairID;
|
|||
|
|
m_wCurrentUser = (wChairID + 1) % GAME_PLAYER;
|
|||
|
|
|
|||
|
|
//<2F>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
while (m_cbHandCardCount[m_wCurrentUser] == 0)
|
|||
|
|
{
|
|||
|
|
m_wCurrentUser = (m_wCurrentUser + 1) % GAME_PLAYER;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ұ<EFBFBD><D2B0>Ʋ<EFBFBD><C6B2>ҳ<EFBFBD><D2B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʣ<EFBFBD><CAA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ0<CEAA><30><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϸ;
|
|||
|
|
if (m_cbHandCardCount[wChairID] != 0)
|
|||
|
|
{
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD>
|
|||
|
|
m_wTurnWiner = wChairID;
|
|||
|
|
m_wCurrentUser = (m_wCurrentUser + 1) % GAME_PLAYER;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
m_wCurrentUser = INVALID_CHAIR;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
CMD_S_OutCard OutCard;
|
|||
|
|
ZeroMemory(&OutCard, sizeof(OutCard));
|
|||
|
|
OutCard.isLastCard = isLastCard;
|
|||
|
|
OutCard.cbCardType = pOutCard->cbCardType;
|
|||
|
|
OutCard.wOutCardUser = wChairID;
|
|||
|
|
OutCard.cbCardCount = pOutCard->cbCardCount;
|
|||
|
|
OutCard.wCurrentUser = m_wCurrentUser;
|
|||
|
|
CopyMemory(OutCard.cbCardData, pOutCard->cbCardData, pOutCard->cbCardCount*sizeof(BYTE));
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
WORD wHeadSize = sizeof(OutCard) - sizeof(OutCard.cbCardData);
|
|||
|
|
WORD wSendSize = wHeadSize + OutCard.cbCardCount*sizeof(BYTE);
|
|||
|
|
m_pITableFrame->SendTableData(INVALID_CHAIR, SUB_S_OUT_CARD, &OutCard, wSendSize);
|
|||
|
|
m_pITableFrame->SendLookonData(INVALID_CHAIR, SUB_S_OUT_CARD, &OutCard, wSendSize);
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD>Ӽ<EFBFBD>¼;
|
|||
|
|
addGameRecordAction(SUB_S_OUT_CARD, &OutCard, wSendSize);
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҳ<EFBFBD><D2B2>Ǵ<EFBFBD><C7B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϸ)
|
|||
|
|
if (m_wCurrentUser == INVALID_CHAIR)
|
|||
|
|
{
|
|||
|
|
OnEventGameConclude(wChairID, NULL, GER_NORMAL);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
bool CTableFrameSink::OnUserPassCard(WORD wChairID)
|
|||
|
|
{
|
|||
|
|
//Ч<><D0A7>״̬
|
|||
|
|
if (m_pITableFrame->GetGameStatus() != GAME_SCENE_PLAY) return true;
|
|||
|
|
if ((wChairID != m_wCurrentUser) || (m_TurnOutCard.cbCardCount == 0)) return false;
|
|||
|
|
|
|||
|
|
//<2F>û<EFBFBD><C3BB>л<EFBFBD>
|
|||
|
|
do
|
|||
|
|
{
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD>
|
|||
|
|
m_wCurrentUser = (m_wCurrentUser + 1) % GAME_PLAYER;
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>
|
|||
|
|
if (m_wCurrentUser == m_wTurnWiner)
|
|||
|
|
{
|
|||
|
|
//<2F><><EFBFBD>ñ<EFBFBD><C3B1><EFBFBD>
|
|||
|
|
m_TurnOutCard.cbCardCount = 0;
|
|||
|
|
|
|||
|
|
//<2F>ӷ紦<D3B7><E7B4A6>
|
|||
|
|
if (m_cbHandCardCount[m_wTurnWiner] == 0)
|
|||
|
|
{
|
|||
|
|
//m_wCurrentUser = (m_wTurnWiner + 2) % GAME_PLAYER;
|
|||
|
|
m_wCurrentUser = m_wFriendChairID[m_wTurnWiner];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
if (m_cbHandCardCount[m_wCurrentUser] != 0) break;
|
|||
|
|
|
|||
|
|
} while (true);
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
|||
|
|
CMD_S_PassCard PassCard;
|
|||
|
|
PassCard.wPassCardUser = wChairID;
|
|||
|
|
PassCard.wCurrentUser = m_wCurrentUser;
|
|||
|
|
PassCard.cbTurnOver = (m_TurnOutCard.cbCardCount == 0) ? TRUE : FALSE;
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
m_pITableFrame->SendTableData(INVALID_CHAIR, SUB_S_PASS_CARD, &PassCard, sizeof(PassCard));
|
|||
|
|
m_pITableFrame->SendLookonData(INVALID_CHAIR, SUB_S_PASS_CARD, &PassCard, sizeof(PassCard));
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD>Ӽ<EFBFBD>¼;
|
|||
|
|
addGameRecordAction(SUB_S_PASS_CARD, &PassCard, sizeof(CMD_S_PassCard));
|
|||
|
|
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;
|
|||
|
|
BYTE CTableFrameSink::SearchFriendChairID()
|
|||
|
|
{
|
|||
|
|
static BYTE cbFriendCard[13] = { 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x21, 0x22 };
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;
|
|||
|
|
BYTE cbTmpCardData = 0x0;
|
|||
|
|
BYTE cbTmpCardCount = 0;
|
|||
|
|
WORD wFirstChairID = INVALID_CHAIR;
|
|||
|
|
WORD wNextChairID = INVALID_CHAIR;
|
|||
|
|
|
|||
|
|
for (BYTE i = 0; i < 13; i++)
|
|||
|
|
{
|
|||
|
|
cbTmpCardData = cbFriendCard[i];
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˭<EFBFBD><CBAD><EFBFBD><EFBFBD>;
|
|||
|
|
for (BYTE j = 0; j < GAME_PLAYER; j++)
|
|||
|
|
{
|
|||
|
|
for (BYTE k = 0; k < m_cbHandCardCount[j];k++)
|
|||
|
|
{
|
|||
|
|
// <20>ҵ<EFBFBD>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD>;
|
|||
|
|
if (cbTmpCardData == m_cbHandCardData[j][k])
|
|||
|
|
{
|
|||
|
|
cbTmpCardCount++;
|
|||
|
|
|
|||
|
|
// һ<><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>2<EFBFBD><32>;
|
|||
|
|
if (cbTmpCardCount >= 2) break;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬһ<CDAC><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;
|
|||
|
|
if ((cbTmpCardCount >= 2) && (wFirstChairID == INVALID_CHAIR))
|
|||
|
|
{
|
|||
|
|
cbTmpCardCount = 0;
|
|||
|
|
wFirstChairID = INVALID_CHAIR;
|
|||
|
|
wNextChairID = INVALID_CHAIR;
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
// <20>ҵ<EFBFBD><D2B5><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>;
|
|||
|
|
if ((cbTmpCardCount == 1) && (wFirstChairID == INVALID_CHAIR))
|
|||
|
|
{
|
|||
|
|
wFirstChairID = j;
|
|||
|
|
}
|
|||
|
|
// <20>ҵ<EFBFBD><D2B5>ڶ<EFBFBD><DAB6><EFBFBD><EFBFBD><EFBFBD>;
|
|||
|
|
else if ((cbTmpCardCount == 2) && (wFirstChairID != INVALID_CHAIR))
|
|||
|
|
{
|
|||
|
|
wNextChairID = j;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// <20>ҵ<EFBFBD>2<EFBFBD><32><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;
|
|||
|
|
if ((cbTmpCardCount == 2) && (wFirstChairID != INVALID_CHAIR) && (wNextChairID != INVALID_CHAIR))
|
|||
|
|
{
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// <20>ҵ<EFBFBD>2<EFBFBD><32><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;
|
|||
|
|
if ((cbTmpCardCount == 2) && (wFirstChairID != INVALID_CHAIR) && (wNextChairID != INVALID_CHAIR))
|
|||
|
|
{
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// <20>ҵ<EFBFBD>2<EFBFBD><32><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;
|
|||
|
|
if ((cbTmpCardCount == 2) && (wFirstChairID != INVALID_CHAIR) && (wNextChairID != INVALID_CHAIR))
|
|||
|
|
{
|
|||
|
|
m_wFriendChairID[wFirstChairID] = wNextChairID;
|
|||
|
|
m_wFriendChairID[wNextChairID] = wFirstChairID;
|
|||
|
|
|
|||
|
|
for (WORD i = 0; i < GAME_PLAYER; i++)
|
|||
|
|
{
|
|||
|
|
if ((i == wFirstChairID) || (i == wNextChairID)) continue;
|
|||
|
|
|
|||
|
|
for (WORD j = 0; j < GAME_PLAYER; j++)
|
|||
|
|
{
|
|||
|
|
if ((j == wFirstChairID) || (j == wNextChairID) || (j == i)) continue;
|
|||
|
|
|
|||
|
|
m_wFriendChairID[i] = j;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
// û<>ҵ<EFBFBD>ͬ<EFBFBD>飬Ĭ<E9A3AC>϶Լ<CFB6>ͬ<EFBFBD><CDAC>;
|
|||
|
|
for (WORD i = 0; i < m_wPlayerCount; i++)
|
|||
|
|
{
|
|||
|
|
m_wFriendChairID[i] = (i + 2) % GAME_PLAYER;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return cbTmpCardData;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//ը<><D5A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;
|
|||
|
|
int CTableFrameSink::AddBombScore(int nCardType, bool bList /*= true*/)
|
|||
|
|
{
|
|||
|
|
int nTmpCardType = 0;
|
|||
|
|
|
|||
|
|
// ը<><D5A8><EFBFBD>ּ<EFBFBD><D6BC><EFBFBD>2ը<32><D5A8>һ<EFBFBD><D2BB>;
|
|||
|
|
if (m_GameLogic.IsHasCardType(nCardType, CT_BOMB_4))
|
|||
|
|
{
|
|||
|
|
nTmpCardType = (bList ? m_GameLogic.TransListToInt(0, CT_BOMB_5) : CT_BOMB_5);
|
|||
|
|
}
|
|||
|
|
else if (m_GameLogic.IsHasCardType(nCardType, CT_BOMB_5))
|
|||
|
|
{
|
|||
|
|
//nTmpCardType = m_GameLogic.TransListToInt(0, CT_BOMB_6);
|
|||
|
|
nTmpCardType = (bList ? m_GameLogic.TransListToInt(0, CT_BOMB_6) : CT_BOMB_6);
|
|||
|
|
}
|
|||
|
|
else if (m_GameLogic.IsHasCardType(nCardType, CT_BOMB_6))
|
|||
|
|
{
|
|||
|
|
//nTmpCardType = m_GameLogic.TransListToInt(0, CT_BOMB_7);
|
|||
|
|
nTmpCardType = (bList ? m_GameLogic.TransListToInt(0, CT_BOMB_7) : CT_BOMB_7);
|
|||
|
|
}
|
|||
|
|
else if (m_GameLogic.IsHasCardType(nCardType, CT_BOMB_7))
|
|||
|
|
{
|
|||
|
|
//nTmpCardType = m_GameLogic.TransListToInt(0, CT_BOMB_8);
|
|||
|
|
nTmpCardType = (bList ? m_GameLogic.TransListToInt(0, CT_BOMB_8) : CT_BOMB_8);
|
|||
|
|
}
|
|||
|
|
else if (m_GameLogic.IsHasCardType(nCardType, CT_BOMB_8))
|
|||
|
|
{
|
|||
|
|
//nTmpCardType = m_GameLogic.TransListToInt(0, CT_BOMB_9);
|
|||
|
|
nTmpCardType = (bList ? m_GameLogic.TransListToInt(0, CT_BOMB_9) : CT_BOMB_9);
|
|||
|
|
}
|
|||
|
|
else if (m_GameLogic.IsHasCardType(nCardType, CT_BOMB_9))
|
|||
|
|
{
|
|||
|
|
//nTmpCardType = m_GameLogic.TransListToInt(0, CT_BOMB_10);
|
|||
|
|
nTmpCardType = (bList ? m_GameLogic.TransListToInt(0, CT_BOMB_10) : CT_BOMB_10);
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
nTmpCardType = nCardType;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return nTmpCardType;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD>ը<EFBFBD><D5A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;
|
|||
|
|
void CTableFrameSink::GetBombScore(WORD wChairID, BYTE cbCardData, int nCardType)
|
|||
|
|
{
|
|||
|
|
if ((nCardType >> CT_BOMB_4) > 0)
|
|||
|
|
{
|
|||
|
|
SCORE lBombScore = 0; // ը<><D5A8><EFBFBD><EFBFBD>;
|
|||
|
|
int nTmpCardType = CT_ERROR;
|
|||
|
|
if ((m_GameLogic.GetCardValue(cbCardData) == m_GameLogic.GetCardValue(0x02)))
|
|||
|
|
{
|
|||
|
|
nTmpCardType = AddBombScore(nCardType);
|
|||
|
|
}
|
|||
|
|
else if (IsHasGameRule(eDZRuleEnum_LOTTERY_7) && (m_GameLogic.GetCardValue(cbCardData) == m_GameLogic.GetCardValue(0x07)))
|
|||
|
|
{
|
|||
|
|
nTmpCardType = AddBombScore(nCardType);
|
|||
|
|
}
|
|||
|
|
else if (IsHasGameRule(eDZRuleEnum_LOTTERY_10) && (m_GameLogic.GetCardValue(cbCardData) == m_GameLogic.GetCardValue(0x0A)))
|
|||
|
|
{
|
|||
|
|
nTmpCardType = AddBombScore(nCardType);
|
|||
|
|
}
|
|||
|
|
else if (IsHasGameRule(eDZRuleEnum_LOTTERY_J) && (m_GameLogic.GetCardValue(cbCardData) == m_GameLogic.GetCardValue(0x0B)))
|
|||
|
|
{
|
|||
|
|
nTmpCardType = AddBombScore(nCardType);
|
|||
|
|
}
|
|||
|
|
else if (IsHasGameRule(eDZRuleEnum_LOTTERY_K) && (m_GameLogic.GetCardValue(cbCardData) == m_GameLogic.GetCardValue(0x0D)))
|
|||
|
|
{
|
|||
|
|
nTmpCardType = AddBombScore(nCardType);
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
nTmpCardType = nCardType;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// ը<><D5A8><EFBFBD>ּ<EFBFBD><D6BC><EFBFBD>2ը<32><D5A8>һ<EFBFBD><D2BB>;
|
|||
|
|
if (m_GameLogic.IsHasCardType(nTmpCardType, CT_BOMB_5))
|
|||
|
|
{
|
|||
|
|
lBombScore = 1;
|
|||
|
|
}
|
|||
|
|
else if (m_GameLogic.IsHasCardType(nTmpCardType, CT_BOMB_6))
|
|||
|
|
{
|
|||
|
|
lBombScore = 2;
|
|||
|
|
}
|
|||
|
|
else if (m_GameLogic.IsHasCardType(nTmpCardType, CT_BOMB_7))
|
|||
|
|
{
|
|||
|
|
lBombScore = 4;
|
|||
|
|
}
|
|||
|
|
else if (m_GameLogic.IsHasCardType(nTmpCardType, CT_BOMB_8))
|
|||
|
|
{
|
|||
|
|
lBombScore = 8;
|
|||
|
|
}
|
|||
|
|
else if (m_GameLogic.IsHasCardType(nTmpCardType, CT_BOMB_9))
|
|||
|
|
{
|
|||
|
|
lBombScore = 16;
|
|||
|
|
}
|
|||
|
|
else if (m_GameLogic.IsHasCardType(nTmpCardType, CT_BOMB_10))
|
|||
|
|
{
|
|||
|
|
lBombScore = 32;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD>ͳ<EFBFBD><CDB3>;
|
|||
|
|
if (lBombScore > 0)
|
|||
|
|
{
|
|||
|
|
// <20><>¼<EFBFBD><C2BC>־;
|
|||
|
|
MyLog("wChairID=%d, cbCardData=0x%x, nCardType=%d, lBombScore=%ld", wChairID, cbCardData, nTmpCardType, lBombScore);
|
|||
|
|
|
|||
|
|
m_lBombScore[wChairID] += lBombScore * (GAME_PLAYER - 1);
|
|||
|
|
|
|||
|
|
for (WORD i = 0; i < GAME_PLAYER; i++)
|
|||
|
|
{
|
|||
|
|
if (i != wChairID)
|
|||
|
|
{
|
|||
|
|
m_lBombScore[i] -= lBombScore;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
MyLog("m_lBombScore[%d] = %ld", i, m_lBombScore[i]);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void CTableFrameSink::GetBombScore(WORD wChairID, BYTE cbHandCardData[], BYTE cbHandCardCount)
|
|||
|
|
{
|
|||
|
|
BYTE bCardDataTemp[MAX_COUNT] = { 0 };
|
|||
|
|
|
|||
|
|
BYTE cbJokerCount = 0;
|
|||
|
|
BYTE cbCardTempCount = 0;
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD><D0B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;
|
|||
|
|
for (BYTE i = 0; i < cbHandCardCount; i++)
|
|||
|
|
{
|
|||
|
|
if (m_GameLogic.IsLaiZiCard(cbHandCardData[i]))
|
|||
|
|
{
|
|||
|
|
cbJokerCount++;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
bCardDataTemp[cbCardTempCount++] = cbHandCardData[i];
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>˿<EFBFBD>
|
|||
|
|
tagAnalyseResult AnalyseResult;
|
|||
|
|
ZeroMemory(&AnalyseResult, sizeof(AnalyseResult));
|
|||
|
|
m_GameLogic.AnalysebCardData(bCardDataTemp, cbCardTempCount, AnalyseResult);
|
|||
|
|
|
|||
|
|
BYTE cbMaxCardType = 0;
|
|||
|
|
BYTE cbMaxCardValue = 0;
|
|||
|
|
|
|||
|
|
// <20>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ը(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD>ҿ<EFBFBD><D2BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD>Ȼ<EFBFBD><C8BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͱȽ<CDB1>);
|
|||
|
|
if (cbJokerCount > 0)
|
|||
|
|
{
|
|||
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;
|
|||
|
|
for (int i = BLOCK_EIGHT; i >= 0; i--)
|
|||
|
|
{
|
|||
|
|
// <20>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;
|
|||
|
|
if (AnalyseResult.cbBlockCount[i] > 0)
|
|||
|
|
{
|
|||
|
|
BYTE cbCardCount = i + 1; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;
|
|||
|
|
BYTE nCardType = CT_BOMB_4 + cbJokerCount + cbCardCount - 4;
|
|||
|
|
nCardType = (nCardType > CT_BOMB_10) ? CT_BOMB_10 : nCardType;
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD>ը<EFBFBD><D5A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;
|
|||
|
|
if (nCardType < CT_BOMB_4) break;
|
|||
|
|
|
|||
|
|
for (BYTE j = 0; j < AnalyseResult.cbBlockCount[i]; j++)
|
|||
|
|
{
|
|||
|
|
BYTE nTmpCardType = 0;
|
|||
|
|
BYTE cbBombCard = AnalyseResult.cbCardData[i][j*cbCardCount];
|
|||
|
|
|
|||
|
|
// 2Ҳ<32>㿪<EFBFBD><E3BFAA>;
|
|||
|
|
if ((m_GameLogic.GetCardValue(cbBombCard) == m_GameLogic.GetCardValue(0x02)))
|
|||
|
|
{
|
|||
|
|
nTmpCardType = nCardType + 1;
|
|||
|
|
}
|
|||
|
|
else if (IsHasGameRule(eDZRuleEnum_LOTTERY_7) && (m_GameLogic.GetCardValue(cbBombCard) == m_GameLogic.GetCardValue(0x07)))
|
|||
|
|
{
|
|||
|
|
nTmpCardType = nCardType + 1;
|
|||
|
|
}
|
|||
|
|
else if (IsHasGameRule(eDZRuleEnum_LOTTERY_10) && (m_GameLogic.GetCardValue(cbBombCard) == m_GameLogic.GetCardValue(0x0A)))
|
|||
|
|
{
|
|||
|
|
nTmpCardType = nCardType + 1;
|
|||
|
|
}
|
|||
|
|
else if (IsHasGameRule(eDZRuleEnum_LOTTERY_J) && (m_GameLogic.GetCardValue(cbBombCard) == m_GameLogic.GetCardValue(0x0B)))
|
|||
|
|
{
|
|||
|
|
nTmpCardType = nCardType + 1;
|
|||
|
|
}
|
|||
|
|
else if (IsHasGameRule(eDZRuleEnum_LOTTERY_K) && (m_GameLogic.GetCardValue(cbBombCard) == m_GameLogic.GetCardValue(0x0D)))
|
|||
|
|
{
|
|||
|
|
nTmpCardType = nCardType + 1;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
nTmpCardType = nCardType;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD>10ը;
|
|||
|
|
nTmpCardType = (nTmpCardType > CT_BOMB_10) ? CT_BOMB_10 : nTmpCardType;
|
|||
|
|
|
|||
|
|
if (nTmpCardType > cbMaxCardType)
|
|||
|
|
{
|
|||
|
|
cbMaxCardValue = m_GameLogic.GetCardLogicValue(cbBombCard);
|
|||
|
|
cbMaxCardType = nTmpCardType;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĸ<EFBFBD><C4B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ը<EFBFBD><D5A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD>ڰ<EFBFBD>ը<EFBFBD><D5A8><EFBFBD><EFBFBD>ֱ<EFBFBD><D6B1><EFBFBD><EFBFBD><EFBFBD>ĸ<EFBFBD><C4B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ը;
|
|||
|
|
if ((4 == cbJokerCount) && (cbMaxCardType < CT_BOMB_8))
|
|||
|
|
{
|
|||
|
|
int nCardType = m_GameLogic.TransListToInt(0, CT_BOMB_8);
|
|||
|
|
GetBombScore(wChairID, 0x4F, nCardType);
|
|||
|
|
|
|||
|
|
cbJokerCount = 0;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;
|
|||
|
|
for (int i = BLOCK_EIGHT; i >= 0; i--)
|
|||
|
|
{
|
|||
|
|
if (AnalyseResult.cbBlockCount[i] <= 0) continue;
|
|||
|
|
|
|||
|
|
BYTE cbCardCount = i + 1; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;
|
|||
|
|
|
|||
|
|
for (BYTE j = 0; j < AnalyseResult.cbBlockCount[i]; j++)
|
|||
|
|
{
|
|||
|
|
BYTE cbBombCard = AnalyseResult.cbCardData[i][j*cbCardCount];
|
|||
|
|
|
|||
|
|
BYTE cbCardType = CT_BOMB_4 + cbCardCount - 4;
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD>ֱ<EFBFBD>Ӻ<EFBFBD><D3BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ը<EFBFBD><D5A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD>ӷ<EFBFBD>;
|
|||
|
|
if ((cbJokerCount > 0) && (m_GameLogic.GetCardLogicValue(cbBombCard) == cbMaxCardValue))
|
|||
|
|
{
|
|||
|
|
cbCardType += cbJokerCount;
|
|||
|
|
cbJokerCount = 0;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
cbCardType = (cbCardType > CT_BOMB_10) ? CT_BOMB_10 : cbCardType;
|
|||
|
|
if (cbCardType < CT_BOMB_4) continue;
|
|||
|
|
|
|||
|
|
// ͳ<><CDB3>ը<EFBFBD><D5A8>;
|
|||
|
|
int nCardType = m_GameLogic.TransListToInt(0, cbCardType);
|
|||
|
|
GetBombScore(wChairID, cbBombCard, nCardType);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F>Ƿ<EFBFBD><C7B7><EFBFBD>ը<EFBFBD><D5A8>(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>);
|
|||
|
|
bool CTableFrameSink::IsHasBomb(BYTE cbHandCardData[], BYTE cbHandCardCount)
|
|||
|
|
{
|
|||
|
|
bool bHasBomb = false;
|
|||
|
|
|
|||
|
|
BYTE bCardDataTemp[MAX_COUNT] = { 0 };
|
|||
|
|
|
|||
|
|
BYTE cbCardTempCount = 0;
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD><D0B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;
|
|||
|
|
for (BYTE i = 0; i < cbHandCardCount; i++)
|
|||
|
|
{
|
|||
|
|
if (!m_GameLogic.IsLaiZiCard(cbHandCardData[i]))
|
|||
|
|
{
|
|||
|
|
bCardDataTemp[cbCardTempCount++] = cbHandCardData[i];
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>˿<EFBFBD>
|
|||
|
|
tagAnalyseResult AnalyseResult;
|
|||
|
|
ZeroMemory(&AnalyseResult, sizeof(AnalyseResult));
|
|||
|
|
m_GameLogic.AnalysebCardData(bCardDataTemp, cbCardTempCount, AnalyseResult);
|
|||
|
|
|
|||
|
|
for (int i = BLOCK_FOUR; i <= BLOCK_EIGHT; i++)
|
|||
|
|
{
|
|||
|
|
if (AnalyseResult.cbBlockCount[i] > 0)
|
|||
|
|
{
|
|||
|
|
bHasBomb = true;
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return bHasBomb;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F>Ƿ<EFBFBD>8ը<38><D5A8>;
|
|||
|
|
bool CTableFrameSink::IsHas8Bomb(BYTE cbHandCardData[], BYTE cbHandCardCount)
|
|||
|
|
{
|
|||
|
|
bool bHas8Bomb = false;
|
|||
|
|
|
|||
|
|
BYTE bCardDataTemp[MAX_COUNT] = { 0 };
|
|||
|
|
|
|||
|
|
BYTE cbJokerCount = 0;
|
|||
|
|
BYTE cbCardTempCount = 0;
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD><D0B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;
|
|||
|
|
for (BYTE i = 0; i < cbHandCardCount; i++)
|
|||
|
|
{
|
|||
|
|
if (m_GameLogic.IsLaiZiCard(cbHandCardData[i]))
|
|||
|
|
{
|
|||
|
|
cbJokerCount++;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
bCardDataTemp[cbCardTempCount++] = cbHandCardData[i];
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD>ը;
|
|||
|
|
if (cbJokerCount >= 4) return true;
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>˿<EFBFBD>
|
|||
|
|
tagAnalyseResult AnalyseResult;
|
|||
|
|
ZeroMemory(&AnalyseResult, sizeof(AnalyseResult));
|
|||
|
|
m_GameLogic.AnalysebCardData(bCardDataTemp, cbCardTempCount, AnalyseResult);
|
|||
|
|
|
|||
|
|
// <20><>С<EFBFBD><D0A1>ը<EFBFBD><D5A8><EFBFBD><EFBFBD>4ը<34><D5A8>4<EFBFBD><34>;
|
|||
|
|
for (int i = BLOCK_FOUR; i <= BLOCK_EIGHT; i++)
|
|||
|
|
{
|
|||
|
|
// <20><>ը<EFBFBD><D5A8>;
|
|||
|
|
if (AnalyseResult.cbBlockCount[i] > 0)
|
|||
|
|
{
|
|||
|
|
if ((i + cbJokerCount) >= BLOCK_EIGHT)
|
|||
|
|
{
|
|||
|
|
bHas8Bomb = true;
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
else if ((i + cbJokerCount) == BLOCK_SEVEN)
|
|||
|
|
{
|
|||
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ;
|
|||
|
|
BYTE cbCardCount = i + 1; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;
|
|||
|
|
for (BYTE j = 0; j < AnalyseResult.cbBlockCount[i]; j++)
|
|||
|
|
{
|
|||
|
|
BYTE cbCardData = AnalyseResult.cbCardData[i][j*cbCardCount];
|
|||
|
|
|
|||
|
|
if ((m_GameLogic.GetCardValue(cbCardData) == m_GameLogic.GetCardValue(0x02)))
|
|||
|
|
{
|
|||
|
|
bHas8Bomb = true;
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
else if (IsHasGameRule(eDZRuleEnum_LOTTERY_7) && (m_GameLogic.GetCardValue(cbCardData) == m_GameLogic.GetCardValue(0x07)))
|
|||
|
|
{
|
|||
|
|
bHas8Bomb = true;
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
else if (IsHasGameRule(eDZRuleEnum_LOTTERY_10) && (m_GameLogic.GetCardValue(cbCardData) == m_GameLogic.GetCardValue(0x0A)))
|
|||
|
|
{
|
|||
|
|
bHas8Bomb = true;
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
else if (IsHasGameRule(eDZRuleEnum_LOTTERY_J) && (m_GameLogic.GetCardValue(cbCardData) == m_GameLogic.GetCardValue(0x0B)))
|
|||
|
|
{
|
|||
|
|
bHas8Bomb = true;
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
else if (IsHasGameRule(eDZRuleEnum_LOTTERY_K) && (m_GameLogic.GetCardValue(cbCardData) == m_GameLogic.GetCardValue(0x0D)))
|
|||
|
|
{
|
|||
|
|
bHas8Bomb = true;
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return bHas8Bomb;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/////////////////////////////// <20><>Ϸ¼<CFB7><C2BC> ///////////////////////////////////////////
|
|||
|
|
void CTableFrameSink::addGameRecordAction(WORD wSubCmdID, void* pSubMessage, int nMessageSize)
|
|||
|
|
{
|
|||
|
|
tagGameRecordOperateResult kOperateRecord;
|
|||
|
|
kOperateRecord.wSubCmdID = wSubCmdID;
|
|||
|
|
kOperateRecord.subMessageData.pushValue(pSubMessage, nMessageSize);
|
|||
|
|
m_kGameRecord.actionVec.push_back(kOperateRecord);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void CTableFrameSink::starGameRecord()
|
|||
|
|
{
|
|||
|
|
m_kGameRecord = tagGameRecord();
|
|||
|
|
|
|||
|
|
m_kGameRecord.wBankerUser = m_wBankerUser;
|
|||
|
|
m_kGameRecord.wEastUser = 0;
|
|||
|
|
|
|||
|
|
for (WORD i = 0; i < GAME_PLAYER; i++)
|
|||
|
|
{
|
|||
|
|
IServerUserItem* pUserItem = m_pITableFrame->GetTableUserItem(i);
|
|||
|
|
tagUserInfo* pUserInfo = pUserItem->GetUserInfo();
|
|||
|
|
if (pUserItem == NULL || NULL == pUserInfo)
|
|||
|
|
{
|
|||
|
|
continue;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
tagGameRecordPlayer kReocrdPlayer;
|
|||
|
|
kReocrdPlayer.dwUserID = pUserItem->GetUserID();
|
|||
|
|
kReocrdPlayer.dwGameID = pUserItem->GetGameID();
|
|||
|
|
kReocrdPlayer.wChairID = pUserItem->GetChairID();
|
|||
|
|
kReocrdPlayer.cbSex = pUserItem->GetGender();
|
|||
|
|
kReocrdPlayer.lScore = pUserItem->GetUserScore();
|
|||
|
|
kReocrdPlayer.strHead = pUserInfo->szHeadHttp;
|
|||
|
|
kReocrdPlayer.strNickName = pUserItem->GetNickName();
|
|||
|
|
|
|||
|
|
for (BYTE j = 0; j < m_cbHandCardCount[i]; j++)
|
|||
|
|
{
|
|||
|
|
kReocrdPlayer.cbCardData.push_back(m_cbHandCardData[i][j]);
|
|||
|
|
}
|
|||
|
|
m_kGameRecord.playersVec.push_back(kReocrdPlayer);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//////////////////////////////////////////////////////////////////////////
|
|||
|
|
|
|||
|
|
void CTableFrameSink::MyLog(TCHAR *szLog, ...)
|
|||
|
|
{
|
|||
|
|
CString strLog = "";
|
|||
|
|
va_list ap;
|
|||
|
|
va_start(ap, szLog);
|
|||
|
|
strLog.FormatV(szLog, ap);
|
|||
|
|
va_end(ap);
|
|||
|
|
|
|||
|
|
CString strTmpLog = "";
|
|||
|
|
strTmpLog.Format("TableID = %d, %s.\n", m_pITableFrame->GetTableID(), strLog);
|
|||
|
|
|
|||
|
|
::OutputDebugString(strTmpLog.GetBuffer());
|
|||
|
|
}
|