mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-26 09:35:28 +00:00
Merge branch 'nistringpalette' into 'master'
Fix NiStringPalette loading again See merge request OpenMW/openmw!2703
This commit is contained in:
commit
de2bd6d802
@ -470,7 +470,7 @@ namespace Nif
|
||||
|
||||
void NiStringPalette::read(NIFStream* nif)
|
||||
{
|
||||
palette = nif->getString();
|
||||
palette = nif->getStringPalette();
|
||||
if (nif->getUInt() != palette.size())
|
||||
Log(Debug::Warning) << "NIFFile Warning: Failed size check in NiStringPalette. File: "
|
||||
<< nif->getFile().getFilename();
|
||||
|
@ -169,6 +169,17 @@ namespace Nif
|
||||
return result;
|
||||
}
|
||||
|
||||
/// Read a sequence of null-terminated strings
|
||||
std::string getStringPalette()
|
||||
{
|
||||
size_t size = readLittleEndianType<uint32_t>(inp);
|
||||
std::string str(size, '\0');
|
||||
inp->read(str.data(), size);
|
||||
if (inp->bad())
|
||||
throw std::runtime_error("Failed to read string palette of " + std::to_string(size) + " chars");
|
||||
return str;
|
||||
}
|
||||
|
||||
void getChars(std::vector<char>& vec, size_t size)
|
||||
{
|
||||
vec.resize(size);
|
||||
|
Loading…
x
Reference in New Issue
Block a user