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

pull/402/head
Arthur Moore 10 years ago
parent cd835152e1
commit b8edd9bac3

@ -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();

@ -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)
{

@ -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);

Loading…
Cancel
Save