fixing MSVC 2013 warning C4244: & C4305

conversion from 'const float' to 'int', possible loss of data
conversion from 'double' to 'int', possible loss of data
conversion from 'float' to 'int', possible loss of data
This commit is contained in:
dteviot 2015-03-08 13:07:29 +13:00
parent f2ac939e61
commit e197f5318b
100 changed files with 457 additions and 474 deletions

View file

@ -10,22 +10,22 @@ namespace ESM
Pathgrid::Point& Pathgrid::Point::operator=(const float rhs[3])
{
mX = rhs[0];
mY = rhs[1];
mZ = rhs[2];
mX = static_cast<int>(rhs[0]);
mY = static_cast<int>(rhs[1]);
mZ = static_cast<int>(rhs[2]);
mAutogenerated = 0;
mConnectionNum = 0;
mUnknown = 0;
return *this;
}
Pathgrid::Point::Point(const float rhs[3])
: mAutogenerated(0),
: mX(static_cast<int>(rhs[0])),
mY(static_cast<int>(rhs[1])),
mZ(static_cast<int>(rhs[2])),
mAutogenerated(0),
mConnectionNum(0),
mUnknown(0)
{
mX = rhs[0];
mY = rhs[1];
mZ = rhs[2];
}
Pathgrid::Point::Point():mX(0),mY(0),mZ(0),mAutogenerated(0),
mConnectionNum(0),mUnknown(0)

View file

@ -15,7 +15,7 @@ namespace ESM
int Race::MaleFemaleF::getValue (bool male) const
{
return male ? mMale : mFemale;
return static_cast<int>(male ? mMale : mFemale);
}
void Race::load(ESMReader &esm)

View file

@ -40,7 +40,7 @@ namespace ESM
// mDamage was changed to a float; ensure backwards compatibility
T oldDamage = 0;
esm.getHNOT(oldDamage, "STDA");
mDamage = oldDamage;
mDamage = static_cast<float>(oldDamage);
esm.getHNOT (mDamage, "STDF");

View file

@ -128,7 +128,7 @@ int ESM::VariantIntegerData::getInteger (bool default_) const
float ESM::VariantIntegerData::getFloat (bool default_) const
{
return mValue;
return static_cast<float>(mValue);
}
void ESM::VariantIntegerData::setInteger (int value)
@ -202,7 +202,7 @@ void ESM::VariantIntegerData::write (ESMWriter& esm, Variant::Format format, Var
{
if (type==VT_Short || type==VT_Long)
{
float value = mValue;
float value = static_cast<float>(mValue);
esm.writeHNString ("FNAM", type==VT_Short ? "s" : "l");
esm.writeHNT ("FLTV", value);
}
@ -262,7 +262,7 @@ float ESM::VariantFloatData::getFloat (bool default_) const
void ESM::VariantFloatData::setInteger (int value)
{
mValue = value;
mValue = static_cast<float>(value);
}
void ESM::VariantFloatData::setFloat (float value)