Perform FogObscures as late as possible

FogObscures is more expensive than simpler boolean, player or HasTraitInfo checks, so in these places it makes sense to perform the other checks first.
This commit is contained in:
reaperrr
2017-08-05 22:43:09 +02:00
committed by abcdefg30
parent 99dac05fd7
commit d949e17b88
7 changed files with 11 additions and 13 deletions

View File

@@ -21,7 +21,7 @@ namespace OpenRA.Orders
static Target TargetForInput(World world, CPos cell, int2 worldPixel, MouseInput mi)
{
var actor = world.ScreenMap.ActorsAt(mi)
.Where(a => !world.FogObscures(a) && a.Info.HasTraitInfo<ITargetableInfo>())
.Where(a => a.Info.HasTraitInfo<ITargetableInfo>() && !world.FogObscures(a))
.WithHighestSelectionPriority(worldPixel);
if (actor != null)