mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-06 07:45:36 +00:00
Fix(loadcell): Save water height regardless of value, if the user actually adjusted it
This commit is contained in:
parent
1b431bf633
commit
bb35f0366a
3 changed files with 11 additions and 1 deletions
|
@ -996,7 +996,10 @@ namespace CSMWorld
|
|||
case 5:
|
||||
{
|
||||
if (isInterior && interiorWater)
|
||||
{
|
||||
cell.mWater = value.toFloat();
|
||||
cell.setHasWater(true);
|
||||
}
|
||||
else
|
||||
return; // return without saving
|
||||
break;
|
||||
|
|
|
@ -118,6 +118,7 @@ namespace ESM
|
|||
bool overriding = !mName.empty();
|
||||
bool isLoaded = false;
|
||||
mHasAmbi = false;
|
||||
mHasWater = false;
|
||||
while (!isLoaded && esm.hasMoreSubs())
|
||||
{
|
||||
esm.getSubName();
|
||||
|
@ -133,6 +134,7 @@ namespace ESM
|
|||
float waterLevel;
|
||||
esm.getHT(waterLevel);
|
||||
mWaterInt = false;
|
||||
mHasWater = true;
|
||||
if (!std::isfinite(waterLevel))
|
||||
{
|
||||
if (!overriding)
|
||||
|
@ -193,7 +195,7 @@ namespace ESM
|
|||
// Try to avoid saving ambient information when it's unnecessary.
|
||||
// This is to fix black lighting and flooded water
|
||||
// in resaved cell records that lack this information.
|
||||
if (mWaterInt && mWater != 0)
|
||||
if (mHasWater)
|
||||
esm.writeHNT("WHGT", mWater);
|
||||
if (mData.mFlags & QuasiEx)
|
||||
esm.writeHNOCRefId("RGNN", mRegion);
|
||||
|
@ -323,6 +325,7 @@ namespace ESM
|
|||
mData.mY = 0;
|
||||
|
||||
mHasAmbi = true;
|
||||
mHasWater = true;
|
||||
mAmbi.mAmbient = 0;
|
||||
mAmbi.mSunlight = 0;
|
||||
mAmbi.mFog = 0;
|
||||
|
|
|
@ -112,6 +112,7 @@ namespace ESM
|
|||
, mHasAmbi(true)
|
||||
, mWater(0)
|
||||
, mWaterInt(false)
|
||||
, mHasWater(false)
|
||||
, mMapColor(0)
|
||||
, mRefNumCounter(0)
|
||||
{
|
||||
|
@ -132,6 +133,7 @@ namespace ESM
|
|||
|
||||
float mWater; // Water level
|
||||
bool mWaterInt;
|
||||
bool mHasWater;
|
||||
int32_t mMapColor;
|
||||
// Counter for RefNums. This is only used during content file editing and has no impact on gameplay.
|
||||
// It prevents overwriting previous refNums, even if they were deleted.
|
||||
|
@ -163,6 +165,8 @@ namespace ESM
|
|||
|
||||
bool hasWater() const { return ((mData.mFlags & HasWater) != 0) || isExterior(); }
|
||||
|
||||
void setHasWater(bool hasWater) { mHasWater = hasWater; }
|
||||
|
||||
bool hasAmbient() const { return mHasAmbi; }
|
||||
|
||||
void setHasAmbient(bool hasAmbi) { mHasAmbi = hasAmbi; }
|
||||
|
|
Loading…
Reference in a new issue