Commit ee5fea7e authored by Chen Bill's avatar Chen Bill

clear data while face-down

MSG_UPDATE_DATA
flag=0: clear

MSG_UPDATE_CARD
flag=QUERY_CODE, code=0: clear
parent 91b183db
...@@ -40,9 +40,10 @@ void ClientCard::UpdateInfo(unsigned char* buf) { ...@@ -40,9 +40,10 @@ void ClientCard::UpdateInfo(unsigned char* buf) {
ClearData(); ClearData();
return; return;
} }
int pdata;
if(flag & QUERY_CODE) { if(flag & QUERY_CODE) {
pdata = BufferIO::ReadInt32(buf); int pdata = BufferIO::ReadInt32(buf);
if (!pdata)
ClearData();
if((location == LOCATION_HAND) && ((unsigned int)pdata != code)) { if((location == LOCATION_HAND) && ((unsigned int)pdata != code)) {
code = pdata; code = pdata;
mainGame->dField.MoveCard(this, 5); mainGame->dField.MoveCard(this, 5);
...@@ -50,7 +51,7 @@ void ClientCard::UpdateInfo(unsigned char* buf) { ...@@ -50,7 +51,7 @@ void ClientCard::UpdateInfo(unsigned char* buf) {
code = pdata; code = pdata;
} }
if(flag & QUERY_POSITION) { if(flag & QUERY_POSITION) {
pdata = (BufferIO::ReadInt32(buf) >> 24) & 0xff; int pdata = (BufferIO::ReadInt32(buf) >> 24) & 0xff;
if((location & (LOCATION_EXTRA | LOCATION_REMOVED)) && (u8)pdata != position) { if((location & (LOCATION_EXTRA | LOCATION_REMOVED)) && (u8)pdata != position) {
position = pdata; position = pdata;
mainGame->dField.MoveCard(this, 1); mainGame->dField.MoveCard(this, 1);
...@@ -62,14 +63,14 @@ void ClientCard::UpdateInfo(unsigned char* buf) { ...@@ -62,14 +63,14 @@ void ClientCard::UpdateInfo(unsigned char* buf) {
if(flag & QUERY_TYPE) if(flag & QUERY_TYPE)
type = BufferIO::ReadInt32(buf); type = BufferIO::ReadInt32(buf);
if(flag & QUERY_LEVEL) { if(flag & QUERY_LEVEL) {
pdata = BufferIO::ReadInt32(buf); int pdata = BufferIO::ReadInt32(buf);
if(level != (unsigned int)pdata) { if(level != (unsigned int)pdata) {
level = pdata; level = pdata;
myswprintf(lvstring, L"L%d", level); myswprintf(lvstring, L"L%d", level);
} }
} }
if(flag & QUERY_RANK) { if(flag & QUERY_RANK) {
pdata = BufferIO::ReadInt32(buf); int pdata = BufferIO::ReadInt32(buf);
if(pdata && rank != (unsigned int)pdata) { if(pdata && rank != (unsigned int)pdata) {
rank = pdata; rank = pdata;
myswprintf(lvstring, L"R%d", rank); myswprintf(lvstring, L"R%d", rank);
...@@ -158,7 +159,7 @@ void ClientCard::UpdateInfo(unsigned char* buf) { ...@@ -158,7 +159,7 @@ void ClientCard::UpdateInfo(unsigned char* buf) {
myswprintf(rscstring, L"%d", rscale); myswprintf(rscstring, L"%d", rscale);
} }
if(flag & QUERY_LINK) { if(flag & QUERY_LINK) {
pdata = BufferIO::ReadInt32(buf); int pdata = BufferIO::ReadInt32(buf);
if (link != (unsigned int)pdata) { if (link != (unsigned int)pdata) {
link = pdata; link = pdata;
} }
......
...@@ -801,11 +801,11 @@ extern Game* mainGame; ...@@ -801,11 +801,11 @@ extern Game* mainGame;
#define BUTTON_BIG_CARD_ZOOM_OUT 382 #define BUTTON_BIG_CARD_ZOOM_OUT 382
#define BUTTON_BIG_CARD_ORIG_SIZE 383 #define BUTTON_BIG_CARD_ORIG_SIZE 383
//gframe messages //STOC_GAME_MSG messages
#define MSG_WAITING 3 #define MSG_WAITING 3
#define MSG_START 4 #define MSG_START 4
#define MSG_UPDATE_DATA 6 #define MSG_UPDATE_DATA 6 // flag=0: clear
#define MSG_UPDATE_CARD 7 #define MSG_UPDATE_CARD 7 // flag=QUERY_CODE, code=0: clear
#define MSG_REQUEST_DECK 8 #define MSG_REQUEST_DECK 8
#define MSG_REFRESH_DECK 34 #define MSG_REFRESH_DECK 34
#define MSG_CARD_SELECTED 80 #define MSG_CARD_SELECTED 80
......
...@@ -463,16 +463,17 @@ void SingleDuel::TPResult(DuelPlayer* dp, unsigned char tp) { ...@@ -463,16 +463,17 @@ void SingleDuel::TPResult(DuelPlayer* dp, unsigned char tp) {
BufferIO::WriteInt8(pbuf, host_info.duel_rule); BufferIO::WriteInt8(pbuf, host_info.duel_rule);
BufferIO::WriteInt32(pbuf, host_info.start_lp); BufferIO::WriteInt32(pbuf, host_info.start_lp);
BufferIO::WriteInt32(pbuf, host_info.start_lp); BufferIO::WriteInt32(pbuf, host_info.start_lp);
BufferIO::WriteInt16(pbuf, query_field_count(pduel, 0, 0x1)); BufferIO::WriteInt16(pbuf, query_field_count(pduel, 0, LOCATION_DECK));
BufferIO::WriteInt16(pbuf, query_field_count(pduel, 0, 0x40)); BufferIO::WriteInt16(pbuf, query_field_count(pduel, 0, LOCATION_EXTRA));
BufferIO::WriteInt16(pbuf, query_field_count(pduel, 1, 0x1)); BufferIO::WriteInt16(pbuf, query_field_count(pduel, 1, LOCATION_DECK));
BufferIO::WriteInt16(pbuf, query_field_count(pduel, 1, 0x40)); BufferIO::WriteInt16(pbuf, query_field_count(pduel, 1, LOCATION_EXTRA));
NetServer::SendBufferToPlayer(players[0], STOC_GAME_MSG, startbuf, 19); NetServer::SendBufferToPlayer(players[0], STOC_GAME_MSG, startbuf, 19);
startbuf[1] = 1; startbuf[1] = 1;
NetServer::SendBufferToPlayer(players[1], STOC_GAME_MSG, startbuf, 19); NetServer::SendBufferToPlayer(players[1], STOC_GAME_MSG, startbuf, 19);
if(!swapped) if(!swapped)
startbuf[1] = 0x10; startbuf[1] = 0x10;
else startbuf[1] = 0x11; else
startbuf[1] = 0x11;
for(auto oit = observers.begin(); oit != observers.end(); ++oit) for(auto oit = observers.begin(); oit != observers.end(); ++oit)
NetServer::SendBufferToPlayer(*oit, STOC_GAME_MSG, startbuf, 19); NetServer::SendBufferToPlayer(*oit, STOC_GAME_MSG, startbuf, 19);
RefreshExtra(0); RefreshExtra(0);
...@@ -1547,14 +1548,16 @@ void SingleDuel::RefreshSingle(int player, int location, int sequence, int flag) ...@@ -1547,14 +1548,16 @@ void SingleDuel::RefreshSingle(int player, int location, int sequence, int flag)
NetServer::SendBufferToPlayer(players[player], STOC_GAME_MSG, query_buffer, len + 4); NetServer::SendBufferToPlayer(players[player], STOC_GAME_MSG, query_buffer, len + 4);
if (len <= LEN_HEADER) if (len <= LEN_HEADER)
return; return;
auto position = GetPosition(qbuf, 12); const int clen = BufferIO::ReadInt32(qbuf);
if(location == LOCATION_REMOVED && (position & POS_FACEDOWN)) auto position = GetPosition(qbuf, 8);
return; if (position & POS_FACEDOWN) {
if ((location & 0x90) || ((location & 0x2c) && (position & POS_FACEUP))) { BufferIO::WriteInt32(qbuf, QUERY_CODE);
NetServer::ReSendToPlayer(players[1 - player]); BufferIO::WriteInt32(qbuf, 0);
for(auto pit = observers.begin(); pit != observers.end(); ++pit) memset(qbuf, 0, clen - 12);
NetServer::ReSendToPlayer(*pit);
} }
NetServer::SendBufferToPlayer(players[1 - player], STOC_GAME_MSG, query_buffer, len + 4);
for (auto pit = observers.begin(); pit != observers.end(); ++pit)
NetServer::ReSendToPlayer(*pit);
} }
uint32 SingleDuel::MessageHandler(intptr_t fduel, uint32 type) { uint32 SingleDuel::MessageHandler(intptr_t fduel, uint32 type) {
if(!enable_log) if(!enable_log)
......
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