1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +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"
VCMI_LIB_NAMESPACE_BEGIN
class ResourceID;
VCMI_LIB_NAMESPACE_END
class CBitmapFont : public IFont
{

View File

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

View File

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