BIM/UIM become traits on World; Added World.WorldActor

This commit is contained in:
Bob
2010-01-29 19:57:21 +13:00
parent 7283bc5273
commit 206e4fb558
21 changed files with 73 additions and 64 deletions

View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using IjwFramework.Collections;
using OpenRa.Graphics;
using OpenRa.Traits;
namespace OpenRa
{
@@ -47,7 +48,7 @@ namespace OpenRa
if (thisCost == float.PositiveInfinity)
return p.Location;
foreach( int2 d in Util.directions )
foreach( int2 d in Graphics.Util.directions )
{
int2 newHere = p.Location + d;
@@ -61,14 +62,14 @@ namespace OpenRa
if (costHere == float.PositiveInfinity)
continue;
if (!world.BuildingInfluence.CanMoveHere(newHere) &&
world.BuildingInfluence.GetBuildingAt(newHere) != ignoreBuilding)
if (!world.WorldActor.traits.Get<BuildingInfluence>().CanMoveHere(newHere) &&
world.WorldActor.traits.Get<BuildingInfluence>().GetBuildingAt(newHere) != ignoreBuilding)
continue;
if (world.Map.IsOverlaySolid(newHere))
continue;
// Replicate real-ra behavior of not being able to enter a cell if there is a mixture of crushable and uncrushable units
if (checkForBlocked && (world.UnitInfluence.GetUnitsAt(newHere).Any(a => !world.IsActorPathableToCrush(a, umt))))
if (checkForBlocked && (world.WorldActor.traits.Get<UnitInfluence>().GetUnitsAt(newHere).Any(a => !world.IsActorPathableToCrush(a, umt))))
continue;
if (customBlock != null && customBlock(newHere))