fix: increased iw4 and iw5 peeking may result in a failbit in the stream

This commit is contained in:
Jan Laupetin committed 2026-10-22 20:01:07 +02:00
1 parent 0df7f16158
commit 53c279ff4c
2 files changed
+9

No files matched your search

+3
View File
@@ -36,6 +36,9 @@ std::expected<std::unique_ptr<Zone>, std::string> ZoneLoading::LoadZone(const st
if (!zoneLoader)
return std::unexpected(std::format("Could not create factory for zone '{}'.", zoneName));
// We may have to clear a fail bit if the peeking resulted in eof.
// Otherwise, we cannot seek.
file.clear();
// Revert to beginning to make sure no peeking has advanced the read position.
// (As different peeking logic may advance by different amounts of bytes).
file.seekg(0, std::ios::beg);