StyleCop
This commit is contained in:
@@ -24,9 +24,9 @@ namespace OpenRA
|
|||||||
}
|
}
|
||||||
Lazy<TypeDictionary> initDict;
|
Lazy<TypeDictionary> initDict;
|
||||||
|
|
||||||
public ActorReference( string type ) : this( type, new Dictionary<string, MiniYaml>() ) { }
|
public ActorReference( string type ) : this(type, new Dictionary<string, MiniYaml>()) { }
|
||||||
|
|
||||||
public ActorReference( string type, Dictionary<string, MiniYaml> inits )
|
public ActorReference(string type, Dictionary<string, MiniYaml> inits)
|
||||||
{
|
{
|
||||||
Type = type;
|
Type = type;
|
||||||
initDict = Exts.Lazy(() =>
|
initDict = Exts.Lazy(() =>
|
||||||
@@ -47,17 +47,17 @@ namespace OpenRA
|
|||||||
|
|
||||||
public MiniYaml Save()
|
public MiniYaml Save()
|
||||||
{
|
{
|
||||||
var ret = new MiniYaml( Type );
|
var ret = new MiniYaml(Type);
|
||||||
foreach( var init in InitDict )
|
foreach (var init in InitDict)
|
||||||
{
|
{
|
||||||
var initName = init.GetType().Name;
|
var initName = init.GetType().Name;
|
||||||
ret.Nodes.Add( new MiniYamlNode( initName.Substring( 0, initName.Length - 4 ), FieldSaver.Save( init ) ) );
|
ret.Nodes.Add(new MiniYamlNode(initName.Substring(0, initName.Length - 4), FieldSaver.Save(init)));
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
// for initialization syntax
|
// for initialization syntax
|
||||||
public void Add( object o ) { InitDict.Add( o ); }
|
public void Add(object o) { InitDict.Add(o); }
|
||||||
public IEnumerator GetEnumerator() { return InitDict.GetEnumerator(); }
|
public IEnumerator GetEnumerator() { return InitDict.GetEnumerator(); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -173,8 +173,8 @@ namespace OpenRA
|
|||||||
return fn();
|
return fn();
|
||||||
|
|
||||||
var shouldCheckSync = Game.Settings.Debug.SanityCheckUnsyncedCode;
|
var shouldCheckSync = Game.Settings.Debug.SanityCheckUnsyncedCode;
|
||||||
int sync = shouldCheckSync ? world.SyncHash() : 0;
|
var sync = shouldCheckSync ? world.SyncHash() : 0;
|
||||||
bool prevInUnsyncedCode = inUnsyncedCode;
|
var prevInUnsyncedCode = inUnsyncedCode;
|
||||||
inUnsyncedCode = true;
|
inUnsyncedCode = true;
|
||||||
|
|
||||||
try
|
try
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#region Copyright & License Information
|
#region Copyright & License Information
|
||||||
/*
|
/*
|
||||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
* Copyright 2007-2014 The OpenRA Developers (see AUTHORS)
|
||||||
* This file is part of OpenRA, which is free software. It is made
|
* This file is part of OpenRA, which is free software. It is made
|
||||||
* available to you under the terms of the GNU General Public License
|
* available to you under the terms of the GNU General Public License
|
||||||
* as published by the Free Software Foundation. For more information,
|
* as published by the Free Software Foundation. For more information,
|
||||||
@@ -18,23 +18,23 @@ namespace OpenRA.Traits
|
|||||||
public Activity NextActivity { get; set; }
|
public Activity NextActivity { get; set; }
|
||||||
protected bool IsCanceled { get; private set; }
|
protected bool IsCanceled { get; private set; }
|
||||||
|
|
||||||
public abstract Activity Tick( Actor self );
|
public abstract Activity Tick(Actor self);
|
||||||
|
|
||||||
public virtual void Cancel( Actor self )
|
public virtual void Cancel(Actor self)
|
||||||
{
|
{
|
||||||
IsCanceled = true;
|
IsCanceled = true;
|
||||||
NextActivity = null;
|
NextActivity = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void Queue( Activity activity )
|
public virtual void Queue(Activity activity)
|
||||||
{
|
{
|
||||||
if( NextActivity != null )
|
if (NextActivity != null)
|
||||||
NextActivity.Queue( activity );
|
NextActivity.Queue(activity);
|
||||||
else
|
else
|
||||||
NextActivity = activity;
|
NextActivity = activity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual IEnumerable<Target> GetTargets( Actor self )
|
public virtual IEnumerable<Target> GetTargets(Actor self)
|
||||||
{
|
{
|
||||||
yield break;
|
yield break;
|
||||||
}
|
}
|
||||||
@@ -42,12 +42,12 @@ namespace OpenRA.Traits
|
|||||||
|
|
||||||
public static class ActivityExts
|
public static class ActivityExts
|
||||||
{
|
{
|
||||||
public static IEnumerable<Target> GetTargetQueue( this Actor self )
|
public static IEnumerable<Target> GetTargetQueue(this Actor self)
|
||||||
{
|
{
|
||||||
return self.GetCurrentActivity()
|
return self.GetCurrentActivity()
|
||||||
.Iterate( u => u.NextActivity )
|
.Iterate(u => u.NextActivity)
|
||||||
.TakeWhile( u => u != null )
|
.TakeWhile(u => u != null)
|
||||||
.SelectMany( u => u.GetTargets( self ) );
|
.SelectMany(u => u.GetTargets(self));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -209,8 +209,8 @@ namespace OpenRA.Widgets
|
|||||||
substitutions.Add("PARENT_LEFT", parentBounds.Left);
|
substitutions.Add("PARENT_LEFT", parentBounds.Left);
|
||||||
substitutions.Add("PARENT_TOP", parentBounds.Top);
|
substitutions.Add("PARENT_TOP", parentBounds.Top);
|
||||||
substitutions.Add("PARENT_BOTTOM", parentBounds.Height);
|
substitutions.Add("PARENT_BOTTOM", parentBounds.Height);
|
||||||
int width = Evaluator.Evaluate(Width, substitutions);
|
var width = Evaluator.Evaluate(Width, substitutions);
|
||||||
int height = Evaluator.Evaluate(Height, substitutions);
|
var height = Evaluator.Evaluate(Height, substitutions);
|
||||||
|
|
||||||
substitutions.Add("WIDTH", width);
|
substitutions.Add("WIDTH", width);
|
||||||
substitutions.Add("HEIGHT", height);
|
substitutions.Add("HEIGHT", height);
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ namespace OpenRA
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Widget LoadWidget( WidgetArgs args, Widget parent, string w )
|
public Widget LoadWidget(WidgetArgs args, Widget parent, string w)
|
||||||
{
|
{
|
||||||
MiniYamlNode ret;
|
MiniYamlNode ret;
|
||||||
if (!widgets.TryGetValue(w, out ret))
|
if (!widgets.TryGetValue(w, out ret))
|
||||||
@@ -44,7 +44,7 @@ namespace OpenRA
|
|||||||
return LoadWidget( args, parent, ret );
|
return LoadWidget( args, parent, ret );
|
||||||
}
|
}
|
||||||
|
|
||||||
public Widget LoadWidget( WidgetArgs args, Widget parent, MiniYamlNode node)
|
public Widget LoadWidget(WidgetArgs args, Widget parent, MiniYamlNode node)
|
||||||
{
|
{
|
||||||
var widget = NewWidget(node.Key, args);
|
var widget = NewWidget(node.Key, args);
|
||||||
|
|
||||||
@@ -67,7 +67,7 @@ namespace OpenRA
|
|||||||
foreach (var c in child.Value.Nodes)
|
foreach (var c in child.Value.Nodes)
|
||||||
LoadWidget( args, widget, c);
|
LoadWidget( args, widget, c);
|
||||||
|
|
||||||
widget.PostInit( args );
|
widget.PostInit(args);
|
||||||
return widget;
|
return widget;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -80,8 +80,8 @@ namespace OpenRA.Mods.RA.Activities
|
|||||||
self.World.AddFrameEndTask(
|
self.World.AddFrameEndTask(
|
||||||
w => w.CreateActor(self.Info.Traits.Get<MinelayerInfo>().Mine, new TypeDictionary
|
w => w.CreateActor(self.Info.Traits.Get<MinelayerInfo>().Mine, new TypeDictionary
|
||||||
{
|
{
|
||||||
new LocationInit( self.Location ),
|
new LocationInit(self.Location),
|
||||||
new OwnerInit( self.Owner ),
|
new OwnerInit(self.Owner),
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,9 +76,9 @@ namespace OpenRA.Mods.RA
|
|||||||
// Create a new actor for this bridge and keep track of which subtiles this bridge includes
|
// Create a new actor for this bridge and keep track of which subtiles this bridge includes
|
||||||
var bridge = w.CreateActor(BridgeTypes[tile].First, new TypeDictionary
|
var bridge = w.CreateActor(BridgeTypes[tile].First, new TypeDictionary
|
||||||
{
|
{
|
||||||
new LocationInit( new CPos(ni, nj) ),
|
new LocationInit(new CPos(ni, nj)),
|
||||||
new OwnerInit( w.WorldActor.Owner ),
|
new OwnerInit(w.WorldActor.Owner),
|
||||||
new HealthInit( BridgeTypes[tile].Second ),
|
new HealthInit(BridgeTypes[tile].Second),
|
||||||
}).Trait<Bridge>();
|
}).Trait<Bridge>();
|
||||||
|
|
||||||
var subTiles = new Dictionary<CPos, byte>();
|
var subTiles = new Dictionary<CPos, byte>();
|
||||||
|
|||||||
@@ -59,8 +59,8 @@ namespace OpenRA.Mods.RA.Crates
|
|||||||
collector.World.AddFrameEndTask(
|
collector.World.AddFrameEndTask(
|
||||||
w => w.CreateActor(Info.Unit, new TypeDictionary
|
w => w.CreateActor(Info.Unit, new TypeDictionary
|
||||||
{
|
{
|
||||||
new LocationInit( location.Value ),
|
new LocationInit(location.Value ),
|
||||||
new OwnerInit( Info.Owner ?? collector.Owner.InternalName )
|
new OwnerInit(Info.Owner ?? collector.Owner.InternalName)
|
||||||
}));
|
}));
|
||||||
|
|
||||||
base.Activate(collector);
|
base.Activate(collector);
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ namespace OpenRA.Mods.RA.Render
|
|||||||
{
|
{
|
||||||
PlayerResources playerResources;
|
PlayerResources playerResources;
|
||||||
|
|
||||||
public RenderBuildingSilo( ActorInitializer init, RenderBuildingSiloInfo info )
|
public RenderBuildingSilo(ActorInitializer init, RenderBuildingSiloInfo info)
|
||||||
: base(init, info)
|
: base(init, info)
|
||||||
{
|
{
|
||||||
playerResources = init.self.Owner.PlayerActor.Trait<PlayerResources>();
|
playerResources = init.self.Owner.PlayerActor.Trait<PlayerResources>();
|
||||||
@@ -36,7 +36,7 @@ namespace OpenRA.Mods.RA.Render
|
|||||||
: 0);
|
: 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnCapture (Actor self, Actor captor, Player oldOwner, Player newOwner)
|
public void OnCapture(Actor self, Actor captor, Player oldOwner, Player newOwner)
|
||||||
{
|
{
|
||||||
playerResources = newOwner.PlayerActor.Trait<PlayerResources>();
|
playerResources = newOwner.PlayerActor.Trait<PlayerResources>();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ namespace OpenRA.Mods.RA
|
|||||||
var cargo = a.Trait<Cargo>();
|
var cargo = a.Trait<Cargo>();
|
||||||
foreach (var i in items)
|
foreach (var i in items)
|
||||||
cargo.Load(a, self.World.CreateActor(false, i.ToLowerInvariant(),
|
cargo.Load(a, self.World.CreateActor(false, i.ToLowerInvariant(),
|
||||||
new TypeDictionary { new OwnerInit( a.Owner ) }));
|
new TypeDictionary { new OwnerInit(a.Owner) }));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user