Browse Source

Fix pfile_compare_hero_demo: Close MpqWriter before reading (for comparsion)

pull/4795/head
obligaron 4 years ago committed by Anders Jenbo
parent
commit
7a27fcd249
  1. 6
      Source/pfile.cpp

6
Source/pfile.cpp

@ -336,8 +336,10 @@ HeroCompareResult pfile_compare_hero_demo(int demo)
return HeroCompareResult::ReferenceNotFound;
std::string actualSavePath = GetSavePath(gSaveNumber, fmt::format("demo_{}_actual_", demo));
auto saveWriter = MpqWriter(actualSavePath.c_str());
pfile_write_hero(saveWriter, true);
{
MpqWriter saveWriter(actualSavePath.c_str());
pfile_write_hero(saveWriter, true);
}
bool compareResult = CompareSaves(actualSavePath, referenceSavePath);
return compareResult ? HeroCompareResult::Same : HeroCompareResult::Difference;

Loading…
Cancel
Save