1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-30 16:15:31 +00:00

Get a nif file's version string regardless of its length.

This commit is contained in:
Arthur Moore 2014-12-12 01:48:57 -05:00
parent cd835152e1
commit b8edd9bac3
3 changed files with 8 additions and 2 deletions

View file

@ -131,9 +131,9 @@ void NIFFile::parse()
NIFStream nif (this, Ogre::ResourceGroupManager::getSingleton().openResource(filename));
// Check the header string
std::string head = nif.getString(40);
std::string head = nif.getVersionString();
if(head.compare(0, 22, "NetImmerse File Format") != 0)
fail("Invalid NIF header");
fail("Invalid NIF header: " + head);
// Get BCD version
ver = nif.getUInt();

View file

@ -101,6 +101,10 @@ std::string NIFStream::getString()
size_t size = read_le32();
return getString(size);
}
std::string NIFStream::getVersionString()
{
return inp->getLine();
}
void NIFStream::getShorts(std::vector<short> &vec, size_t size)
{

View file

@ -81,6 +81,8 @@ public:
std::string getString(size_t length);
///Read in a string of the length specified in the file
std::string getString();
///This is special since the version string doesn't start with a number, and ends with "\n"
std::string getVersionString();
void getShorts(std::vector<short> &vec, size_t size);
void getFloats(std::vector<float> &vec, size_t size);