Commit 09f36c87 authored by salix5's avatar salix5

MSG_ADD_COUNTER, MSG_REMOVE_COUNTER

number of counters should be uint16 (7 bytes after msg)
parent c0fe8f31
...@@ -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;
} }
......
...@@ -1159,7 +1159,7 @@ int SingleDuel::Analyze(char* msgbuffer, unsigned int len) { ...@@ -1159,7 +1159,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)
...@@ -1167,7 +1167,7 @@ int SingleDuel::Analyze(char* msgbuffer, unsigned int len) { ...@@ -1167,7 +1167,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;
} }
......
...@@ -1180,7 +1180,7 @@ int TagDuel::Analyze(char* msgbuffer, unsigned int len) { ...@@ -1180,7 +1180,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]);
...@@ -1190,7 +1190,7 @@ int TagDuel::Analyze(char* msgbuffer, unsigned int len) { ...@@ -1190,7 +1190,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]);
......
Subproject commit 254984eb568314cae7eda492261d14e1e6679758 Subproject commit 0a34f5dcb88617fb60902377193403947059ca90
Subproject commit a34425aff55ada884503625019cf8a82e08495e0 Subproject commit 550760f272fc3aec01ad2c05bda24a783d03cdc0
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