Small optimization to ESM::Variant

deque
scrawl 11 years ago
parent d7f3cd75ac
commit ce14a6413b

@ -6,6 +6,15 @@
#include "esmreader.hpp"
#include "variantimp.hpp"
#include "defs.hpp"
namespace
{
const uint32_t STRV = ESM::FourCC<'S','T','R','V'>::value;
const uint32_t INTV = ESM::FourCC<'I','N','T','V'>::value;
const uint32_t FLTV = ESM::FourCC<'F','L','T','V'>::value;
}
ESM::Variant::Variant() : mType (VT_None), mData (0) {}
ESM::Variant::~Variant()
@ -90,15 +99,17 @@ void ESM::Variant::read (ESMReader& esm, Format format)
esm.getSubName();
NAME name = esm.retSubName();
if (name=="STRV")
if (name==STRV)
{
type = VT_String;
}
else if (name=="INTV")
else if (name==INTV)
{
type = VT_Int;
}
else if (name=="FLTV")
else if (name==FLTV)
{
type = VT_Float;
}
@ -111,11 +122,11 @@ void ESM::Variant::read (ESMReader& esm, Format format)
esm.getSubName();
NAME name = esm.retSubName();
if (name=="INTV")
if (name==INTV)
{
type = VT_Int;
}
else if (name=="FLTV")
else if (name==FLTV)
{
type = VT_Float;
}
@ -279,4 +290,4 @@ bool ESM::operator== (const Variant& left, const Variant& right)
bool ESM::operator!= (const Variant& left, const Variant& right)
{
return !(left==right);
}
}

Loading…
Cancel
Save