Fail on invalid water levels

dont-compose-content
Evil Eye 3 years ago committed by psi29a
parent 82eb0c6a7a
commit 5f84494046

@ -12,6 +12,7 @@
Bug #5483: AutoCalc flag is not used to calculate spells cost
Bug #5842: GetDisposition adds temporary disposition change from different actors
Bug #6037: Morrowind Content Language Cannot be Set to English in OpenMW Launcher
Bug #6051: NaN water height in ESM file is not handled gracefully
Bug #6066: addtopic "return" does not work from within script. No errors thrown
Bug #6067: esp loader fails in for certain subrecord orders
Bug #6101: Disarming trapped unlocked owned objects isn't considered a crime

@ -1,10 +1,12 @@
#include "loadcell.hpp"
#include <string>
#include <limits>
#include <list>
#include <boost/concept_check.hpp>
#include <components/debug/debuglog.hpp>
#include <components/misc/stringops.hpp>
#include "esmreader.hpp"
@ -109,6 +111,7 @@ namespace ESM
void Cell::loadCell(ESMReader &esm, bool saveContext)
{
bool overriding = !mName.empty();
bool isLoaded = false;
mHasAmbi = false;
while (!isLoaded && esm.hasMoreSubs())
@ -123,8 +126,17 @@ namespace ESM
mWaterInt = true;
break;
case ESM::FourCC<'W','H','G','T'>::value:
esm.getHT(mWater);
float waterLevel;
esm.getHT(waterLevel);
mWaterInt = false;
if(!std::isfinite(waterLevel))
{
if(!overriding)
mWater = std::numeric_limits<float>::max();
Log(Debug::Warning) << "Warning: Encountered invalid water level in cell " << mName << " defined in " << esm.getContext().filename;
}
else
mWater = waterLevel;
break;
case ESM::FourCC<'A','M','B','I'>::value:
esm.getHT(mAmbi);

Loading…
Cancel
Save