Use IRender.ScreenBounds in ScreenMap.

Traits are now required to trigger a ScreenMap update whenever they
believe that their ScreenBounds have changed.
This commit is contained in:
Paul Chote
2017-12-09 19:09:17 +00:00
committed by reaperrr
parent fa65fef4d1
commit 8fcc80b05a
8 changed files with 141 additions and 24 deletions

View File

@@ -204,6 +204,23 @@ namespace OpenRA
yield return renderable;
}
public IEnumerable<Rectangle> ScreenBounds(WorldRenderer wr)
{
var bounds = Bounds(wr);
foreach (var modifier in renderModifiers)
bounds = modifier.ModifyScreenBounds(this, wr, bounds);
return bounds;
}
IEnumerable<Rectangle> Bounds(WorldRenderer wr)
{
// PERF: Avoid LINQ. See comments for Renderables
foreach (var render in renders)
foreach (var r in render.ScreenBounds(this, wr))
if (!r.IsEmpty)
yield return r;
}
public void QueueActivity(bool queued, Activity nextActivity)
{
if (!queued)