forked from mirror/openmw-tes3mp
Get a nif file's version string regardless of its length.
This commit is contained in:
parent
cd835152e1
commit
b8edd9bac3
3 changed files with 8 additions and 2 deletions
|
@ -131,9 +131,9 @@ void NIFFile::parse()
|
||||||
NIFStream nif (this, Ogre::ResourceGroupManager::getSingleton().openResource(filename));
|
NIFStream nif (this, Ogre::ResourceGroupManager::getSingleton().openResource(filename));
|
||||||
|
|
||||||
// Check the header string
|
// Check the header string
|
||||||
std::string head = nif.getString(40);
|
std::string head = nif.getVersionString();
|
||||||
if(head.compare(0, 22, "NetImmerse File Format") != 0)
|
if(head.compare(0, 22, "NetImmerse File Format") != 0)
|
||||||
fail("Invalid NIF header");
|
fail("Invalid NIF header: " + head);
|
||||||
|
|
||||||
// Get BCD version
|
// Get BCD version
|
||||||
ver = nif.getUInt();
|
ver = nif.getUInt();
|
||||||
|
|
|
@ -101,6 +101,10 @@ std::string NIFStream::getString()
|
||||||
size_t size = read_le32();
|
size_t size = read_le32();
|
||||||
return getString(size);
|
return getString(size);
|
||||||
}
|
}
|
||||||
|
std::string NIFStream::getVersionString()
|
||||||
|
{
|
||||||
|
return inp->getLine();
|
||||||
|
}
|
||||||
|
|
||||||
void NIFStream::getShorts(std::vector<short> &vec, size_t size)
|
void NIFStream::getShorts(std::vector<short> &vec, size_t size)
|
||||||
{
|
{
|
||||||
|
|
|
@ -81,6 +81,8 @@ public:
|
||||||
std::string getString(size_t length);
|
std::string getString(size_t length);
|
||||||
///Read in a string of the length specified in the file
|
///Read in a string of the length specified in the file
|
||||||
std::string getString();
|
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 getShorts(std::vector<short> &vec, size_t size);
|
||||||
void getFloats(std::vector<float> &vec, size_t size);
|
void getFloats(std::vector<float> &vec, size_t size);
|
||||||
|
|
Loading…
Reference in a new issue