Silently ignore bogus prerequisites instead of crashing. Fixes #4225.
This commit is contained in:
@@ -63,10 +63,20 @@ namespace OpenRA.Mods.RA
|
|||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
// Add buildables that provide prerequisites
|
// Add buildables that provide prerequisites
|
||||||
foreach (var b in player.World.ActorsWithTrait<ITechTreePrerequisite>()
|
var prereqs = player.World.ActorsWithTrait<ITechTreePrerequisite>()
|
||||||
.Where(a => a.Actor.IsInWorld && !a.Actor.IsDead() && a.Actor.Owner == player))
|
.Where(a => a.Actor.Owner == player && !a.Actor.IsDead() && a.Actor.IsInWorld);
|
||||||
|
|
||||||
|
foreach (var b in prereqs)
|
||||||
|
{
|
||||||
foreach (var p in b.Trait.ProvidesPrerequisites)
|
foreach (var p in b.Trait.ProvidesPrerequisites)
|
||||||
|
{
|
||||||
|
// Ignore bogus prerequisites
|
||||||
|
if (p == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
ret[p].Add(b.Actor);
|
ret[p].Add(b.Actor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Add buildables that have a build limit set and are not already in the list
|
// Add buildables that have a build limit set and are not already in the list
|
||||||
player.World.ActorsWithTrait<Buildable>()
|
player.World.ActorsWithTrait<Buildable>()
|
||||||
|
|||||||
Reference in New Issue
Block a user