This commit is contained in:
Matthias Mailänder
2014-05-03 11:32:03 +02:00
parent 0679940c77
commit 8f64835898
11 changed files with 35 additions and 35 deletions

View File

@@ -64,7 +64,7 @@ namespace OpenRA.Editor
{
g.DrawImage(brushTemplate.Bitmap,
surface.TileSetRenderer.TileSize * surface.GetBrushLocation().X * surface.Zoom + surface.GetOffset().X,
surface.TileSetRenderer.TileSize * surface.GetBrushLocation().Y * surface.Zoom + surface.GetOffset().Y,
surface.TileSetRenderer.TileSize * surface.GetBrushLocation().Y * surface.Zoom + surface.GetOffset().Y,
brushTemplate.Bitmap.Width * surface.Zoom,
brushTemplate.Bitmap.Height * surface.Zoom);
}

View File

@@ -24,9 +24,9 @@ namespace OpenRA
}
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;
initDict = Exts.Lazy(() =>
@@ -47,17 +47,17 @@ namespace OpenRA
public MiniYaml Save()
{
var ret = new MiniYaml( Type );
foreach( var init in InitDict )
var ret = new MiniYaml(Type);
foreach (var init in InitDict)
{
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;
}
// 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(); }
}
}

View File

@@ -173,8 +173,8 @@ namespace OpenRA
return fn();
var shouldCheckSync = Game.Settings.Debug.SanityCheckUnsyncedCode;
int sync = shouldCheckSync ? world.SyncHash() : 0;
bool prevInUnsyncedCode = inUnsyncedCode;
var sync = shouldCheckSync ? world.SyncHash() : 0;
var prevInUnsyncedCode = inUnsyncedCode;
inUnsyncedCode = true;
try

View File

@@ -1,6 +1,6 @@
#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
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
@@ -18,23 +18,23 @@ namespace OpenRA.Traits
public Activity NextActivity { get; 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;
NextActivity = null;
}
public virtual void Queue( Activity activity )
public virtual void Queue(Activity activity)
{
if( NextActivity != null )
NextActivity.Queue( activity );
if (NextActivity != null)
NextActivity.Queue(activity);
else
NextActivity = activity;
}
public virtual IEnumerable<Target> GetTargets( Actor self )
public virtual IEnumerable<Target> GetTargets(Actor self)
{
yield break;
}
@@ -42,12 +42,12 @@ namespace OpenRA.Traits
public static class ActivityExts
{
public static IEnumerable<Target> GetTargetQueue( this Actor self )
public static IEnumerable<Target> GetTargetQueue(this Actor self)
{
return self.GetCurrentActivity()
.Iterate( u => u.NextActivity )
.TakeWhile( u => u != null )
.SelectMany( u => u.GetTargets( self ) );
.Iterate(u => u.NextActivity)
.TakeWhile(u => u != null)
.SelectMany(u => u.GetTargets(self));
}
}
}

View File

@@ -209,8 +209,8 @@ namespace OpenRA.Widgets
substitutions.Add("PARENT_LEFT", parentBounds.Left);
substitutions.Add("PARENT_TOP", parentBounds.Top);
substitutions.Add("PARENT_BOTTOM", parentBounds.Height);
int width = Evaluator.Evaluate(Width, substitutions);
int height = Evaluator.Evaluate(Height, substitutions);
var width = Evaluator.Evaluate(Width, substitutions);
var height = Evaluator.Evaluate(Height, substitutions);
substitutions.Add("WIDTH", width);
substitutions.Add("HEIGHT", height);

View File

@@ -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;
if (!widgets.TryGetValue(w, out ret))
@@ -44,7 +44,7 @@ namespace OpenRA
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);
@@ -67,7 +67,7 @@ namespace OpenRA
foreach (var c in child.Value.Nodes)
LoadWidget( args, widget, c);
widget.PostInit( args );
widget.PostInit(args);
return widget;
}

View File

@@ -80,8 +80,8 @@ namespace OpenRA.Mods.RA.Activities
self.World.AddFrameEndTask(
w => w.CreateActor(self.Info.Traits.Get<MinelayerInfo>().Mine, new TypeDictionary
{
new LocationInit( self.Location ),
new OwnerInit( self.Owner ),
new LocationInit(self.Location),
new OwnerInit(self.Owner),
}));
}
}

View File

@@ -76,9 +76,9 @@ namespace OpenRA.Mods.RA
// 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
{
new LocationInit( new CPos(ni, nj) ),
new OwnerInit( w.WorldActor.Owner ),
new HealthInit( BridgeTypes[tile].Second ),
new LocationInit(new CPos(ni, nj)),
new OwnerInit(w.WorldActor.Owner),
new HealthInit(BridgeTypes[tile].Second),
}).Trait<Bridge>();
var subTiles = new Dictionary<CPos, byte>();

View File

@@ -59,8 +59,8 @@ namespace OpenRA.Mods.RA.Crates
collector.World.AddFrameEndTask(
w => w.CreateActor(Info.Unit, new TypeDictionary
{
new LocationInit( location.Value ),
new OwnerInit( Info.Owner ?? collector.Owner.InternalName )
new LocationInit(location.Value ),
new OwnerInit(Info.Owner ?? collector.Owner.InternalName)
}));
base.Activate(collector);

View File

@@ -21,7 +21,7 @@ namespace OpenRA.Mods.RA.Render
{
PlayerResources playerResources;
public RenderBuildingSilo( ActorInitializer init, RenderBuildingSiloInfo info )
public RenderBuildingSilo(ActorInitializer init, RenderBuildingSiloInfo info)
: base(init, info)
{
playerResources = init.self.Owner.PlayerActor.Trait<PlayerResources>();
@@ -36,7 +36,7 @@ namespace OpenRA.Mods.RA.Render
: 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>();
}

View File

@@ -70,7 +70,7 @@ namespace OpenRA.Mods.RA
var cargo = a.Trait<Cargo>();
foreach (var i in items)
cargo.Load(a, self.World.CreateActor(false, i.ToLowerInvariant(),
new TypeDictionary { new OwnerInit( a.Owner ) }));
new TypeDictionary { new OwnerInit(a.Owner) }));
});
}
}