Commit b346701c authored by edo9300's avatar edo9300

Updated ReplayPacket

parent 01fc559d
......@@ -121,27 +121,6 @@ public:
return ret;
return 0;
}
struct ReplayPacket {
int message;
int length;
unsigned char data[0x2000];
ReplayPacket() {}
ReplayPacket(char * buf, int len) {
message = ReadInt8(buf);
length = len;
memcpy(data, buf, length);
}
ReplayPacket(int msg, char * buf, int len) {
message = msg;
length = len;
memcpy(data, buf, length);
}
void Set(int msg, char * buf, int len) {
message = msg;
length = len;
memcpy(data, buf, length);
}
};
};
#endif //BUFFERIO_H
......@@ -26,7 +26,7 @@ u64 DuelClient::select_hint = 0;
wchar_t DuelClient::event_string[256];
mtrandom DuelClient::rnd;
std::vector<BufferIO::ReplayPacket> DuelClient::replay_stream;
std::vector<ReplayPacket> DuelClient::replay_stream;
Replay DuelClient::last_replay;
bool DuelClient::old_replay = true;
......@@ -798,7 +798,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
char* prep = pdata;
ReplayHeader pheader;
memcpy(&pheader, prep, sizeof(ReplayHeader));
replay_stream.push_back(BufferIO::ReplayPacket(OLD_REPLAY_MODE, prep, len - 1));
replay_stream.push_back(ReplayPacket(OLD_REPLAY_MODE, prep, len - 1));
if(mainGame->saveReplay) {
last_replay.BeginRecord(false);
last_replay.WriteHeader(pheader);
......@@ -1001,7 +1001,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
if(!mainGame->dInfo.isReplay || mainGame->dInfo.isOldReplay) {
mainGame->dInfo.curMsg = BufferIO::ReadUInt8(pbuf);
if(mainGame->dInfo.curMsg != MSG_WAITING) {
BufferIO::ReplayPacket p;
ReplayPacket p;
p.message = mainGame->dInfo.curMsg;
p.length = len - 1;
memcpy(p.data, pbuf, p.length);
......
......@@ -46,8 +46,9 @@ public:
static void ClientEvent(bufferevent *bev, short events, void *ctx);
static int ClientThread(void* param);
static void HandleSTOCPacketLan(char* data, unsigned int len);
static std::vector<BufferIO::ReplayPacket> replay_stream;
static std::vector<ReplayPacket> replay_stream;
static Replay last_replay;
static bool old_replay;
static int ClientAnalyze(char* msg, unsigned int len);
static void SetResponseI(int respI);
static void SetResponseB(void* respB, unsigned char len);
......
......@@ -7,6 +7,22 @@
namespace ygo {
ReplayPacket::ReplayPacket(char * buf, int len) {
message = BufferIO::ReadInt8(buf);
length = len;
memcpy(data, buf, length);
}
ReplayPacket::ReplayPacket(int msg, char * buf, int len) {
message = msg;
length = len;
memcpy(data, buf, length);
}
void ReplayPacket::Set(int msg, char * buf, int len) {
message = msg;
length = len;
memcpy(data, buf, length);
}
Replay::Replay() {
is_recording = false;
is_replaying = false;
......@@ -40,12 +56,12 @@ void Replay::BeginRecord(bool write) {
pdata = replay_data;
is_recording = true;
}
void Replay::WritePacket(BufferIO::ReplayPacket p) {
void Replay::WritePacket(ReplayPacket p) {
WriteInt8(p.message, false);
WriteInt32(p.length, false);
WriteData((char*)p.data, p.length);
}
void Replay::WriteStream(std::vector<BufferIO::ReplayPacket> stream) {
void Replay::WriteStream(std::vector<ReplayPacket> stream) {
if(stream.size())
for(auto it = stream.begin(); it != stream.end(); it++)
WritePacket((*it));
......@@ -216,7 +232,7 @@ bool Replay::CheckReplay(const wchar_t* name) {
fclose(rfp);
return (rheader.id == 0x31707279 || rheader.id == 0x58707279) && rheader.version >= 0x12d0;
}
bool Replay::ReadNextPacket(BufferIO::ReplayPacket* packet) {
bool Replay::ReadNextPacket(ReplayPacket* packet) {
if (pdata - replay_data >= (int)replay_size)
return false;
packet->message = *pdata++;
......@@ -273,7 +289,7 @@ void Replay::Rewind() {
bool Replay::LoadYrp() {
if (pheader.flag & REPLAY_NEWREPLAY) {
pdata += (4 + ((pheader.flag & REPLAY_TAG) ? 160 : 80));
BufferIO::ReplayPacket p;
ReplayPacket p;
while (ReadNextPacket(&p))
if (p.message == OLD_REPLAY_MODE) {
char* prep = (char*)p.data;
......
......@@ -23,13 +23,24 @@ struct ReplayHeader {
unsigned char props[8];
};
class ReplayPacket {
public:
int message;
int length;
unsigned char data[0x2000];
ReplayPacket() {}
ReplayPacket(char * buf, int len);
ReplayPacket(int msg, char * buf, int len);
void Set(int msg, char * buf, int len);
};
class Replay {
public:
Replay();
~Replay();
void BeginRecord(bool write = true);
void WriteStream(std::vector<BufferIO::ReplayPacket> stream);
void WritePacket(BufferIO::ReplayPacket p);
void WriteStream(std::vector<ReplayPacket> stream);
void WritePacket(ReplayPacket p);
void WriteHeader(ReplayHeader& header);
void WriteData(const void* data, unsigned int length, bool flush = true);
void WriteInt32(int data, bool flush = true);
......@@ -40,7 +51,7 @@ public:
void SaveReplay(const wchar_t* name);
bool OpenReplay(const wchar_t* name);
static bool CheckReplay(const wchar_t* name);
bool ReadNextPacket(BufferIO::ReplayPacket* packet);
bool ReadNextPacket(ReplayPacket* packet);
bool ReadNextResponse(unsigned char resp[64]);
void ReadName(wchar_t* data);
void ReadData(void* data, unsigned int length);
......
......@@ -11,7 +11,7 @@ namespace ygo {
long ReplayMode::pduel = 0;
bool ReplayMode::yrp = false;
Replay ReplayMode::cur_replay;
std::vector<BufferIO::ReplayPacket> ReplayMode::current_stream;
std::vector<ReplayPacket> ReplayMode::current_stream;
bool ReplayMode::is_continuing = true;
bool ReplayMode::is_closing = false;
bool ReplayMode::is_pausing = false;
......@@ -78,7 +78,7 @@ int ReplayMode::ReplayThread(void* param) {
mainGame->dInfo.duel_field = opt & 0xff;
mainGame->dInfo.extraval = (opt >> 8);
mainGame->SetPhaseButtons();
BufferIO::ReplayPacket p;
ReplayPacket p;
current_stream.clear();
while (cur_replay.ReadNextPacket(&p)) {
current_stream.push_back(p);
......@@ -177,7 +177,7 @@ void ReplayMode::Undo() {
mainGame->gMutex.Lock();
Pause(false, false);
}
bool ReplayMode::ReplayAnalyze(BufferIO::ReplayPacket p) {
bool ReplayMode::ReplayAnalyze(ReplayPacket p) {
is_restarting = false;
while(true) {
if(is_closing)
......
......@@ -27,7 +27,7 @@ private:
public:
static Replay cur_replay;
static std::vector<BufferIO::ReplayPacket> ReplayMode::current_stream;
static std::vector<ReplayPacket> ReplayMode::current_stream;
public:
static bool StartReplay(int skipturn);
......@@ -41,7 +41,7 @@ public:
static void EndDuel();
static void Restart(bool refresh);
static void Undo();
static bool ReplayAnalyze(BufferIO::ReplayPacket p);
static bool ReplayAnalyze(ReplayPacket p);
static bool ReplayAnalyze(char* msg, unsigned int len);
static void ReplayRefresh(int flag = 0xf81fff);
......
......@@ -9,7 +9,7 @@
namespace ygo {
std::vector<BufferIO::ReplayPacket> SingleDuel::replay_stream;
std::vector<ReplayPacket> SingleDuel::replay_stream;
SingleDuel::SingleDuel(bool is_match) {
game_started = false;
......@@ -187,7 +187,7 @@ void SingleDuel::LeaveGame(DuelPlayer* dp) {
NetServer::ReSendToPlayer(players[1]);
for(auto oit = observers.begin(); oit != observers.end(); ++oit)
NetServer::ReSendToPlayer(*oit);
BufferIO::ReplayPacket p((char*)wbuf, 3);
ReplayPacket p((char*)wbuf, 3);
replay_stream.push_back(p);
EndDuel();
NetServer::SendPacketToPlayer(players[0], STOC_DUEL_END);
......@@ -530,7 +530,7 @@ void SingleDuel::TPResult(DuelPlayer* dp, unsigned char tp) {
for(auto oit = observers.begin(); oit != observers.end(); ++oit)
NetServer::SendBufferToPlayer(*oit, STOC_GAME_MSG, startbuf, 18);
startbuf[1] = 0;
BufferIO::ReplayPacket p((char*)startbuf, 17);
ReplayPacket p((char*)startbuf, 17);
replay_stream.push_back(p);
PseudoRefreshDeck(0);
PseudoRefreshDeck(1);
......@@ -611,7 +611,7 @@ void SingleDuel::Surrender(DuelPlayer* dp) {
NetServer::ReSendToPlayer(players[1]);
for(auto oit = observers.begin(); oit != observers.end(); ++oit)
NetServer::ReSendToPlayer(*oit);
BufferIO::ReplayPacket p((char*)wbuf, 3);
ReplayPacket p((char*)wbuf, 3);
replay_stream.push_back(p);
if(players[player] == pplayer[player]) {
match_result[duel_count++] = 1 - player;
......@@ -630,7 +630,7 @@ int SingleDuel::Analyze(char* msgbuffer, unsigned int len) {
while (pbuf - msgbuffer < (int)len) {
replay_stream.clear();
bool record = true;
BufferIO::ReplayPacket p;
ReplayPacket p;
offset = pbuf;
unsigned char engType = BufferIO::ReadUInt8(pbuf);
p.message = engType;
......@@ -1496,7 +1496,7 @@ void SingleDuel::EndDuel() {
pbuf += sizeof(ReplayHeader);
memcpy(pbuf, last_replay.comp_data, last_replay.comp_size);
replay_stream.push_back(BufferIO::ReplayPacket(OLD_REPLAY_MODE, replaybuf, sizeof(ReplayHeader) + last_replay.comp_size));
replay_stream.push_back(ReplayPacket(OLD_REPLAY_MODE, replaybuf, sizeof(ReplayHeader) + last_replay.comp_size));
//in case of remaining packets, e.g. MSG_WIN
new_replay.WriteStream(replay_stream);
......@@ -1551,7 +1551,7 @@ void SingleDuel::RefreshMzone(int player, int flag, int use_cache) {
BufferIO::WriteInt8(qbuf, LOCATION_MZONE);
int len = query_field_card(pduel, player, LOCATION_MZONE, flag, (unsigned char*)qbuf, use_cache);
NetServer::SendBufferToPlayer(players[player], STOC_GAME_MSG, query_buffer, len + 3);
BufferIO::ReplayPacket p((char*)query_buffer, len + 2);
ReplayPacket p((char*)query_buffer, len + 2);
replay_stream.push_back(p);
int qlen = 0;
while (qlen < len) {
......@@ -1575,7 +1575,7 @@ void SingleDuel::RefreshSzone(int player, int flag, int use_cache) {
BufferIO::WriteInt8(qbuf, LOCATION_SZONE);
int len = query_field_card(pduel, player, LOCATION_SZONE, flag, (unsigned char*)qbuf, use_cache);
NetServer::SendBufferToPlayer(players[player], STOC_GAME_MSG, query_buffer, len + 3);
BufferIO::ReplayPacket p((char*)query_buffer, len + 2);
ReplayPacket p((char*)query_buffer, len + 2);
replay_stream.push_back(p);
int qlen = 0;
while (qlen < len) {
......@@ -1616,7 +1616,7 @@ void SingleDuel::RefreshHand(int player, int flag, int use_cache) {
NetServer::SendBufferToPlayer(players[1 - player], STOC_GAME_MSG, query_buffer, len + 3);
for(auto pit = observers.begin(); pit != observers.end(); ++pit)
NetServer::ReSendToPlayer(*pit);
BufferIO::ReplayPacket p((char*)query_buffer, len + 2);
ReplayPacket p((char*)query_buffer, len + 2);
replay_stream.push_back(p);
}
void SingleDuel::RefreshGrave(int player, int flag, int use_cache) {
......@@ -1630,7 +1630,7 @@ void SingleDuel::RefreshGrave(int player, int flag, int use_cache) {
NetServer::ReSendToPlayer(players[1]);
for(auto pit = observers.begin(); pit != observers.end(); ++pit)
NetServer::ReSendToPlayer(*pit);
BufferIO::ReplayPacket p((char*)query_buffer, len + 2);
ReplayPacket p((char*)query_buffer, len + 2);
replay_stream.push_back(p);
}
void SingleDuel::RefreshExtra(int player, int flag, int use_cache) {
......@@ -1641,7 +1641,7 @@ void SingleDuel::RefreshExtra(int player, int flag, int use_cache) {
BufferIO::WriteInt8(qbuf, LOCATION_EXTRA);
int len = query_field_card(pduel, player, LOCATION_EXTRA, flag, (unsigned char*)qbuf, use_cache);
NetServer::SendBufferToPlayer(players[player], STOC_GAME_MSG, query_buffer, len + 3);
BufferIO::ReplayPacket p((char*)query_buffer, len + 2);
ReplayPacket p((char*)query_buffer, len + 2);
replay_stream.push_back(p);
}
void SingleDuel::RefreshSingle(int player, int location, int sequence, int flag) {
......@@ -1653,7 +1653,7 @@ void SingleDuel::RefreshSingle(int player, int location, int sequence, int flag)
BufferIO::WriteInt8(qbuf, sequence);
int len = query_card(pduel, player, location, sequence, flag, (unsigned char*)qbuf, 0);
NetServer::SendBufferToPlayer(players[player], STOC_GAME_MSG, query_buffer, len + 4);
BufferIO::ReplayPacket p((char*)query_buffer, len + 3);
ReplayPacket p((char*)query_buffer, len + 3);
replay_stream.push_back(p);
if(location == LOCATION_REMOVED && (qbuf[15] & POS_FACEDOWN))
return;
......@@ -1670,7 +1670,7 @@ void SingleDuel::PseudoRefreshDeck(int player, int flag) {
BufferIO::WriteInt8(qbuf, player);
BufferIO::WriteInt8(qbuf, LOCATION_DECK);
int len = query_field_card(pduel, player, LOCATION_DECK, flag, (unsigned char*)qbuf, 0);
BufferIO::ReplayPacket p((char*)query_buffer, len + 2);
ReplayPacket p((char*)query_buffer, len + 2);
replay_stream.push_back(p);
}
int SingleDuel::MessageHandler(long fduel, int type) {
......@@ -1694,7 +1694,7 @@ void SingleDuel::SingleTimer(evutil_socket_t fd, short events, void* arg) {
NetServer::ReSendToPlayer(sd->players[1]);
for(auto oit = sd->observers.begin(); oit != sd->observers.end(); ++oit)
NetServer::ReSendToPlayer(*oit);
BufferIO::ReplayPacket p((char*)wbuf, 3);
ReplayPacket p((char*)wbuf, 3);
sd->replay_stream.push_back(p);
if(sd->players[player] == sd->pplayer[player]) {
sd->match_result[sd->duel_count++] = 1 - player;
......
......@@ -42,7 +42,7 @@ public:
static void SingleTimer(evutil_socket_t fd, short events, void* arg);
void PseudoRefreshDeck(int player, int flag = 0x181fff);
static std::vector<BufferIO::ReplayPacket> replay_stream;
static std::vector<ReplayPacket> replay_stream;
protected:
DuelPlayer* players[2];
......
......@@ -12,7 +12,7 @@ bool SingleMode::is_closing = false;
bool SingleMode::is_continuing = false;
Replay SingleMode::last_replay;
Replay SingleMode::new_replay;
std::vector<BufferIO::ReplayPacket> SingleMode::replay_stream;
std::vector<ReplayPacket> SingleMode::replay_stream;
static byte buffer[0x20000];
......@@ -151,7 +151,7 @@ int SingleMode::SinglePlayThread(void* param) {
pbuf += sizeof(ReplayHeader);
memcpy(pbuf, last_replay.comp_data, last_replay.comp_size);
new_replay.WritePacket(BufferIO::ReplayPacket(OLD_REPLAY_MODE, replaybuf, sizeof(ReplayHeader) + last_replay.comp_size));
new_replay.WritePacket(ReplayPacket(OLD_REPLAY_MODE, replaybuf, sizeof(ReplayHeader) + last_replay.comp_size));
new_replay.EndRecord();
time_t nowtime = time(NULL);
......@@ -196,7 +196,7 @@ bool SingleMode::SinglePlayAnalyze(char* msg, unsigned int len) {
if(is_closing || !is_continuing)
return false;
offset = pbuf;
BufferIO::ReplayPacket p;
ReplayPacket p;
mainGame->dInfo.curMsg = BufferIO::ReadUInt8(pbuf);
p.message = mainGame->dInfo.curMsg;
p.length = len - 1;
......@@ -881,13 +881,13 @@ void SingleMode::SinglePlayRefresh(int player, int location, int flag) {
unsigned char queryBuffer[0x2000];
char queryBuffer2[0x2000];
char* qbuf = queryBuffer2;
BufferIO::ReplayPacket p;
ReplayPacket p;
int len = query_field_card(pduel, player, location, flag, queryBuffer, 0);
mainGame->dField.UpdateFieldCard(mainGame->LocalPlayer(player), location, (char*)queryBuffer);
BufferIO::WriteInt8(qbuf, player);
BufferIO::WriteInt8(qbuf, location);
memcpy(qbuf, (char*)queryBuffer, len);
replay_stream.push_back(BufferIO::ReplayPacket(MSG_UPDATE_DATA, queryBuffer2, len + 2));
replay_stream.push_back(ReplayPacket(MSG_UPDATE_DATA, queryBuffer2, len + 2));
}
void SingleMode::SinglePlayRefreshSingle(int player, int location, int sequence, int flag) {
unsigned char queryBuffer[0x2000];
......@@ -899,7 +899,7 @@ void SingleMode::SinglePlayRefreshSingle(int player, int location, int sequence,
BufferIO::WriteInt8(qbuf, location);
BufferIO::WriteInt8(qbuf, sequence);
memcpy(qbuf, (char*)queryBuffer, len);
BufferIO::ReplayPacket p(MSG_UPDATE_CARD, queryBuffer2, len + 3);
ReplayPacket p(MSG_UPDATE_CARD, queryBuffer2, len + 3);
replay_stream.push_back(p);
}
void SingleMode::SinglePlayRefresh(int flag) {
......
......@@ -29,7 +29,7 @@ public:
protected:
static Replay last_replay;
static Replay new_replay;
static std::vector<BufferIO::ReplayPacket> replay_stream;
static std::vector<ReplayPacket> replay_stream;
};
}
......
......@@ -9,7 +9,7 @@
namespace ygo {
std::vector<BufferIO::ReplayPacket> TagDuel::replay_stream;
std::vector<ReplayPacket> TagDuel::replay_stream;
TagDuel::TagDuel() {
game_started = false;
......@@ -533,7 +533,7 @@ void TagDuel::TPResult(DuelPlayer* dp, unsigned char tp) {
for(auto oit = observers.begin(); oit != observers.end(); ++oit)
NetServer::SendBufferToPlayer(*oit, STOC_GAME_MSG, startbuf, 18);
startbuf[1] = 0;
BufferIO::ReplayPacket p((char*)startbuf, 17);
ReplayPacket p((char*)startbuf, 17);
replay_stream.push_back(p);
PseudoRefreshDeck(0);
PseudoRefreshDeck(1);
......@@ -579,7 +579,7 @@ int TagDuel::Analyze(char* msgbuffer, unsigned int len) {
while (pbuf - msgbuffer < (int)len) {
replay_stream.clear();
bool record = true;
BufferIO::ReplayPacket p;
ReplayPacket p;
offset = pbuf;
unsigned char engType = BufferIO::ReadUInt8(pbuf);
p.message = engType;
......@@ -1579,7 +1579,7 @@ void TagDuel::EndDuel() {
pbuf += sizeof(ReplayHeader);
memcpy(pbuf, last_replay.comp_data, last_replay.comp_size);
replay_stream.push_back(BufferIO::ReplayPacket(OLD_REPLAY_MODE, replaybuf, sizeof(ReplayHeader) + last_replay.comp_size));
replay_stream.push_back(ReplayPacket(OLD_REPLAY_MODE, replaybuf, sizeof(ReplayHeader) + last_replay.comp_size));
//in case of remaining packets, e.g. MSG_WIN
new_replay.WriteStream(replay_stream);
......@@ -1642,7 +1642,7 @@ void TagDuel::RefreshMzone(int player, int flag, int use_cache) {
int len = query_field_card(pduel, player, LOCATION_MZONE, flag, (unsigned char*)qbuf, use_cache);
int pid = (player == 0) ? 0 : 2;
NetServer::SendBufferToPlayer(players[pid], STOC_GAME_MSG, query_buffer, len + 3);
BufferIO::ReplayPacket p((char*)query_buffer, len + 2);
ReplayPacket p((char*)query_buffer, len + 2);
replay_stream.push_back(p);
NetServer::ReSendToPlayer(players[pid + 1]);
int qlen = 0;
......@@ -1670,7 +1670,7 @@ void TagDuel::RefreshSzone(int player, int flag, int use_cache) {
int len = query_field_card(pduel, player, LOCATION_SZONE, flag, (unsigned char*)qbuf, use_cache);
int pid = (player == 0) ? 0 : 2;
NetServer::SendBufferToPlayer(players[pid], STOC_GAME_MSG, query_buffer, len + 3);
BufferIO::ReplayPacket p((char*)query_buffer, len + 2);
ReplayPacket p((char*)query_buffer, len + 2);
replay_stream.push_back(p);
NetServer::ReSendToPlayer(players[pid + 1]);
int qlen = 0;
......@@ -1697,7 +1697,7 @@ void TagDuel::RefreshHand(int player, int flag, int use_cache) {
BufferIO::WriteInt8(qbuf, LOCATION_HAND);
int len = query_field_card(pduel, player, LOCATION_HAND, flag | QUERY_IS_PUBLIC, (unsigned char*)qbuf, use_cache);
NetServer::SendBufferToPlayer(cur_player[player], STOC_GAME_MSG, query_buffer, len + 3);
BufferIO::ReplayPacket p((char*)query_buffer, len + 2);
ReplayPacket p((char*)query_buffer, len + 2);
replay_stream.push_back(p);
int qlen = 0;
while(qlen < len) {
......@@ -1732,7 +1732,7 @@ void TagDuel::RefreshGrave(int player, int flag, int use_cache) {
NetServer::ReSendToPlayer(players[3]);
for(auto pit = observers.begin(); pit != observers.end(); ++pit)
NetServer::ReSendToPlayer(*pit);
BufferIO::ReplayPacket p((char*)query_buffer, len + 2);
ReplayPacket p((char*)query_buffer, len + 2);
replay_stream.push_back(p);
}
void TagDuel::RefreshExtra(int player, int flag, int use_cache) {
......@@ -1743,7 +1743,7 @@ void TagDuel::RefreshExtra(int player, int flag, int use_cache) {
BufferIO::WriteInt8(qbuf, LOCATION_EXTRA);
int len = query_field_card(pduel, player, LOCATION_EXTRA, flag, (unsigned char*)qbuf, use_cache);
NetServer::SendBufferToPlayer(cur_player[player], STOC_GAME_MSG, query_buffer, len + 3);
BufferIO::ReplayPacket p((char*)query_buffer, len + 2);
ReplayPacket p((char*)query_buffer, len + 2);
replay_stream.push_back(p);
}
void TagDuel::RefreshSingle(int player, int location, int sequence, int flag) {
......@@ -1754,7 +1754,7 @@ void TagDuel::RefreshSingle(int player, int location, int sequence, int flag) {
BufferIO::WriteInt8(qbuf, location);
BufferIO::WriteInt8(qbuf, sequence);
int len = query_card(pduel, player, location, sequence, flag, (unsigned char*)qbuf, 0);
BufferIO::ReplayPacket p((char*)query_buffer, len + 3);
ReplayPacket p((char*)query_buffer, len + 3);
replay_stream.push_back(p);
if(location & LOCATION_ONFIELD) {
int pid = (player == 0) ? 0 : 2;
......@@ -1789,7 +1789,7 @@ void TagDuel::PseudoRefreshDeck(int player, int flag) {
BufferIO::WriteInt8(qbuf, player);
BufferIO::WriteInt8(qbuf, LOCATION_DECK);
int len = query_field_card(pduel, player, LOCATION_DECK, flag, (unsigned char*)qbuf, 0);
BufferIO::ReplayPacket p((char*)query_buffer, len + 2);
ReplayPacket p((char*)query_buffer, len + 2);
replay_stream.push_back(p);
}
int TagDuel::MessageHandler(long fduel, int type) {
......@@ -1813,7 +1813,7 @@ void TagDuel::TagTimer(evutil_socket_t fd, short events, void* arg) {
NetServer::ReSendToPlayer(sd->players[1]);
NetServer::ReSendToPlayer(sd->players[2]);
NetServer::ReSendToPlayer(sd->players[3]);
BufferIO::ReplayPacket p((char*)wbuf, 3);
ReplayPacket p((char*)wbuf, 3);
sd->replay_stream.push_back(p);
sd->EndDuel();
sd->DuelEndProc();
......
......@@ -42,7 +42,7 @@ public:
static void TagTimer(evutil_socket_t fd, short events, void* arg);
void PseudoRefreshDeck(int player, int flag = 0x181fff);
static std::vector<BufferIO::ReplayPacket> replay_stream;
static std::vector<ReplayPacket> replay_stream;
protected:
DuelPlayer* players[4];
......
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