mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-19 20:53:52 +00:00
Merge branch 'inline' into 'master'
Inline a couple of methods in esmreader.cpp See merge request OpenMW/openmw!945
This commit is contained in:
commit
080106e802
2 changed files with 6 additions and 36 deletions
|
@ -7,11 +7,6 @@ namespace ESM
|
||||||
|
|
||||||
using namespace Misc;
|
using namespace Misc;
|
||||||
|
|
||||||
std::string ESMReader::getName() const
|
|
||||||
{
|
|
||||||
return mCtx.filename;
|
|
||||||
}
|
|
||||||
|
|
||||||
ESM_Context ESMReader::getContext()
|
ESM_Context ESMReader::getContext()
|
||||||
{
|
{
|
||||||
// Update the file position before returning
|
// Update the file position before returning
|
||||||
|
@ -29,11 +24,6 @@ ESMReader::ESMReader()
|
||||||
clearCtx();
|
clearCtx();
|
||||||
}
|
}
|
||||||
|
|
||||||
int ESMReader::getFormat() const
|
|
||||||
{
|
|
||||||
return mHeader.mFormat;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ESMReader::restoreContext(const ESM_Context &rc)
|
void ESMReader::restoreContext(const ESM_Context &rc)
|
||||||
{
|
{
|
||||||
// Reopen the file if necessary
|
// Reopen the file if necessary
|
||||||
|
@ -181,11 +171,6 @@ bool ESMReader::peekNextSub(const char *name)
|
||||||
return mCtx.subName == name;
|
return mCtx.subName == name;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ESMReader::cacheSubName()
|
|
||||||
{
|
|
||||||
mCtx.subCached = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Read subrecord name. This gets called a LOT, so I've optimized it
|
// Read subrecord name. This gets called a LOT, so I've optimized it
|
||||||
// slightly.
|
// slightly.
|
||||||
void ESMReader::getSubName()
|
void ESMReader::getSubName()
|
||||||
|
@ -328,19 +313,4 @@ std::string ESMReader::getString(int size)
|
||||||
throw std::runtime_error(ss.str());
|
throw std::runtime_error(ss.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ESMReader::setEncoder(ToUTF8::Utf8Encoder* encoder)
|
|
||||||
{
|
|
||||||
mEncoder = encoder;
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t ESMReader::getFileOffset() const
|
|
||||||
{
|
|
||||||
return mEsm->tellg();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ESMReader::skip(int bytes)
|
|
||||||
{
|
|
||||||
mEsm->seekg(getFileOffset()+bytes);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,10 +36,10 @@ public:
|
||||||
const std::string getDesc() const { return mHeader.mData.desc; }
|
const std::string getDesc() const { return mHeader.mData.desc; }
|
||||||
const std::vector<Header::MasterData> &getGameFiles() const { return mHeader.mMaster; }
|
const std::vector<Header::MasterData> &getGameFiles() const { return mHeader.mMaster; }
|
||||||
const Header& getHeader() const { return mHeader; }
|
const Header& getHeader() const { return mHeader; }
|
||||||
int getFormat() const;
|
int getFormat() const { return mHeader.mFormat; };
|
||||||
const NAME &retSubName() const { return mCtx.subName; }
|
const NAME &retSubName() const { return mCtx.subName; }
|
||||||
uint32_t getSubSize() const { return mCtx.leftSub; }
|
uint32_t getSubSize() const { return mCtx.leftSub; }
|
||||||
std::string getName() const;
|
std::string getName() const {return mCtx.filename; };
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
*
|
*
|
||||||
|
@ -73,7 +73,7 @@ public:
|
||||||
void openRaw(const std::string &filename);
|
void openRaw(const std::string &filename);
|
||||||
|
|
||||||
/// Get the current position in the file. Make sure that the file has been opened!
|
/// Get the current position in the file. Make sure that the file has been opened!
|
||||||
size_t getFileOffset() const;
|
size_t getFileOffset() const { return mEsm->tellg(); };
|
||||||
|
|
||||||
// This is a quick hack for multiple esm/esp files. Each plugin introduces its own
|
// This is a quick hack for multiple esm/esp files. Each plugin introduces its own
|
||||||
// terrain palette, but ESMReader does not pass a reference to the correct plugin
|
// terrain palette, but ESMReader does not pass a reference to the correct plugin
|
||||||
|
@ -185,7 +185,7 @@ public:
|
||||||
bool peekNextSub(const char* name);
|
bool peekNextSub(const char* name);
|
||||||
|
|
||||||
// Store the current subrecord name for the next call of getSubName()
|
// Store the current subrecord name for the next call of getSubName()
|
||||||
void cacheSubName();
|
void cacheSubName() {mCtx.subCached = true; };
|
||||||
|
|
||||||
// Read subrecord name. This gets called a LOT, so I've optimized it
|
// Read subrecord name. This gets called a LOT, so I've optimized it
|
||||||
// slightly.
|
// slightly.
|
||||||
|
@ -247,13 +247,13 @@ public:
|
||||||
// them from native encoding to UTF8 in the process.
|
// them from native encoding to UTF8 in the process.
|
||||||
std::string getString(int size);
|
std::string getString(int size);
|
||||||
|
|
||||||
void skip(int bytes);
|
void skip(int bytes) { mEsm->seekg(getFileOffset()+bytes); };
|
||||||
|
|
||||||
/// Used for error handling
|
/// Used for error handling
|
||||||
[[noreturn]] void fail(const std::string &msg);
|
[[noreturn]] void fail(const std::string &msg);
|
||||||
|
|
||||||
/// Sets font encoder for ESM strings
|
/// Sets font encoder for ESM strings
|
||||||
void setEncoder(ToUTF8::Utf8Encoder* encoder);
|
void setEncoder(ToUTF8::Utf8Encoder* encoder) { mEncoder = encoder; };
|
||||||
|
|
||||||
/// Get record flags of last record
|
/// Get record flags of last record
|
||||||
unsigned int getRecordFlags() { return mRecordFlags; }
|
unsigned int getRecordFlags() { return mRecordFlags; }
|
||||||
|
|
Loading…
Reference in a new issue