mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-01 04:20:20 +00:00
assert -> exception to gracefully handle corrupted savegames
This commit is contained in:
parent
368c868623
commit
ac8abd3398
@ -296,7 +296,8 @@ void LocalMap::requestMap(MWWorld::CellStore* cell,
|
|||||||
ESM::FogState* fog = cell->getFog();
|
ESM::FogState* fog = cell->getFog();
|
||||||
|
|
||||||
// We are using the same bounds and angle as we were using when the textures were originally made. Segments should come out the same.
|
// We are using the same bounds and angle as we were using when the textures were originally made. Segments should come out the same.
|
||||||
assert (i < int(fog->mFogTextures.size()));
|
if (i >= int(fog->mFogTextures.size()))
|
||||||
|
throw std::runtime_error("fog texture count mismatch");
|
||||||
|
|
||||||
ESM::FogTexture& esm = fog->mFogTextures[i];
|
ESM::FogTexture& esm = fog->mFogTextures[i];
|
||||||
loadFogOfWar(texturePrefix, esm);
|
loadFogOfWar(texturePrefix, esm);
|
||||||
@ -351,7 +352,8 @@ void LocalMap::loadFogOfWar (const std::string& texturePrefix, ESM::FogTexture&
|
|||||||
Ogre::Image image;
|
Ogre::Image image;
|
||||||
image.load(stream, "tga");
|
image.load(stream, "tga");
|
||||||
|
|
||||||
assert (image.getWidth() == sFogOfWarResolution && image.getHeight() == sFogOfWarResolution);
|
if (image.getWidth() != sFogOfWarResolution || image.getHeight() != sFogOfWarResolution)
|
||||||
|
throw std::runtime_error("fog texture size mismatch");
|
||||||
|
|
||||||
std::string texName = texturePrefix + "_fog";
|
std::string texName = texturePrefix + "_fog";
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user