Commit a49d2990 authored by nanahira's avatar nanahira

Merge branch 'master' of https://github.com/Fluorohydride/ygopro

parents 16481a4d d14c1516
......@@ -159,7 +159,10 @@ bool Replay::OpenReplay(const wchar_t* name) {
}
if(!fp)
return false;
fread(&pheader, sizeof(pheader), 1, fp);
if(fread(&pheader, sizeof(pheader), 1, fp) < 1) {
fclose(fp);
return false;
}
if(pheader.flag & REPLAY_COMPRESSED) {
comp_size = fread(comp_data, 1, 0x1000, fp);
fclose(fp);
......@@ -188,9 +191,9 @@ bool Replay::CheckReplay(const wchar_t* name) {
if(!rfp)
return false;
ReplayHeader rheader;
fread(&rheader, sizeof(ReplayHeader), 1, rfp);
size_t count = fread(&rheader, sizeof(ReplayHeader), 1, rfp);
fclose(rfp);
return rheader.id == 0x31707279 && rheader.version >= 0x12d0;
return count == 1 && rheader.id == 0x31707279 && rheader.version >= 0x12d0;
}
bool Replay::DeleteReplay(const wchar_t* name) {
wchar_t fname[256];
......
......@@ -52,6 +52,7 @@ int SingleMode::SinglePlayThread(void* param) {
myswprintf(mainGame->dInfo.strLP[1], L"%d", mainGame->dInfo.lp[1]);
BufferIO::CopyWStr(mainGame->ebNickName->getText(), mainGame->dInfo.hostname, 20);
mainGame->dInfo.clientname[0] = 0;
mainGame->dInfo.player_type = 0;
mainGame->dInfo.turn = 0;
mainGame->dInfo.announce_cache.clear();
char filename[256];
......
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