Fixes TerrainRenderer.Draw() causing a crash because of negative firstRow value
This commit is contained in:
@@ -69,9 +69,6 @@ namespace OpenRA.Graphics
|
|||||||
if (lastRow < 0 || firstRow > map.Bounds.Height)
|
if (lastRow < 0 || firstRow > map.Bounds.Height)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (firstRow < 0) firstRow = 0;
|
|
||||||
if (lastRow > map.Bounds.Height) lastRow = map.Bounds.Height;
|
|
||||||
|
|
||||||
if (world.VisibleBounds.HasValue)
|
if (world.VisibleBounds.HasValue)
|
||||||
{
|
{
|
||||||
var r = world.VisibleBounds.Value;
|
var r = world.VisibleBounds.Value;
|
||||||
@@ -82,6 +79,9 @@ namespace OpenRA.Graphics
|
|||||||
firstRow = r.Bottom - map.Bounds.Top;
|
firstRow = r.Bottom - map.Bounds.Top;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (firstRow < 0) firstRow = 0;
|
||||||
|
if (lastRow > map.Bounds.Height) lastRow = map.Bounds.Height;
|
||||||
|
|
||||||
if( lastRow < firstRow ) lastRow = firstRow;
|
if( lastRow < firstRow ) lastRow = firstRow;
|
||||||
|
|
||||||
Game.Renderer.WorldSpriteRenderer.DrawVertexBuffer(
|
Game.Renderer.WorldSpriteRenderer.DrawVertexBuffer(
|
||||||
|
|||||||
Reference in New Issue
Block a user