Commit 595e266a authored by edo9300's avatar edo9300

Fixes

parent 3a597afc
......@@ -796,7 +796,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_SYSTEM, prep, len - 1));
replay_stream.push_back(BufferIO::ReplayPacket(OLD_REPLAY_MODE, prep, len - 1));
if(old_replay && mainGame->saveReplay) {
last_replay.BeginRecord();
last_replay.WriteHeader(pheader);
......
......@@ -1495,7 +1495,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_SYSTEM, replaybuf, sizeof(ReplayHeader) + last_replay.comp_size));
replay_stream.push_back(BufferIO::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);
......
......@@ -145,6 +145,13 @@ int SingleMode::SinglePlayThread(void* param) {
}
}
last_replay.EndRecord();
char replaybuf[0x2000], *pbuf = replaybuf;
memcpy(pbuf, &last_replay.pheader, sizeof(ReplayHeader));
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.EndRecord();
time_t nowtime = time(NULL);
struct tm *localedtime = localtime(&nowtime);
......
......@@ -1572,6 +1572,14 @@ void TagDuel::GetResponse(DuelPlayer* dp, void* pdata, unsigned int len) {
void TagDuel::EndDuel() {
if(!pduel)
return;
last_replay.EndRecord();
char replaybuf[0x2000], *pbuf = replaybuf;
memcpy(pbuf, &last_replay.pheader, sizeof(ReplayHeader));
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));
//in case of remaining packets, e.g. MSG_WIN
new_replay.WriteStream(replay_stream);
new_replay.EndRecord();
......@@ -1587,11 +1595,6 @@ void TagDuel::EndDuel() {
NetServer::ReSendToPlayer(*oit);
last_replay.EndRecord();
char replaybuf[0x2000], *pbuf = replaybuf;
memcpy(pbuf, &last_replay.pheader, sizeof(ReplayHeader));
pbuf += sizeof(ReplayHeader);
memcpy(pbuf, last_replay.comp_data, last_replay.comp_size);
NetServer::SendBufferToPlayer(players[0], STOC_REPLAY, replaybuf, sizeof(ReplayHeader) + last_replay.comp_size);
NetServer::ReSendToPlayer(players[1]);
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