Commit d71e9504 authored by mercury233's avatar mercury233

Revert "Revert "MSG_ADD_COUNTER, MSG_REMOVE_COUNTER""

This reverts commit 51ec61cd.
parent aec969f8
...@@ -2648,7 +2648,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2648,7 +2648,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
int c = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int c = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
int l = BufferIO::ReadInt8(pbuf); int l = BufferIO::ReadInt8(pbuf);
int s = BufferIO::ReadInt8(pbuf); int s = BufferIO::ReadInt8(pbuf);
int count = BufferIO::ReadInt8(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))
pc->counters[type] += count; pc->counters[type] += count;
...@@ -2670,7 +2670,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2670,7 +2670,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
int c = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int c = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
int l = BufferIO::ReadInt8(pbuf); int l = BufferIO::ReadInt8(pbuf);
int s = BufferIO::ReadInt8(pbuf); int s = BufferIO::ReadInt8(pbuf);
int count = BufferIO::ReadInt8(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;
if (pc->counters[type] <= 0) if (pc->counters[type] <= 0)
......
...@@ -567,12 +567,12 @@ bool ReplayMode::ReplayAnalyze(char* msg, unsigned int len) { ...@@ -567,12 +567,12 @@ bool ReplayMode::ReplayAnalyze(char* msg, unsigned int len) {
break; break;
} }
case MSG_ADD_COUNTER: { case MSG_ADD_COUNTER: {
pbuf += 6; pbuf += 7;
DuelClient::ClientAnalyze(offset, pbuf - offset); DuelClient::ClientAnalyze(offset, pbuf - offset);
break; break;
} }
case MSG_REMOVE_COUNTER: { case MSG_REMOVE_COUNTER: {
pbuf += 6; pbuf += 7;
DuelClient::ClientAnalyze(offset, pbuf - offset); DuelClient::ClientAnalyze(offset, pbuf - offset);
break; break;
} }
......
...@@ -1212,7 +1212,7 @@ int SingleDuel::Analyze(char* msgbuffer, unsigned int len) { ...@@ -1212,7 +1212,7 @@ int SingleDuel::Analyze(char* msgbuffer, unsigned int len) {
break; break;
} }
case MSG_ADD_COUNTER: { case MSG_ADD_COUNTER: {
pbuf += 6; pbuf += 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]);
for(auto oit = observers.begin(); oit != observers.end(); ++oit) for(auto oit = observers.begin(); oit != observers.end(); ++oit)
...@@ -1220,7 +1220,7 @@ int SingleDuel::Analyze(char* msgbuffer, unsigned int len) { ...@@ -1220,7 +1220,7 @@ int SingleDuel::Analyze(char* msgbuffer, unsigned int len) {
break; break;
} }
case MSG_REMOVE_COUNTER: { case MSG_REMOVE_COUNTER: {
pbuf += 6; pbuf += 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]);
for(auto oit = observers.begin(); oit != observers.end(); ++oit) for(auto oit = observers.begin(); oit != observers.end(); ++oit)
......
...@@ -505,12 +505,12 @@ bool SingleMode::SinglePlayAnalyze(char* msg, unsigned int len) { ...@@ -505,12 +505,12 @@ bool SingleMode::SinglePlayAnalyze(char* msg, unsigned int len) {
break; break;
} }
case MSG_ADD_COUNTER: { case MSG_ADD_COUNTER: {
pbuf += 6; pbuf += 7;
DuelClient::ClientAnalyze(offset, pbuf - offset); DuelClient::ClientAnalyze(offset, pbuf - offset);
break; break;
} }
case MSG_REMOVE_COUNTER: { case MSG_REMOVE_COUNTER: {
pbuf += 6; pbuf += 7;
DuelClient::ClientAnalyze(offset, pbuf - offset); DuelClient::ClientAnalyze(offset, pbuf - offset);
break; break;
} }
......
...@@ -1237,7 +1237,7 @@ int TagDuel::Analyze(char* msgbuffer, unsigned int len) { ...@@ -1237,7 +1237,7 @@ int TagDuel::Analyze(char* msgbuffer, unsigned int len) {
break; break;
} }
case MSG_ADD_COUNTER: { case MSG_ADD_COUNTER: {
pbuf += 6; pbuf += 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]);
NetServer::ReSendToPlayer(players[2]); NetServer::ReSendToPlayer(players[2]);
...@@ -1247,7 +1247,7 @@ int TagDuel::Analyze(char* msgbuffer, unsigned int len) { ...@@ -1247,7 +1247,7 @@ int TagDuel::Analyze(char* msgbuffer, unsigned int len) {
break; break;
} }
case MSG_REMOVE_COUNTER: { case MSG_REMOVE_COUNTER: {
pbuf += 6; pbuf += 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]);
NetServer::ReSendToPlayer(players[2]); NetServer::ReSendToPlayer(players[2]);
......
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