From 74e52034ad69dee85c0cca62d72baca3cbe9677a Mon Sep 17 00:00:00 2001 From: leo Date: Sat, 12 Jan 2013 21:00:38 +0000 Subject: [PATCH] Force C locale when reading library files. --- common/lc_library.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/common/lc_library.cpp b/common/lc_library.cpp index 1feb7a6c..ddc5b038 100644 --- a/common/lc_library.cpp +++ b/common/lc_library.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #define LC_LIBRARY_CACHE_VERSION 0x0100 #define LC_LIBRARY_CACHE_ARCHIVE 0x0001 @@ -749,7 +750,11 @@ bool lcPiecesLibrary::LoadPiece(PieceInfo* Info) if (!mZipFile->ExtractFile(Info->mZipFileIndex, PieceFile)) return false; - if (!ReadMeshData(PieceFile, lcMatrix44Identity(), 16, TextureStack, MeshData)) + const char* OldLocale = setlocale(LC_NUMERIC, "C"); + bool Ret = ReadMeshData(PieceFile, lcMatrix44Identity(), 16, TextureStack, MeshData); + setlocale(LC_NUMERIC, OldLocale); + + if (!Ret) return false; } else @@ -766,7 +771,11 @@ bool lcPiecesLibrary::LoadPiece(PieceInfo* Info) if (!PieceFile.Open(FileName, "rt")) return false; - if (!ReadMeshData(PieceFile, lcMatrix44Identity(), 16, TextureStack, MeshData)) + const char* OldLocale = setlocale(LC_NUMERIC, "C"); + bool Ret = ReadMeshData(PieceFile, lcMatrix44Identity(), 16, TextureStack, MeshData); + setlocale(LC_NUMERIC, OldLocale); + + if (!Ret) return false; }