Convert all CreateActor calls to use TypeDictionary
This commit is contained in:
@@ -44,7 +44,7 @@ namespace OpenRA
|
||||
World = world;
|
||||
Shroud = new ShroudRenderer(this, world.Map);
|
||||
|
||||
PlayerActor = world.CreateActor("Player", new int2(int.MaxValue, int.MaxValue), this);
|
||||
PlayerActor = world.CreateActor("Player", new TypeDictionary{ new OwnerInit( this ) });
|
||||
|
||||
Index = index;
|
||||
Palette = "player"+index;
|
||||
@@ -64,7 +64,7 @@ namespace OpenRA
|
||||
World = world;
|
||||
Shroud = new ShroudRenderer(this, world.Map);
|
||||
|
||||
PlayerActor = world.CreateActor("Player", new int2(int.MaxValue, int.MaxValue), this);
|
||||
PlayerActor = world.CreateActor("Player", new TypeDictionary{ new OwnerInit( this ) });
|
||||
|
||||
Index = client.Index;
|
||||
Palette = "player"+client.Index;
|
||||
|
||||
@@ -76,7 +76,9 @@ namespace OpenRA.Traits
|
||||
{
|
||||
this.self = init.self;
|
||||
this.Info = info;
|
||||
this.__fromCell = this.__toCell = init.Get<LocationInit,int2>();
|
||||
if (init.Contains<LocationInit>())
|
||||
this.__fromCell = this.__toCell = init.Get<LocationInit,int2>();
|
||||
|
||||
this.Facing = init.Contains<FacingInit>() ? init.Get<FacingInit,int>() : info.InitialFacing;
|
||||
this.Altitude = init.Contains<AltitudeInit>() ? init.Get<AltitudeInit,int>() : 0;
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
using System.Linq;
|
||||
using OpenRA.Effects;
|
||||
using OpenRA.GameRules;
|
||||
using OpenRA.FileFormats;
|
||||
|
||||
namespace OpenRA.Traits
|
||||
{
|
||||
@@ -40,7 +41,12 @@ namespace OpenRA.Traits
|
||||
bool playSounds = true;
|
||||
foreach (var t in LineBuildUtils.GetLineBuildCells(w, order.TargetLocation, order.TargetString, buildingInfo))
|
||||
{
|
||||
var building = w.CreateActor(order.TargetString, t, order.Player);
|
||||
var building = w.CreateActor(order.TargetString, new TypeDictionary
|
||||
{
|
||||
new LocationInit( t ),
|
||||
new OwnerInit( order.Player ),
|
||||
});
|
||||
|
||||
if (playSounds)
|
||||
foreach (var s in buildingInfo.BuildSounds)
|
||||
Sound.PlayToPlayer(order.Player, s, building.CenterLocation);
|
||||
@@ -49,7 +55,11 @@ namespace OpenRA.Traits
|
||||
}
|
||||
else
|
||||
{
|
||||
var building = w.CreateActor(order.TargetString, order.TargetLocation, order.Player);
|
||||
var building = w.CreateActor(order.TargetString, new TypeDictionary
|
||||
{
|
||||
new LocationInit( order.TargetLocation ),
|
||||
new OwnerInit( order.Player ),
|
||||
});
|
||||
foreach (var s in buildingInfo.BuildSounds)
|
||||
Sound.PlayToPlayer(order.Player, s, building.CenterLocation);
|
||||
}
|
||||
|
||||
@@ -125,21 +125,6 @@ namespace OpenRA
|
||||
Timer.Time( "----end World.ctor" );
|
||||
}
|
||||
|
||||
public Actor CreateActor( string name, int2 location, Player owner )
|
||||
{
|
||||
return CreateActor( true, name, location, owner );
|
||||
}
|
||||
|
||||
public Actor CreateActor( bool addToWorld, string name, int2 location, Player owner )
|
||||
{
|
||||
var initDict = new TypeDictionary
|
||||
{
|
||||
new LocationInit( location ),
|
||||
new OwnerInit( owner ),
|
||||
};
|
||||
return CreateActor( addToWorld, name, initDict );
|
||||
}
|
||||
|
||||
public Actor CreateActor( string name, TypeDictionary initDict )
|
||||
{
|
||||
return CreateActor( true, name, initDict );
|
||||
|
||||
Reference in New Issue
Block a user