Don't pass movement class via IsPassable directly

Let IsPassable get that info from the locomotor instead.
This commit is contained in:
reaperrr
2018-03-23 23:47:03 +01:00
committed by abcdefg30
parent a52e83ca49
commit 5364515004
9 changed files with 25 additions and 35 deletions

View File

@@ -67,12 +67,8 @@ namespace OpenRA.Mods.Common.Traits
// If a water-land transition is required, bail early
var domainIndex = world.WorldActor.TraitOrDefault<DomainIndex>();
if (domainIndex != null)
{
var passable = li.GetMovementClass(world.Map.Rules.TileSet);
if (!domainIndex.IsPassable(source, target, li, (uint)passable))
return EmptyPath;
}
if (domainIndex != null && !domainIndex.IsPassable(source, target, li))
return EmptyPath;
List<CPos> pb;
using (var fromSrc = PathSearch.FromPoint(world, li, self, target, source, true).WithIgnoredActor(ignoreActor))
@@ -104,8 +100,7 @@ namespace OpenRA.Mods.Common.Traits
var domainIndex = world.WorldActor.TraitOrDefault<DomainIndex>();
if (domainIndex != null)
{
var passable = li.GetMovementClass(world.Map.Rules.TileSet);
tilesInRange = new List<CPos>(tilesInRange.Where(t => domainIndex.IsPassable(source, t, li, (uint)passable)));
tilesInRange = new List<CPos>(tilesInRange.Where(t => domainIndex.IsPassable(source, t, li)));
if (!tilesInRange.Any())
return EmptyPath;
}