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

@@ -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;
}