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:
RoosterDragon
2022-01-30 14:19:26 +00:00
committed by Matthias Mailänder
parent 4b4b0125a2
commit 2ab3917f29
6 changed files with 4 additions and 15 deletions

View File

@@ -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)
{