Silently ignore bogus prerequisites instead of crashing. Fixes #4225.

This commit is contained in:
Paul Chote
2013-12-08 21:34:49 +13:00
parent 28cf6d36f4
commit e76dbcd4bf

View File

@@ -63,10 +63,20 @@ namespace OpenRA.Mods.RA
return ret;
// Add buildables that provide prerequisites
foreach (var b in player.World.ActorsWithTrait<ITechTreePrerequisite>()
.Where(a => a.Actor.IsInWorld && !a.Actor.IsDead() && a.Actor.Owner == player))
var prereqs = player.World.ActorsWithTrait<ITechTreePrerequisite>()
.Where(a => a.Actor.Owner == player && !a.Actor.IsDead() && a.Actor.IsInWorld);
foreach (var b in prereqs)
{
foreach (var p in b.Trait.ProvidesPrerequisites)
{
// Ignore bogus prerequisites
if (p == null)
continue;
ret[p].Add(b.Actor);
}
}
// Add buildables that have a build limit set and are not already in the list
player.World.ActorsWithTrait<Buildable>()