Changed missed ActorInfo.Traits.Contains => ActorInfo.HasTraitInfo

This commit is contained in:
atlimit8
2015-09-19 12:06:37 -05:00
parent d77839bb3d
commit 131084d129
2 changed files with 4 additions and 4 deletions

View File

@@ -254,9 +254,9 @@ namespace OpenRA.Scripting
static readonly object[] NoArguments = new object[0]; static readonly object[] NoArguments = new object[0];
Type[] FilterActorCommands(ActorInfo ai) Type[] FilterActorCommands(ActorInfo ai)
{ {
var method = typeof(TypeDictionary).GetMethod("Contains"); var method = typeof(ActorInfo).GetMethod("HasTraitInfo");
return knownActorCommands.Where(c => ExtractRequiredTypes(c) return knownActorCommands.Where(c => ExtractRequiredTypes(c)
.All(t => (bool)method.MakeGenericMethod(t).Invoke(ai.Traits, NoArguments))) .All(t => (bool)method.MakeGenericMethod(t).Invoke(ai, NoArguments)))
.ToArray(); .ToArray();
} }

View File

@@ -141,9 +141,9 @@ namespace OpenRA.Mods.Common.AI
// HACK: HACK HACK HACK // HACK: HACK HACK HACK
// TODO: Derive this from BuildingCommonNames instead // TODO: Derive this from BuildingCommonNames instead
var type = BuildingType.Building; var type = BuildingType.Building;
if (world.Map.Rules.Actors[currentBuilding.Item].Traits.Contains<AttackBaseInfo>()) if (world.Map.Rules.Actors[currentBuilding.Item].HasTraitInfo<AttackBaseInfo>())
type = BuildingType.Defense; type = BuildingType.Defense;
else if (world.Map.Rules.Actors[currentBuilding.Item].Traits.Contains<RefineryInfo>()) else if (world.Map.Rules.Actors[currentBuilding.Item].HasTraitInfo<RefineryInfo>())
type = BuildingType.Refinery; type = BuildingType.Refinery;
var location = ai.ChooseBuildLocation(currentBuilding.Item, true, type); var location = ai.ChooseBuildLocation(currentBuilding.Item, true, type);