From 0dd6dd782e624155fc27def951fa1fcb3114f0a1 Mon Sep 17 00:00:00 2001 From: Shauren Date: Thu, 17 Oct 2024 22:23:00 +0200 Subject: [PATCH] Core/Misc: Don't use tellg() to estimate file sizes --- src/server/game/DataStores/M2Stores.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/server/game/DataStores/M2Stores.cpp b/src/server/game/DataStores/M2Stores.cpp index 72e660893e..db1b18da27 100644 --- a/src/server/game/DataStores/M2Stores.cpp +++ b/src/server/game/DataStores/M2Stores.cpp @@ -21,6 +21,7 @@ #include "Log.h" #include "M2Structure.h" #include "Timer.h" +#include #include #include #include @@ -191,8 +192,7 @@ TC_GAME_API void LoadM2Cameras(std::string const& dataPath) continue; // Get file size - m2file.seekg(0, std::ios::end); - std::streamoff fileSize = m2file.tellg(); + std::streamoff fileSize = boost::filesystem::file_size(filename); // Reject if not at least the size of the header if (static_cast(fileSize) < sizeof(M2Header) + 4) @@ -203,7 +203,6 @@ TC_GAME_API void LoadM2Cameras(std::string const& dataPath) } // Read 4 bytes (signature) - m2file.seekg(0, std::ios::beg); char fileCheck[5]; m2file.read(fileCheck, 4); fileCheck[4] = '\0';