Commit b2901259 authored by Chen Bill's avatar Chen Bill Committed by GitHub

Use BufferIO::ReadUInt8 (#2537)

* change code, location, position to unsigned

* change code, location, postion to unsigned

* use ReadUInt8() for 1-byte data

* Game::LocalPlayer() returns 0, 1

* wrong matching

* change card code to unsigned
parent 497b364a
...@@ -113,10 +113,10 @@ void ClientCard::UpdateInfo(unsigned char* buf) { ...@@ -113,10 +113,10 @@ void ClientCard::UpdateInfo(unsigned char* buf) {
if(flag & QUERY_REASON_CARD) if(flag & QUERY_REASON_CARD)
buf += 4; buf += 4;
if(flag & QUERY_EQUIP_CARD) { if(flag & QUERY_EQUIP_CARD) {
int c = BufferIO::ReadInt8(buf); int c = BufferIO::ReadUInt8(buf);
int l = BufferIO::ReadInt8(buf); unsigned int l = BufferIO::ReadUInt8(buf);
int s = BufferIO::ReadInt8(buf); int s = BufferIO::ReadUInt8(buf);
BufferIO::ReadInt8(buf); BufferIO::ReadUInt8(buf);
ClientCard* ecard = mainGame->dField.GetCard(mainGame->LocalPlayer(c), l, s); ClientCard* ecard = mainGame->dField.GetCard(mainGame->LocalPlayer(c), l, s);
if (ecard) { if (ecard) {
equipTarget = ecard; equipTarget = ecard;
...@@ -126,10 +126,10 @@ void ClientCard::UpdateInfo(unsigned char* buf) { ...@@ -126,10 +126,10 @@ void ClientCard::UpdateInfo(unsigned char* buf) {
if(flag & QUERY_TARGET_CARD) { if(flag & QUERY_TARGET_CARD) {
int count = BufferIO::ReadInt32(buf); int count = BufferIO::ReadInt32(buf);
for(int i = 0; i < count; ++i) { for(int i = 0; i < count; ++i) {
int c = BufferIO::ReadInt8(buf); int c = BufferIO::ReadUInt8(buf);
int l = BufferIO::ReadInt8(buf); unsigned int l = BufferIO::ReadUInt8(buf);
int s = BufferIO::ReadInt8(buf); int s = BufferIO::ReadUInt8(buf);
BufferIO::ReadInt8(buf); BufferIO::ReadUInt8(buf);
ClientCard* tcard = mainGame->dField.GetCard(mainGame->LocalPlayer(c), l, s); ClientCard* tcard = mainGame->dField.GetCard(mainGame->LocalPlayer(c), l, s);
if (tcard) { if (tcard) {
cardTarget.insert(tcard); cardTarget.insert(tcard);
......
...@@ -1004,8 +1004,8 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) { ...@@ -1004,8 +1004,8 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
return false; return false;
} }
case MSG_HINT: { case MSG_HINT: {
int type = BufferIO::ReadInt8(pbuf); int type = BufferIO::ReadUInt8(pbuf);
int player = BufferIO::ReadInt8(pbuf); int player = BufferIO::ReadUInt8(pbuf);
int data = BufferIO::ReadInt32(pbuf); int data = BufferIO::ReadInt32(pbuf);
if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping) if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping)
return true; return true;
...@@ -1139,8 +1139,8 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) { ...@@ -1139,8 +1139,8 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
} }
case MSG_WIN: { case MSG_WIN: {
mainGame->dInfo.isFinished = true; mainGame->dInfo.isFinished = true;
int player = BufferIO::ReadInt8(pbuf); int player = BufferIO::ReadUInt8(pbuf);
int type = BufferIO::ReadInt8(pbuf); int type = BufferIO::ReadUInt8(pbuf);
mainGame->showcarddif = 110; mainGame->showcarddif = 110;
mainGame->showcardp = 0; mainGame->showcardp = 0;
mainGame->dInfo.vic_string = 0; mainGame->dInfo.vic_string = 0;
...@@ -1190,7 +1190,7 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) { ...@@ -1190,7 +1190,7 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
mainGame->showcard = 0; mainGame->showcard = 0;
mainGame->gMutex.lock(); mainGame->gMutex.lock();
mainGame->dField.Clear(); mainGame->dField.Clear();
int playertype = BufferIO::ReadInt8(pbuf); int playertype = BufferIO::ReadUInt8(pbuf);
mainGame->dInfo.isFirst = (playertype & 0xf) ? false : true; mainGame->dInfo.isFirst = (playertype & 0xf) ? false : true;
if(playertype & 0xf0) if(playertype & 0xf0)
mainGame->dInfo.player_type = 7; mainGame->dInfo.player_type = 7;
...@@ -1200,7 +1200,7 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) { ...@@ -1200,7 +1200,7 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
else else
mainGame->dInfo.tag_player[0] = true; mainGame->dInfo.tag_player[0] = true;
} }
mainGame->dInfo.duel_rule = BufferIO::ReadInt8(pbuf); mainGame->dInfo.duel_rule = BufferIO::ReadUInt8(pbuf);
mainGame->dInfo.lp[mainGame->LocalPlayer(0)] = BufferIO::ReadInt32(pbuf); mainGame->dInfo.lp[mainGame->LocalPlayer(0)] = BufferIO::ReadInt32(pbuf);
mainGame->dInfo.lp[mainGame->LocalPlayer(1)] = BufferIO::ReadInt32(pbuf); mainGame->dInfo.lp[mainGame->LocalPlayer(1)] = BufferIO::ReadInt32(pbuf);
myswprintf(mainGame->dInfo.strLP[0], L"%d", mainGame->dInfo.lp[0]); myswprintf(mainGame->dInfo.strLP[0], L"%d", mainGame->dInfo.lp[0]);
...@@ -1227,36 +1227,37 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) { ...@@ -1227,36 +1227,37 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
return true; return true;
} }
case MSG_UPDATE_DATA: { case MSG_UPDATE_DATA: {
int player = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int player = mainGame->LocalPlayer(BufferIO::ReadUInt8(pbuf));
int location = BufferIO::ReadInt8(pbuf); int location = BufferIO::ReadUInt8(pbuf);
mainGame->gMutex.lock(); mainGame->gMutex.lock();
mainGame->dField.UpdateFieldCard(player, location, pbuf); mainGame->dField.UpdateFieldCard(player, location, pbuf);
mainGame->gMutex.unlock(); mainGame->gMutex.unlock();
return true; return true;
} }
case MSG_UPDATE_CARD: { case MSG_UPDATE_CARD: {
int player = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int player = mainGame->LocalPlayer(BufferIO::ReadUInt8(pbuf));
int loc = BufferIO::ReadInt8(pbuf); unsigned int loc = BufferIO::ReadUInt8(pbuf);
int seq = BufferIO::ReadInt8(pbuf); int seq = BufferIO::ReadUInt8(pbuf);
mainGame->gMutex.lock(); mainGame->gMutex.lock();
mainGame->dField.UpdateCard(player, loc, seq, pbuf); mainGame->dField.UpdateCard(player, loc, seq, pbuf);
mainGame->gMutex.unlock(); mainGame->gMutex.unlock();
break; break;
} }
case MSG_SELECT_BATTLECMD: { case MSG_SELECT_BATTLECMD: {
/*int selecting_player = */BufferIO::ReadInt8(pbuf); /*int selecting_player = */BufferIO::ReadUInt8(pbuf);
int code, desc, count, con, loc, seq/*, diratt*/; int desc, count, con, seq/*, diratt*/;
unsigned int code, loc;
ClientCard* pcard; ClientCard* pcard;
mainGame->dField.activatable_cards.clear(); mainGame->dField.activatable_cards.clear();
mainGame->dField.activatable_descs.clear(); mainGame->dField.activatable_descs.clear();
mainGame->dField.conti_cards.clear(); mainGame->dField.conti_cards.clear();
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
for (int i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {
code = BufferIO::ReadInt32(pbuf); code = BufferIO::ReadInt32(pbuf);
con = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); con = mainGame->LocalPlayer(BufferIO::ReadUInt8(pbuf));
loc = BufferIO::ReadInt8(pbuf); loc = BufferIO::ReadUInt8(pbuf);
seq = BufferIO::ReadInt8(pbuf); seq = BufferIO::ReadUInt8(pbuf);
desc = BufferIO::ReadInt32(pbuf); desc = BufferIO::ReadInt32(pbuf);
pcard = mainGame->dField.GetCard(con, loc, seq); pcard = mainGame->dField.GetCard(con, loc, seq);
int flag = 0; int flag = 0;
if(code & 0x80000000) { if(code & 0x80000000) {
...@@ -1282,24 +1283,24 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) { ...@@ -1282,24 +1283,24 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
} }
} }
mainGame->dField.attackable_cards.clear(); mainGame->dField.attackable_cards.clear();
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
for (int i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {
/*code = */BufferIO::ReadInt32(pbuf); /*code = */BufferIO::ReadInt32(pbuf);
con = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); con = mainGame->LocalPlayer(BufferIO::ReadUInt8(pbuf));
loc = BufferIO::ReadInt8(pbuf); loc = BufferIO::ReadUInt8(pbuf);
seq = BufferIO::ReadInt8(pbuf); seq = BufferIO::ReadUInt8(pbuf);
/*diratt = */BufferIO::ReadInt8(pbuf); /*diratt = */BufferIO::ReadUInt8(pbuf);
pcard = mainGame->dField.GetCard(con, loc, seq); pcard = mainGame->dField.GetCard(con, loc, seq);
mainGame->dField.attackable_cards.push_back(pcard); mainGame->dField.attackable_cards.push_back(pcard);
pcard->cmdFlag |= COMMAND_ATTACK; pcard->cmdFlag |= COMMAND_ATTACK;
} }
mainGame->gMutex.lock(); mainGame->gMutex.lock();
if(BufferIO::ReadInt8(pbuf)) { if(BufferIO::ReadUInt8(pbuf)) {
mainGame->btnM2->setVisible(true); mainGame->btnM2->setVisible(true);
mainGame->btnM2->setEnabled(true); mainGame->btnM2->setEnabled(true);
mainGame->btnM2->setPressed(false); mainGame->btnM2->setPressed(false);
} }
if(BufferIO::ReadInt8(pbuf)) { if(BufferIO::ReadUInt8(pbuf)) {
mainGame->btnEP->setVisible(true); mainGame->btnEP->setVisible(true);
mainGame->btnEP->setEnabled(true); mainGame->btnEP->setEnabled(true);
mainGame->btnEP->setPressed(false); mainGame->btnEP->setPressed(false);
...@@ -1308,27 +1309,28 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) { ...@@ -1308,27 +1309,28 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
return false; return false;
} }
case MSG_SELECT_IDLECMD: { case MSG_SELECT_IDLECMD: {
/*int selecting_player = */BufferIO::ReadInt8(pbuf); /*int selecting_player = */BufferIO::ReadUInt8(pbuf);
int code, desc, count, con, loc, seq; int desc, count, con, seq;
unsigned int code, loc;
ClientCard* pcard; ClientCard* pcard;
mainGame->dField.summonable_cards.clear(); mainGame->dField.summonable_cards.clear();
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
for (int i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {
code = BufferIO::ReadInt32(pbuf); code = BufferIO::ReadInt32(pbuf);
con = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); con = mainGame->LocalPlayer(BufferIO::ReadUInt8(pbuf));
loc = BufferIO::ReadInt8(pbuf); loc = BufferIO::ReadUInt8(pbuf);
seq = BufferIO::ReadInt8(pbuf); seq = BufferIO::ReadUInt8(pbuf);
pcard = mainGame->dField.GetCard(con, loc, seq); pcard = mainGame->dField.GetCard(con, loc, seq);
mainGame->dField.summonable_cards.push_back(pcard); mainGame->dField.summonable_cards.push_back(pcard);
pcard->cmdFlag |= COMMAND_SUMMON; pcard->cmdFlag |= COMMAND_SUMMON;
} }
mainGame->dField.spsummonable_cards.clear(); mainGame->dField.spsummonable_cards.clear();
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
for (int i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {
code = BufferIO::ReadInt32(pbuf); code = BufferIO::ReadInt32(pbuf);
con = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); con = mainGame->LocalPlayer(BufferIO::ReadUInt8(pbuf));
loc = BufferIO::ReadInt8(pbuf); loc = BufferIO::ReadUInt8(pbuf);
seq = BufferIO::ReadInt8(pbuf); seq = BufferIO::ReadUInt8(pbuf);
pcard = mainGame->dField.GetCard(con, loc, seq); pcard = mainGame->dField.GetCard(con, loc, seq);
mainGame->dField.spsummonable_cards.push_back(pcard); mainGame->dField.spsummonable_cards.push_back(pcard);
pcard->cmdFlag |= COMMAND_SPSUMMON; pcard->cmdFlag |= COMMAND_SPSUMMON;
...@@ -1348,34 +1350,34 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) { ...@@ -1348,34 +1350,34 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
} }
} }
mainGame->dField.reposable_cards.clear(); mainGame->dField.reposable_cards.clear();
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
for (int i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {
code = BufferIO::ReadInt32(pbuf); code = BufferIO::ReadInt32(pbuf);
con = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); con = mainGame->LocalPlayer(BufferIO::ReadUInt8(pbuf));
loc = BufferIO::ReadInt8(pbuf); loc = BufferIO::ReadUInt8(pbuf);
seq = BufferIO::ReadInt8(pbuf); seq = BufferIO::ReadUInt8(pbuf);
pcard = mainGame->dField.GetCard(con, loc, seq); pcard = mainGame->dField.GetCard(con, loc, seq);
mainGame->dField.reposable_cards.push_back(pcard); mainGame->dField.reposable_cards.push_back(pcard);
pcard->cmdFlag |= COMMAND_REPOS; pcard->cmdFlag |= COMMAND_REPOS;
} }
mainGame->dField.msetable_cards.clear(); mainGame->dField.msetable_cards.clear();
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
for (int i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {
code = BufferIO::ReadInt32(pbuf); code = BufferIO::ReadInt32(pbuf);
con = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); con = mainGame->LocalPlayer(BufferIO::ReadUInt8(pbuf));
loc = BufferIO::ReadInt8(pbuf); loc = BufferIO::ReadUInt8(pbuf);
seq = BufferIO::ReadInt8(pbuf); seq = BufferIO::ReadUInt8(pbuf);
pcard = mainGame->dField.GetCard(con, loc, seq); pcard = mainGame->dField.GetCard(con, loc, seq);
mainGame->dField.msetable_cards.push_back(pcard); mainGame->dField.msetable_cards.push_back(pcard);
pcard->cmdFlag |= COMMAND_MSET; pcard->cmdFlag |= COMMAND_MSET;
} }
mainGame->dField.ssetable_cards.clear(); mainGame->dField.ssetable_cards.clear();
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
for (int i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {
code = BufferIO::ReadInt32(pbuf); code = BufferIO::ReadInt32(pbuf);
con = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); con = mainGame->LocalPlayer(BufferIO::ReadUInt8(pbuf));
loc = BufferIO::ReadInt8(pbuf); loc = BufferIO::ReadUInt8(pbuf);
seq = BufferIO::ReadInt8(pbuf); seq = BufferIO::ReadUInt8(pbuf);
pcard = mainGame->dField.GetCard(con, loc, seq); pcard = mainGame->dField.GetCard(con, loc, seq);
mainGame->dField.ssetable_cards.push_back(pcard); mainGame->dField.ssetable_cards.push_back(pcard);
pcard->cmdFlag |= COMMAND_SSET; pcard->cmdFlag |= COMMAND_SSET;
...@@ -1383,12 +1385,12 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) { ...@@ -1383,12 +1385,12 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
mainGame->dField.activatable_cards.clear(); mainGame->dField.activatable_cards.clear();
mainGame->dField.activatable_descs.clear(); mainGame->dField.activatable_descs.clear();
mainGame->dField.conti_cards.clear(); mainGame->dField.conti_cards.clear();
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
for (int i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {
code = BufferIO::ReadInt32(pbuf); code = BufferIO::ReadInt32(pbuf);
con = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); con = mainGame->LocalPlayer(BufferIO::ReadUInt8(pbuf));
loc = BufferIO::ReadInt8(pbuf); loc = BufferIO::ReadUInt8(pbuf);
seq = BufferIO::ReadInt8(pbuf); seq = BufferIO::ReadUInt8(pbuf);
desc = BufferIO::ReadInt32(pbuf); desc = BufferIO::ReadInt32(pbuf);
pcard = mainGame->dField.GetCard(con, loc, seq); pcard = mainGame->dField.GetCard(con, loc, seq);
int flag = 0; int flag = 0;
...@@ -1414,17 +1416,17 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) { ...@@ -1414,17 +1416,17 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
} }
} }
} }
if(BufferIO::ReadInt8(pbuf)) { if(BufferIO::ReadUInt8(pbuf)) {
mainGame->btnBP->setVisible(true); mainGame->btnBP->setVisible(true);
mainGame->btnBP->setEnabled(true); mainGame->btnBP->setEnabled(true);
mainGame->btnBP->setPressed(false); mainGame->btnBP->setPressed(false);
} }
if(BufferIO::ReadInt8(pbuf)) { if(BufferIO::ReadUInt8(pbuf)) {
mainGame->btnEP->setVisible(true); mainGame->btnEP->setVisible(true);
mainGame->btnEP->setEnabled(true); mainGame->btnEP->setEnabled(true);
mainGame->btnEP->setPressed(false); mainGame->btnEP->setPressed(false);
} }
if (BufferIO::ReadInt8(pbuf)) { if (BufferIO::ReadUInt8(pbuf)) {
mainGame->btnShuffle->setVisible(true); mainGame->btnShuffle->setVisible(true);
} else { } else {
mainGame->btnShuffle->setVisible(false); mainGame->btnShuffle->setVisible(false);
...@@ -1432,15 +1434,15 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) { ...@@ -1432,15 +1434,15 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
return false; return false;
} }
case MSG_SELECT_EFFECTYN: { case MSG_SELECT_EFFECTYN: {
/*int selecting_player = */BufferIO::ReadInt8(pbuf); /*int selecting_player = */BufferIO::ReadUInt8(pbuf);
unsigned int code = (unsigned int)BufferIO::ReadInt32(pbuf); unsigned int code = BufferIO::ReadInt32(pbuf);
int c = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int c = mainGame->LocalPlayer(BufferIO::ReadUInt8(pbuf));
int l = BufferIO::ReadInt8(pbuf); unsigned int l = BufferIO::ReadUInt8(pbuf);
int s = BufferIO::ReadInt8(pbuf); int s = BufferIO::ReadUInt8(pbuf);
ClientCard* pcard = mainGame->dField.GetCard(c, l, s); ClientCard* pcard = mainGame->dField.GetCard(c, l, s);
if (pcard->code != code) if (pcard->code != code)
pcard->SetCode(code); pcard->SetCode(code);
BufferIO::ReadInt8(pbuf); BufferIO::ReadUInt8(pbuf);
if(l != LOCATION_DECK) { if(l != LOCATION_DECK) {
pcard->is_highlighting = true; pcard->is_highlighting = true;
mainGame->dField.highlighting_card = pcard; mainGame->dField.highlighting_card = pcard;
...@@ -1466,7 +1468,7 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) { ...@@ -1466,7 +1468,7 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
return false; return false;
} }
case MSG_SELECT_YESNO: { case MSG_SELECT_YESNO: {
/*int selecting_player = */BufferIO::ReadInt8(pbuf); /*int selecting_player = */BufferIO::ReadUInt8(pbuf);
int desc = BufferIO::ReadInt32(pbuf); int desc = BufferIO::ReadInt32(pbuf);
mainGame->dField.highlighting_card = 0; mainGame->dField.highlighting_card = 0;
mainGame->gMutex.lock(); mainGame->gMutex.lock();
...@@ -1476,8 +1478,8 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) { ...@@ -1476,8 +1478,8 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
return false; return false;
} }
case MSG_SELECT_OPTION: { case MSG_SELECT_OPTION: {
/*int selecting_player = */BufferIO::ReadInt8(pbuf); /*int selecting_player = */BufferIO::ReadUInt8(pbuf);
int count = BufferIO::ReadInt8(pbuf); int count = BufferIO::ReadUInt8(pbuf);
mainGame->dField.select_options.clear(); mainGame->dField.select_options.clear();
for (int i = 0; i < count; ++i) for (int i = 0; i < count; ++i)
mainGame->dField.select_options.push_back(BufferIO::ReadInt32(pbuf)); mainGame->dField.select_options.push_back(BufferIO::ReadInt32(pbuf));
...@@ -1486,14 +1488,15 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) { ...@@ -1486,14 +1488,15 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
return false; return false;
} }
case MSG_SELECT_CARD: { case MSG_SELECT_CARD: {
/*int selecting_player = */BufferIO::ReadInt8(pbuf); /*int selecting_player = */BufferIO::ReadUInt8(pbuf);
mainGame->dField.select_cancelable = BufferIO::ReadInt8(pbuf) != 0; mainGame->dField.select_cancelable = BufferIO::ReadUInt8(pbuf) != 0;
mainGame->dField.select_min = BufferIO::ReadInt8(pbuf); mainGame->dField.select_min = BufferIO::ReadUInt8(pbuf);
mainGame->dField.select_max = BufferIO::ReadInt8(pbuf); mainGame->dField.select_max = BufferIO::ReadUInt8(pbuf);
int count = BufferIO::ReadInt8(pbuf); int count = BufferIO::ReadUInt8(pbuf);
mainGame->dField.selectable_cards.clear(); mainGame->dField.selectable_cards.clear();
mainGame->dField.selected_cards.clear(); mainGame->dField.selected_cards.clear();
int c, l, s, ss; int c, s, ss;
unsigned int l;
unsigned int code; unsigned int code;
bool panelmode = false; bool panelmode = false;
size_t hand_count[2] = { mainGame->dField.hand[0].size(), mainGame->dField.hand[1].size() }; size_t hand_count[2] = { mainGame->dField.hand[0].size(), mainGame->dField.hand[1].size() };
...@@ -1502,11 +1505,11 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) { ...@@ -1502,11 +1505,11 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
mainGame->dField.select_ready = select_ready; mainGame->dField.select_ready = select_ready;
ClientCard* pcard; ClientCard* pcard;
for (int i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {
code = (unsigned int)BufferIO::ReadInt32(pbuf); code = BufferIO::ReadInt32(pbuf);
c = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); c = mainGame->LocalPlayer(BufferIO::ReadUInt8(pbuf));
l = BufferIO::ReadInt8(pbuf); l = BufferIO::ReadUInt8(pbuf);
s = BufferIO::ReadInt8(pbuf); s = BufferIO::ReadUInt8(pbuf);
ss = BufferIO::ReadInt8(pbuf); ss = BufferIO::ReadUInt8(pbuf);
if ((l & LOCATION_OVERLAY) > 0) if ((l & LOCATION_OVERLAY) > 0)
pcard = mainGame->dField.GetCard(c, l & 0x7f, s)->overlayed[ss]; pcard = mainGame->dField.GetCard(c, l & 0x7f, s)->overlayed[ss];
else else
...@@ -1549,16 +1552,17 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) { ...@@ -1549,16 +1552,17 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
return false; return false;
} }
case MSG_SELECT_UNSELECT_CARD: { case MSG_SELECT_UNSELECT_CARD: {
/*int selecting_player = */BufferIO::ReadInt8(pbuf); /*int selecting_player = */BufferIO::ReadUInt8(pbuf);
bool finishable = BufferIO::ReadInt8(pbuf) != 0; bool finishable = BufferIO::ReadUInt8(pbuf) != 0;
bool cancelable = BufferIO::ReadInt8(pbuf) != 0; bool cancelable = BufferIO::ReadUInt8(pbuf) != 0;
mainGame->dField.select_cancelable = finishable || cancelable; mainGame->dField.select_cancelable = finishable || cancelable;
mainGame->dField.select_min = BufferIO::ReadInt8(pbuf); mainGame->dField.select_min = BufferIO::ReadUInt8(pbuf);
mainGame->dField.select_max = BufferIO::ReadInt8(pbuf); mainGame->dField.select_max = BufferIO::ReadUInt8(pbuf);
int count1 = BufferIO::ReadInt8(pbuf); int count1 = BufferIO::ReadUInt8(pbuf);
mainGame->dField.selectable_cards.clear(); mainGame->dField.selectable_cards.clear();
mainGame->dField.selected_cards.clear(); mainGame->dField.selected_cards.clear();
int c, l, s, ss; int c, s, ss;
unsigned int l;
unsigned int code; unsigned int code;
bool panelmode = false; bool panelmode = false;
size_t hand_count[2] = { mainGame->dField.hand[0].size(), mainGame->dField.hand[1].size() }; size_t hand_count[2] = { mainGame->dField.hand[0].size(), mainGame->dField.hand[1].size() };
...@@ -1567,10 +1571,10 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) { ...@@ -1567,10 +1571,10 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
ClientCard* pcard; ClientCard* pcard;
for (int i = 0; i < count1; ++i) { for (int i = 0; i < count1; ++i) {
code = (unsigned int)BufferIO::ReadInt32(pbuf); code = (unsigned int)BufferIO::ReadInt32(pbuf);
c = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); c = mainGame->LocalPlayer(BufferIO::ReadUInt8(pbuf));
l = BufferIO::ReadInt8(pbuf); l = BufferIO::ReadUInt8(pbuf);
s = BufferIO::ReadInt8(pbuf); s = BufferIO::ReadUInt8(pbuf);
ss = BufferIO::ReadInt8(pbuf); ss = BufferIO::ReadUInt8(pbuf);
if ((l & LOCATION_OVERLAY) > 0) if ((l & LOCATION_OVERLAY) > 0)
pcard = mainGame->dField.GetCard(c, l & 0x7f, s)->overlayed[ss]; pcard = mainGame->dField.GetCard(c, l & 0x7f, s)->overlayed[ss];
else else
...@@ -1588,13 +1592,13 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) { ...@@ -1588,13 +1592,13 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
panelmode = true; panelmode = true;
} }
} }
int count2 = BufferIO::ReadInt8(pbuf); int count2 = BufferIO::ReadUInt8(pbuf);
for (int i = count1; i < count1 + count2; ++i) { for (int i = count1; i < count1 + count2; ++i) {
code = (unsigned int)BufferIO::ReadInt32(pbuf); code = (unsigned int)BufferIO::ReadInt32(pbuf);
c = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); c = mainGame->LocalPlayer(BufferIO::ReadUInt8(pbuf));
l = BufferIO::ReadInt8(pbuf); l = BufferIO::ReadUInt8(pbuf);
s = BufferIO::ReadInt8(pbuf); s = BufferIO::ReadUInt8(pbuf);
ss = BufferIO::ReadInt8(pbuf); ss = BufferIO::ReadUInt8(pbuf);
if ((l & LOCATION_OVERLAY) > 0) if ((l & LOCATION_OVERLAY) > 0)
pcard = mainGame->dField.GetCard(c, l & 0x7f, s)->overlayed[ss]; pcard = mainGame->dField.GetCard(c, l & 0x7f, s)->overlayed[ss];
else else
...@@ -1643,13 +1647,14 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) { ...@@ -1643,13 +1647,14 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
return false; return false;
} }
case MSG_SELECT_CHAIN: { case MSG_SELECT_CHAIN: {
/*int selecting_player = */BufferIO::ReadInt8(pbuf); /*int selecting_player = */BufferIO::ReadUInt8(pbuf);
int count = BufferIO::ReadInt8(pbuf); int count = BufferIO::ReadUInt8(pbuf);
int specount = BufferIO::ReadInt8(pbuf); int specount = BufferIO::ReadUInt8(pbuf);
int forced = BufferIO::ReadInt8(pbuf); int forced = BufferIO::ReadUInt8(pbuf);
/*int hint0 = */BufferIO::ReadInt32(pbuf); /*int hint0 = */BufferIO::ReadInt32(pbuf);
/*int hint1 = */BufferIO::ReadInt32(pbuf); /*int hint1 = */BufferIO::ReadInt32(pbuf);
int code, c, l, s, ss, desc; int c, s, ss, desc;
unsigned int code,l;
ClientCard* pcard; ClientCard* pcard;
bool panelmode = false; bool panelmode = false;
bool conti_exist = false; bool conti_exist = false;
...@@ -1659,12 +1664,12 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) { ...@@ -1659,12 +1664,12 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
mainGame->dField.activatable_descs.clear(); mainGame->dField.activatable_descs.clear();
mainGame->dField.conti_cards.clear(); mainGame->dField.conti_cards.clear();
for (int i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {
int flag = BufferIO::ReadInt8(pbuf); int flag = BufferIO::ReadUInt8(pbuf);
code = BufferIO::ReadInt32(pbuf); code = BufferIO::ReadInt32(pbuf);
c = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); c = mainGame->LocalPlayer(BufferIO::ReadUInt8(pbuf));
l = BufferIO::ReadInt8(pbuf); l = BufferIO::ReadUInt8(pbuf);
s = BufferIO::ReadInt8(pbuf); s = BufferIO::ReadUInt8(pbuf);
ss = BufferIO::ReadInt8(pbuf); ss = BufferIO::ReadUInt8(pbuf);
desc = BufferIO::ReadInt32(pbuf); desc = BufferIO::ReadInt32(pbuf);
pcard = mainGame->dField.GetCard(c, l, s, ss); pcard = mainGame->dField.GetCard(c, l, s, ss);
mainGame->dField.activatable_cards.push_back(pcard); mainGame->dField.activatable_cards.push_back(pcard);
...@@ -1739,8 +1744,8 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) { ...@@ -1739,8 +1744,8 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
} }
case MSG_SELECT_PLACE: case MSG_SELECT_PLACE:
case MSG_SELECT_DISFIELD: { case MSG_SELECT_DISFIELD: {
int selecting_player = BufferIO::ReadInt8(pbuf); int selecting_player = BufferIO::ReadUInt8(pbuf);
int count = BufferIO::ReadInt8(pbuf); int count = BufferIO::ReadUInt8(pbuf);
mainGame->dField.select_min = count > 0 ? count : 1; mainGame->dField.select_min = count > 0 ? count : 1;
mainGame->dField.select_ready = false; mainGame->dField.select_ready = false;
mainGame->dField.select_cancelable = count == 0; mainGame->dField.select_cancelable = count == 0;
...@@ -1824,9 +1829,9 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) { ...@@ -1824,9 +1829,9 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
return false; return false;
} }
case MSG_SELECT_POSITION: { case MSG_SELECT_POSITION: {
/*int selecting_player = */BufferIO::ReadInt8(pbuf); /*int selecting_player = */BufferIO::ReadUInt8(pbuf);
unsigned int code = (unsigned int)BufferIO::ReadInt32(pbuf); unsigned int code = (unsigned int)BufferIO::ReadInt32(pbuf);
int positions = BufferIO::ReadInt8(pbuf); unsigned int positions = BufferIO::ReadUInt8(pbuf);
if (positions == 0x1 || positions == 0x2 || positions == 0x4 || positions == 0x8) { if (positions == 0x1 || positions == 0x2 || positions == 0x4 || positions == 0x8) {
SetResponseI(positions); SetResponseI(positions);
return true; return true;
...@@ -1867,26 +1872,26 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) { ...@@ -1867,26 +1872,26 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
return false; return false;
} }
case MSG_SELECT_TRIBUTE: { case MSG_SELECT_TRIBUTE: {
/*int selecting_player = */BufferIO::ReadInt8(pbuf); /*int selecting_player = */BufferIO::ReadUInt8(pbuf);
mainGame->dField.select_cancelable = BufferIO::ReadInt8(pbuf) != 0; mainGame->dField.select_cancelable = BufferIO::ReadUInt8(pbuf) != 0;
mainGame->dField.select_min = BufferIO::ReadInt8(pbuf); mainGame->dField.select_min = BufferIO::ReadUInt8(pbuf);
mainGame->dField.select_max = BufferIO::ReadInt8(pbuf); mainGame->dField.select_max = BufferIO::ReadUInt8(pbuf);
int count = BufferIO::ReadInt8(pbuf); int count = BufferIO::ReadUInt8(pbuf);
mainGame->dField.selectable_cards.clear(); mainGame->dField.selectable_cards.clear();
mainGame->dField.selected_cards.clear(); mainGame->dField.selected_cards.clear();
mainGame->dField.selectsum_all.clear(); mainGame->dField.selectsum_all.clear();
mainGame->dField.selectsum_cards.clear(); mainGame->dField.selectsum_cards.clear();
mainGame->dField.select_panalmode = false; mainGame->dField.select_panalmode = false;
int c, l, s, t; int c, s, t;
unsigned int code; unsigned int code, l;
ClientCard* pcard; ClientCard* pcard;
mainGame->dField.select_ready = false; mainGame->dField.select_ready = false;
for (int i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {
code = (unsigned int)BufferIO::ReadInt32(pbuf); code = (unsigned int)BufferIO::ReadInt32(pbuf);
c = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); c = mainGame->LocalPlayer(BufferIO::ReadUInt8(pbuf));
l = BufferIO::ReadInt8(pbuf); l = BufferIO::ReadUInt8(pbuf);
s = BufferIO::ReadInt8(pbuf); s = BufferIO::ReadUInt8(pbuf);
t = BufferIO::ReadInt8(pbuf); t = BufferIO::ReadUInt8(pbuf);
pcard = mainGame->dField.GetCard(c, l, s); pcard = mainGame->dField.GetCard(c, l, s);
if (code && pcard->code != code) if (code && pcard->code != code)
pcard->SetCode(code); pcard->SetCode(code);
...@@ -1912,18 +1917,19 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) { ...@@ -1912,18 +1917,19 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
return false; return false;
} }
case MSG_SELECT_COUNTER: { case MSG_SELECT_COUNTER: {
/*int selecting_player = */BufferIO::ReadInt8(pbuf); /*int selecting_player = */BufferIO::ReadUInt8(pbuf);
mainGame->dField.select_counter_type = BufferIO::ReadInt16(pbuf); mainGame->dField.select_counter_type = BufferIO::ReadInt16(pbuf);
mainGame->dField.select_counter_count = BufferIO::ReadInt16(pbuf); mainGame->dField.select_counter_count = BufferIO::ReadInt16(pbuf);
int count = BufferIO::ReadInt8(pbuf); int count = BufferIO::ReadUInt8(pbuf);
mainGame->dField.selectable_cards.clear(); mainGame->dField.selectable_cards.clear();
int c, l, s, t/*, code*/; int c, s, t/*, code*/;
unsigned int l;
ClientCard* pcard; ClientCard* pcard;
for (int i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {
/*code = */BufferIO::ReadInt32(pbuf); /*code = */BufferIO::ReadInt32(pbuf);
c = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); c = mainGame->LocalPlayer(BufferIO::ReadUInt8(pbuf));
l = BufferIO::ReadInt8(pbuf); l = BufferIO::ReadUInt8(pbuf);
s = BufferIO::ReadInt8(pbuf); s = BufferIO::ReadUInt8(pbuf);
t = BufferIO::ReadInt16(pbuf); t = BufferIO::ReadInt16(pbuf);
pcard = mainGame->dField.GetCard(c, l, s); pcard = mainGame->dField.GetCard(c, l, s);
mainGame->dField.selectable_cards.push_back(pcard); mainGame->dField.selectable_cards.push_back(pcard);
...@@ -1938,21 +1944,21 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) { ...@@ -1938,21 +1944,21 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
return false; return false;
} }
case MSG_SELECT_SUM: { case MSG_SELECT_SUM: {
mainGame->dField.select_mode = BufferIO::ReadInt8(pbuf); mainGame->dField.select_mode = BufferIO::ReadUInt8(pbuf);
/*int selecting_player = */BufferIO::ReadInt8(pbuf); /*int selecting_player = */BufferIO::ReadUInt8(pbuf);
mainGame->dField.select_sumval = BufferIO::ReadInt32(pbuf); mainGame->dField.select_sumval = BufferIO::ReadInt32(pbuf);
mainGame->dField.select_min = BufferIO::ReadInt8(pbuf); mainGame->dField.select_min = BufferIO::ReadUInt8(pbuf);
mainGame->dField.select_max = BufferIO::ReadInt8(pbuf); mainGame->dField.select_max = BufferIO::ReadUInt8(pbuf);
mainGame->dField.must_select_count = BufferIO::ReadInt8(pbuf); mainGame->dField.must_select_count = BufferIO::ReadUInt8(pbuf);
mainGame->dField.selectsum_all.clear(); mainGame->dField.selectsum_all.clear();
mainGame->dField.selected_cards.clear(); mainGame->dField.selected_cards.clear();
mainGame->dField.selectsum_cards.clear(); mainGame->dField.selectsum_cards.clear();
mainGame->dField.select_panalmode = false; mainGame->dField.select_panalmode = false;
for (int i = 0; i < mainGame->dField.must_select_count; ++i) { for (int i = 0; i < mainGame->dField.must_select_count; ++i) {
unsigned int code = (unsigned int)BufferIO::ReadInt32(pbuf); unsigned int code = (unsigned int)BufferIO::ReadInt32(pbuf);
int c = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int c = mainGame->LocalPlayer(BufferIO::ReadUInt8(pbuf));
int l = BufferIO::ReadInt8(pbuf); unsigned int l = BufferIO::ReadUInt8(pbuf);
int s = BufferIO::ReadInt8(pbuf); int s = BufferIO::ReadUInt8(pbuf);
ClientCard* pcard = mainGame->dField.GetCard(c, l, s); ClientCard* pcard = mainGame->dField.GetCard(c, l, s);
if (code != 0 && pcard->code != code) if (code != 0 && pcard->code != code)
pcard->SetCode(code); pcard->SetCode(code);
...@@ -1960,12 +1966,12 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) { ...@@ -1960,12 +1966,12 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
pcard->select_seq = 0; pcard->select_seq = 0;
mainGame->dField.selected_cards.push_back(pcard); mainGame->dField.selected_cards.push_back(pcard);
} }
int count = BufferIO::ReadInt8(pbuf); int count = BufferIO::ReadUInt8(pbuf);
for (int i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {
unsigned int code = (unsigned int)BufferIO::ReadInt32(pbuf); unsigned int code = (unsigned int)BufferIO::ReadInt32(pbuf);
int c = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int c = mainGame->LocalPlayer(BufferIO::ReadUInt8(pbuf));
int l = BufferIO::ReadInt8(pbuf); unsigned int l = BufferIO::ReadUInt8(pbuf);
int s = BufferIO::ReadInt8(pbuf); int s = BufferIO::ReadUInt8(pbuf);
ClientCard* pcard = mainGame->dField.GetCard(c, l, s); ClientCard* pcard = mainGame->dField.GetCard(c, l, s);
if (code != 0 && pcard->code != code) if (code != 0 && pcard->code != code)
pcard->SetCode(code); pcard->SetCode(code);
...@@ -1989,19 +1995,19 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) { ...@@ -1989,19 +1995,19 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
return mainGame->dField.ShowSelectSum(mainGame->dField.select_panalmode); return mainGame->dField.ShowSelectSum(mainGame->dField.select_panalmode);
} }
case MSG_SORT_CARD: { case MSG_SORT_CARD: {
/*int player = */BufferIO::ReadInt8(pbuf); /*int player = */BufferIO::ReadUInt8(pbuf);
int count = BufferIO::ReadInt8(pbuf); int count = BufferIO::ReadUInt8(pbuf);
mainGame->dField.selectable_cards.clear(); mainGame->dField.selectable_cards.clear();
mainGame->dField.selected_cards.clear(); mainGame->dField.selected_cards.clear();
mainGame->dField.sort_list.clear(); mainGame->dField.sort_list.clear();
int c, l, s; int c, s;
unsigned int code; unsigned int code, l;
ClientCard* pcard; ClientCard* pcard;
for (int i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {
code = (unsigned int)BufferIO::ReadInt32(pbuf); code = (unsigned int)BufferIO::ReadInt32(pbuf);
c = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); c = mainGame->LocalPlayer(BufferIO::ReadUInt8(pbuf));
l = BufferIO::ReadInt8(pbuf); l = BufferIO::ReadUInt8(pbuf);
s = BufferIO::ReadInt8(pbuf); s = BufferIO::ReadUInt8(pbuf);
pcard = mainGame->dField.GetCard(c, l, s); pcard = mainGame->dField.GetCard(c, l, s);
if (code != 0 && pcard->code != code) if (code != 0 && pcard->code != code)
pcard->SetCode(code); pcard->SetCode(code);
...@@ -2015,9 +2021,9 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) { ...@@ -2015,9 +2021,9 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
return false; return false;
} }
case MSG_CONFIRM_DECKTOP: { case MSG_CONFIRM_DECKTOP: {
int player = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int player = mainGame->LocalPlayer(BufferIO::ReadUInt8(pbuf));
int count = BufferIO::ReadInt8(pbuf); int count = BufferIO::ReadUInt8(pbuf);
int code; unsigned int code;
ClientCard* pcard; ClientCard* pcard;
mainGame->dField.selectable_cards.clear(); mainGame->dField.selectable_cards.clear();
for (int i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {
...@@ -2053,9 +2059,9 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) { ...@@ -2053,9 +2059,9 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
return true; return true;
} }
case MSG_CONFIRM_EXTRATOP: { case MSG_CONFIRM_EXTRATOP: {
int player = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int player = mainGame->LocalPlayer(BufferIO::ReadUInt8(pbuf));
int count = BufferIO::ReadInt8(pbuf); int count = BufferIO::ReadUInt8(pbuf);
int code; unsigned int code;
ClientCard* pcard; ClientCard* pcard;
mainGame->dField.selectable_cards.clear(); mainGame->dField.selectable_cards.clear();
for (int i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {
...@@ -2090,9 +2096,10 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) { ...@@ -2090,9 +2096,10 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
return true; return true;
} }
case MSG_CONFIRM_CARDS: { case MSG_CONFIRM_CARDS: {
/*int player = */mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); /*int player = */mainGame->LocalPlayer(BufferIO::ReadUInt8(pbuf));
int count = BufferIO::ReadInt8(pbuf); int count = BufferIO::ReadUInt8(pbuf);
int code, c, l, s; int c, s;
unsigned int code, l;
std::vector<ClientCard*> field_confirm; std::vector<ClientCard*> field_confirm;
std::vector<ClientCard*> panel_confirm; std::vector<ClientCard*> panel_confirm;
ClientCard* pcard; ClientCard* pcard;
...@@ -2105,9 +2112,9 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) { ...@@ -2105,9 +2112,9 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
mainGame->AddLog(textBuffer); mainGame->AddLog(textBuffer);
for (int i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {
code = BufferIO::ReadInt32(pbuf); code = BufferIO::ReadInt32(pbuf);
c = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); c = mainGame->LocalPlayer(BufferIO::ReadUInt8(pbuf));
l = BufferIO::ReadInt8(pbuf); l = BufferIO::ReadUInt8(pbuf);
s = BufferIO::ReadInt8(pbuf); s = BufferIO::ReadUInt8(pbuf);
pcard = mainGame->dField.GetCard(c, l, s); pcard = mainGame->dField.GetCard(c, l, s);
if (code != 0) if (code != 0)
pcard->SetCode(code); pcard->SetCode(code);
...@@ -2190,7 +2197,7 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) { ...@@ -2190,7 +2197,7 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
return true; return true;
} }
case MSG_SHUFFLE_DECK: { case MSG_SHUFFLE_DECK: {
int player = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int player = mainGame->LocalPlayer(BufferIO::ReadUInt8(pbuf));
if(mainGame->dField.deck[player].size() < 2) if(mainGame->dField.deck[player].size() < 2)
return true; return true;
bool rev = mainGame->dField.deck_reversed; bool rev = mainGame->dField.deck_reversed;
...@@ -2229,8 +2236,8 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) { ...@@ -2229,8 +2236,8 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
return true; return true;
} }
case MSG_SHUFFLE_HAND: { case MSG_SHUFFLE_HAND: {
int player = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int player = mainGame->LocalPlayer(BufferIO::ReadUInt8(pbuf));
int count = BufferIO::ReadInt8(pbuf); int count = BufferIO::ReadUInt8(pbuf);
if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) { if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) {
if(count > 1) if(count > 1)
soundManager.PlaySoundEffect(SOUND_SHUFFLE); soundManager.PlaySoundEffect(SOUND_SHUFFLE);
...@@ -2272,8 +2279,8 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) { ...@@ -2272,8 +2279,8 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
return true; return true;
} }
case MSG_SHUFFLE_EXTRA: { case MSG_SHUFFLE_EXTRA: {
int player = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int player = mainGame->LocalPlayer(BufferIO::ReadUInt8(pbuf));
int count = BufferIO::ReadInt8(pbuf); int count = BufferIO::ReadUInt8(pbuf);
if((mainGame->dField.extra[player].size() - mainGame->dField.extra_p_count[player]) < 2) if((mainGame->dField.extra[player].size() - mainGame->dField.extra_p_count[player]) < 2)
return true; return true;
if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) { if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) {
...@@ -2301,11 +2308,11 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) { ...@@ -2301,11 +2308,11 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
return true; return true;
} }
case MSG_REFRESH_DECK: { case MSG_REFRESH_DECK: {
/*int player = */mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); /*int player = */mainGame->LocalPlayer(BufferIO::ReadUInt8(pbuf));
return true; return true;
} }
case MSG_SWAP_GRAVE_DECK: { case MSG_SWAP_GRAVE_DECK: {
int player = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int player = mainGame->LocalPlayer(BufferIO::ReadUInt8(pbuf));
if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping) { if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping) {
mainGame->dField.grave[player].swap(mainGame->dField.deck[player]); mainGame->dField.grave[player].swap(mainGame->dField.deck[player]);
for (auto cit = mainGame->dField.grave[player].begin(); cit != mainGame->dField.grave[player].end(); ++cit) for (auto cit = mainGame->dField.grave[player].begin(); cit != mainGame->dField.grave[player].end(); ++cit)
...@@ -2359,9 +2366,9 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) { ...@@ -2359,9 +2366,9 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
return true; return true;
} }
case MSG_DECK_TOP: { case MSG_DECK_TOP: {
int player = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int player = mainGame->LocalPlayer(BufferIO::ReadUInt8(pbuf));
int seq = BufferIO::ReadInt8(pbuf); int seq = BufferIO::ReadUInt8(pbuf);
unsigned int code = (unsigned int)BufferIO::ReadInt32(pbuf); unsigned int code = BufferIO::ReadInt32(pbuf);
ClientCard* pcard = mainGame->dField.GetCard(player, LOCATION_DECK, mainGame->dField.deck[player].size() - 1 - seq); ClientCard* pcard = mainGame->dField.GetCard(player, LOCATION_DECK, mainGame->dField.deck[player].size() - 1 - seq);
pcard->SetCode(code & 0x7fffffff); pcard->SetCode(code & 0x7fffffff);
bool rev = (code & 0x80000000) != 0; bool rev = (code & 0x80000000) != 0;
...@@ -2373,20 +2380,21 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) { ...@@ -2373,20 +2380,21 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
} }
case MSG_SHUFFLE_SET_CARD: { case MSG_SHUFFLE_SET_CARD: {
std::vector<ClientCard*>* lst = 0; std::vector<ClientCard*>* lst = 0;
int loc = BufferIO::ReadInt8(pbuf); unsigned int loc = BufferIO::ReadUInt8(pbuf);
int count = BufferIO::ReadInt8(pbuf); int count = BufferIO::ReadUInt8(pbuf);
if(loc == LOCATION_MZONE) if(loc == LOCATION_MZONE)
lst = mainGame->dField.mzone; lst = mainGame->dField.mzone;
else else
lst = mainGame->dField.szone; lst = mainGame->dField.szone;
ClientCard* mc[5]; ClientCard* mc[5]{ nullptr };
ClientCard* swp; ClientCard* swp;
int c, l, s, ps; int c, s, ps;
unsigned int l;
for (int i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {
c = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); c = mainGame->LocalPlayer(BufferIO::ReadUInt8(pbuf));
l = BufferIO::ReadInt8(pbuf); l = BufferIO::ReadUInt8(pbuf);
s = BufferIO::ReadInt8(pbuf); s = BufferIO::ReadUInt8(pbuf);
BufferIO::ReadInt8(pbuf); BufferIO::ReadUInt8(pbuf);
mc[i] = lst[c][s]; mc[i] = lst[c][s];
mc[i]->SetCode(0); mc[i]->SetCode(0);
if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) { if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) {
...@@ -2399,10 +2407,10 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) { ...@@ -2399,10 +2407,10 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping)
mainGame->WaitFrameSignal(20); mainGame->WaitFrameSignal(20);
for (int i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {
c = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); c = mainGame->LocalPlayer(BufferIO::ReadUInt8(pbuf));
l = BufferIO::ReadInt8(pbuf); l = BufferIO::ReadUInt8(pbuf);
s = BufferIO::ReadInt8(pbuf); s = BufferIO::ReadUInt8(pbuf);
BufferIO::ReadInt8(pbuf); BufferIO::ReadUInt8(pbuf);
ps = mc[i]->sequence; ps = mc[i]->sequence;
if (l > 0) { if (l > 0) {
swp = lst[c][s]; swp = lst[c][s];
...@@ -2424,7 +2432,7 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) { ...@@ -2424,7 +2432,7 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
return true; return true;
} }
case MSG_NEW_TURN: { case MSG_NEW_TURN: {
int player = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int player = mainGame->LocalPlayer(BufferIO::ReadUInt8(pbuf));
mainGame->dInfo.turn++; mainGame->dInfo.turn++;
if(!mainGame->dInfo.isTag && !mainGame->dInfo.isReplay && mainGame->dInfo.player_type < 7) { if(!mainGame->dInfo.isTag && !mainGame->dInfo.isReplay && mainGame->dInfo.player_type < 7) {
mainGame->btnLeaveGame->setText(dataManager.GetSysString(1351)); mainGame->btnLeaveGame->setText(dataManager.GetSysString(1351));
...@@ -2507,15 +2515,15 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) { ...@@ -2507,15 +2515,15 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
return true; return true;
} }
case MSG_MOVE: { case MSG_MOVE: {
unsigned int code = (unsigned int)BufferIO::ReadInt32(pbuf); unsigned int code = BufferIO::ReadInt32(pbuf);
int pc = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int pc = mainGame->LocalPlayer(BufferIO::ReadUInt8(pbuf));
int pl = BufferIO::ReadUInt8(pbuf); unsigned int pl = BufferIO::ReadUInt8(pbuf);
int ps = BufferIO::ReadInt8(pbuf); int ps = BufferIO::ReadUInt8(pbuf);
int pp = BufferIO::ReadInt8(pbuf); unsigned int pp = BufferIO::ReadUInt8(pbuf);
int cc = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int cc = mainGame->LocalPlayer(BufferIO::ReadUInt8(pbuf));
int cl = BufferIO::ReadUInt8(pbuf); unsigned int cl = BufferIO::ReadUInt8(pbuf);
int cs = BufferIO::ReadInt8(pbuf); int cs = BufferIO::ReadUInt8(pbuf);
int cp = BufferIO::ReadInt8(pbuf); unsigned int cp = BufferIO::ReadUInt8(pbuf);
int reason = BufferIO::ReadInt32(pbuf); int reason = BufferIO::ReadInt32(pbuf);
if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) { if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) {
if(cl & LOCATION_REMOVED && pl != cl) if(cl & LOCATION_REMOVED && pl != cl)
...@@ -2723,12 +2731,12 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) { ...@@ -2723,12 +2731,12 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
return true; return true;
} }
case MSG_POS_CHANGE: { case MSG_POS_CHANGE: {
unsigned int code = (unsigned int)BufferIO::ReadInt32(pbuf); unsigned int code = BufferIO::ReadInt32(pbuf);
int cc = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int cc = mainGame->LocalPlayer(BufferIO::ReadUInt8(pbuf));
int cl = BufferIO::ReadInt8(pbuf); unsigned int cl = BufferIO::ReadUInt8(pbuf);
int cs = BufferIO::ReadInt8(pbuf); int cs = BufferIO::ReadUInt8(pbuf);
int pp = BufferIO::ReadInt8(pbuf); unsigned int pp = BufferIO::ReadUInt8(pbuf);
int cp = BufferIO::ReadInt8(pbuf); unsigned int cp = BufferIO::ReadUInt8(pbuf);
ClientCard* pcard = mainGame->dField.GetCard(cc, cl, cs); ClientCard* pcard = mainGame->dField.GetCard(cc, cl, cs);
if((pp & POS_FACEUP) && (cp & POS_FACEDOWN)) { if((pp & POS_FACEUP) && (cp & POS_FACEDOWN)) {
pcard->counters.clear(); pcard->counters.clear();
...@@ -2746,10 +2754,10 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) { ...@@ -2746,10 +2754,10 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
} }
case MSG_SET: { case MSG_SET: {
/*int code = */BufferIO::ReadInt32(pbuf); /*int code = */BufferIO::ReadInt32(pbuf);
/*int cc = mainGame->LocalPlayer*/(BufferIO::ReadInt8(pbuf)); /*int cc = mainGame->LocalPlayer*/(BufferIO::ReadUInt8(pbuf));
/*int cl = */BufferIO::ReadInt8(pbuf); /*int cl = */BufferIO::ReadUInt8(pbuf);
/*int cs = */BufferIO::ReadInt8(pbuf); /*int cs = */BufferIO::ReadUInt8(pbuf);
/*int cp = */BufferIO::ReadInt8(pbuf); /*int cp = */BufferIO::ReadUInt8(pbuf);
if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping)
soundManager.PlaySoundEffect(SOUND_SET); soundManager.PlaySoundEffect(SOUND_SET);
myswprintf(event_string, dataManager.GetSysString(1601)); myswprintf(event_string, dataManager.GetSysString(1601));
...@@ -2757,15 +2765,15 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) { ...@@ -2757,15 +2765,15 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
} }
case MSG_SWAP: { case MSG_SWAP: {
/*int code1 = */BufferIO::ReadInt32(pbuf); /*int code1 = */BufferIO::ReadInt32(pbuf);
int c1 = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int c1 = mainGame->LocalPlayer(BufferIO::ReadUInt8(pbuf));
int l1 = BufferIO::ReadInt8(pbuf); unsigned int l1 = BufferIO::ReadUInt8(pbuf);
int s1 = BufferIO::ReadInt8(pbuf); int s1 = BufferIO::ReadUInt8(pbuf);
/*int p1 = */BufferIO::ReadInt8(pbuf); /*int p1 = */BufferIO::ReadUInt8(pbuf);
/*int code2 = */BufferIO::ReadInt32(pbuf); /*int code2 = */BufferIO::ReadInt32(pbuf);
int c2 = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int c2 = mainGame->LocalPlayer(BufferIO::ReadUInt8(pbuf));
int l2 = BufferIO::ReadInt8(pbuf); unsigned int l2 = BufferIO::ReadUInt8(pbuf);
int s2 = BufferIO::ReadInt8(pbuf); int s2 = BufferIO::ReadUInt8(pbuf);
/*int p2 = */BufferIO::ReadInt8(pbuf); /*int p2 = */BufferIO::ReadUInt8(pbuf);
myswprintf(event_string, dataManager.GetSysString(1602)); myswprintf(event_string, dataManager.GetSysString(1602));
ClientCard* pc1 = mainGame->dField.GetCard(c1, l1, s1); ClientCard* pc1 = mainGame->dField.GetCard(c1, l1, s1);
ClientCard* pc2 = mainGame->dField.GetCard(c2, l2, s2); ClientCard* pc2 = mainGame->dField.GetCard(c2, l2, s2);
...@@ -2799,11 +2807,11 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) { ...@@ -2799,11 +2807,11 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
return true; return true;
} }
case MSG_SUMMONING: { case MSG_SUMMONING: {
unsigned int code = (unsigned int)BufferIO::ReadInt32(pbuf); unsigned int code = BufferIO::ReadInt32(pbuf);
/*int cc = */mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); /*int cc = */mainGame->LocalPlayer(BufferIO::ReadUInt8(pbuf));
/*int cl = */BufferIO::ReadInt8(pbuf); /*int cl = */BufferIO::ReadUInt8(pbuf);
/*int cs = */BufferIO::ReadInt8(pbuf); /*int cs = */BufferIO::ReadUInt8(pbuf);
/*int cp = */BufferIO::ReadInt8(pbuf); /*int cp = */BufferIO::ReadUInt8(pbuf);
if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) { if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) {
soundManager.PlaySoundEffect(SOUND_SUMMON); soundManager.PlaySoundEffect(SOUND_SUMMON);
myswprintf(event_string, dataManager.GetSysString(1603), dataManager.GetName(code)); myswprintf(event_string, dataManager.GetSysString(1603), dataManager.GetName(code));
...@@ -2822,11 +2830,11 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) { ...@@ -2822,11 +2830,11 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
return true; return true;
} }
case MSG_SPSUMMONING: { case MSG_SPSUMMONING: {
unsigned int code = (unsigned int)BufferIO::ReadInt32(pbuf); unsigned int code = BufferIO::ReadInt32(pbuf);
/*int cc = */mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); /*int cc = */mainGame->LocalPlayer(BufferIO::ReadUInt8(pbuf));
/*int cl = */BufferIO::ReadInt8(pbuf); /*int cl = */BufferIO::ReadUInt8(pbuf);
/*int cs = */BufferIO::ReadInt8(pbuf); /*int cs = */BufferIO::ReadUInt8(pbuf);
/*int cp = */BufferIO::ReadInt8(pbuf); /*int cp = */BufferIO::ReadUInt8(pbuf);
if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) { if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) {
CardData cd; CardData cd;
if(dataManager.GetData(code, &cd) && (cd.type & TYPE_TOKEN)) if(dataManager.GetData(code, &cd) && (cd.type & TYPE_TOKEN))
...@@ -2848,11 +2856,11 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) { ...@@ -2848,11 +2856,11 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
return true; return true;
} }
case MSG_FLIPSUMMONING: { case MSG_FLIPSUMMONING: {
unsigned int code = (unsigned int)BufferIO::ReadInt32(pbuf); unsigned int code = BufferIO::ReadInt32(pbuf);
int cc = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int cc = mainGame->LocalPlayer(BufferIO::ReadUInt8(pbuf));
int cl = BufferIO::ReadInt8(pbuf); unsigned int cl = BufferIO::ReadUInt8(pbuf);
int cs = BufferIO::ReadInt8(pbuf); int cs = BufferIO::ReadUInt8(pbuf);
int cp = BufferIO::ReadInt8(pbuf); unsigned int cp = BufferIO::ReadUInt8(pbuf);
ClientCard* pcard = mainGame->dField.GetCard(cc, cl, cs); ClientCard* pcard = mainGame->dField.GetCard(cc, cl, cs);
pcard->SetCode(code); pcard->SetCode(code);
pcard->position = cp; pcard->position = cp;
...@@ -2876,16 +2884,16 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) { ...@@ -2876,16 +2884,16 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
return true; return true;
} }
case MSG_CHAINING: { case MSG_CHAINING: {
unsigned int code = (unsigned int)BufferIO::ReadInt32(pbuf); unsigned int code = BufferIO::ReadInt32(pbuf);
int pcc = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int pcc = mainGame->LocalPlayer(BufferIO::ReadUInt8(pbuf));
int pcl = BufferIO::ReadInt8(pbuf); unsigned int pcl = BufferIO::ReadUInt8(pbuf);
int pcs = BufferIO::ReadInt8(pbuf); int pcs = BufferIO::ReadUInt8(pbuf);
int subs = BufferIO::ReadInt8(pbuf); int subs = BufferIO::ReadUInt8(pbuf);
int cc = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int cc = mainGame->LocalPlayer(BufferIO::ReadUInt8(pbuf));
int cl = BufferIO::ReadInt8(pbuf); unsigned int cl = BufferIO::ReadUInt8(pbuf);
int cs = BufferIO::ReadInt8(pbuf); int cs = BufferIO::ReadUInt8(pbuf);
int desc = BufferIO::ReadInt32(pbuf); int desc = BufferIO::ReadInt32(pbuf);
/*int ct = */BufferIO::ReadInt8(pbuf); /*int ct = */BufferIO::ReadUInt8(pbuf);
if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping) if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping)
return true; return true;
soundManager.PlaySoundEffect(SOUND_ACTIVATE); soundManager.PlaySoundEffect(SOUND_ACTIVATE);
...@@ -2936,7 +2944,7 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) { ...@@ -2936,7 +2944,7 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
return true; return true;
} }
case MSG_CHAINED: { case MSG_CHAINED: {
int ct = BufferIO::ReadInt8(pbuf); int ct = BufferIO::ReadUInt8(pbuf);
if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping) if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping)
return true; return true;
myswprintf(event_string, dataManager.GetSysString(1609), dataManager.GetName(mainGame->dField.current_chain.code)); myswprintf(event_string, dataManager.GetSysString(1609), dataManager.GetName(mainGame->dField.current_chain.code));
...@@ -2949,7 +2957,7 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) { ...@@ -2949,7 +2957,7 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
return true; return true;
} }
case MSG_CHAIN_SOLVING: { case MSG_CHAIN_SOLVING: {
int ct = BufferIO::ReadInt8(pbuf); int ct = BufferIO::ReadUInt8(pbuf);
if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping) if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping)
return true; return true;
if(mainGame->dField.chains.size() > 1 || mainGame->gameConf.draw_single_chain) { if(mainGame->dField.chains.size() > 1 || mainGame->gameConf.draw_single_chain) {
...@@ -2966,7 +2974,7 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) { ...@@ -2966,7 +2974,7 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
return true; return true;
} }
case MSG_CHAIN_SOLVED: { case MSG_CHAIN_SOLVED: {
/*int ct = */BufferIO::ReadInt8(pbuf); /*int ct = */BufferIO::ReadUInt8(pbuf);
return true; return true;
} }
case MSG_CHAIN_END: { case MSG_CHAIN_END: {
...@@ -2980,7 +2988,7 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) { ...@@ -2980,7 +2988,7 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
} }
case MSG_CHAIN_NEGATED: case MSG_CHAIN_NEGATED:
case MSG_CHAIN_DISABLED: { case MSG_CHAIN_DISABLED: {
int ct = BufferIO::ReadInt8(pbuf); int ct = BufferIO::ReadUInt8(pbuf);
if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) { if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) {
mainGame->showcardcode = mainGame->dField.chains[ct - 1].code; mainGame->showcardcode = mainGame->dField.chains[ct - 1].code;
mainGame->showcarddif = 0; mainGame->showcarddif = 0;
...@@ -2994,8 +3002,8 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) { ...@@ -2994,8 +3002,8 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
return true; return true;
} }
case MSG_RANDOM_SELECTED: { case MSG_RANDOM_SELECTED: {
/*int player = */BufferIO::ReadInt8(pbuf); /*int player = */BufferIO::ReadUInt8(pbuf);
int count = BufferIO::ReadInt8(pbuf); int count = BufferIO::ReadUInt8(pbuf);
if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping) { if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping) {
pbuf += count * 4; pbuf += count * 4;
return true; return true;
...@@ -3003,10 +3011,10 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) { ...@@ -3003,10 +3011,10 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
soundManager.PlaySoundEffect(SOUND_DICE); soundManager.PlaySoundEffect(SOUND_DICE);
ClientCard* pcards[10]; ClientCard* pcards[10];
for (int i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {
int c = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int c = mainGame->LocalPlayer(BufferIO::ReadUInt8(pbuf));
int l = BufferIO::ReadInt8(pbuf); unsigned int l = BufferIO::ReadUInt8(pbuf);
int s = BufferIO::ReadInt8(pbuf); int s = BufferIO::ReadUInt8(pbuf);
int ss = BufferIO::ReadInt8(pbuf); int ss = BufferIO::ReadUInt8(pbuf);
if ((l & LOCATION_OVERLAY) > 0) if ((l & LOCATION_OVERLAY) > 0)
pcards[i] = mainGame->dField.GetCard(c, l & 0x7f, s)->overlayed[ss]; pcards[i] = mainGame->dField.GetCard(c, l & 0x7f, s)->overlayed[ss];
else else
...@@ -3020,16 +3028,16 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) { ...@@ -3020,16 +3028,16 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
} }
case MSG_BECOME_TARGET: { case MSG_BECOME_TARGET: {
//soundManager.PlaySoundEffect(SOUND_TARGET); //soundManager.PlaySoundEffect(SOUND_TARGET);
int count = BufferIO::ReadInt8(pbuf); int count = BufferIO::ReadUInt8(pbuf);
if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping) { if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping) {
pbuf += count * 4; pbuf += count * 4;
return true; return true;
} }
for (int i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {
int c = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int c = mainGame->LocalPlayer(BufferIO::ReadUInt8(pbuf));
int l = BufferIO::ReadInt8(pbuf); unsigned int l = BufferIO::ReadUInt8(pbuf);
int s = BufferIO::ReadInt8(pbuf); int s = BufferIO::ReadUInt8(pbuf);
/*int ss = */BufferIO::ReadInt8(pbuf); /*int ss = */BufferIO::ReadUInt8(pbuf);
ClientCard* pcard = mainGame->dField.GetCard(c, l, s); ClientCard* pcard = mainGame->dField.GetCard(c, l, s);
pcard->is_highlighting = true; pcard->is_highlighting = true;
mainGame->dField.current_chain.target.insert(pcard); mainGame->dField.current_chain.target.insert(pcard);
...@@ -3058,11 +3066,11 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) { ...@@ -3058,11 +3066,11 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
return true; return true;
} }
case MSG_DRAW: { case MSG_DRAW: {
int player = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int player = mainGame->LocalPlayer(BufferIO::ReadUInt8(pbuf));
int count = BufferIO::ReadInt8(pbuf); int count = BufferIO::ReadUInt8(pbuf);
ClientCard* pcard; ClientCard* pcard;
for (int i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {
unsigned int code = (unsigned int)BufferIO::ReadInt32(pbuf); unsigned int code = BufferIO::ReadInt32(pbuf);
pcard = mainGame->dField.GetCard(player, LOCATION_DECK, mainGame->dField.deck[player].size() - 1 - i); pcard = mainGame->dField.GetCard(player, LOCATION_DECK, mainGame->dField.deck[player].size() - 1 - i);
if(!mainGame->dField.deck_reversed || code) if(!mainGame->dField.deck_reversed || code)
pcard->SetCode(code & 0x7fffffff); pcard->SetCode(code & 0x7fffffff);
...@@ -3092,7 +3100,7 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) { ...@@ -3092,7 +3100,7 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
return true; return true;
} }
case MSG_DAMAGE: { case MSG_DAMAGE: {
int player = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int player = mainGame->LocalPlayer(BufferIO::ReadUInt8(pbuf));
int val = BufferIO::ReadInt32(pbuf); int val = BufferIO::ReadInt32(pbuf);
int final = mainGame->dInfo.lp[player] - val; int final = mainGame->dInfo.lp[player] - val;
if (final < 0) if (final < 0)
...@@ -3123,7 +3131,7 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) { ...@@ -3123,7 +3131,7 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
return true; return true;
} }
case MSG_RECOVER: { case MSG_RECOVER: {
int player = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int player = mainGame->LocalPlayer(BufferIO::ReadUInt8(pbuf));
int val = BufferIO::ReadInt32(pbuf); int val = BufferIO::ReadInt32(pbuf);
int final = mainGame->dInfo.lp[player] + val; int final = mainGame->dInfo.lp[player] + val;
if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping) { if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping) {
...@@ -3152,14 +3160,14 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) { ...@@ -3152,14 +3160,14 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
return true; return true;
} }
case MSG_EQUIP: { case MSG_EQUIP: {
int c1 = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int c1 = mainGame->LocalPlayer(BufferIO::ReadUInt8(pbuf));
int l1 = BufferIO::ReadInt8(pbuf); unsigned int l1 = BufferIO::ReadUInt8(pbuf);
int s1 = BufferIO::ReadInt8(pbuf); int s1 = BufferIO::ReadUInt8(pbuf);
BufferIO::ReadInt8(pbuf); BufferIO::ReadUInt8(pbuf);
int c2 = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int c2 = mainGame->LocalPlayer(BufferIO::ReadUInt8(pbuf));
int l2 = BufferIO::ReadInt8(pbuf); unsigned int l2 = BufferIO::ReadUInt8(pbuf);
int s2 = BufferIO::ReadInt8(pbuf); int s2 = BufferIO::ReadUInt8(pbuf);
BufferIO::ReadInt8(pbuf); BufferIO::ReadUInt8(pbuf);
ClientCard* pc1 = mainGame->dField.GetCard(c1, l1, s1); ClientCard* pc1 = mainGame->dField.GetCard(c1, l1, s1);
ClientCard* pc2 = mainGame->dField.GetCard(c2, l2, s2); ClientCard* pc2 = mainGame->dField.GetCard(c2, l2, s2);
if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping) { if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping) {
...@@ -3186,7 +3194,7 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) { ...@@ -3186,7 +3194,7 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
return true; return true;
} }
case MSG_LPUPDATE: { case MSG_LPUPDATE: {
int player = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int player = mainGame->LocalPlayer(BufferIO::ReadUInt8(pbuf));
int val = BufferIO::ReadInt32(pbuf); int val = BufferIO::ReadInt32(pbuf);
if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping) { if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping) {
mainGame->dInfo.lp[player] = val; mainGame->dInfo.lp[player] = val;
...@@ -3204,10 +3212,10 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) { ...@@ -3204,10 +3212,10 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
return true; return true;
} }
case MSG_UNEQUIP: { case MSG_UNEQUIP: {
int c1 = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int c1 = mainGame->LocalPlayer(BufferIO::ReadUInt8(pbuf));
int l1 = BufferIO::ReadInt8(pbuf); unsigned int l1 = BufferIO::ReadUInt8(pbuf);
int s1 = BufferIO::ReadInt8(pbuf); int s1 = BufferIO::ReadUInt8(pbuf);
BufferIO::ReadInt8(pbuf); BufferIO::ReadUInt8(pbuf);
ClientCard* pc = mainGame->dField.GetCard(c1, l1, s1); ClientCard* pc = mainGame->dField.GetCard(c1, l1, s1);
if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping) { if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping) {
pc->equipTarget->equipped.erase(pc); pc->equipTarget->equipped.erase(pc);
...@@ -3225,14 +3233,14 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) { ...@@ -3225,14 +3233,14 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
return true; return true;
} }
case MSG_CARD_TARGET: { case MSG_CARD_TARGET: {
int c1 = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int c1 = mainGame->LocalPlayer(BufferIO::ReadUInt8(pbuf));
int l1 = BufferIO::ReadInt8(pbuf); unsigned int l1 = BufferIO::ReadUInt8(pbuf);
int s1 = BufferIO::ReadInt8(pbuf); int s1 = BufferIO::ReadUInt8(pbuf);
BufferIO::ReadInt8(pbuf); BufferIO::ReadUInt8(pbuf);
int c2 = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int c2 = mainGame->LocalPlayer(BufferIO::ReadUInt8(pbuf));
int l2 = BufferIO::ReadInt8(pbuf); unsigned int l2 = BufferIO::ReadUInt8(pbuf);
int s2 = BufferIO::ReadInt8(pbuf); int s2 = BufferIO::ReadUInt8(pbuf);
BufferIO::ReadInt8(pbuf); BufferIO::ReadUInt8(pbuf);
ClientCard* pc1 = mainGame->dField.GetCard(c1, l1, s1); ClientCard* pc1 = mainGame->dField.GetCard(c1, l1, s1);
ClientCard* pc2 = mainGame->dField.GetCard(c2, l2, s2); ClientCard* pc2 = mainGame->dField.GetCard(c2, l2, s2);
if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping) { if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping) {
...@@ -3251,14 +3259,14 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) { ...@@ -3251,14 +3259,14 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
break; break;
} }
case MSG_CANCEL_TARGET: { case MSG_CANCEL_TARGET: {
int c1 = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int c1 = mainGame->LocalPlayer(BufferIO::ReadUInt8(pbuf));
int l1 = BufferIO::ReadInt8(pbuf); unsigned int l1 = BufferIO::ReadUInt8(pbuf);
int s1 = BufferIO::ReadInt8(pbuf); int s1 = BufferIO::ReadUInt8(pbuf);
BufferIO::ReadInt8(pbuf); BufferIO::ReadUInt8(pbuf);
int c2 = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int c2 = mainGame->LocalPlayer(BufferIO::ReadUInt8(pbuf));
int l2 = BufferIO::ReadInt8(pbuf); unsigned int l2 = BufferIO::ReadUInt8(pbuf);
int s2 = BufferIO::ReadInt8(pbuf); int s2 = BufferIO::ReadUInt8(pbuf);
BufferIO::ReadInt8(pbuf); BufferIO::ReadUInt8(pbuf);
ClientCard* pc1 = mainGame->dField.GetCard(c1, l1, s1); ClientCard* pc1 = mainGame->dField.GetCard(c1, l1, s1);
ClientCard* pc2 = mainGame->dField.GetCard(c2, l2, s2); ClientCard* pc2 = mainGame->dField.GetCard(c2, l2, s2);
if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping) { if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping) {
...@@ -3277,7 +3285,7 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) { ...@@ -3277,7 +3285,7 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
break; break;
} }
case MSG_PAY_LPCOST: { case MSG_PAY_LPCOST: {
int player = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int player = mainGame->LocalPlayer(BufferIO::ReadUInt8(pbuf));
int cost = BufferIO::ReadInt32(pbuf); int cost = BufferIO::ReadInt32(pbuf);
int final = mainGame->dInfo.lp[player] - cost; int final = mainGame->dInfo.lp[player] - cost;
if (final < 0) if (final < 0)
...@@ -3305,9 +3313,9 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) { ...@@ -3305,9 +3313,9 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
} }
case MSG_ADD_COUNTER: { case MSG_ADD_COUNTER: {
int type = BufferIO::ReadInt16(pbuf); int type = BufferIO::ReadInt16(pbuf);
int c = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int c = mainGame->LocalPlayer(BufferIO::ReadUInt8(pbuf));
int l = BufferIO::ReadInt8(pbuf); unsigned int l = BufferIO::ReadUInt8(pbuf);
int s = BufferIO::ReadInt8(pbuf); int s = BufferIO::ReadUInt8(pbuf);
int count = BufferIO::ReadInt16(pbuf); int count = BufferIO::ReadInt16(pbuf);
ClientCard* pc = mainGame->dField.GetCard(c, l, s); ClientCard* pc = mainGame->dField.GetCard(c, l, s);
if (pc->counters.count(type)) if (pc->counters.count(type))
...@@ -3328,9 +3336,9 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) { ...@@ -3328,9 +3336,9 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
} }
case MSG_REMOVE_COUNTER: { case MSG_REMOVE_COUNTER: {
int type = BufferIO::ReadInt16(pbuf); int type = BufferIO::ReadInt16(pbuf);
int c = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int c = mainGame->LocalPlayer(BufferIO::ReadUInt8(pbuf));
int l = BufferIO::ReadInt8(pbuf); unsigned int l = BufferIO::ReadUInt8(pbuf);
int s = BufferIO::ReadInt8(pbuf); int s = BufferIO::ReadUInt8(pbuf);
int count = BufferIO::ReadInt16(pbuf); int count = BufferIO::ReadInt16(pbuf);
ClientCard* pc = mainGame->dField.GetCard(c, l, s); ClientCard* pc = mainGame->dField.GetCard(c, l, s);
pc->counters[type] -= count; pc->counters[type] -= count;
...@@ -3350,15 +3358,15 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) { ...@@ -3350,15 +3358,15 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
return true; return true;
} }
case MSG_ATTACK: { case MSG_ATTACK: {
int ca = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int ca = mainGame->LocalPlayer(BufferIO::ReadUInt8(pbuf));
int la = BufferIO::ReadInt8(pbuf); unsigned int la = BufferIO::ReadUInt8(pbuf);
int sa = BufferIO::ReadInt8(pbuf); int sa = BufferIO::ReadUInt8(pbuf);
BufferIO::ReadInt8(pbuf); BufferIO::ReadUInt8(pbuf);
mainGame->dField.attacker = mainGame->dField.GetCard(ca, la, sa); mainGame->dField.attacker = mainGame->dField.GetCard(ca, la, sa);
int cd = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int cd = mainGame->LocalPlayer(BufferIO::ReadUInt8(pbuf));
int ld = BufferIO::ReadInt8(pbuf); unsigned int ld = BufferIO::ReadUInt8(pbuf);
int sd = BufferIO::ReadInt8(pbuf); int sd = BufferIO::ReadUInt8(pbuf);
BufferIO::ReadInt8(pbuf); BufferIO::ReadUInt8(pbuf);
if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping) if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping)
return true; return true;
float sy; float sy;
...@@ -3401,20 +3409,20 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) { ...@@ -3401,20 +3409,20 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
return true; return true;
} }
case MSG_BATTLE: { case MSG_BATTLE: {
int ca = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int ca = mainGame->LocalPlayer(BufferIO::ReadUInt8(pbuf));
int la = BufferIO::ReadInt8(pbuf); unsigned int la = BufferIO::ReadUInt8(pbuf);
int sa = BufferIO::ReadInt8(pbuf); int sa = BufferIO::ReadUInt8(pbuf);
BufferIO::ReadInt8(pbuf); BufferIO::ReadUInt8(pbuf);
int aatk = BufferIO::ReadInt32(pbuf); int aatk = BufferIO::ReadInt32(pbuf);
int adef = BufferIO::ReadInt32(pbuf); int adef = BufferIO::ReadInt32(pbuf);
/*int da = */BufferIO::ReadInt8(pbuf); /*int da = */BufferIO::ReadUInt8(pbuf);
int cd = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int cd = mainGame->LocalPlayer(BufferIO::ReadUInt8(pbuf));
int ld = BufferIO::ReadInt8(pbuf); unsigned int ld = BufferIO::ReadUInt8(pbuf);
int sd = BufferIO::ReadInt8(pbuf); int sd = BufferIO::ReadUInt8(pbuf);
BufferIO::ReadInt8(pbuf); BufferIO::ReadUInt8(pbuf);
int datk = BufferIO::ReadInt32(pbuf); int datk = BufferIO::ReadInt32(pbuf);
int ddef = BufferIO::ReadInt32(pbuf); int ddef = BufferIO::ReadInt32(pbuf);
/*int dd = */BufferIO::ReadInt8(pbuf); /*int dd = */BufferIO::ReadUInt8(pbuf);
if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping) if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping)
return true; return true;
mainGame->gMutex.lock(); mainGame->gMutex.lock();
...@@ -3453,18 +3461,18 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) { ...@@ -3453,18 +3461,18 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
} }
case MSG_MISSED_EFFECT: { case MSG_MISSED_EFFECT: {
BufferIO::ReadInt32(pbuf); BufferIO::ReadInt32(pbuf);
unsigned int code = (unsigned int)BufferIO::ReadInt32(pbuf); unsigned int code = BufferIO::ReadInt32(pbuf);
myswprintf(textBuffer, dataManager.GetSysString(1622), dataManager.GetName(code)); myswprintf(textBuffer, dataManager.GetSysString(1622), dataManager.GetName(code));
mainGame->AddLog(textBuffer, code); mainGame->AddLog(textBuffer, code);
return true; return true;
} }
case MSG_TOSS_COIN: { case MSG_TOSS_COIN: {
/*int player = */mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); /*int player = */mainGame->LocalPlayer(BufferIO::ReadUInt8(pbuf));
int count = BufferIO::ReadInt8(pbuf); int count = BufferIO::ReadUInt8(pbuf);
wchar_t* pwbuf = textBuffer; wchar_t* pwbuf = textBuffer;
BufferIO::CopyWStrRef(dataManager.GetSysString(1623), pwbuf, 256); BufferIO::CopyWStrRef(dataManager.GetSysString(1623), pwbuf, 256);
for (int i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {
int res = BufferIO::ReadInt8(pbuf); int res = BufferIO::ReadUInt8(pbuf);
*pwbuf++ = L'['; *pwbuf++ = L'[';
BufferIO::CopyWStrRef(dataManager.GetSysString(res ? 60 : 61), pwbuf, 256); BufferIO::CopyWStrRef(dataManager.GetSysString(res ? 60 : 61), pwbuf, 256);
*pwbuf++ = L']'; *pwbuf++ = L']';
...@@ -3482,12 +3490,12 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) { ...@@ -3482,12 +3490,12 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
return true; return true;
} }
case MSG_TOSS_DICE: { case MSG_TOSS_DICE: {
/*int player = */mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); /*int player = */mainGame->LocalPlayer(BufferIO::ReadUInt8(pbuf));
int count = BufferIO::ReadInt8(pbuf); int count = BufferIO::ReadUInt8(pbuf);
wchar_t* pwbuf = textBuffer; wchar_t* pwbuf = textBuffer;
BufferIO::CopyWStrRef(dataManager.GetSysString(1624), pwbuf, 256); BufferIO::CopyWStrRef(dataManager.GetSysString(1624), pwbuf, 256);
for (int i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {
int res = BufferIO::ReadInt8(pbuf); int res = BufferIO::ReadUInt8(pbuf);
*pwbuf++ = L'['; *pwbuf++ = L'[';
*pwbuf++ = L'0' + res; *pwbuf++ = L'0' + res;
*pwbuf++ = L']'; *pwbuf++ = L']';
...@@ -3505,7 +3513,7 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) { ...@@ -3505,7 +3513,7 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
return true; return true;
} }
case MSG_ROCK_PAPER_SCISSORS: { case MSG_ROCK_PAPER_SCISSORS: {
/*int player = */mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); /*int player = */mainGame->LocalPlayer(BufferIO::ReadUInt8(pbuf));
if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping) if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping)
return true; return true;
mainGame->gMutex.lock(); mainGame->gMutex.lock();
...@@ -3514,7 +3522,7 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) { ...@@ -3514,7 +3522,7 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
return false; return false;
} }
case MSG_HAND_RES: { case MSG_HAND_RES: {
int res = BufferIO::ReadInt8(pbuf); int res = BufferIO::ReadUInt8(pbuf);
if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping) if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping)
return true; return true;
mainGame->stHintMsg->setVisible(false); mainGame->stHintMsg->setVisible(false);
...@@ -3531,8 +3539,8 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) { ...@@ -3531,8 +3539,8 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
return false; return false;
} }
case MSG_ANNOUNCE_RACE: { case MSG_ANNOUNCE_RACE: {
/*int player = */mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); /*int player = */mainGame->LocalPlayer(BufferIO::ReadUInt8(pbuf));
mainGame->dField.announce_count = BufferIO::ReadInt8(pbuf); mainGame->dField.announce_count = BufferIO::ReadUInt8(pbuf);
int available = BufferIO::ReadInt32(pbuf); int available = BufferIO::ReadInt32(pbuf);
for(int i = 0, filter = 0x1; i < RACES_COUNT; ++i, filter <<= 1) { for(int i = 0, filter = 0x1; i < RACES_COUNT; ++i, filter <<= 1) {
mainGame->chkRace[i]->setChecked(false); mainGame->chkRace[i]->setChecked(false);
...@@ -3551,8 +3559,8 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) { ...@@ -3551,8 +3559,8 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
return false; return false;
} }
case MSG_ANNOUNCE_ATTRIB: { case MSG_ANNOUNCE_ATTRIB: {
/*int player = */mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); /*int player = */mainGame->LocalPlayer(BufferIO::ReadUInt8(pbuf));
mainGame->dField.announce_count = BufferIO::ReadInt8(pbuf); mainGame->dField.announce_count = BufferIO::ReadUInt8(pbuf);
int available = BufferIO::ReadInt32(pbuf); int available = BufferIO::ReadInt32(pbuf);
for(int i = 0, filter = 0x1; i < 7; ++i, filter <<= 1) { for(int i = 0, filter = 0x1; i < 7; ++i, filter <<= 1) {
mainGame->chkAttribute[i]->setChecked(false); mainGame->chkAttribute[i]->setChecked(false);
...@@ -3571,7 +3579,7 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) { ...@@ -3571,7 +3579,7 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
return false; return false;
} }
case MSG_ANNOUNCE_CARD: { case MSG_ANNOUNCE_CARD: {
/*int player = */mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); /*int player = */mainGame->LocalPlayer(BufferIO::ReadUInt8(pbuf));
int count = BufferIO::ReadUInt8(pbuf); int count = BufferIO::ReadUInt8(pbuf);
mainGame->dField.declare_opcodes.clear(); mainGame->dField.declare_opcodes.clear();
for (int i = 0; i < count; ++i) for (int i = 0; i < count; ++i)
...@@ -3589,7 +3597,7 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) { ...@@ -3589,7 +3597,7 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
return false; return false;
} }
case MSG_ANNOUNCE_NUMBER: { case MSG_ANNOUNCE_NUMBER: {
/*int player = */mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); /*int player = */mainGame->LocalPlayer(BufferIO::ReadUInt8(pbuf));
int count = BufferIO::ReadUInt8(pbuf); int count = BufferIO::ReadUInt8(pbuf);
mainGame->gMutex.lock(); mainGame->gMutex.lock();
mainGame->cbANNumber->clear(); mainGame->cbANNumber->clear();
...@@ -3641,11 +3649,11 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) { ...@@ -3641,11 +3649,11 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
return false; return false;
} }
case MSG_CARD_HINT: { case MSG_CARD_HINT: {
int c = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int c = mainGame->LocalPlayer(BufferIO::ReadUInt8(pbuf));
int l = BufferIO::ReadInt8(pbuf); unsigned int l = BufferIO::ReadUInt8(pbuf);
int s = BufferIO::ReadInt8(pbuf); int s = BufferIO::ReadUInt8(pbuf);
BufferIO::ReadInt8(pbuf); BufferIO::ReadUInt8(pbuf);
int chtype = BufferIO::ReadInt8(pbuf); int chtype = BufferIO::ReadUInt8(pbuf);
int value = BufferIO::ReadInt32(pbuf); int value = BufferIO::ReadInt32(pbuf);
ClientCard* pcard = mainGame->dField.GetCard(c, l, s); ClientCard* pcard = mainGame->dField.GetCard(c, l, s);
if(!pcard) if(!pcard)
...@@ -3678,8 +3686,8 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) { ...@@ -3678,8 +3686,8 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
return true; return true;
} }
case MSG_PLAYER_HINT: { case MSG_PLAYER_HINT: {
int player = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int player = mainGame->LocalPlayer(BufferIO::ReadUInt8(pbuf));
int chtype = BufferIO::ReadInt8(pbuf); int chtype = BufferIO::ReadUInt8(pbuf);
int value = BufferIO::ReadInt32(pbuf); int value = BufferIO::ReadInt32(pbuf);
auto& player_desc_hints = mainGame->dField.player_desc_hints[player]; auto& player_desc_hints = mainGame->dField.player_desc_hints[player];
if(value == CARD_QUESTION && player == 0) { if(value == CARD_QUESTION && player == 0) {
...@@ -3703,11 +3711,11 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) { ...@@ -3703,11 +3711,11 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
return true; return true;
} }
case MSG_TAG_SWAP: { case MSG_TAG_SWAP: {
int player = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int player = mainGame->LocalPlayer(BufferIO::ReadUInt8(pbuf));
size_t mcount = (size_t)BufferIO::ReadInt8(pbuf); size_t mcount = (size_t)BufferIO::ReadUInt8(pbuf);
size_t ecount = (size_t)BufferIO::ReadInt8(pbuf); size_t ecount = (size_t)BufferIO::ReadUInt8(pbuf);
size_t pcount = (size_t)BufferIO::ReadInt8(pbuf); size_t pcount = (size_t)BufferIO::ReadUInt8(pbuf);
size_t hcount = (size_t)BufferIO::ReadInt8(pbuf); size_t hcount = (size_t)BufferIO::ReadUInt8(pbuf);
int topcode = BufferIO::ReadInt32(pbuf); int topcode = BufferIO::ReadInt32(pbuf);
if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) { if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) {
for (auto cit = mainGame->dField.deck[player].begin(); cit != mainGame->dField.deck[player].end(); ++cit) { for (auto cit = mainGame->dField.deck[player].begin(); cit != mainGame->dField.deck[player].end(); ++cit) {
...@@ -3818,19 +3826,19 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) { ...@@ -3818,19 +3826,19 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
case MSG_RELOAD_FIELD: { case MSG_RELOAD_FIELD: {
mainGame->gMutex.lock(); mainGame->gMutex.lock();
mainGame->dField.Clear(); mainGame->dField.Clear();
mainGame->dInfo.duel_rule = BufferIO::ReadInt8(pbuf); mainGame->dInfo.duel_rule = BufferIO::ReadUInt8(pbuf);
int val = 0; int val = 0;
for(int i = 0; i < 2; ++i) { for(int i = 0; i < 2; ++i) {
int p = mainGame->LocalPlayer(i); int p = mainGame->LocalPlayer(i);
mainGame->dInfo.lp[p] = BufferIO::ReadInt32(pbuf); mainGame->dInfo.lp[p] = BufferIO::ReadInt32(pbuf);
myswprintf(mainGame->dInfo.strLP[p], L"%d", mainGame->dInfo.lp[p]); myswprintf(mainGame->dInfo.strLP[p], L"%d", mainGame->dInfo.lp[p]);
for(int seq = 0; seq < 7; ++seq) { for(int seq = 0; seq < 7; ++seq) {
val = BufferIO::ReadInt8(pbuf); val = BufferIO::ReadUInt8(pbuf);
if(val) { if(val) {
ClientCard* ccard = new ClientCard; ClientCard* ccard = new ClientCard;
mainGame->dField.AddCard(ccard, p, LOCATION_MZONE, seq); mainGame->dField.AddCard(ccard, p, LOCATION_MZONE, seq);
ccard->position = BufferIO::ReadInt8(pbuf); ccard->position = BufferIO::ReadUInt8(pbuf);
val = BufferIO::ReadInt8(pbuf); val = BufferIO::ReadUInt8(pbuf);
if(val) { if(val) {
for(int xyz = 0; xyz < val; ++xyz) { for(int xyz = 0; xyz < val; ++xyz) {
ClientCard* xcard = new ClientCard; ClientCard* xcard = new ClientCard;
...@@ -3846,52 +3854,52 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) { ...@@ -3846,52 +3854,52 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
} }
} }
for(int seq = 0; seq < 8; ++seq) { for(int seq = 0; seq < 8; ++seq) {
val = BufferIO::ReadInt8(pbuf); val = BufferIO::ReadUInt8(pbuf);
if(val) { if(val) {
ClientCard* ccard = new ClientCard; ClientCard* ccard = new ClientCard;
mainGame->dField.AddCard(ccard, p, LOCATION_SZONE, seq); mainGame->dField.AddCard(ccard, p, LOCATION_SZONE, seq);
ccard->position = BufferIO::ReadInt8(pbuf); ccard->position = BufferIO::ReadUInt8(pbuf);
} }
} }
val = BufferIO::ReadInt8(pbuf); val = BufferIO::ReadUInt8(pbuf);
for(int seq = 0; seq < val; ++seq) { for(int seq = 0; seq < val; ++seq) {
ClientCard* ccard = new ClientCard; ClientCard* ccard = new ClientCard;
mainGame->dField.AddCard(ccard, p, LOCATION_DECK, seq); mainGame->dField.AddCard(ccard, p, LOCATION_DECK, seq);
} }
val = BufferIO::ReadInt8(pbuf); val = BufferIO::ReadUInt8(pbuf);
for(int seq = 0; seq < val; ++seq) { for(int seq = 0; seq < val; ++seq) {
ClientCard* ccard = new ClientCard; ClientCard* ccard = new ClientCard;
mainGame->dField.AddCard(ccard, p, LOCATION_HAND, seq); mainGame->dField.AddCard(ccard, p, LOCATION_HAND, seq);
} }
val = BufferIO::ReadInt8(pbuf); val = BufferIO::ReadUInt8(pbuf);
for(int seq = 0; seq < val; ++seq) { for(int seq = 0; seq < val; ++seq) {
ClientCard* ccard = new ClientCard; ClientCard* ccard = new ClientCard;
mainGame->dField.AddCard(ccard, p, LOCATION_GRAVE, seq); mainGame->dField.AddCard(ccard, p, LOCATION_GRAVE, seq);
} }
val = BufferIO::ReadInt8(pbuf); val = BufferIO::ReadUInt8(pbuf);
for(int seq = 0; seq < val; ++seq) { for(int seq = 0; seq < val; ++seq) {
ClientCard* ccard = new ClientCard; ClientCard* ccard = new ClientCard;
mainGame->dField.AddCard(ccard, p, LOCATION_REMOVED, seq); mainGame->dField.AddCard(ccard, p, LOCATION_REMOVED, seq);
} }
val = BufferIO::ReadInt8(pbuf); val = BufferIO::ReadUInt8(pbuf);
for(int seq = 0; seq < val; ++seq) { for(int seq = 0; seq < val; ++seq) {
ClientCard* ccard = new ClientCard; ClientCard* ccard = new ClientCard;
mainGame->dField.AddCard(ccard, p, LOCATION_EXTRA, seq); mainGame->dField.AddCard(ccard, p, LOCATION_EXTRA, seq);
} }
val = BufferIO::ReadInt8(pbuf); val = BufferIO::ReadUInt8(pbuf);
mainGame->dField.extra_p_count[p] = val; mainGame->dField.extra_p_count[p] = val;
} }
mainGame->dField.RefreshAllCards(); mainGame->dField.RefreshAllCards();
val = BufferIO::ReadInt8(pbuf); //chains val = BufferIO::ReadUInt8(pbuf); //chains
for(int i = 0; i < val; ++i) { for(int i = 0; i < val; ++i) {
unsigned int code = (unsigned int)BufferIO::ReadInt32(pbuf); unsigned int code = BufferIO::ReadInt32(pbuf);
int pcc = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int pcc = mainGame->LocalPlayer(BufferIO::ReadUInt8(pbuf));
int pcl = BufferIO::ReadInt8(pbuf); unsigned int pcl = BufferIO::ReadUInt8(pbuf);
int pcs = BufferIO::ReadInt8(pbuf); int pcs = BufferIO::ReadUInt8(pbuf);
int subs = BufferIO::ReadInt8(pbuf); int subs = BufferIO::ReadUInt8(pbuf);
int cc = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int cc = mainGame->LocalPlayer(BufferIO::ReadUInt8(pbuf));
int cl = BufferIO::ReadInt8(pbuf); unsigned int cl = BufferIO::ReadUInt8(pbuf);
int cs = BufferIO::ReadInt8(pbuf); int cs = BufferIO::ReadUInt8(pbuf);
int desc = BufferIO::ReadInt32(pbuf); int desc = BufferIO::ReadInt32(pbuf);
ClientCard* pcard = mainGame->dField.GetCard(pcc, pcl, pcs, subs); ClientCard* pcard = mainGame->dField.GetCard(pcc, pcl, pcs, subs);
mainGame->dField.current_chain.chain_card = pcard; mainGame->dField.current_chain.chain_card = pcard;
......
...@@ -1775,8 +1775,9 @@ void Game::CloseDuelWindow() { ...@@ -1775,8 +1775,9 @@ void Game::CloseDuelWindow() {
ClearTextures(); ClearTextures();
closeDoneSignal.Set(); closeDoneSignal.Set();
} }
int Game::LocalPlayer(int player) { int Game::LocalPlayer(int player) const {
return dInfo.isFirst ? player : 1 - player; int pid = player ? 1 : 0;
return dInfo.isFirst ? pid : 1 - pid;
} }
const wchar_t* Game::LocalName(int local_player) { const wchar_t* Game::LocalName(int local_player) {
return local_player == 0 ? dInfo.hostname : dInfo.clientname; return local_player == 0 ? dInfo.hostname : dInfo.clientname;
......
...@@ -167,7 +167,7 @@ public: ...@@ -167,7 +167,7 @@ public:
void CloseGameWindow(); void CloseGameWindow();
void CloseDuelWindow(); void CloseDuelWindow();
int LocalPlayer(int player); int LocalPlayer(int player) const;
const wchar_t* LocalName(int local_player); const wchar_t* LocalName(int local_player);
bool HasFocus(EGUI_ELEMENT_TYPE type) const { bool HasFocus(EGUI_ELEMENT_TYPE type) const {
......
...@@ -352,141 +352,141 @@ bool ReplayMode::ReplayAnalyze(unsigned char* msg, unsigned int len) { ...@@ -352,141 +352,141 @@ bool ReplayMode::ReplayAnalyze(unsigned char* msg, unsigned int len) {
return false; return false;
} }
case MSG_SELECT_BATTLECMD: { case MSG_SELECT_BATTLECMD: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 11; pbuf += count * 11;
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 8 + 2; pbuf += count * 8 + 2;
ReplayRefresh(); ReplayRefresh();
return ReadReplayResponse(); return ReadReplayResponse();
} }
case MSG_SELECT_IDLECMD: { case MSG_SELECT_IDLECMD: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 7; pbuf += count * 7;
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 7; pbuf += count * 7;
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 7; pbuf += count * 7;
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 7; pbuf += count * 7;
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 7; pbuf += count * 7;
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 11 + 3; pbuf += count * 11 + 3;
ReplayRefresh(); ReplayRefresh();
return ReadReplayResponse(); return ReadReplayResponse();
} }
case MSG_SELECT_EFFECTYN: { case MSG_SELECT_EFFECTYN: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
pbuf += 12; pbuf += 12;
return ReadReplayResponse(); return ReadReplayResponse();
} }
case MSG_SELECT_YESNO: { case MSG_SELECT_YESNO: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
pbuf += 4; pbuf += 4;
return ReadReplayResponse(); return ReadReplayResponse();
} }
case MSG_SELECT_OPTION: { case MSG_SELECT_OPTION: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 4; pbuf += count * 4;
return ReadReplayResponse(); return ReadReplayResponse();
} }
case MSG_SELECT_CARD: case MSG_SELECT_CARD:
case MSG_SELECT_TRIBUTE: { case MSG_SELECT_TRIBUTE: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
pbuf += 3; pbuf += 3;
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 8; pbuf += count * 8;
return ReadReplayResponse(); return ReadReplayResponse();
} }
case MSG_SELECT_UNSELECT_CARD: { case MSG_SELECT_UNSELECT_CARD: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
pbuf += 4; pbuf += 4;
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 8; pbuf += count * 8;
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 8; pbuf += count * 8;
return ReadReplayResponse(); return ReadReplayResponse();
} }
case MSG_SELECT_CHAIN: { case MSG_SELECT_CHAIN: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += 10 + count * 13; pbuf += 10 + count * 13;
return ReadReplayResponse(); return ReadReplayResponse();
} }
case MSG_SELECT_PLACE: case MSG_SELECT_PLACE:
case MSG_SELECT_DISFIELD: { case MSG_SELECT_DISFIELD: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
pbuf += 5; pbuf += 5;
return ReadReplayResponse(); return ReadReplayResponse();
} }
case MSG_SELECT_POSITION: { case MSG_SELECT_POSITION: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
pbuf += 5; pbuf += 5;
return ReadReplayResponse(); return ReadReplayResponse();
} }
case MSG_SELECT_COUNTER: { case MSG_SELECT_COUNTER: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
pbuf += 4; pbuf += 4;
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 9; pbuf += count * 9;
return ReadReplayResponse(); return ReadReplayResponse();
} }
case MSG_SELECT_SUM: { case MSG_SELECT_SUM: {
pbuf++; pbuf++;
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
pbuf += 6; pbuf += 6;
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 11; pbuf += count * 11;
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 11; pbuf += count * 11;
return ReadReplayResponse(); return ReadReplayResponse();
} }
case MSG_SORT_CARD: { case MSG_SORT_CARD: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 7; pbuf += count * 7;
return ReadReplayResponse(); return ReadReplayResponse();
} }
case MSG_CONFIRM_DECKTOP: { case MSG_CONFIRM_DECKTOP: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 7; pbuf += count * 7;
DuelClient::ClientAnalyze(offset, pbuf - offset); DuelClient::ClientAnalyze(offset, pbuf - offset);
break; break;
} }
case MSG_CONFIRM_EXTRATOP: { case MSG_CONFIRM_EXTRATOP: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 7; pbuf += count * 7;
DuelClient::ClientAnalyze(offset, pbuf - offset); DuelClient::ClientAnalyze(offset, pbuf - offset);
break; break;
} }
case MSG_CONFIRM_CARDS: { case MSG_CONFIRM_CARDS: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 7; pbuf += count * 7;
DuelClient::ClientAnalyze(offset, pbuf - offset); DuelClient::ClientAnalyze(offset, pbuf - offset);
break; break;
} }
case MSG_SHUFFLE_DECK: { case MSG_SHUFFLE_DECK: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
DuelClient::ClientAnalyze(offset, pbuf - offset); DuelClient::ClientAnalyze(offset, pbuf - offset);
ReplayRefreshDeck(player); ReplayRefreshDeck(player);
break; break;
} }
case MSG_SHUFFLE_HAND: { case MSG_SHUFFLE_HAND: {
/*int oplayer = */BufferIO::ReadInt8(pbuf); /*int oplayer = */BufferIO::ReadUInt8(pbuf);
int count = BufferIO::ReadInt8(pbuf); int count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 4; pbuf += count * 4;
DuelClient::ClientAnalyze(offset, pbuf - offset); DuelClient::ClientAnalyze(offset, pbuf - offset);
break; break;
} }
case MSG_SHUFFLE_EXTRA: { case MSG_SHUFFLE_EXTRA: {
/*int oplayer = */BufferIO::ReadInt8(pbuf); /*int oplayer = */BufferIO::ReadUInt8(pbuf);
int count = BufferIO::ReadInt8(pbuf); int count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 4; pbuf += count * 4;
DuelClient::ClientAnalyze(offset, pbuf - offset); DuelClient::ClientAnalyze(offset, pbuf - offset);
break; break;
...@@ -497,7 +497,7 @@ bool ReplayMode::ReplayAnalyze(unsigned char* msg, unsigned int len) { ...@@ -497,7 +497,7 @@ bool ReplayMode::ReplayAnalyze(unsigned char* msg, unsigned int len) {
break; break;
} }
case MSG_SWAP_GRAVE_DECK: { case MSG_SWAP_GRAVE_DECK: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
DuelClient::ClientAnalyze(offset, pbuf - offset); DuelClient::ClientAnalyze(offset, pbuf - offset);
ReplayRefreshGrave(player); ReplayRefreshGrave(player);
break; break;
...@@ -515,7 +515,7 @@ bool ReplayMode::ReplayAnalyze(unsigned char* msg, unsigned int len) { ...@@ -515,7 +515,7 @@ bool ReplayMode::ReplayAnalyze(unsigned char* msg, unsigned int len) {
} }
case MSG_SHUFFLE_SET_CARD: { case MSG_SHUFFLE_SET_CARD: {
pbuf++; pbuf++;
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 8; pbuf += count * 8;
DuelClient::ClientAnalyze(offset, pbuf - offset); DuelClient::ClientAnalyze(offset, pbuf - offset);
break; break;
...@@ -529,7 +529,7 @@ bool ReplayMode::ReplayAnalyze(unsigned char* msg, unsigned int len) { ...@@ -529,7 +529,7 @@ bool ReplayMode::ReplayAnalyze(unsigned char* msg, unsigned int len) {
mainGame->gMutex.unlock(); mainGame->gMutex.unlock();
} }
} }
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
DuelClient::ClientAnalyze(offset, pbuf - offset); DuelClient::ClientAnalyze(offset, pbuf - offset);
break; break;
} }
...@@ -653,22 +653,22 @@ bool ReplayMode::ReplayAnalyze(unsigned char* msg, unsigned int len) { ...@@ -653,22 +653,22 @@ bool ReplayMode::ReplayAnalyze(unsigned char* msg, unsigned int len) {
} }
case MSG_CARD_SELECTED: case MSG_CARD_SELECTED:
case MSG_RANDOM_SELECTED: { case MSG_RANDOM_SELECTED: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 4; pbuf += count * 4;
DuelClient::ClientAnalyze(offset, pbuf - offset); DuelClient::ClientAnalyze(offset, pbuf - offset);
pauseable = false; pauseable = false;
break; break;
} }
case MSG_BECOME_TARGET: { case MSG_BECOME_TARGET: {
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 4; pbuf += count * 4;
DuelClient::ClientAnalyze(offset, pbuf - offset); DuelClient::ClientAnalyze(offset, pbuf - offset);
break; break;
} }
case MSG_DRAW: { case MSG_DRAW: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 4; pbuf += count * 4;
DuelClient::ClientAnalyze(offset, pbuf - offset); DuelClient::ClientAnalyze(offset, pbuf - offset);
break; break;
...@@ -761,21 +761,21 @@ bool ReplayMode::ReplayAnalyze(unsigned char* msg, unsigned int len) { ...@@ -761,21 +761,21 @@ bool ReplayMode::ReplayAnalyze(unsigned char* msg, unsigned int len) {
break; break;
} }
case MSG_TOSS_COIN: { case MSG_TOSS_COIN: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count; pbuf += count;
DuelClient::ClientAnalyze(offset, pbuf - offset); DuelClient::ClientAnalyze(offset, pbuf - offset);
break; break;
} }
case MSG_TOSS_DICE: { case MSG_TOSS_DICE: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count; pbuf += count;
DuelClient::ClientAnalyze(offset, pbuf - offset); DuelClient::ClientAnalyze(offset, pbuf - offset);
break; break;
} }
case MSG_ROCK_PAPER_SCISSORS: { case MSG_ROCK_PAPER_SCISSORS: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
return ReadReplayResponse(); return ReadReplayResponse();
} }
case MSG_HAND_RES: { case MSG_HAND_RES: {
...@@ -784,18 +784,18 @@ bool ReplayMode::ReplayAnalyze(unsigned char* msg, unsigned int len) { ...@@ -784,18 +784,18 @@ bool ReplayMode::ReplayAnalyze(unsigned char* msg, unsigned int len) {
break; break;
} }
case MSG_ANNOUNCE_RACE: { case MSG_ANNOUNCE_RACE: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
pbuf += 5; pbuf += 5;
return ReadReplayResponse(); return ReadReplayResponse();
} }
case MSG_ANNOUNCE_ATTRIB: { case MSG_ANNOUNCE_ATTRIB: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
pbuf += 5; pbuf += 5;
return ReadReplayResponse(); return ReadReplayResponse();
} }
case MSG_ANNOUNCE_CARD: case MSG_ANNOUNCE_CARD:
case MSG_ANNOUNCE_NUMBER: { case MSG_ANNOUNCE_NUMBER: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
count = BufferIO::ReadUInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += 4 * count; pbuf += 4 * count;
return ReadReplayResponse(); return ReadReplayResponse();
...@@ -827,12 +827,12 @@ bool ReplayMode::ReplayAnalyze(unsigned char* msg, unsigned int len) { ...@@ -827,12 +827,12 @@ bool ReplayMode::ReplayAnalyze(unsigned char* msg, unsigned int len) {
for(int p = 0; p < 2; ++p) { for(int p = 0; p < 2; ++p) {
pbuf += 4; pbuf += 4;
for(int seq = 0; seq < 7; ++seq) { for(int seq = 0; seq < 7; ++seq) {
int val = BufferIO::ReadInt8(pbuf); int val = BufferIO::ReadUInt8(pbuf);
if(val) if(val)
pbuf += 2; pbuf += 2;
} }
for(int seq = 0; seq < 8; ++seq) { for(int seq = 0; seq < 8; ++seq) {
int val = BufferIO::ReadInt8(pbuf); int val = BufferIO::ReadUInt8(pbuf);
if(val) if(val)
pbuf++; pbuf++;
} }
......
...@@ -587,8 +587,8 @@ int SingleDuel::Analyze(unsigned char* msgbuffer, unsigned int len) { ...@@ -587,8 +587,8 @@ int SingleDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
return 1; return 1;
} }
case MSG_HINT: { case MSG_HINT: {
type = BufferIO::ReadInt8(pbuf); type = BufferIO::ReadUInt8(pbuf);
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
BufferIO::ReadInt32(pbuf); BufferIO::ReadInt32(pbuf);
switch (type) { switch (type) {
case 1: case 1:
...@@ -620,8 +620,8 @@ int SingleDuel::Analyze(unsigned char* msgbuffer, unsigned int len) { ...@@ -620,8 +620,8 @@ int SingleDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
break; break;
} }
case MSG_WIN: { case MSG_WIN: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
type = BufferIO::ReadInt8(pbuf); type = BufferIO::ReadUInt8(pbuf);
NetServer::SendBufferToPlayer(players[0], STOC_GAME_MSG, offset, pbuf - offset); NetServer::SendBufferToPlayer(players[0], STOC_GAME_MSG, offset, pbuf - offset);
NetServer::ReSendToPlayer(players[1]); NetServer::ReSendToPlayer(players[1]);
for(auto oit = observers.begin(); oit != observers.end(); ++oit) for(auto oit = observers.begin(); oit != observers.end(); ++oit)
...@@ -640,10 +640,10 @@ int SingleDuel::Analyze(unsigned char* msgbuffer, unsigned int len) { ...@@ -640,10 +640,10 @@ int SingleDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
return 2; return 2;
} }
case MSG_SELECT_BATTLECMD: { case MSG_SELECT_BATTLECMD: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 11; pbuf += count * 11;
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 8 + 2; pbuf += count * 8 + 2;
RefreshMzone(0); RefreshMzone(0);
RefreshMzone(1); RefreshMzone(1);
...@@ -656,18 +656,18 @@ int SingleDuel::Analyze(unsigned char* msgbuffer, unsigned int len) { ...@@ -656,18 +656,18 @@ int SingleDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
return 1; return 1;
} }
case MSG_SELECT_IDLECMD: { case MSG_SELECT_IDLECMD: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 7; pbuf += count * 7;
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 7; pbuf += count * 7;
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 7; pbuf += count * 7;
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 7; pbuf += count * 7;
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 7; pbuf += count * 7;
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 11 + 3; pbuf += count * 11 + 3;
RefreshMzone(0); RefreshMzone(0);
RefreshMzone(1); RefreshMzone(1);
...@@ -680,22 +680,22 @@ int SingleDuel::Analyze(unsigned char* msgbuffer, unsigned int len) { ...@@ -680,22 +680,22 @@ int SingleDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
return 1; return 1;
} }
case MSG_SELECT_EFFECTYN: { case MSG_SELECT_EFFECTYN: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
pbuf += 12; pbuf += 12;
WaitforResponse(player); WaitforResponse(player);
NetServer::SendBufferToPlayer(players[player], STOC_GAME_MSG, offset, pbuf - offset); NetServer::SendBufferToPlayer(players[player], STOC_GAME_MSG, offset, pbuf - offset);
return 1; return 1;
} }
case MSG_SELECT_YESNO: { case MSG_SELECT_YESNO: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
pbuf += 4; pbuf += 4;
WaitforResponse(player); WaitforResponse(player);
NetServer::SendBufferToPlayer(players[player], STOC_GAME_MSG, offset, pbuf - offset); NetServer::SendBufferToPlayer(players[player], STOC_GAME_MSG, offset, pbuf - offset);
return 1; return 1;
} }
case MSG_SELECT_OPTION: { case MSG_SELECT_OPTION: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 4; pbuf += count * 4;
WaitforResponse(player); WaitforResponse(player);
NetServer::SendBufferToPlayer(players[player], STOC_GAME_MSG, offset, pbuf - offset); NetServer::SendBufferToPlayer(players[player], STOC_GAME_MSG, offset, pbuf - offset);
...@@ -703,17 +703,17 @@ int SingleDuel::Analyze(unsigned char* msgbuffer, unsigned int len) { ...@@ -703,17 +703,17 @@ int SingleDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
} }
case MSG_SELECT_CARD: case MSG_SELECT_CARD:
case MSG_SELECT_TRIBUTE: { case MSG_SELECT_TRIBUTE: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
pbuf += 3; pbuf += 3;
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
int c/*, l, s, ss, code*/; int c/*, l, s, ss, code*/;
for (int i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {
pbufw = pbuf; pbufw = pbuf;
/*code = */BufferIO::ReadInt32(pbuf); /*code = */BufferIO::ReadInt32(pbuf);
c = BufferIO::ReadInt8(pbuf); c = BufferIO::ReadUInt8(pbuf);
/*l = */BufferIO::ReadInt8(pbuf); /*l = */BufferIO::ReadUInt8(pbuf);
/*s = */BufferIO::ReadInt8(pbuf); /*s = */BufferIO::ReadUInt8(pbuf);
/*ss = */BufferIO::ReadInt8(pbuf); /*ss = */BufferIO::ReadUInt8(pbuf);
if (c != player) BufferIO::WriteInt32(pbufw, 0); if (c != player) BufferIO::WriteInt32(pbufw, 0);
} }
WaitforResponse(player); WaitforResponse(player);
...@@ -721,27 +721,27 @@ int SingleDuel::Analyze(unsigned char* msgbuffer, unsigned int len) { ...@@ -721,27 +721,27 @@ int SingleDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
return 1; return 1;
} }
case MSG_SELECT_UNSELECT_CARD: { case MSG_SELECT_UNSELECT_CARD: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
pbuf += 4; pbuf += 4;
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
int c/*, l, s, ss, code*/; int c/*, l, s, ss, code*/;
for (int i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {
pbufw = pbuf; pbufw = pbuf;
/*code = */BufferIO::ReadInt32(pbuf); /*code = */BufferIO::ReadInt32(pbuf);
c = BufferIO::ReadInt8(pbuf); c = BufferIO::ReadUInt8(pbuf);
/*l = */BufferIO::ReadInt8(pbuf); /*l = */BufferIO::ReadUInt8(pbuf);
/*s = */BufferIO::ReadInt8(pbuf); /*s = */BufferIO::ReadUInt8(pbuf);
/*ss = */BufferIO::ReadInt8(pbuf); /*ss = */BufferIO::ReadUInt8(pbuf);
if (c != player) BufferIO::WriteInt32(pbufw, 0); if (c != player) BufferIO::WriteInt32(pbufw, 0);
} }
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
for (int i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {
pbufw = pbuf; pbufw = pbuf;
/*code = */BufferIO::ReadInt32(pbuf); /*code = */BufferIO::ReadInt32(pbuf);
c = BufferIO::ReadInt8(pbuf); c = BufferIO::ReadUInt8(pbuf);
/*l = */BufferIO::ReadInt8(pbuf); /*l = */BufferIO::ReadUInt8(pbuf);
/*s = */BufferIO::ReadInt8(pbuf); /*s = */BufferIO::ReadUInt8(pbuf);
/*ss = */BufferIO::ReadInt8(pbuf); /*ss = */BufferIO::ReadUInt8(pbuf);
if (c != player) BufferIO::WriteInt32(pbufw, 0); if (c != player) BufferIO::WriteInt32(pbufw, 0);
} }
WaitforResponse(player); WaitforResponse(player);
...@@ -749,8 +749,8 @@ int SingleDuel::Analyze(unsigned char* msgbuffer, unsigned int len) { ...@@ -749,8 +749,8 @@ int SingleDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
return 1; return 1;
} }
case MSG_SELECT_CHAIN: { case MSG_SELECT_CHAIN: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += 10 + count * 13; pbuf += 10 + count * 13;
WaitforResponse(player); WaitforResponse(player);
NetServer::SendBufferToPlayer(players[player], STOC_GAME_MSG, offset, pbuf - offset); NetServer::SendBufferToPlayer(players[player], STOC_GAME_MSG, offset, pbuf - offset);
...@@ -758,23 +758,23 @@ int SingleDuel::Analyze(unsigned char* msgbuffer, unsigned int len) { ...@@ -758,23 +758,23 @@ int SingleDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
} }
case MSG_SELECT_PLACE: case MSG_SELECT_PLACE:
case MSG_SELECT_DISFIELD: { case MSG_SELECT_DISFIELD: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
pbuf += 5; pbuf += 5;
WaitforResponse(player); WaitforResponse(player);
NetServer::SendBufferToPlayer(players[player], STOC_GAME_MSG, offset, pbuf - offset); NetServer::SendBufferToPlayer(players[player], STOC_GAME_MSG, offset, pbuf - offset);
return 1; return 1;
} }
case MSG_SELECT_POSITION: { case MSG_SELECT_POSITION: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
pbuf += 5; pbuf += 5;
WaitforResponse(player); WaitforResponse(player);
NetServer::SendBufferToPlayer(players[player], STOC_GAME_MSG, offset, pbuf - offset); NetServer::SendBufferToPlayer(players[player], STOC_GAME_MSG, offset, pbuf - offset);
return 1; return 1;
} }
case MSG_SELECT_COUNTER: { case MSG_SELECT_COUNTER: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
pbuf += 4; pbuf += 4;
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 9; pbuf += count * 9;
WaitforResponse(player); WaitforResponse(player);
NetServer::SendBufferToPlayer(players[player], STOC_GAME_MSG, offset, pbuf - offset); NetServer::SendBufferToPlayer(players[player], STOC_GAME_MSG, offset, pbuf - offset);
...@@ -782,27 +782,27 @@ int SingleDuel::Analyze(unsigned char* msgbuffer, unsigned int len) { ...@@ -782,27 +782,27 @@ int SingleDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
} }
case MSG_SELECT_SUM: { case MSG_SELECT_SUM: {
pbuf++; pbuf++;
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
pbuf += 6; pbuf += 6;
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 11; pbuf += count * 11;
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 11; pbuf += count * 11;
WaitforResponse(player); WaitforResponse(player);
NetServer::SendBufferToPlayer(players[player], STOC_GAME_MSG, offset, pbuf - offset); NetServer::SendBufferToPlayer(players[player], STOC_GAME_MSG, offset, pbuf - offset);
return 1; return 1;
} }
case MSG_SORT_CARD: { case MSG_SORT_CARD: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 7; pbuf += count * 7;
WaitforResponse(player); WaitforResponse(player);
NetServer::SendBufferToPlayer(players[player], STOC_GAME_MSG, offset, pbuf - offset); NetServer::SendBufferToPlayer(players[player], STOC_GAME_MSG, offset, pbuf - offset);
return 1; return 1;
} }
case MSG_CONFIRM_DECKTOP: { case MSG_CONFIRM_DECKTOP: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 7; pbuf += count * 7;
NetServer::SendBufferToPlayer(players[0], STOC_GAME_MSG, offset, pbuf - offset); NetServer::SendBufferToPlayer(players[0], STOC_GAME_MSG, offset, pbuf - offset);
NetServer::ReSendToPlayer(players[1]); NetServer::ReSendToPlayer(players[1]);
...@@ -811,8 +811,8 @@ int SingleDuel::Analyze(unsigned char* msgbuffer, unsigned int len) { ...@@ -811,8 +811,8 @@ int SingleDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
break; break;
} }
case MSG_CONFIRM_EXTRATOP: { case MSG_CONFIRM_EXTRATOP: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 7; pbuf += count * 7;
NetServer::SendBufferToPlayer(players[0], STOC_GAME_MSG, offset, pbuf - offset); NetServer::SendBufferToPlayer(players[0], STOC_GAME_MSG, offset, pbuf - offset);
NetServer::ReSendToPlayer(players[1]); NetServer::ReSendToPlayer(players[1]);
...@@ -821,8 +821,8 @@ int SingleDuel::Analyze(unsigned char* msgbuffer, unsigned int len) { ...@@ -821,8 +821,8 @@ int SingleDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
break; break;
} }
case MSG_CONFIRM_CARDS: { case MSG_CONFIRM_CARDS: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
if(pbuf[5] != LOCATION_DECK) { if(pbuf[5] != LOCATION_DECK) {
pbuf += count * 7; pbuf += count * 7;
NetServer::SendBufferToPlayer(players[player], STOC_GAME_MSG, offset, pbuf - offset); NetServer::SendBufferToPlayer(players[player], STOC_GAME_MSG, offset, pbuf - offset);
...@@ -836,7 +836,7 @@ int SingleDuel::Analyze(unsigned char* msgbuffer, unsigned int len) { ...@@ -836,7 +836,7 @@ int SingleDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
break; break;
} }
case MSG_SHUFFLE_DECK: { case MSG_SHUFFLE_DECK: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
NetServer::SendBufferToPlayer(players[0], STOC_GAME_MSG, offset, pbuf - offset); NetServer::SendBufferToPlayer(players[0], STOC_GAME_MSG, offset, pbuf - offset);
NetServer::ReSendToPlayer(players[1]); NetServer::ReSendToPlayer(players[1]);
for(auto oit = observers.begin(); oit != observers.end(); ++oit) for(auto oit = observers.begin(); oit != observers.end(); ++oit)
...@@ -844,8 +844,8 @@ int SingleDuel::Analyze(unsigned char* msgbuffer, unsigned int len) { ...@@ -844,8 +844,8 @@ int SingleDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
break; break;
} }
case MSG_SHUFFLE_HAND: { case MSG_SHUFFLE_HAND: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
NetServer::SendBufferToPlayer(players[player], STOC_GAME_MSG, offset, (pbuf - offset) + count * 4); NetServer::SendBufferToPlayer(players[player], STOC_GAME_MSG, offset, (pbuf - offset) + count * 4);
for(int i = 0; i < count; ++i) for(int i = 0; i < count; ++i)
BufferIO::WriteInt32(pbuf, 0); BufferIO::WriteInt32(pbuf, 0);
...@@ -856,8 +856,8 @@ int SingleDuel::Analyze(unsigned char* msgbuffer, unsigned int len) { ...@@ -856,8 +856,8 @@ int SingleDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
break; break;
} }
case MSG_SHUFFLE_EXTRA: { case MSG_SHUFFLE_EXTRA: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
NetServer::SendBufferToPlayer(players[player], STOC_GAME_MSG, offset, (pbuf - offset) + count * 4); NetServer::SendBufferToPlayer(players[player], STOC_GAME_MSG, offset, (pbuf - offset) + count * 4);
for (int i = 0; i < count; ++i) for (int i = 0; i < count; ++i)
BufferIO::WriteInt32(pbuf, 0); BufferIO::WriteInt32(pbuf, 0);
...@@ -876,7 +876,7 @@ int SingleDuel::Analyze(unsigned char* msgbuffer, unsigned int len) { ...@@ -876,7 +876,7 @@ int SingleDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
break; break;
} }
case MSG_SWAP_GRAVE_DECK: { case MSG_SWAP_GRAVE_DECK: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
NetServer::SendBufferToPlayer(players[0], STOC_GAME_MSG, offset, pbuf - offset); NetServer::SendBufferToPlayer(players[0], STOC_GAME_MSG, offset, pbuf - offset);
NetServer::ReSendToPlayer(players[1]); NetServer::ReSendToPlayer(players[1]);
for(auto oit = observers.begin(); oit != observers.end(); ++oit) for(auto oit = observers.begin(); oit != observers.end(); ++oit)
...@@ -900,8 +900,8 @@ int SingleDuel::Analyze(unsigned char* msgbuffer, unsigned int len) { ...@@ -900,8 +900,8 @@ int SingleDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
break; break;
} }
case MSG_SHUFFLE_SET_CARD: { case MSG_SHUFFLE_SET_CARD: {
int loc = BufferIO::ReadInt8(pbuf); unsigned int loc = BufferIO::ReadUInt8(pbuf);
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 8; pbuf += count * 8;
NetServer::SendBufferToPlayer(players[0], STOC_GAME_MSG, offset, pbuf - offset); NetServer::SendBufferToPlayer(players[0], STOC_GAME_MSG, offset, pbuf - offset);
NetServer::ReSendToPlayer(players[1]); NetServer::ReSendToPlayer(players[1]);
...@@ -1148,14 +1148,14 @@ int SingleDuel::Analyze(unsigned char* msgbuffer, unsigned int len) { ...@@ -1148,14 +1148,14 @@ int SingleDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
break; break;
} }
case MSG_CARD_SELECTED: { case MSG_CARD_SELECTED: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 4; pbuf += count * 4;
break; break;
} }
case MSG_RANDOM_SELECTED: { case MSG_RANDOM_SELECTED: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 4; pbuf += count * 4;
NetServer::SendBufferToPlayer(players[player], STOC_GAME_MSG, offset, pbuf - offset); NetServer::SendBufferToPlayer(players[player], STOC_GAME_MSG, offset, pbuf - offset);
NetServer::ReSendToPlayer(players[1]); NetServer::ReSendToPlayer(players[1]);
...@@ -1164,7 +1164,7 @@ int SingleDuel::Analyze(unsigned char* msgbuffer, unsigned int len) { ...@@ -1164,7 +1164,7 @@ int SingleDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
break; break;
} }
case MSG_BECOME_TARGET: { case MSG_BECOME_TARGET: {
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 4; pbuf += count * 4;
NetServer::SendBufferToPlayer(players[0], STOC_GAME_MSG, offset, pbuf - offset); NetServer::SendBufferToPlayer(players[0], STOC_GAME_MSG, offset, pbuf - offset);
NetServer::ReSendToPlayer(players[1]); NetServer::ReSendToPlayer(players[1]);
...@@ -1173,8 +1173,8 @@ int SingleDuel::Analyze(unsigned char* msgbuffer, unsigned int len) { ...@@ -1173,8 +1173,8 @@ int SingleDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
break; break;
} }
case MSG_DRAW: { case MSG_DRAW: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbufw = pbuf; pbufw = pbuf;
pbuf += count * 4; pbuf += count * 4;
NetServer::SendBufferToPlayer(players[player], STOC_GAME_MSG, offset, pbuf - offset); NetServer::SendBufferToPlayer(players[player], STOC_GAME_MSG, offset, pbuf - offset);
...@@ -1317,8 +1317,8 @@ int SingleDuel::Analyze(unsigned char* msgbuffer, unsigned int len) { ...@@ -1317,8 +1317,8 @@ int SingleDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
break; break;
} }
case MSG_TOSS_COIN: { case MSG_TOSS_COIN: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count; pbuf += count;
NetServer::SendBufferToPlayer(players[0], STOC_GAME_MSG, offset, pbuf - offset); NetServer::SendBufferToPlayer(players[0], STOC_GAME_MSG, offset, pbuf - offset);
NetServer::ReSendToPlayer(players[1]); NetServer::ReSendToPlayer(players[1]);
...@@ -1327,8 +1327,8 @@ int SingleDuel::Analyze(unsigned char* msgbuffer, unsigned int len) { ...@@ -1327,8 +1327,8 @@ int SingleDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
break; break;
} }
case MSG_TOSS_DICE: { case MSG_TOSS_DICE: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count; pbuf += count;
NetServer::SendBufferToPlayer(players[0], STOC_GAME_MSG, offset, pbuf - offset); NetServer::SendBufferToPlayer(players[0], STOC_GAME_MSG, offset, pbuf - offset);
NetServer::ReSendToPlayer(players[1]); NetServer::ReSendToPlayer(players[1]);
...@@ -1337,7 +1337,7 @@ int SingleDuel::Analyze(unsigned char* msgbuffer, unsigned int len) { ...@@ -1337,7 +1337,7 @@ int SingleDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
break; break;
} }
case MSG_ROCK_PAPER_SCISSORS: { case MSG_ROCK_PAPER_SCISSORS: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
WaitforResponse(player); WaitforResponse(player);
NetServer::SendBufferToPlayer(players[player], STOC_GAME_MSG, offset, pbuf - offset); NetServer::SendBufferToPlayer(players[player], STOC_GAME_MSG, offset, pbuf - offset);
return 1; return 1;
...@@ -1351,14 +1351,14 @@ int SingleDuel::Analyze(unsigned char* msgbuffer, unsigned int len) { ...@@ -1351,14 +1351,14 @@ int SingleDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
break; break;
} }
case MSG_ANNOUNCE_RACE: { case MSG_ANNOUNCE_RACE: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
pbuf += 5; pbuf += 5;
WaitforResponse(player); WaitforResponse(player);
NetServer::SendBufferToPlayer(players[player], STOC_GAME_MSG, offset, pbuf - offset); NetServer::SendBufferToPlayer(players[player], STOC_GAME_MSG, offset, pbuf - offset);
return 1; return 1;
} }
case MSG_ANNOUNCE_ATTRIB: { case MSG_ANNOUNCE_ATTRIB: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
pbuf += 5; pbuf += 5;
WaitforResponse(player); WaitforResponse(player);
NetServer::SendBufferToPlayer(players[player], STOC_GAME_MSG, offset, pbuf - offset); NetServer::SendBufferToPlayer(players[player], STOC_GAME_MSG, offset, pbuf - offset);
...@@ -1366,7 +1366,7 @@ int SingleDuel::Analyze(unsigned char* msgbuffer, unsigned int len) { ...@@ -1366,7 +1366,7 @@ int SingleDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
} }
case MSG_ANNOUNCE_CARD: case MSG_ANNOUNCE_CARD:
case MSG_ANNOUNCE_NUMBER: { case MSG_ANNOUNCE_NUMBER: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
count = BufferIO::ReadUInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += 4 * count; pbuf += 4 * count;
WaitforResponse(player); WaitforResponse(player);
......
...@@ -192,8 +192,8 @@ bool SingleMode::SinglePlayAnalyze(unsigned char* msg, unsigned int len) { ...@@ -192,8 +192,8 @@ bool SingleMode::SinglePlayAnalyze(unsigned char* msg, unsigned int len) {
break; break;
} }
case MSG_HINT: { case MSG_HINT: {
/*int type = */BufferIO::ReadInt8(pbuf); /*int type = */BufferIO::ReadUInt8(pbuf);
int player = BufferIO::ReadInt8(pbuf); int player = BufferIO::ReadUInt8(pbuf);
/*int data = */BufferIO::ReadInt32(pbuf); /*int data = */BufferIO::ReadInt32(pbuf);
if(player == 0) if(player == 0)
DuelClient::ClientAnalyze(offset, pbuf - offset); DuelClient::ClientAnalyze(offset, pbuf - offset);
...@@ -205,10 +205,10 @@ bool SingleMode::SinglePlayAnalyze(unsigned char* msg, unsigned int len) { ...@@ -205,10 +205,10 @@ bool SingleMode::SinglePlayAnalyze(unsigned char* msg, unsigned int len) {
return false; return false;
} }
case MSG_SELECT_BATTLECMD: { case MSG_SELECT_BATTLECMD: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 11; pbuf += count * 11;
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 8 + 2; pbuf += count * 8 + 2;
SinglePlayRefresh(); SinglePlayRefresh();
if(!DuelClient::ClientAnalyze(offset, pbuf - offset)) { if(!DuelClient::ClientAnalyze(offset, pbuf - offset)) {
...@@ -218,18 +218,18 @@ bool SingleMode::SinglePlayAnalyze(unsigned char* msg, unsigned int len) { ...@@ -218,18 +218,18 @@ bool SingleMode::SinglePlayAnalyze(unsigned char* msg, unsigned int len) {
break; break;
} }
case MSG_SELECT_IDLECMD: { case MSG_SELECT_IDLECMD: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 7; pbuf += count * 7;
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 7; pbuf += count * 7;
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 7; pbuf += count * 7;
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 7; pbuf += count * 7;
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 7; pbuf += count * 7;
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 11 + 3; pbuf += count * 11 + 3;
SinglePlayRefresh(); SinglePlayRefresh();
if(!DuelClient::ClientAnalyze(offset, pbuf - offset)) { if(!DuelClient::ClientAnalyze(offset, pbuf - offset)) {
...@@ -239,7 +239,7 @@ bool SingleMode::SinglePlayAnalyze(unsigned char* msg, unsigned int len) { ...@@ -239,7 +239,7 @@ bool SingleMode::SinglePlayAnalyze(unsigned char* msg, unsigned int len) {
break; break;
} }
case MSG_SELECT_EFFECTYN: { case MSG_SELECT_EFFECTYN: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
pbuf += 12; pbuf += 12;
DuelClient::ClientAnalyze(offset, pbuf - offset); DuelClient::ClientAnalyze(offset, pbuf - offset);
if(!DuelClient::ClientAnalyze(offset, pbuf - offset)) { if(!DuelClient::ClientAnalyze(offset, pbuf - offset)) {
...@@ -249,7 +249,7 @@ bool SingleMode::SinglePlayAnalyze(unsigned char* msg, unsigned int len) { ...@@ -249,7 +249,7 @@ bool SingleMode::SinglePlayAnalyze(unsigned char* msg, unsigned int len) {
break; break;
} }
case MSG_SELECT_YESNO: { case MSG_SELECT_YESNO: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
pbuf += 4; pbuf += 4;
if(!DuelClient::ClientAnalyze(offset, pbuf - offset)) { if(!DuelClient::ClientAnalyze(offset, pbuf - offset)) {
mainGame->singleSignal.Reset(); mainGame->singleSignal.Reset();
...@@ -258,8 +258,8 @@ bool SingleMode::SinglePlayAnalyze(unsigned char* msg, unsigned int len) { ...@@ -258,8 +258,8 @@ bool SingleMode::SinglePlayAnalyze(unsigned char* msg, unsigned int len) {
break; break;
} }
case MSG_SELECT_OPTION: { case MSG_SELECT_OPTION: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 4; pbuf += count * 4;
if(!DuelClient::ClientAnalyze(offset, pbuf - offset)) { if(!DuelClient::ClientAnalyze(offset, pbuf - offset)) {
mainGame->singleSignal.Reset(); mainGame->singleSignal.Reset();
...@@ -269,9 +269,9 @@ bool SingleMode::SinglePlayAnalyze(unsigned char* msg, unsigned int len) { ...@@ -269,9 +269,9 @@ bool SingleMode::SinglePlayAnalyze(unsigned char* msg, unsigned int len) {
} }
case MSG_SELECT_CARD: case MSG_SELECT_CARD:
case MSG_SELECT_TRIBUTE: { case MSG_SELECT_TRIBUTE: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
pbuf += 3; pbuf += 3;
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 8; pbuf += count * 8;
if(!DuelClient::ClientAnalyze(offset, pbuf - offset)) { if(!DuelClient::ClientAnalyze(offset, pbuf - offset)) {
mainGame->singleSignal.Reset(); mainGame->singleSignal.Reset();
...@@ -280,11 +280,11 @@ bool SingleMode::SinglePlayAnalyze(unsigned char* msg, unsigned int len) { ...@@ -280,11 +280,11 @@ bool SingleMode::SinglePlayAnalyze(unsigned char* msg, unsigned int len) {
break; break;
} }
case MSG_SELECT_UNSELECT_CARD: { case MSG_SELECT_UNSELECT_CARD: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
pbuf += 4; pbuf += 4;
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 8; pbuf += count * 8;
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 8; pbuf += count * 8;
if(!DuelClient::ClientAnalyze(offset, pbuf - offset)) { if(!DuelClient::ClientAnalyze(offset, pbuf - offset)) {
mainGame->singleSignal.Reset(); mainGame->singleSignal.Reset();
...@@ -293,8 +293,8 @@ bool SingleMode::SinglePlayAnalyze(unsigned char* msg, unsigned int len) { ...@@ -293,8 +293,8 @@ bool SingleMode::SinglePlayAnalyze(unsigned char* msg, unsigned int len) {
break; break;
} }
case MSG_SELECT_CHAIN: { case MSG_SELECT_CHAIN: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += 10 + count * 13; pbuf += 10 + count * 13;
if(!DuelClient::ClientAnalyze(offset, pbuf - offset)) { if(!DuelClient::ClientAnalyze(offset, pbuf - offset)) {
mainGame->singleSignal.Reset(); mainGame->singleSignal.Reset();
...@@ -304,7 +304,7 @@ bool SingleMode::SinglePlayAnalyze(unsigned char* msg, unsigned int len) { ...@@ -304,7 +304,7 @@ bool SingleMode::SinglePlayAnalyze(unsigned char* msg, unsigned int len) {
} }
case MSG_SELECT_PLACE: case MSG_SELECT_PLACE:
case MSG_SELECT_DISFIELD: { case MSG_SELECT_DISFIELD: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
pbuf += 5; pbuf += 5;
if(!DuelClient::ClientAnalyze(offset, pbuf - offset)) { if(!DuelClient::ClientAnalyze(offset, pbuf - offset)) {
mainGame->singleSignal.Reset(); mainGame->singleSignal.Reset();
...@@ -313,7 +313,7 @@ bool SingleMode::SinglePlayAnalyze(unsigned char* msg, unsigned int len) { ...@@ -313,7 +313,7 @@ bool SingleMode::SinglePlayAnalyze(unsigned char* msg, unsigned int len) {
break; break;
} }
case MSG_SELECT_POSITION: { case MSG_SELECT_POSITION: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
pbuf += 5; pbuf += 5;
if(!DuelClient::ClientAnalyze(offset, pbuf - offset)) { if(!DuelClient::ClientAnalyze(offset, pbuf - offset)) {
mainGame->singleSignal.Reset(); mainGame->singleSignal.Reset();
...@@ -322,9 +322,9 @@ bool SingleMode::SinglePlayAnalyze(unsigned char* msg, unsigned int len) { ...@@ -322,9 +322,9 @@ bool SingleMode::SinglePlayAnalyze(unsigned char* msg, unsigned int len) {
break; break;
} }
case MSG_SELECT_COUNTER: { case MSG_SELECT_COUNTER: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
pbuf += 4; pbuf += 4;
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 9; pbuf += count * 9;
if(!DuelClient::ClientAnalyze(offset, pbuf - offset)) { if(!DuelClient::ClientAnalyze(offset, pbuf - offset)) {
mainGame->singleSignal.Reset(); mainGame->singleSignal.Reset();
...@@ -334,11 +334,11 @@ bool SingleMode::SinglePlayAnalyze(unsigned char* msg, unsigned int len) { ...@@ -334,11 +334,11 @@ bool SingleMode::SinglePlayAnalyze(unsigned char* msg, unsigned int len) {
} }
case MSG_SELECT_SUM: { case MSG_SELECT_SUM: {
pbuf++; pbuf++;
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
pbuf += 6; pbuf += 6;
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 11; pbuf += count * 11;
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 11; pbuf += count * 11;
if(!DuelClient::ClientAnalyze(offset, pbuf - offset)) { if(!DuelClient::ClientAnalyze(offset, pbuf - offset)) {
mainGame->singleSignal.Reset(); mainGame->singleSignal.Reset();
...@@ -347,8 +347,8 @@ bool SingleMode::SinglePlayAnalyze(unsigned char* msg, unsigned int len) { ...@@ -347,8 +347,8 @@ bool SingleMode::SinglePlayAnalyze(unsigned char* msg, unsigned int len) {
break; break;
} }
case MSG_SORT_CARD: { case MSG_SORT_CARD: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 7; pbuf += count * 7;
if(!DuelClient::ClientAnalyze(offset, pbuf - offset)) { if(!DuelClient::ClientAnalyze(offset, pbuf - offset)) {
mainGame->singleSignal.Reset(); mainGame->singleSignal.Reset();
...@@ -357,42 +357,42 @@ bool SingleMode::SinglePlayAnalyze(unsigned char* msg, unsigned int len) { ...@@ -357,42 +357,42 @@ bool SingleMode::SinglePlayAnalyze(unsigned char* msg, unsigned int len) {
break; break;
} }
case MSG_CONFIRM_DECKTOP: { case MSG_CONFIRM_DECKTOP: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 7; pbuf += count * 7;
DuelClient::ClientAnalyze(offset, pbuf - offset); DuelClient::ClientAnalyze(offset, pbuf - offset);
break; break;
} }
case MSG_CONFIRM_EXTRATOP: { case MSG_CONFIRM_EXTRATOP: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 7; pbuf += count * 7;
DuelClient::ClientAnalyze(offset, pbuf - offset); DuelClient::ClientAnalyze(offset, pbuf - offset);
break; break;
} }
case MSG_CONFIRM_CARDS: { case MSG_CONFIRM_CARDS: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 7; pbuf += count * 7;
DuelClient::ClientAnalyze(offset, pbuf - offset); DuelClient::ClientAnalyze(offset, pbuf - offset);
break; break;
} }
case MSG_SHUFFLE_DECK: { case MSG_SHUFFLE_DECK: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
DuelClient::ClientAnalyze(offset, pbuf - offset); DuelClient::ClientAnalyze(offset, pbuf - offset);
SinglePlayRefreshDeck(player); SinglePlayRefreshDeck(player);
break; break;
} }
case MSG_SHUFFLE_HAND: { case MSG_SHUFFLE_HAND: {
/*int oplayer = */BufferIO::ReadInt8(pbuf); /*int oplayer = */BufferIO::ReadUInt8(pbuf);
int count = BufferIO::ReadInt8(pbuf); int count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 4; pbuf += count * 4;
DuelClient::ClientAnalyze(offset, pbuf - offset); DuelClient::ClientAnalyze(offset, pbuf - offset);
break; break;
} }
case MSG_SHUFFLE_EXTRA: { case MSG_SHUFFLE_EXTRA: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 4; pbuf += count * 4;
DuelClient::ClientAnalyze(offset, pbuf - offset); DuelClient::ClientAnalyze(offset, pbuf - offset);
break; break;
...@@ -403,7 +403,7 @@ bool SingleMode::SinglePlayAnalyze(unsigned char* msg, unsigned int len) { ...@@ -403,7 +403,7 @@ bool SingleMode::SinglePlayAnalyze(unsigned char* msg, unsigned int len) {
break; break;
} }
case MSG_SWAP_GRAVE_DECK: { case MSG_SWAP_GRAVE_DECK: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
DuelClient::ClientAnalyze(offset, pbuf - offset); DuelClient::ClientAnalyze(offset, pbuf - offset);
SinglePlayRefreshGrave(player); SinglePlayRefreshGrave(player);
break; break;
...@@ -421,13 +421,13 @@ bool SingleMode::SinglePlayAnalyze(unsigned char* msg, unsigned int len) { ...@@ -421,13 +421,13 @@ bool SingleMode::SinglePlayAnalyze(unsigned char* msg, unsigned int len) {
} }
case MSG_SHUFFLE_SET_CARD: { case MSG_SHUFFLE_SET_CARD: {
pbuf++; pbuf++;
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 8; pbuf += count * 8;
DuelClient::ClientAnalyze(offset, pbuf - offset); DuelClient::ClientAnalyze(offset, pbuf - offset);
break; break;
} }
case MSG_NEW_TURN: { case MSG_NEW_TURN: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
DuelClient::ClientAnalyze(offset, pbuf - offset); DuelClient::ClientAnalyze(offset, pbuf - offset);
break; break;
} }
...@@ -543,21 +543,21 @@ bool SingleMode::SinglePlayAnalyze(unsigned char* msg, unsigned int len) { ...@@ -543,21 +543,21 @@ bool SingleMode::SinglePlayAnalyze(unsigned char* msg, unsigned int len) {
} }
case MSG_CARD_SELECTED: case MSG_CARD_SELECTED:
case MSG_RANDOM_SELECTED: { case MSG_RANDOM_SELECTED: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 4; pbuf += count * 4;
DuelClient::ClientAnalyze(offset, pbuf - offset); DuelClient::ClientAnalyze(offset, pbuf - offset);
break; break;
} }
case MSG_BECOME_TARGET: { case MSG_BECOME_TARGET: {
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 4; pbuf += count * 4;
DuelClient::ClientAnalyze(offset, pbuf - offset); DuelClient::ClientAnalyze(offset, pbuf - offset);
break; break;
} }
case MSG_DRAW: { case MSG_DRAW: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 4; pbuf += count * 4;
DuelClient::ClientAnalyze(offset, pbuf - offset); DuelClient::ClientAnalyze(offset, pbuf - offset);
break; break;
...@@ -642,21 +642,21 @@ bool SingleMode::SinglePlayAnalyze(unsigned char* msg, unsigned int len) { ...@@ -642,21 +642,21 @@ bool SingleMode::SinglePlayAnalyze(unsigned char* msg, unsigned int len) {
break; break;
} }
case MSG_TOSS_COIN: { case MSG_TOSS_COIN: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count; pbuf += count;
DuelClient::ClientAnalyze(offset, pbuf - offset); DuelClient::ClientAnalyze(offset, pbuf - offset);
break; break;
} }
case MSG_TOSS_DICE: { case MSG_TOSS_DICE: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count; pbuf += count;
DuelClient::ClientAnalyze(offset, pbuf - offset); DuelClient::ClientAnalyze(offset, pbuf - offset);
break; break;
} }
case MSG_ROCK_PAPER_SCISSORS: { case MSG_ROCK_PAPER_SCISSORS: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
if(!DuelClient::ClientAnalyze(offset, pbuf - offset)) { if(!DuelClient::ClientAnalyze(offset, pbuf - offset)) {
mainGame->singleSignal.Reset(); mainGame->singleSignal.Reset();
mainGame->singleSignal.Wait(); mainGame->singleSignal.Wait();
...@@ -669,7 +669,7 @@ bool SingleMode::SinglePlayAnalyze(unsigned char* msg, unsigned int len) { ...@@ -669,7 +669,7 @@ bool SingleMode::SinglePlayAnalyze(unsigned char* msg, unsigned int len) {
break; break;
} }
case MSG_ANNOUNCE_RACE: { case MSG_ANNOUNCE_RACE: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
pbuf += 5; pbuf += 5;
if(!DuelClient::ClientAnalyze(offset, pbuf - offset)) { if(!DuelClient::ClientAnalyze(offset, pbuf - offset)) {
mainGame->singleSignal.Reset(); mainGame->singleSignal.Reset();
...@@ -678,7 +678,7 @@ bool SingleMode::SinglePlayAnalyze(unsigned char* msg, unsigned int len) { ...@@ -678,7 +678,7 @@ bool SingleMode::SinglePlayAnalyze(unsigned char* msg, unsigned int len) {
break; break;
} }
case MSG_ANNOUNCE_ATTRIB: { case MSG_ANNOUNCE_ATTRIB: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
pbuf += 5; pbuf += 5;
if(!DuelClient::ClientAnalyze(offset, pbuf - offset)) { if(!DuelClient::ClientAnalyze(offset, pbuf - offset)) {
mainGame->singleSignal.Reset(); mainGame->singleSignal.Reset();
...@@ -688,7 +688,7 @@ bool SingleMode::SinglePlayAnalyze(unsigned char* msg, unsigned int len) { ...@@ -688,7 +688,7 @@ bool SingleMode::SinglePlayAnalyze(unsigned char* msg, unsigned int len) {
} }
case MSG_ANNOUNCE_CARD: case MSG_ANNOUNCE_CARD:
case MSG_ANNOUNCE_NUMBER: { case MSG_ANNOUNCE_NUMBER: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
count = BufferIO::ReadUInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += 4 * count; pbuf += 4 * count;
if(!DuelClient::ClientAnalyze(offset, pbuf - offset)) { if(!DuelClient::ClientAnalyze(offset, pbuf - offset)) {
...@@ -724,18 +724,18 @@ bool SingleMode::SinglePlayAnalyze(unsigned char* msg, unsigned int len) { ...@@ -724,18 +724,18 @@ bool SingleMode::SinglePlayAnalyze(unsigned char* msg, unsigned int len) {
for(int p = 0; p < 2; ++p) { for(int p = 0; p < 2; ++p) {
pbuf += 4; pbuf += 4;
for(int seq = 0; seq < 7; ++seq) { for(int seq = 0; seq < 7; ++seq) {
int val = BufferIO::ReadInt8(pbuf); int val = BufferIO::ReadUInt8(pbuf);
if(val) if(val)
pbuf += 2; pbuf += 2;
} }
for(int seq = 0; seq < 8; ++seq) { for(int seq = 0; seq < 8; ++seq) {
int val = BufferIO::ReadInt8(pbuf); int val = BufferIO::ReadUInt8(pbuf);
if(val) if(val)
pbuf++; pbuf++;
} }
pbuf += 6; pbuf += 6;
} }
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 15; pbuf += count * 15;
DuelClient::ClientAnalyze(offset, pbuf - offset); DuelClient::ClientAnalyze(offset, pbuf - offset);
SinglePlayReload(); SinglePlayReload();
......
...@@ -535,8 +535,8 @@ int TagDuel::Analyze(unsigned char* msgbuffer, unsigned int len) { ...@@ -535,8 +535,8 @@ int TagDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
return 1; return 1;
} }
case MSG_HINT: { case MSG_HINT: {
type = BufferIO::ReadInt8(pbuf); type = BufferIO::ReadUInt8(pbuf);
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
BufferIO::ReadInt32(pbuf); BufferIO::ReadInt32(pbuf);
switch (type) { switch (type) {
case 1: case 1:
...@@ -570,8 +570,8 @@ int TagDuel::Analyze(unsigned char* msgbuffer, unsigned int len) { ...@@ -570,8 +570,8 @@ int TagDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
break; break;
} }
case MSG_WIN: { case MSG_WIN: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
type = BufferIO::ReadInt8(pbuf); type = BufferIO::ReadUInt8(pbuf);
NetServer::SendBufferToPlayer(players[0], STOC_GAME_MSG, offset, pbuf - offset); NetServer::SendBufferToPlayer(players[0], STOC_GAME_MSG, offset, pbuf - offset);
NetServer::ReSendToPlayer(players[1]); NetServer::ReSendToPlayer(players[1]);
NetServer::ReSendToPlayer(players[2]); NetServer::ReSendToPlayer(players[2]);
...@@ -582,10 +582,10 @@ int TagDuel::Analyze(unsigned char* msgbuffer, unsigned int len) { ...@@ -582,10 +582,10 @@ int TagDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
return 2; return 2;
} }
case MSG_SELECT_BATTLECMD: { case MSG_SELECT_BATTLECMD: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 11; pbuf += count * 11;
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 8 + 2; pbuf += count * 8 + 2;
RefreshMzone(0); RefreshMzone(0);
RefreshMzone(1); RefreshMzone(1);
...@@ -598,18 +598,18 @@ int TagDuel::Analyze(unsigned char* msgbuffer, unsigned int len) { ...@@ -598,18 +598,18 @@ int TagDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
return 1; return 1;
} }
case MSG_SELECT_IDLECMD: { case MSG_SELECT_IDLECMD: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 7; pbuf += count * 7;
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 7; pbuf += count * 7;
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 7; pbuf += count * 7;
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 7; pbuf += count * 7;
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 7; pbuf += count * 7;
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 11 + 3; pbuf += count * 11 + 3;
RefreshMzone(0); RefreshMzone(0);
RefreshMzone(1); RefreshMzone(1);
...@@ -622,22 +622,22 @@ int TagDuel::Analyze(unsigned char* msgbuffer, unsigned int len) { ...@@ -622,22 +622,22 @@ int TagDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
return 1; return 1;
} }
case MSG_SELECT_EFFECTYN: { case MSG_SELECT_EFFECTYN: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
pbuf += 12; pbuf += 12;
WaitforResponse(player); WaitforResponse(player);
NetServer::SendBufferToPlayer(cur_player[player], STOC_GAME_MSG, offset, pbuf - offset); NetServer::SendBufferToPlayer(cur_player[player], STOC_GAME_MSG, offset, pbuf - offset);
return 1; return 1;
} }
case MSG_SELECT_YESNO: { case MSG_SELECT_YESNO: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
pbuf += 4; pbuf += 4;
WaitforResponse(player); WaitforResponse(player);
NetServer::SendBufferToPlayer(cur_player[player], STOC_GAME_MSG, offset, pbuf - offset); NetServer::SendBufferToPlayer(cur_player[player], STOC_GAME_MSG, offset, pbuf - offset);
return 1; return 1;
} }
case MSG_SELECT_OPTION: { case MSG_SELECT_OPTION: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 4; pbuf += count * 4;
WaitforResponse(player); WaitforResponse(player);
NetServer::SendBufferToPlayer(cur_player[player], STOC_GAME_MSG, offset, pbuf - offset); NetServer::SendBufferToPlayer(cur_player[player], STOC_GAME_MSG, offset, pbuf - offset);
...@@ -645,17 +645,17 @@ int TagDuel::Analyze(unsigned char* msgbuffer, unsigned int len) { ...@@ -645,17 +645,17 @@ int TagDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
} }
case MSG_SELECT_CARD: case MSG_SELECT_CARD:
case MSG_SELECT_TRIBUTE: { case MSG_SELECT_TRIBUTE: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
pbuf += 3; pbuf += 3;
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
int c/*, l, s, ss, code*/; int c/*, l, s, ss, code*/;
for (int i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {
pbufw = pbuf; pbufw = pbuf;
/*code = */BufferIO::ReadInt32(pbuf); /*code = */BufferIO::ReadInt32(pbuf);
c = BufferIO::ReadInt8(pbuf); c = BufferIO::ReadUInt8(pbuf);
/*l = */BufferIO::ReadInt8(pbuf); /*l = */BufferIO::ReadUInt8(pbuf);
/*s = */BufferIO::ReadInt8(pbuf); /*s = */BufferIO::ReadUInt8(pbuf);
/*ss = */BufferIO::ReadInt8(pbuf); /*ss = */BufferIO::ReadUInt8(pbuf);
if (c != player) BufferIO::WriteInt32(pbufw, 0); if (c != player) BufferIO::WriteInt32(pbufw, 0);
} }
WaitforResponse(player); WaitforResponse(player);
...@@ -663,27 +663,27 @@ int TagDuel::Analyze(unsigned char* msgbuffer, unsigned int len) { ...@@ -663,27 +663,27 @@ int TagDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
return 1; return 1;
} }
case MSG_SELECT_UNSELECT_CARD: { case MSG_SELECT_UNSELECT_CARD: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
pbuf += 4; pbuf += 4;
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
int c/*, l, s, ss, code*/; int c/*, l, s, ss, code*/;
for (int i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {
pbufw = pbuf; pbufw = pbuf;
/*code = */BufferIO::ReadInt32(pbuf); /*code = */BufferIO::ReadInt32(pbuf);
c = BufferIO::ReadInt8(pbuf); c = BufferIO::ReadUInt8(pbuf);
/*l = */BufferIO::ReadInt8(pbuf); /*l = */BufferIO::ReadUInt8(pbuf);
/*s = */BufferIO::ReadInt8(pbuf); /*s = */BufferIO::ReadUInt8(pbuf);
/*ss = */BufferIO::ReadInt8(pbuf); /*ss = */BufferIO::ReadUInt8(pbuf);
if (c != player) BufferIO::WriteInt32(pbufw, 0); if (c != player) BufferIO::WriteInt32(pbufw, 0);
} }
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
for (int i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {
pbufw = pbuf; pbufw = pbuf;
/*code = */BufferIO::ReadInt32(pbuf); /*code = */BufferIO::ReadInt32(pbuf);
c = BufferIO::ReadInt8(pbuf); c = BufferIO::ReadUInt8(pbuf);
/*l = */BufferIO::ReadInt8(pbuf); /*l = */BufferIO::ReadUInt8(pbuf);
/*s = */BufferIO::ReadInt8(pbuf); /*s = */BufferIO::ReadUInt8(pbuf);
/*ss = */BufferIO::ReadInt8(pbuf); /*ss = */BufferIO::ReadUInt8(pbuf);
if (c != player) BufferIO::WriteInt32(pbufw, 0); if (c != player) BufferIO::WriteInt32(pbufw, 0);
} }
WaitforResponse(player); WaitforResponse(player);
...@@ -691,8 +691,8 @@ int TagDuel::Analyze(unsigned char* msgbuffer, unsigned int len) { ...@@ -691,8 +691,8 @@ int TagDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
return 1; return 1;
} }
case MSG_SELECT_CHAIN: { case MSG_SELECT_CHAIN: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += 10 + count * 13; pbuf += 10 + count * 13;
WaitforResponse(player); WaitforResponse(player);
NetServer::SendBufferToPlayer(cur_player[player], STOC_GAME_MSG, offset, pbuf - offset); NetServer::SendBufferToPlayer(cur_player[player], STOC_GAME_MSG, offset, pbuf - offset);
...@@ -700,23 +700,23 @@ int TagDuel::Analyze(unsigned char* msgbuffer, unsigned int len) { ...@@ -700,23 +700,23 @@ int TagDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
} }
case MSG_SELECT_PLACE: case MSG_SELECT_PLACE:
case MSG_SELECT_DISFIELD: { case MSG_SELECT_DISFIELD: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
pbuf += 5; pbuf += 5;
WaitforResponse(player); WaitforResponse(player);
NetServer::SendBufferToPlayer(cur_player[player], STOC_GAME_MSG, offset, pbuf - offset); NetServer::SendBufferToPlayer(cur_player[player], STOC_GAME_MSG, offset, pbuf - offset);
return 1; return 1;
} }
case MSG_SELECT_POSITION: { case MSG_SELECT_POSITION: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
pbuf += 5; pbuf += 5;
WaitforResponse(player); WaitforResponse(player);
NetServer::SendBufferToPlayer(cur_player[player], STOC_GAME_MSG, offset, pbuf - offset); NetServer::SendBufferToPlayer(cur_player[player], STOC_GAME_MSG, offset, pbuf - offset);
return 1; return 1;
} }
case MSG_SELECT_COUNTER: { case MSG_SELECT_COUNTER: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
pbuf += 4; pbuf += 4;
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 9; pbuf += count * 9;
WaitforResponse(player); WaitforResponse(player);
NetServer::SendBufferToPlayer(cur_player[player], STOC_GAME_MSG, offset, pbuf - offset); NetServer::SendBufferToPlayer(cur_player[player], STOC_GAME_MSG, offset, pbuf - offset);
...@@ -724,27 +724,27 @@ int TagDuel::Analyze(unsigned char* msgbuffer, unsigned int len) { ...@@ -724,27 +724,27 @@ int TagDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
} }
case MSG_SELECT_SUM: { case MSG_SELECT_SUM: {
pbuf++; pbuf++;
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
pbuf += 6; pbuf += 6;
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 11; pbuf += count * 11;
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 11; pbuf += count * 11;
WaitforResponse(player); WaitforResponse(player);
NetServer::SendBufferToPlayer(cur_player[player], STOC_GAME_MSG, offset, pbuf - offset); NetServer::SendBufferToPlayer(cur_player[player], STOC_GAME_MSG, offset, pbuf - offset);
return 1; return 1;
} }
case MSG_SORT_CARD: { case MSG_SORT_CARD: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 7; pbuf += count * 7;
WaitforResponse(player); WaitforResponse(player);
NetServer::SendBufferToPlayer(cur_player[player], STOC_GAME_MSG, offset, pbuf - offset); NetServer::SendBufferToPlayer(cur_player[player], STOC_GAME_MSG, offset, pbuf - offset);
return 1; return 1;
} }
case MSG_CONFIRM_DECKTOP: { case MSG_CONFIRM_DECKTOP: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 7; pbuf += count * 7;
NetServer::SendBufferToPlayer(players[0], STOC_GAME_MSG, offset, pbuf - offset); NetServer::SendBufferToPlayer(players[0], STOC_GAME_MSG, offset, pbuf - offset);
NetServer::ReSendToPlayer(players[1]); NetServer::ReSendToPlayer(players[1]);
...@@ -755,8 +755,8 @@ int TagDuel::Analyze(unsigned char* msgbuffer, unsigned int len) { ...@@ -755,8 +755,8 @@ int TagDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
break; break;
} }
case MSG_CONFIRM_EXTRATOP: { case MSG_CONFIRM_EXTRATOP: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 7; pbuf += count * 7;
NetServer::SendBufferToPlayer(players[0], STOC_GAME_MSG, offset, pbuf - offset); NetServer::SendBufferToPlayer(players[0], STOC_GAME_MSG, offset, pbuf - offset);
NetServer::ReSendToPlayer(players[1]); NetServer::ReSendToPlayer(players[1]);
...@@ -767,8 +767,8 @@ int TagDuel::Analyze(unsigned char* msgbuffer, unsigned int len) { ...@@ -767,8 +767,8 @@ int TagDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
break; break;
} }
case MSG_CONFIRM_CARDS: { case MSG_CONFIRM_CARDS: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
if(pbuf[5] != LOCATION_DECK) { if(pbuf[5] != LOCATION_DECK) {
pbuf += count * 7; pbuf += count * 7;
NetServer::SendBufferToPlayer(players[0], STOC_GAME_MSG, offset, pbuf - offset); NetServer::SendBufferToPlayer(players[0], STOC_GAME_MSG, offset, pbuf - offset);
...@@ -784,7 +784,7 @@ int TagDuel::Analyze(unsigned char* msgbuffer, unsigned int len) { ...@@ -784,7 +784,7 @@ int TagDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
break; break;
} }
case MSG_SHUFFLE_DECK: { case MSG_SHUFFLE_DECK: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
NetServer::SendBufferToPlayer(players[0], STOC_GAME_MSG, offset, pbuf - offset); NetServer::SendBufferToPlayer(players[0], STOC_GAME_MSG, offset, pbuf - offset);
NetServer::ReSendToPlayer(players[1]); NetServer::ReSendToPlayer(players[1]);
NetServer::ReSendToPlayer(players[2]); NetServer::ReSendToPlayer(players[2]);
...@@ -794,8 +794,8 @@ int TagDuel::Analyze(unsigned char* msgbuffer, unsigned int len) { ...@@ -794,8 +794,8 @@ int TagDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
break; break;
} }
case MSG_SHUFFLE_HAND: { case MSG_SHUFFLE_HAND: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
NetServer::SendBufferToPlayer(cur_player[player], STOC_GAME_MSG, offset, (pbuf - offset) + count * 4); NetServer::SendBufferToPlayer(cur_player[player], STOC_GAME_MSG, offset, (pbuf - offset) + count * 4);
for(int i = 0; i < count; ++i) for(int i = 0; i < count; ++i)
BufferIO::WriteInt32(pbuf, 0); BufferIO::WriteInt32(pbuf, 0);
...@@ -808,8 +808,8 @@ int TagDuel::Analyze(unsigned char* msgbuffer, unsigned int len) { ...@@ -808,8 +808,8 @@ int TagDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
break; break;
} }
case MSG_SHUFFLE_EXTRA: { case MSG_SHUFFLE_EXTRA: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
NetServer::SendBufferToPlayer(cur_player[player], STOC_GAME_MSG, offset, (pbuf - offset) + count * 4); NetServer::SendBufferToPlayer(cur_player[player], STOC_GAME_MSG, offset, (pbuf - offset) + count * 4);
for(int i = 0; i < count; ++i) for(int i = 0; i < count; ++i)
BufferIO::WriteInt32(pbuf, 0); BufferIO::WriteInt32(pbuf, 0);
...@@ -832,7 +832,7 @@ int TagDuel::Analyze(unsigned char* msgbuffer, unsigned int len) { ...@@ -832,7 +832,7 @@ int TagDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
break; break;
} }
case MSG_SWAP_GRAVE_DECK: { case MSG_SWAP_GRAVE_DECK: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
NetServer::SendBufferToPlayer(players[0], STOC_GAME_MSG, offset, pbuf - offset); NetServer::SendBufferToPlayer(players[0], STOC_GAME_MSG, offset, pbuf - offset);
NetServer::ReSendToPlayer(players[1]); NetServer::ReSendToPlayer(players[1]);
NetServer::ReSendToPlayer(players[2]); NetServer::ReSendToPlayer(players[2]);
...@@ -862,8 +862,8 @@ int TagDuel::Analyze(unsigned char* msgbuffer, unsigned int len) { ...@@ -862,8 +862,8 @@ int TagDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
break; break;
} }
case MSG_SHUFFLE_SET_CARD: { case MSG_SHUFFLE_SET_CARD: {
int loc = BufferIO::ReadInt8(pbuf); unsigned int loc = BufferIO::ReadUInt8(pbuf);
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 8; pbuf += count * 8;
NetServer::SendBufferToPlayer(players[0], STOC_GAME_MSG, offset, pbuf - offset); NetServer::SendBufferToPlayer(players[0], STOC_GAME_MSG, offset, pbuf - offset);
NetServer::ReSendToPlayer(players[1]); NetServer::ReSendToPlayer(players[1]);
...@@ -1159,14 +1159,14 @@ int TagDuel::Analyze(unsigned char* msgbuffer, unsigned int len) { ...@@ -1159,14 +1159,14 @@ int TagDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
break; break;
} }
case MSG_CARD_SELECTED: { case MSG_CARD_SELECTED: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 4; pbuf += count * 4;
break; break;
} }
case MSG_RANDOM_SELECTED: { case MSG_RANDOM_SELECTED: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 4; pbuf += count * 4;
NetServer::SendBufferToPlayer(players[player], STOC_GAME_MSG, offset, pbuf - offset); NetServer::SendBufferToPlayer(players[player], STOC_GAME_MSG, offset, pbuf - offset);
NetServer::ReSendToPlayer(players[1]); NetServer::ReSendToPlayer(players[1]);
...@@ -1177,7 +1177,7 @@ int TagDuel::Analyze(unsigned char* msgbuffer, unsigned int len) { ...@@ -1177,7 +1177,7 @@ int TagDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
break; break;
} }
case MSG_BECOME_TARGET: { case MSG_BECOME_TARGET: {
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count * 4; pbuf += count * 4;
NetServer::SendBufferToPlayer(players[0], STOC_GAME_MSG, offset, pbuf - offset); NetServer::SendBufferToPlayer(players[0], STOC_GAME_MSG, offset, pbuf - offset);
NetServer::ReSendToPlayer(players[1]); NetServer::ReSendToPlayer(players[1]);
...@@ -1188,8 +1188,8 @@ int TagDuel::Analyze(unsigned char* msgbuffer, unsigned int len) { ...@@ -1188,8 +1188,8 @@ int TagDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
break; break;
} }
case MSG_DRAW: { case MSG_DRAW: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbufw = pbuf; pbufw = pbuf;
pbuf += count * 4; pbuf += count * 4;
NetServer::SendBufferToPlayer(cur_player[player], STOC_GAME_MSG, offset, pbuf - offset); NetServer::SendBufferToPlayer(cur_player[player], STOC_GAME_MSG, offset, pbuf - offset);
...@@ -1364,8 +1364,8 @@ int TagDuel::Analyze(unsigned char* msgbuffer, unsigned int len) { ...@@ -1364,8 +1364,8 @@ int TagDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
break; break;
} }
case MSG_TOSS_COIN: { case MSG_TOSS_COIN: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count; pbuf += count;
NetServer::SendBufferToPlayer(players[0], STOC_GAME_MSG, offset, pbuf - offset); NetServer::SendBufferToPlayer(players[0], STOC_GAME_MSG, offset, pbuf - offset);
NetServer::ReSendToPlayer(players[1]); NetServer::ReSendToPlayer(players[1]);
...@@ -1376,8 +1376,8 @@ int TagDuel::Analyze(unsigned char* msgbuffer, unsigned int len) { ...@@ -1376,8 +1376,8 @@ int TagDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
break; break;
} }
case MSG_TOSS_DICE: { case MSG_TOSS_DICE: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += count; pbuf += count;
NetServer::SendBufferToPlayer(players[0], STOC_GAME_MSG, offset, pbuf - offset); NetServer::SendBufferToPlayer(players[0], STOC_GAME_MSG, offset, pbuf - offset);
NetServer::ReSendToPlayer(players[1]); NetServer::ReSendToPlayer(players[1]);
...@@ -1388,7 +1388,7 @@ int TagDuel::Analyze(unsigned char* msgbuffer, unsigned int len) { ...@@ -1388,7 +1388,7 @@ int TagDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
break; break;
} }
case MSG_ROCK_PAPER_SCISSORS: { case MSG_ROCK_PAPER_SCISSORS: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
WaitforResponse(player); WaitforResponse(player);
NetServer::SendBufferToPlayer(cur_player[player], STOC_GAME_MSG, offset, pbuf - offset); NetServer::SendBufferToPlayer(cur_player[player], STOC_GAME_MSG, offset, pbuf - offset);
return 1; return 1;
...@@ -1404,14 +1404,14 @@ int TagDuel::Analyze(unsigned char* msgbuffer, unsigned int len) { ...@@ -1404,14 +1404,14 @@ int TagDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
break; break;
} }
case MSG_ANNOUNCE_RACE: { case MSG_ANNOUNCE_RACE: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
pbuf += 5; pbuf += 5;
WaitforResponse(player); WaitforResponse(player);
NetServer::SendBufferToPlayer(cur_player[player], STOC_GAME_MSG, offset, pbuf - offset); NetServer::SendBufferToPlayer(cur_player[player], STOC_GAME_MSG, offset, pbuf - offset);
return 1; return 1;
} }
case MSG_ANNOUNCE_ATTRIB: { case MSG_ANNOUNCE_ATTRIB: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
pbuf += 5; pbuf += 5;
WaitforResponse(player); WaitforResponse(player);
NetServer::SendBufferToPlayer(cur_player[player], STOC_GAME_MSG, offset, pbuf - offset); NetServer::SendBufferToPlayer(cur_player[player], STOC_GAME_MSG, offset, pbuf - offset);
...@@ -1419,7 +1419,7 @@ int TagDuel::Analyze(unsigned char* msgbuffer, unsigned int len) { ...@@ -1419,7 +1419,7 @@ int TagDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
} }
case MSG_ANNOUNCE_CARD: case MSG_ANNOUNCE_CARD:
case MSG_ANNOUNCE_NUMBER: { case MSG_ANNOUNCE_NUMBER: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
count = BufferIO::ReadUInt8(pbuf); count = BufferIO::ReadUInt8(pbuf);
pbuf += 4 * count; pbuf += 4 * count;
WaitforResponse(player); WaitforResponse(player);
...@@ -1447,11 +1447,11 @@ int TagDuel::Analyze(unsigned char* msgbuffer, unsigned int len) { ...@@ -1447,11 +1447,11 @@ int TagDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
break; break;
} }
case MSG_TAG_SWAP: { case MSG_TAG_SWAP: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadUInt8(pbuf);
/*int mcount = */BufferIO::ReadInt8(pbuf); /*int mcount = */BufferIO::ReadUInt8(pbuf);
int ecount = BufferIO::ReadInt8(pbuf); int ecount = BufferIO::ReadUInt8(pbuf);
/*int pcount = */BufferIO::ReadInt8(pbuf); /*int pcount = */BufferIO::ReadUInt8(pbuf);
int hcount = BufferIO::ReadInt8(pbuf); int hcount = BufferIO::ReadUInt8(pbuf);
pbufw = pbuf + 4; pbufw = pbuf + 4;
pbuf += hcount * 4 + ecount * 4 + 4; pbuf += hcount * 4 + ecount * 4 + 4;
NetServer::SendBufferToPlayer(cur_player[player], STOC_GAME_MSG, offset, pbuf - offset); NetServer::SendBufferToPlayer(cur_player[player], STOC_GAME_MSG, offset, pbuf - offset);
......
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