1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-20 02:53:51 +00:00

changed EMSLoader to use ConstrainedDataStream

Changed the EMSLoader class to use the ConstrainedDataStream so that
future changes may benifit from its increased performance.
This commit is contained in:
Nathan Jeffords 2013-01-01 15:13:36 -08:00
parent 278337116b
commit fec9a59237

View file

@ -1,6 +1,8 @@
#include "esmreader.hpp" #include "esmreader.hpp"
#include <stdexcept> #include <stdexcept>
#include "../files/constrainedfiledatastream.hpp"
namespace ESM namespace ESM
{ {
@ -108,16 +110,12 @@ void ESMReader::open(Ogre::DataStreamPtr _esm, const std::string &name)
void ESMReader::open(const std::string &file) void ESMReader::open(const std::string &file)
{ {
std::ifstream *stream = OGRE_NEW_T(std::ifstream, Ogre::MEMCATEGORY_GENERAL)(file.c_str(), std::ios_base::binary); open (openConstrainedFileDataStream (file.c_str ()), file);
// Ogre will delete the stream for us
open(Ogre::DataStreamPtr(new Ogre::FileStreamDataStream(stream)), file);
} }
void ESMReader::openRaw(const std::string &file) void ESMReader::openRaw(const std::string &file)
{ {
std::ifstream *stream = OGRE_NEW_T(std::ifstream, Ogre::MEMCATEGORY_GENERAL)(file.c_str(), std::ios_base::binary); openRaw (openConstrainedFileDataStream (file.c_str ()), file);
// Ogre will delete the stream for us
openRaw(Ogre::DataStreamPtr(new Ogre::FileStreamDataStream(stream)), file);
} }
int64_t ESMReader::getHNLong(const char *name) int64_t ESMReader::getHNLong(const char *name)