mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-19 20:23:54 +00:00
Merge branch 'stringpalette' into 'master'
Fix NiStringPalette loading See merge request OpenMW/openmw!406
This commit is contained in:
commit
18a95377eb
2 changed files with 3 additions and 15 deletions
|
@ -460,21 +460,9 @@ void NiPalette::read(NIFStream *nif)
|
|||
|
||||
void NiStringPalette::read(NIFStream *nif)
|
||||
{
|
||||
unsigned int size = nif->getUInt();
|
||||
if (!size)
|
||||
return;
|
||||
std::vector<char> source;
|
||||
nif->getChars(source, size);
|
||||
if (nif->getUInt() != size)
|
||||
palette = nif->getString();
|
||||
if (nif->getUInt() != palette.size())
|
||||
nif->file->warn("Failed size check in NiStringPalette");
|
||||
if (source[source.size()-1] != '\0')
|
||||
source.emplace_back('\0');
|
||||
const char* buffer = source.data();
|
||||
while (static_cast<size_t>(buffer - source.data()) < source.size())
|
||||
{
|
||||
palette.emplace_back(buffer);
|
||||
buffer += palette.back().size() + 1;
|
||||
}
|
||||
}
|
||||
|
||||
void NiBoolData::read(NIFStream *nif)
|
||||
|
|
|
@ -262,7 +262,7 @@ public:
|
|||
|
||||
struct NiStringPalette : public Record
|
||||
{
|
||||
std::vector<std::string> palette;
|
||||
std::string palette;
|
||||
void read(NIFStream *nif) override;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue