Commit 79d7fd1e authored by mercury233's avatar mercury233

fix #2033

parent 96b57ccd
...@@ -302,11 +302,11 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) { ...@@ -302,11 +302,11 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
myswprintf(infobuf, L"%d/%d/%d %02d:%02d:%02d\n", st->tm_year + 1900, st->tm_mon + 1, st->tm_mday, st->tm_hour, st->tm_min, st->tm_sec); myswprintf(infobuf, L"%d/%d/%d %02d:%02d:%02d\n", st->tm_year + 1900, st->tm_mon + 1, st->tm_mday, st->tm_hour, st->tm_min, st->tm_sec);
repinfo.append(infobuf); repinfo.append(infobuf);
wchar_t namebuf[4][20]; wchar_t namebuf[4][20];
BufferIO::CopyWStr((unsigned short*)&ReplayMode::cur_replay.replay_data[0], namebuf[0], 20); ReplayMode::cur_replay.ReadName(namebuf[0]);
BufferIO::CopyWStr((unsigned short*)&ReplayMode::cur_replay.replay_data[40], namebuf[1], 20); ReplayMode::cur_replay.ReadName(namebuf[1]);
if(ReplayMode::cur_replay.pheader.flag & REPLAY_TAG) { if(ReplayMode::cur_replay.pheader.flag & REPLAY_TAG) {
BufferIO::CopyWStr((unsigned short*)&ReplayMode::cur_replay.replay_data[80], namebuf[2], 20); ReplayMode::cur_replay.ReadName(namebuf[2]);
BufferIO::CopyWStr((unsigned short*)&ReplayMode::cur_replay.replay_data[120], namebuf[3], 20); ReplayMode::cur_replay.ReadName(namebuf[3]);
} }
if(ReplayMode::cur_replay.pheader.flag & REPLAY_TAG) if(ReplayMode::cur_replay.pheader.flag & REPLAY_TAG)
myswprintf(infobuf, L"%ls\n%ls\n===VS===\n%ls\n%ls\n", namebuf[0], namebuf[1], namebuf[2], namebuf[3]); myswprintf(infobuf, L"%ls\n%ls\n===VS===\n%ls\n%ls\n", namebuf[0], namebuf[1], namebuf[2], namebuf[3]);
......
...@@ -202,6 +202,13 @@ bool Replay::ReadNextResponse(unsigned char resp[64]) { ...@@ -202,6 +202,13 @@ bool Replay::ReadNextResponse(unsigned char resp[64]) {
pdata += len; pdata += len;
return true; return true;
} }
void Replay::ReadName(wchar_t* data) {
if(!is_replaying)
return;
unsigned short buffer[20];
ReadData(buffer, 40);
BufferIO::CopyWStr(buffer, data, 20);
}
void Replay::ReadData(void* data, unsigned int length) { void Replay::ReadData(void* data, unsigned int length) {
if(!is_replaying) if(!is_replaying)
return; return;
......
...@@ -36,6 +36,7 @@ public: ...@@ -36,6 +36,7 @@ public:
bool OpenReplay(const wchar_t* name); bool OpenReplay(const wchar_t* name);
static bool CheckReplay(const wchar_t* name); static bool CheckReplay(const wchar_t* name);
bool ReadNextResponse(unsigned char resp[64]); bool ReadNextResponse(unsigned char resp[64]);
void ReadName(wchar_t* data);
void ReadHeader(ReplayHeader& header); void ReadHeader(ReplayHeader& header);
void ReadData(void* data, unsigned int length); void ReadData(void* data, unsigned int length);
int ReadInt32(); int ReadInt32();
......
...@@ -61,16 +61,16 @@ int ReplayMode::ReplayThread(void* param) { ...@@ -61,16 +61,16 @@ int ReplayMode::ReplayThread(void* param) {
int seed = rh.seed; int seed = rh.seed;
rnd.reset(seed); rnd.reset(seed);
if(rh.flag & REPLAY_TAG) { if(rh.flag & REPLAY_TAG) {
cur_replay.ReadData(mainGame->dInfo.hostname, 40); cur_replay.ReadName(mainGame->dInfo.hostname);
cur_replay.ReadData(mainGame->dInfo.hostname_tag, 40); cur_replay.ReadName(mainGame->dInfo.hostname_tag);
cur_replay.ReadData(mainGame->dInfo.clientname_tag, 40); cur_replay.ReadName(mainGame->dInfo.clientname_tag);
cur_replay.ReadData(mainGame->dInfo.clientname, 40); cur_replay.ReadName(mainGame->dInfo.clientname);
mainGame->dInfo.isTag = true; mainGame->dInfo.isTag = true;
mainGame->dInfo.tag_player[0] = false; mainGame->dInfo.tag_player[0] = false;
mainGame->dInfo.tag_player[1] = false; mainGame->dInfo.tag_player[1] = false;
} else { } else {
cur_replay.ReadData(mainGame->dInfo.hostname, 40); cur_replay.ReadName(mainGame->dInfo.hostname);
cur_replay.ReadData(mainGame->dInfo.clientname, 40); cur_replay.ReadName(mainGame->dInfo.clientname);
} }
set_script_reader(default_script_reader); set_script_reader(default_script_reader);
set_card_reader((card_reader)DataManager::CardReader); set_card_reader((card_reader)DataManager::CardReader);
...@@ -205,16 +205,16 @@ void ReplayMode::Restart(bool refresh) { ...@@ -205,16 +205,16 @@ void ReplayMode::Restart(bool refresh) {
int seed = rh.seed; int seed = rh.seed;
rnd.reset(seed); rnd.reset(seed);
if(rh.flag & REPLAY_TAG) { if(rh.flag & REPLAY_TAG) {
cur_replay.ReadData(mainGame->dInfo.hostname, 40); cur_replay.ReadName(mainGame->dInfo.hostname);
cur_replay.ReadData(mainGame->dInfo.hostname_tag, 40); cur_replay.ReadName(mainGame->dInfo.hostname_tag);
cur_replay.ReadData(mainGame->dInfo.clientname_tag, 40); cur_replay.ReadName(mainGame->dInfo.clientname_tag);
cur_replay.ReadData(mainGame->dInfo.clientname, 40); cur_replay.ReadName(mainGame->dInfo.clientname);
mainGame->dInfo.isTag = true; mainGame->dInfo.isTag = true;
mainGame->dInfo.tag_player[0] = false; mainGame->dInfo.tag_player[0] = false;
mainGame->dInfo.tag_player[1] = false; mainGame->dInfo.tag_player[1] = false;
} else { } else {
cur_replay.ReadData(mainGame->dInfo.hostname, 40); cur_replay.ReadName(mainGame->dInfo.hostname);
cur_replay.ReadData(mainGame->dInfo.clientname, 40); cur_replay.ReadName(mainGame->dInfo.clientname);
} }
//set_card_reader((card_reader)DataManager::CardReader); //set_card_reader((card_reader)DataManager::CardReader);
//set_message_handler((message_handler)MessageHandler); //set_message_handler((message_handler)MessageHandler);
......
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