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