Handle length of UTF-8 strings properly in plugin metadata (bug #4653)

pull/541/head
Andrei Kortunov 6 years ago
parent bce8de5fe9
commit 0176ee389e

@ -129,6 +129,7 @@
Bug #4644: %Name should be available for all actors, not just for NPCs Bug #4644: %Name should be available for all actors, not just for NPCs
Bug #4648: Hud thinks that throwing weapons have condition Bug #4648: Hud thinks that throwing weapons have condition
Bug #4649: Levelup fully restores health Bug #4649: Levelup fully restores health
Bug #4653: Length of non-ASCII strings is handled incorrectly in ESM reader
Feature #912: Editor: Add missing icons to UniversalId tables Feature #912: Editor: Add missing icons to UniversalId tables
Feature #1617: Editor: Enchantment effect record verifier Feature #1617: Editor: Enchantment effect record verifier
Feature #1645: Casting effects from objects Feature #1645: Casting effects from objects

@ -14,8 +14,8 @@ void CSMWorld::MetaData::blank()
void CSMWorld::MetaData::load (ESM::ESMReader& esm) void CSMWorld::MetaData::load (ESM::ESMReader& esm)
{ {
mFormat = esm.getHeader().mFormat; mFormat = esm.getHeader().mFormat;
mAuthor = esm.getHeader().mData.author.toString(); mAuthor = esm.getHeader().mData.author;
mDescription = esm.getHeader().mData.desc.toString(); mDescription = esm.getHeader().mData.desc;
} }
void CSMWorld::MetaData::save (ESM::ESMWriter& esm) const void CSMWorld::MetaData::save (ESM::ESMWriter& esm) const

@ -33,8 +33,8 @@ public:
int getVer() const { return mHeader.mData.version; } int getVer() const { return mHeader.mData.version; }
int getRecordCount() const { return mHeader.mData.records; } int getRecordCount() const { return mHeader.mData.records; }
float getFVer() const { return (mHeader.mData.version == VER_12) ? 1.2f : 1.3f; } float getFVer() const { return (mHeader.mData.version == VER_12) ? 1.2f : 1.3f; }
const std::string getAuthor() const { return mHeader.mData.author.toString(); } const std::string getAuthor() const { return mHeader.mData.author; }
const std::string getDesc() const { return mHeader.mData.desc.toString(); } const std::string getDesc() const { return mHeader.mData.desc; }
const std::vector<Header::MasterData> &getGameFiles() const { return mHeader.mMaster; } const std::vector<Header::MasterData> &getGameFiles() const { return mHeader.mMaster; }
const Header& getHeader() const { return mHeader; } const Header& getHeader() const { return mHeader; }
int getFormat() const; int getFormat() const;

@ -32,8 +32,8 @@ void ESM::Header::load (ESMReader &esm)
esm.getSubHeader(); esm.getSubHeader();
esm.getT(mData.version); esm.getT(mData.version);
esm.getT(mData.type); esm.getT(mData.type);
mData.author.assign( esm.getString(mData.author.data_size()) ); mData.author.assign( esm.getString(32) );
mData.desc.assign( esm.getString(mData.desc.data_size()) ); mData.desc.assign( esm.getString(256) );
esm.getT(mData.records); esm.getT(mData.records);
} }
@ -73,8 +73,8 @@ void ESM::Header::save (ESMWriter &esm)
esm.startSubRecord("HEDR"); esm.startSubRecord("HEDR");
esm.writeT(mData.version); esm.writeT(mData.version);
esm.writeT(mData.type); esm.writeT(mData.type);
esm.writeFixedSizeString(mData.author.toString(), mData.author.data_size()); esm.writeFixedSizeString(mData.author, 32);
esm.writeFixedSizeString(mData.desc.toString(), mData.desc.data_size()); esm.writeFixedSizeString(mData.desc, 256);
esm.writeT(mData.records); esm.writeT(mData.records);
esm.endRecord("HEDR"); esm.endRecord("HEDR");

@ -21,8 +21,8 @@ namespace ESM
*/ */
unsigned int version; unsigned int version;
int type; // 0=esp, 1=esm, 32=ess (unused) int type; // 0=esp, 1=esm, 32=ess (unused)
NAME32 author; // Author's name std::string author; // Author's name
NAME256 desc; // File description std::string desc; // File description
int records; // Number of records int records; // Number of records
}; };

Loading…
Cancel
Save