1
0
forked from 0ad/0ad

Avoid assertion failure when editing terrain off the edge of the map

This was SVN commit r11600.
This commit is contained in:
Ykkrosh 2012-04-21 13:07:47 +00:00
parent dfc86d8ab2
commit 177d7856a6

View File

@ -614,7 +614,14 @@ void CTerrain::MakeDirty(ssize_t i0, ssize_t j0, ssize_t i1, ssize_t j1, int dir
}
if (m_Heightmap)
m_HeightMipmap.Update(m_Heightmap, i0, j0, i1, j1);
{
m_HeightMipmap.Update(m_Heightmap,
clamp(i0, (ssize_t)0, m_MapSize-1),
clamp(j0, (ssize_t)0, m_MapSize-1),
clamp(i1, (ssize_t)1, m_MapSize),
clamp(j1, (ssize_t)1, m_MapSize)
);
}
}
void CTerrain::MakeDirty(int dirtyFlags)