Fix WithCargo crash.
This commit is contained in:
@@ -99,7 +99,12 @@ namespace OpenRA.Mods.Cnc.Traits.Render
|
||||
.ToArray();
|
||||
}
|
||||
|
||||
foreach (var p in previews.Values.SelectMany(p => p))
|
||||
foreach (var actorPreviews in previews.Values)
|
||||
{
|
||||
if (actorPreviews == null)
|
||||
continue;
|
||||
|
||||
foreach (var p in actorPreviews)
|
||||
{
|
||||
var index = cargo.PassengerCount > 1 ? i++ % info.LocalOffset.Length : info.LocalOffset.Length / 2;
|
||||
var localOffset = info.LocalOffset[index];
|
||||
@@ -108,11 +113,14 @@ namespace OpenRA.Mods.Cnc.Traits.Render
|
||||
yield return pp.WithZOffset(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
IEnumerable<Rectangle> IRender.ScreenBounds(Actor self, WorldRenderer wr)
|
||||
{
|
||||
var pos = self.CenterPosition;
|
||||
foreach (var p in previews.Values.SelectMany(p => p))
|
||||
foreach (var actorPreviews in previews.Values)
|
||||
if (actorPreviews != null)
|
||||
foreach (var p in actorPreviews)
|
||||
foreach (var b in p.ScreenBounds(wr, pos))
|
||||
yield return b;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user