mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-10 15:45:37 +00:00
Small optimization to ESM::Variant
This commit is contained in:
parent
d7f3cd75ac
commit
ce14a6413b
@ -6,6 +6,15 @@
|
|||||||
#include "esmreader.hpp"
|
#include "esmreader.hpp"
|
||||||
#include "variantimp.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() : mType (VT_None), mData (0) {}
|
||||||
|
|
||||||
ESM::Variant::~Variant()
|
ESM::Variant::~Variant()
|
||||||
@ -90,15 +99,17 @@ void ESM::Variant::read (ESMReader& esm, Format format)
|
|||||||
esm.getSubName();
|
esm.getSubName();
|
||||||
NAME name = esm.retSubName();
|
NAME name = esm.retSubName();
|
||||||
|
|
||||||
if (name=="STRV")
|
|
||||||
|
|
||||||
|
if (name==STRV)
|
||||||
{
|
{
|
||||||
type = VT_String;
|
type = VT_String;
|
||||||
}
|
}
|
||||||
else if (name=="INTV")
|
else if (name==INTV)
|
||||||
{
|
{
|
||||||
type = VT_Int;
|
type = VT_Int;
|
||||||
}
|
}
|
||||||
else if (name=="FLTV")
|
else if (name==FLTV)
|
||||||
{
|
{
|
||||||
type = VT_Float;
|
type = VT_Float;
|
||||||
}
|
}
|
||||||
@ -111,11 +122,11 @@ void ESM::Variant::read (ESMReader& esm, Format format)
|
|||||||
esm.getSubName();
|
esm.getSubName();
|
||||||
NAME name = esm.retSubName();
|
NAME name = esm.retSubName();
|
||||||
|
|
||||||
if (name=="INTV")
|
if (name==INTV)
|
||||||
{
|
{
|
||||||
type = VT_Int;
|
type = VT_Int;
|
||||||
}
|
}
|
||||||
else if (name=="FLTV")
|
else if (name==FLTV)
|
||||||
{
|
{
|
||||||
type = VT_Float;
|
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)
|
bool ESM::operator!= (const Variant& left, const Variant& right)
|
||||||
{
|
{
|
||||||
return !(left==right);
|
return !(left==right);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user