Fix crash on ambient map update outside landscape bounds (#1216)

issue1247
Armin Burgmeier 2015-01-06 11:47:25 +01:00
parent b5560dff25
commit dffed48b3d
2 changed files with 5 additions and 0 deletions

View File

@ -3316,6 +3316,8 @@ void C4Landscape::PrepareChange(C4Rect BoundingBox)
void C4Landscape::FinishChange(C4Rect BoundingBox)
{
// Intersect bounding box with landscape
BoundingBox.Intersect(C4Rect(0, 0, Width, Height));
// update render
if(pLandscapeRender)
pLandscapeRender->Update(BoundingBox, this);

View File

@ -126,6 +126,9 @@ void C4FoWAmbient::CreateFromLandscape(const C4Landscape& landscape, double reso
void C4FoWAmbient::UpdateFromLandscape(const C4Landscape& landscape, const C4Rect& update)
{
// Nothing to do?
if(update.Wdt == 0 || update.Hgt == 0) return;
assert(Tex != 0);
// Factor to go from zoomed to landscape coordinates