Clean up usage of DomainIndex
- When a path search is being performed the path search will not attempt route to inaccessible cells, so domain index checks to avoid inaccessible cells in the search predicate are redundant and can be removed. - DomainIndex is a required world trait, so we don't need to use TraitOrDefault and therefore can avoid dealing with the null case.
This commit is contained in:
committed by
Matthias Mailänder
parent
4b4b0125a2
commit
2ab3917f29
@@ -325,8 +325,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
// If this bridge repair operation connects two pathfinding domains,
|
||||
// update the domain index.
|
||||
var domainIndex = self.World.WorldActor.TraitOrDefault<DomainIndex>();
|
||||
domainIndex?.UpdateCells(self.World, footprint.Keys);
|
||||
var domainIndex = self.World.WorldActor.Trait<DomainIndex>();
|
||||
domainIndex.UpdateCells(self.World, footprint.Keys);
|
||||
|
||||
if (LongBridgeSegmentIsDead() && !killedUnits)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user