Don't pass movement class via IsPassable directly
Let IsPassable get that info from the locomotor instead.
This commit is contained in:
@@ -42,10 +42,9 @@ namespace OpenRA.Mods.Common.AI
|
||||
CPos FindNextResource(Actor actor, Harvester harv)
|
||||
{
|
||||
var locomotorInfo = actor.Info.TraitInfo<MobileInfo>().LocomotorInfo;
|
||||
var passable = (uint)locomotorInfo.GetMovementClass(World.Map.Rules.TileSet);
|
||||
|
||||
Func<CPos, bool> isValidResource = cell =>
|
||||
domainIndex.IsPassable(actor.Location, cell, locomotorInfo, passable) &&
|
||||
domainIndex.IsPassable(actor.Location, cell, locomotorInfo) &&
|
||||
harv.CanHarvestCell(actor, cell) &&
|
||||
claimLayer.CanClaimCell(actor, cell);
|
||||
|
||||
|
||||
@@ -31,11 +31,10 @@ namespace OpenRA.Mods.Common.AI
|
||||
// You might be tempted to move these lookups into Activate() but that causes null reference exception.
|
||||
var domainIndex = first.World.WorldActor.Trait<DomainIndex>();
|
||||
var locomotorInfo = first.Info.TraitInfo<MobileInfo>().LocomotorInfo;
|
||||
var passable = (uint)locomotorInfo.GetMovementClass(first.World.Map.Rules.TileSet);
|
||||
|
||||
var navalProductions = owner.World.ActorsHavingTrait<Building>().Where(a
|
||||
=> owner.Bot.Info.BuildingCommonNames.NavalProduction.Contains(a.Info.Name)
|
||||
&& domainIndex.IsPassable(first.Location, a.Location, locomotorInfo, passable)
|
||||
&& domainIndex.IsPassable(first.Location, a.Location, locomotorInfo)
|
||||
&& a.AppearsHostileTo(first));
|
||||
|
||||
if (navalProductions.Any())
|
||||
|
||||
Reference in New Issue
Block a user