1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-04-21 12:06:49 +02:00

Fixed encoding of strings in h3m maps

This commit is contained in:
Ivan Savenko 2023-02-25 01:18:15 +02:00
parent 9b428e8231
commit f653d22f99
3 changed files with 9 additions and 1 deletions

View File

@ -11,7 +11,9 @@
#include "../render/IFont.h" #include "../render/IFont.h"
VCMI_LIB_NAMESPACE_BEGIN
class ResourceID; class ResourceID;
VCMI_LIB_NAMESPACE_END
class CBitmapFont : public IFont class CBitmapFont : public IFont
{ {

View File

@ -25,6 +25,7 @@
#include "../mapObjects/CObjectClassesHandler.h" #include "../mapObjects/CObjectClassesHandler.h"
#include "../mapObjects/MapObjects.h" #include "../mapObjects/MapObjects.h"
#include "../VCMI_Lib.h" #include "../VCMI_Lib.h"
#include "../TextOperations.h"
#include "../TerrainHandler.h" #include "../TerrainHandler.h"
#include "../RoadHandler.h" #include "../RoadHandler.h"
#include "../RiverHandler.h" #include "../RiverHandler.h"
@ -38,6 +39,8 @@ CMapLoaderH3M::CMapLoaderH3M(const std::string & mapName, const std::string & en
: map(nullptr) : map(nullptr)
, reader(new CBinaryReader(stream)) , reader(new CBinaryReader(stream))
, inputStream(stream) , inputStream(stream)
, mapName(mapName)
, fileEncoding(encodingName)
{ {
} }
@ -2242,7 +2245,7 @@ int3 CMapLoaderH3M::readInt3()
std::string CMapLoaderH3M::readLocalizedString() std::string CMapLoaderH3M::readLocalizedString()
{ {
return reader->readBaseString(); return TextOperations::toUnicode(reader->readBaseString(), fileEncoding);
} }
void CMapLoaderH3M::afterRead() void CMapLoaderH3M::afterRead()

View File

@ -256,6 +256,9 @@ private:
std::unique_ptr<CBinaryReader> reader; std::unique_ptr<CBinaryReader> reader;
CInputStream * inputStream; CInputStream * inputStream;
std::string mapName;
std::string fileEncoding;
}; };
VCMI_LIB_NAMESPACE_END VCMI_LIB_NAMESPACE_END