mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-01 07:15:34 +00:00
Some additional safety checks for global map loading
This commit is contained in:
parent
f89b3cac02
commit
dea9d21db6
1 changed files with 11 additions and 1 deletions
|
@ -265,6 +265,10 @@ namespace MWRender
|
|||
if (bounds.mMaxY-bounds.mMinY <= 0)
|
||||
return;
|
||||
|
||||
if (bounds.mMinX > bounds.mMaxX
|
||||
|| bounds.mMinY > bounds.mMaxY)
|
||||
throw std::runtime_error("invalid map bounds");
|
||||
|
||||
Ogre::Image image;
|
||||
Ogre::DataStreamPtr stream(new Ogre::MemoryDataStream(&map.mImageData[0], map.mImageData.size()));
|
||||
image.load(stream, "png");
|
||||
|
@ -297,9 +301,15 @@ namespace MWRender
|
|||
// If cell bounds of the currently loaded content and the loaded savegame do not match,
|
||||
// we need to resize source/dest boxes to accommodate
|
||||
// This means nonexisting cells will be dropped silently
|
||||
|
||||
int cellImageSizeDst = 24;
|
||||
|
||||
// Completely off-screen? -> no need to blit anything
|
||||
if (bounds.mMaxX < mMinX
|
||||
|| bounds.mMaxY < mMinY
|
||||
|| bounds.mMinX > mMaxX
|
||||
|| bounds.mMinY > mMaxY)
|
||||
return;
|
||||
|
||||
int leftDiff = (mMinX - bounds.mMinX);
|
||||
int topDiff = (bounds.mMaxY - mMaxY);
|
||||
int rightDiff = (bounds.mMaxX - mMaxX);
|
||||
|
|
Loading…
Reference in a new issue