fix units disappearing if their topleftmost cell was not in the map (proc at top edge, etc)

This commit is contained in:
Chris Forbes
2010-03-30 22:08:37 +13:00
parent 6423c04983
commit 9270a85619

View File

@@ -34,10 +34,13 @@ namespace OpenRA.Traits
foreach (var a in self.World.Actors)
{
if (!self.World.Map.IsInMap(a.Location))
continue;
var bounds = a.GetBounds(true);
if (bounds.Right <= Game.CellSize * self.World.Map.XOffset) continue;
if (bounds.Bottom <= Game.CellSize * self.World.Map.YOffset) continue;
if (bounds.Left >= Game.CellSize * (self.World.Map.XOffset + self.World.Map.Width)) continue;
if (bounds.Top >= Game.CellSize * (self.World.Map.YOffset + self.World.Map.Height)) continue;
var i1 = Math.Max(0, (int)bounds.Left / scale);
var i2 = Math.Min(bins.GetUpperBound(0), (int)bounds.Right / scale);
var j1 = Math.Max(0, (int)bounds.Top / scale);