1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-02-04 21:40:03 +00:00

Merge branch 'esm_read_on_skip' into 'master'

Read when need to skip few bytes

See merge request OpenMW/openmw!1765
This commit is contained in:
psi29a 2022-04-11 06:33:39 +00:00
commit 292dda0c78

View File

@ -265,7 +265,14 @@ public:
// them from native encoding to UTF8 in the process.
std::string getString(int size);
void skip(int bytes) { mEsm->seekg(getFileOffset()+bytes); };
void skip(std::size_t bytes)
{
char buffer[4096];
if (bytes > std::size(buffer))
mEsm->seekg(getFileOffset() + bytes);
else
mEsm->read(buffer, bytes);
}
/// Used for error handling
[[noreturn]] void fail(const std::string &msg);