Skip to content

Commit

Permalink
tidy up some spurious trait lookups in HackyAI
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisforbes committed Aug 21, 2011
1 parent 5a3f5d9 commit 840f613
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions OpenRA.Mods.RA/HackyAI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -377,8 +377,8 @@ int2 ChooseRallyLocationNear(int2 startPos)

int2? ChooseDestinationNear(Actor a, int2 desiredMoveTarget)
{
if (!a.HasTrait<IMove>())
return null;
var move = a.TraitOrDefault<IMove>();
if (move == null) return null;

int2 xy;
int loopCount = 0; //avoid infinite loops.
Expand All @@ -390,7 +390,7 @@ int2 ChooseRallyLocationNear(int2 startPos)
loopCount++;
range = Math.Max(range, loopCount / 2);
if (loopCount > 10) return null;
} while (!a.Trait<IMove>().CanEnterCell(xy) && xy != a.Location);
} while (!move.CanEnterCell(xy) && xy != a.Location);

return xy;
}
Expand Down

0 comments on commit 840f613

Please sign in to comment.