mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-21 07:53:53 +00:00
Merge branch 'clamp' into 'master'
Minor refactor making use of std::clamp See merge request OpenMW/openmw!972
This commit is contained in:
commit
890eaabd4f
1 changed files with 2 additions and 10 deletions
|
@ -72,10 +72,7 @@ void ESM::CellRef::loadData(ESMReader &esm, bool &isDeleted)
|
||||||
break;
|
break;
|
||||||
case ESM::FourCC<'X','S','C','L'>::value:
|
case ESM::FourCC<'X','S','C','L'>::value:
|
||||||
esm.getHT(mScale);
|
esm.getHT(mScale);
|
||||||
if (mScale < 0.5)
|
mScale = std::clamp(mScale, 0.5f, 2.0f);
|
||||||
mScale = 0.5;
|
|
||||||
else if (mScale > 2)
|
|
||||||
mScale = 2;
|
|
||||||
break;
|
break;
|
||||||
case ESM::FourCC<'A','N','A','M'>::value:
|
case ESM::FourCC<'A','N','A','M'>::value:
|
||||||
mOwner = esm.getHString();
|
mOwner = esm.getHString();
|
||||||
|
@ -153,12 +150,7 @@ void ESM::CellRef::save (ESMWriter &esm, bool wideRefNum, bool inInventory, bool
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mScale != 1.0) {
|
if (mScale != 1.0) {
|
||||||
float scale = mScale;
|
esm.writeHNT("XSCL", std::clamp(mScale, 0.5f, 2.0f));
|
||||||
if (scale < 0.5)
|
|
||||||
scale = 0.5;
|
|
||||||
else if (scale > 2)
|
|
||||||
scale = 2;
|
|
||||||
esm.writeHNT("XSCL", scale);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!inInventory)
|
if (!inInventory)
|
||||||
|
|
Loading…
Reference in a new issue