Pull ActorMap back out into a trait.
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
|
||||
using System.Linq;
|
||||
using OpenRA.FileFormats;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA
|
||||
{
|
||||
|
||||
@@ -83,7 +83,6 @@
|
||||
<ItemGroup>
|
||||
<Compile Include="Actor.cs" />
|
||||
<Compile Include="ActorInitializer.cs" />
|
||||
<Compile Include="ActorMap.cs" />
|
||||
<Compile Include="ActorReference.cs" />
|
||||
<Compile Include="Graphics\QuadRenderer.cs" />
|
||||
<Compile Include="PVecInt.cs" />
|
||||
@@ -239,6 +238,7 @@
|
||||
<Compile Include="Traits\Player\PlayerColorPalette.cs" />
|
||||
<Compile Include="Traits\Player\PlayerHighlightPalette.cs" />
|
||||
<Compile Include="Traits\World\ScreenMap.cs" />
|
||||
<Compile Include="Traits\World\ActorMap.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj">
|
||||
|
||||
@@ -12,10 +12,15 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA
|
||||
namespace OpenRA.Traits
|
||||
{
|
||||
public enum SubCell { FullCell, TopLeft, TopRight, Center, BottomLeft, BottomRight }
|
||||
|
||||
class ActorMapInfo : ITraitInfo
|
||||
{
|
||||
public object Create(ActorInitializer init) { return new ActorMap(init.world); }
|
||||
}
|
||||
|
||||
public class ActorMap
|
||||
{
|
||||
class InfluenceNode
|
||||
@@ -39,7 +44,8 @@ namespace OpenRA
|
||||
|
||||
public IEnumerable<Actor> GetUnitsAt(CPos a)
|
||||
{
|
||||
if (!map.IsInMap(a)) yield break;
|
||||
if (!map.IsInMap(a))
|
||||
yield break;
|
||||
|
||||
for (var i = influence[a.X, a.Y]; i != null; i = i.next)
|
||||
if (!i.actor.Destroyed)
|
||||
@@ -48,7 +54,8 @@ namespace OpenRA
|
||||
|
||||
public IEnumerable<Actor> GetUnitsAt(CPos a, SubCell sub)
|
||||
{
|
||||
if (!map.IsInMap(a)) yield break;
|
||||
if (!map.IsInMap(a))
|
||||
yield break;
|
||||
|
||||
for (var i = influence[a.X, a.Y]; i != null; i = i.next)
|
||||
if (!i.actor.Destroyed && (i.subCell == sub || i.subCell == SubCell.FullCell))
|
||||
@@ -116,7 +123,8 @@ namespace OpenRA
|
||||
public void Update(Actor self, IOccupySpace unit)
|
||||
{
|
||||
Remove(self, unit);
|
||||
if (!self.IsDead()) Add(self, unit);
|
||||
if (!self.IsDead())
|
||||
Add(self, unit);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -123,7 +123,7 @@ namespace OpenRA
|
||||
SharedRandom = new XRandom(orderManager.LobbyInfo.GlobalSettings.RandomSeed);
|
||||
|
||||
WorldActor = CreateActor("World", new TypeDictionary());
|
||||
ActorMap = new ActorMap(this);
|
||||
ActorMap = WorldActor.Trait<ActorMap>();
|
||||
ScreenMap = WorldActor.Trait<ScreenMap>();
|
||||
|
||||
// Add players
|
||||
|
||||
@@ -207,6 +207,7 @@ Player:
|
||||
|
||||
World:
|
||||
ScreenMap:
|
||||
ActorMap:
|
||||
LoadWidgetAtGameStart:
|
||||
Widget: INGAME_ROOT
|
||||
CncMenuPaletteEffect:
|
||||
|
||||
@@ -358,6 +358,7 @@ Player:
|
||||
|
||||
World:
|
||||
ScreenMap:
|
||||
ActorMap:
|
||||
LoadWidgetAtGameStart:
|
||||
Widget: INGAME_ROOT
|
||||
ScreenShaker:
|
||||
|
||||
@@ -530,6 +530,7 @@ Player:
|
||||
|
||||
World:
|
||||
ScreenMap:
|
||||
ActorMap:
|
||||
LoadWidgetAtGameStart:
|
||||
Widget: INGAME_ROOT
|
||||
ScreenShaker:
|
||||
|
||||
@@ -43,6 +43,7 @@ Player:
|
||||
|
||||
World:
|
||||
ScreenMap:
|
||||
ActorMap:
|
||||
LoadWidgetAtGameStart:
|
||||
Widget: INGAME_ROOT
|
||||
BuildingInfluence:
|
||||
|
||||
Reference in New Issue
Block a user