mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-03-30 10:06:42 +00:00
some cleanup and fixing
This commit is contained in:
parent
a1ac20c6f3
commit
ce49ad54a1
3 changed files with 25 additions and 22 deletions
|
@ -1,17 +1,13 @@
|
||||||
#include "loadglob.hpp"
|
#include "loadglob.hpp"
|
||||||
|
|
||||||
#include "esmreader.hpp"
|
|
||||||
#include "esmwriter.hpp"
|
|
||||||
|
|
||||||
namespace ESM
|
namespace ESM
|
||||||
{
|
{
|
||||||
|
void Global::load (ESMReader &esm)
|
||||||
void Global::load(ESMReader &esm)
|
|
||||||
{
|
{
|
||||||
mValue.read (esm, ESM::Variant::Format_Global);
|
mValue.read (esm, ESM::Variant::Format_Global);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Global::save(ESMWriter &esm)
|
void Global::save (ESMWriter &esm)
|
||||||
{
|
{
|
||||||
mValue.write (esm, ESM::Variant::Format_Global);
|
mValue.write (esm, ESM::Variant::Format_Global);
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ ESM::VarType ESM::Variant::getType() const
|
||||||
return mType;
|
return mType;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string ESM::Variant::toString() const
|
std::string ESM::Variant::getString() const
|
||||||
{
|
{
|
||||||
if (!mData)
|
if (!mData)
|
||||||
throw std::runtime_error ("can not convert empty variant to string");
|
throw std::runtime_error ("can not convert empty variant to string");
|
||||||
|
@ -81,23 +81,30 @@ void ESM::Variant::read (ESMReader& esm, Format format)
|
||||||
}
|
}
|
||||||
else // GMST
|
else // GMST
|
||||||
{
|
{
|
||||||
esm.getSubName();
|
if (!esm.hasMoreSubs())
|
||||||
NAME name = esm.retSubName();
|
|
||||||
|
|
||||||
if (name=="STRV")
|
|
||||||
{
|
{
|
||||||
type = VT_String;
|
type = VT_None;
|
||||||
}
|
|
||||||
else if (name=="INTV")
|
|
||||||
{
|
|
||||||
type = VT_Int;
|
|
||||||
}
|
|
||||||
else if (name=="FLTV")
|
|
||||||
{
|
|
||||||
type = VT_Float;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
esm.fail ("invalid subrecord: " + name.toString());
|
{
|
||||||
|
esm.getSubName();
|
||||||
|
NAME name = esm.retSubName();
|
||||||
|
|
||||||
|
if (name=="STRV")
|
||||||
|
{
|
||||||
|
type = VT_String;
|
||||||
|
}
|
||||||
|
else if (name=="INTV")
|
||||||
|
{
|
||||||
|
type = VT_Int;
|
||||||
|
}
|
||||||
|
else if (name=="FLTV")
|
||||||
|
{
|
||||||
|
type = VT_Float;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
esm.fail ("invalid subrecord: " + name.toString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setType (type);
|
setType (type);
|
||||||
|
|
|
@ -45,7 +45,7 @@ namespace ESM
|
||||||
|
|
||||||
VarType getType() const;
|
VarType getType() const;
|
||||||
|
|
||||||
std::string toString() const;
|
std::string getString() const;
|
||||||
///< Will throw an exception, if value can not be represented as a string.
|
///< Will throw an exception, if value can not be represented as a string.
|
||||||
|
|
||||||
int getInteger() const;
|
int getInteger() const;
|
||||||
|
|
Loading…
Reference in a new issue