Commit d50ffd16 authored by DailyShana's avatar DailyShana Committed by GitHub

add STOC_DECK_COUNT (#2290)

* add STOC_DECK_COUNT

* side count

* show deck in tag duel
parent f7fa8c18
...@@ -408,6 +408,19 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) { ...@@ -408,6 +408,19 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
mainGame->gMutex.unlock(); mainGame->gMutex.unlock();
break; break;
} }
case STOC_DECK_COUNT: {
mainGame->gMutex.lock();
int deckc = BufferIO::ReadInt16(pdata);
int extrac = BufferIO::ReadInt16(pdata);
int sidec = BufferIO::ReadInt16(pdata);
mainGame->dField.Initial(0, deckc, extrac);
deckc = BufferIO::ReadInt16(pdata);
extrac = BufferIO::ReadInt16(pdata);
sidec = BufferIO::ReadInt16(pdata);
mainGame->dField.Initial(1, deckc, extrac);
mainGame->gMutex.unlock();
break;
}
case STOC_JOIN_GAME: { case STOC_JOIN_GAME: {
STOC_JoinGame* pkt = (STOC_JoinGame*)pdata; STOC_JoinGame* pkt = (STOC_JoinGame*)pdata;
std::wstring str; std::wstring str;
...@@ -1164,6 +1177,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -1164,6 +1177,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->WaitFrameSignal(40); mainGame->WaitFrameSignal(40);
mainGame->showcard = 0; mainGame->showcard = 0;
mainGame->gMutex.lock(); mainGame->gMutex.lock();
mainGame->dField.Clear();
int playertype = BufferIO::ReadInt8(pbuf); int playertype = BufferIO::ReadInt8(pbuf);
mainGame->dInfo.isFirst = (playertype & 0xf) ? false : true; mainGame->dInfo.isFirst = (playertype & 0xf) ? false : true;
if(playertype & 0xf0) if(playertype & 0xf0)
......
...@@ -185,6 +185,7 @@ public: ...@@ -185,6 +185,7 @@ public:
#define STOC_TP_RESULT 0x6 #define STOC_TP_RESULT 0x6
#define STOC_CHANGE_SIDE 0x7 #define STOC_CHANGE_SIDE 0x7
#define STOC_WAITING_SIDE 0x8 #define STOC_WAITING_SIDE 0x8
#define STOC_DECK_COUNT 0x9
#define STOC_CREATE_GAME 0x11 #define STOC_CREATE_GAME 0x11
#define STOC_JOIN_GAME 0x12 #define STOC_JOIN_GAME 0x12
#define STOC_TYPE_CHANGE 0x13 #define STOC_TYPE_CHANGE 0x13
......
...@@ -328,6 +328,20 @@ void SingleDuel::StartDuel(DuelPlayer* dp) { ...@@ -328,6 +328,20 @@ void SingleDuel::StartDuel(DuelPlayer* dp) {
(*oit)->state = CTOS_LEAVE_GAME; (*oit)->state = CTOS_LEAVE_GAME;
NetServer::ReSendToPlayer(*oit); NetServer::ReSendToPlayer(*oit);
} }
char deckbuff[12];
char* pbuf = deckbuff;
BufferIO::WriteInt16(pbuf, pdeck[0].main.size());
BufferIO::WriteInt16(pbuf, pdeck[0].extra.size());
BufferIO::WriteInt16(pbuf, pdeck[0].side.size());
BufferIO::WriteInt16(pbuf, pdeck[1].main.size());
BufferIO::WriteInt16(pbuf, pdeck[1].extra.size());
BufferIO::WriteInt16(pbuf, pdeck[1].side.size());
NetServer::SendBufferToPlayer(players[0], STOC_DECK_COUNT, deckbuff, 12);
char tempbuff[6];
memcpy(tempbuff, deckbuff, 6);
memcpy(deckbuff, deckbuff + 6, 6);
memcpy(deckbuff + 6, tempbuff, 6);
NetServer::SendBufferToPlayer(players[1], STOC_DECK_COUNT, deckbuff, 12);
NetServer::SendPacketToPlayer(players[0], STOC_SELECT_HAND); NetServer::SendPacketToPlayer(players[0], STOC_SELECT_HAND);
NetServer::ReSendToPlayer(players[1]); NetServer::ReSendToPlayer(players[1]);
hand_result[0] = 0; hand_result[0] = 0;
......
...@@ -285,6 +285,22 @@ void TagDuel::StartDuel(DuelPlayer* dp) { ...@@ -285,6 +285,22 @@ void TagDuel::StartDuel(DuelPlayer* dp) {
(*oit)->state = CTOS_LEAVE_GAME; (*oit)->state = CTOS_LEAVE_GAME;
NetServer::ReSendToPlayer(*oit); NetServer::ReSendToPlayer(*oit);
} }
char deckbuff[12];
char* pbuf = deckbuff;
BufferIO::WriteInt16(pbuf, pdeck[0].main.size());
BufferIO::WriteInt16(pbuf, pdeck[0].extra.size());
BufferIO::WriteInt16(pbuf, pdeck[0].side.size());
BufferIO::WriteInt16(pbuf, pdeck[2].main.size());
BufferIO::WriteInt16(pbuf, pdeck[2].extra.size());
BufferIO::WriteInt16(pbuf, pdeck[2].side.size());
NetServer::SendBufferToPlayer(players[0], STOC_DECK_COUNT, deckbuff, 12);
NetServer::ReSendToPlayer(players[1]);
char tempbuff[6];
memcpy(tempbuff, deckbuff, 6);
memcpy(deckbuff, deckbuff + 6, 6);
memcpy(deckbuff + 6, tempbuff, 6);
NetServer::SendBufferToPlayer(players[2], STOC_DECK_COUNT, deckbuff, 12);
NetServer::ReSendToPlayer(players[3]);
NetServer::SendPacketToPlayer(players[0], STOC_SELECT_HAND); NetServer::SendPacketToPlayer(players[0], STOC_SELECT_HAND);
NetServer::ReSendToPlayer(players[2]); NetServer::ReSendToPlayer(players[2]);
hand_result[0] = 0; hand_result[0] = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment