Commit 2ea30047 authored by nanahira's avatar nanahira

other fixes on server

parent 8b07a795
......@@ -31,6 +31,7 @@ namespace ygo {
Game* mainGame;
#ifndef YGOPRO_SERVER_MODE
void DuelInfo::Clear() {
isStarted = false;
isFinished = false;
......@@ -62,6 +63,7 @@ void DuelInfo::Clear() {
time_left[0] = 0;
time_left[1] = 0;
}
#endif
#ifdef YGOPRO_SERVER_MODE
unsigned short server_port;
......
......@@ -1820,7 +1820,7 @@ void SingleDuel::RequestField(DuelPlayer* dp) {
int player = dp->type;
NetServer::SendPacketToPlayer(dp, STOC_DUEL_START);
char startbuf[32], *pbuf = startbuf;
unsigned char startbuf[32], *pbuf = startbuf;
BufferIO::WriteInt8(pbuf, MSG_START);
BufferIO::WriteInt8(pbuf, player);
BufferIO::WriteInt8(pbuf, host_info.duel_rule);
......@@ -1836,18 +1836,18 @@ void SingleDuel::RequestField(DuelPlayer* dp) {
if(turn_player == 1)
newturn_count = 2;
for(int i = 0; i < newturn_count; i++) {
char turnbuf[2], *pbuf_t = turnbuf;
unsigned char turnbuf[2], *pbuf_t = turnbuf;
BufferIO::WriteInt8(pbuf_t, MSG_NEW_TURN);
BufferIO::WriteInt8(pbuf_t, i);
NetServer::SendBufferToPlayer(dp, STOC_GAME_MSG, turnbuf, 2);
}
char phasebuf[4], *pbuf_p = phasebuf;
unsigned char phasebuf[4], *pbuf_p = phasebuf;
BufferIO::WriteInt8(pbuf_p, MSG_NEW_PHASE);
BufferIO::WriteInt16(pbuf_p, phase);
NetServer::SendBufferToPlayer(dp, STOC_GAME_MSG, phasebuf, 3);
char query_buffer[1024];
unsigned char query_buffer[1024];
int length = query_field_info(pduel, (unsigned char*)query_buffer);
NetServer::SendBufferToPlayer(dp, STOC_GAME_MSG, query_buffer, length);
RefreshMzone(1 - player, 0xefffff, 0, dp);
......@@ -2095,7 +2095,7 @@ if(!dp || dp == players[player])
qbuf += clen - 4;
}
if(!dp || dp == players[1 - player])
NetServer::SendBufferToPlayer(players[1 - player], STOC_GAME_MSG, query_buffer, len + 3);
NetServer::SendBufferToPlayer(players[1 - player], STOC_GAME_MSG, query_buffer.data(), len + 3);
if(!dp)
for(auto pit = observers.begin(); pit != observers.end(); ++pit)
NetServer::ReSendToPlayer(*pit);
......
......@@ -1912,7 +1912,7 @@ void TagDuel::RequestField(DuelPlayer* dp) {
int player = (dp->type > 1) ? 1 : 0;
NetServer::SendPacketToPlayer(dp, STOC_DUEL_START);
char startbuf[32], *pbuf = startbuf;
unsigned char startbuf[32], *pbuf = startbuf;
BufferIO::WriteInt8(pbuf, MSG_START);
BufferIO::WriteInt8(pbuf, player);
BufferIO::WriteInt8(pbuf, host_info.duel_rule);
......@@ -1928,18 +1928,18 @@ void TagDuel::RequestField(DuelPlayer* dp) {
if(newturn_count == 0)
newturn_count = 4;
for(int i = 0; i < newturn_count; i++) {
char turnbuf[2], *pbuf_t = turnbuf;
unsigned char turnbuf[2], *pbuf_t = turnbuf;
BufferIO::WriteInt8(pbuf_t, MSG_NEW_TURN);
BufferIO::WriteInt8(pbuf_t, i % 2);
NetServer::SendBufferToPlayer(dp, STOC_GAME_MSG, turnbuf, 2);
}
char phasebuf[4], *pbuf_p = phasebuf;
unsigned char phasebuf[4], *pbuf_p = phasebuf;
BufferIO::WriteInt8(pbuf_p, MSG_NEW_PHASE);
BufferIO::WriteInt16(pbuf_p, phase);
NetServer::SendBufferToPlayer(dp, STOC_GAME_MSG, phasebuf, 3);
char query_buffer[1024];
unsigned char query_buffer[1024];
int length = query_field_info(pduel, (unsigned char*)query_buffer);
NetServer::SendBufferToPlayer(dp, STOC_GAME_MSG, query_buffer, length);
RefreshMzone(1 - player, 0xefffff, 0, dp);
......
Subproject commit 31785ae6e80d89f31290d0e2411225b44de6b785
Subproject commit 8a44abb6810a30a7aed0d2fd3d845c718f06e214
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