remove 'private' keyword where possible

This commit is contained in:
Chris Forbes
2011-06-29 09:15:39 +12:00
parent 587b2ef0d1
commit 0e45968573
16 changed files with 27 additions and 34 deletions

View File

@@ -19,9 +19,10 @@ namespace OpenRA.Editor
InitializeComponent(); InitializeComponent();
} }
private void SelectText(object sender, System.EventArgs e) void SelectText(object sender, System.EventArgs e)
{ {
(sender as NumericUpDown).Select(0, (sender as NumericUpDown).ToString().Length); var ud = sender as NumericUpDown;
ud.Select(0, ud.ToString().Length);
} }
} }
} }

View File

@@ -158,7 +158,7 @@ namespace OpenRA.FileFormats
} }
// Decode a code using huffman table h. // Decode a code using huffman table h.
private static int Decode(Huffman h, BitReader br) static int Decode(Huffman h, BitReader br)
{ {
int code = 0; // len bits being decoded int code = 0; // len bits being decoded
int first = 0; // first code of length len int first = 0; // first code of length len

View File

@@ -63,7 +63,7 @@ namespace OpenRA.FileFormats
public Size Size { get { return new Size(Width, Height); } } public Size Size { get { return new Size(Width, Height); } }
private readonly List<ImageHeader> headers = new List<ImageHeader>(); readonly List<ImageHeader> headers = new List<ImageHeader>();
int recurseDepth = 0; int recurseDepth = 0;
@@ -156,7 +156,7 @@ namespace OpenRA.FileFormats
return compressedBytes; return compressedBytes;
} }
private byte[] CopyImageData( byte[] baseImage ) byte[] CopyImageData( byte[] baseImage )
{ {
byte[] imageData = new byte[ Width * Height ]; byte[] imageData = new byte[ Width * Height ];
for( int i = 0 ; i < Width * Height ; i++ ) for( int i = 0 ; i < Width * Height ; i++ )

View File

@@ -48,7 +48,7 @@ namespace OpenRA
[Sync] [Sync]
public Player Owner; public Player Owner;
private Activity currentActivity; Activity currentActivity;
public Group Group; public Group Group;
internal Actor(World world, string name, TypeDictionary initDict ) internal Actor(World world, string name, TypeDictionary initDict )

View File

@@ -32,7 +32,7 @@ namespace OpenRA
public static int CellSize { get { return modData.Manifest.TileSize; } } public static int CellSize { get { return modData.Manifest.TileSize; } }
public static ModData modData; public static ModData modData;
private static WorldRenderer worldRenderer; static WorldRenderer worldRenderer;
public static Viewport viewport; public static Viewport viewport;
public static Settings Settings; public static Settings Settings;

View File

@@ -22,7 +22,7 @@ namespace OpenRA
{ {
public readonly Manifest Manifest; public readonly Manifest Manifest;
public readonly ObjectCreator ObjectCreator; public readonly ObjectCreator ObjectCreator;
public Dictionary<string, Map> AvailableMaps {get; private set;} public Dictionary<string, Map> AvailableMaps { get; private set; }
public readonly WidgetLoader WidgetLoader; public readonly WidgetLoader WidgetLoader;
public ILoadScreen LoadScreen = null; public ILoadScreen LoadScreen = null;
public SheetBuilder SheetBuilder; public SheetBuilder SheetBuilder;

View File

@@ -26,7 +26,7 @@ namespace OpenRA
public int Deaths; public int Deaths;
public WinState WinState = WinState.Undefined; public WinState WinState = WinState.Undefined;
public readonly ColorRamp ColorRamp; public readonly ColorRamp ColorRamp;
public readonly string PlayerName; public readonly string PlayerName;
public readonly string InternalName; public readonly string InternalName;

View File

@@ -16,7 +16,7 @@ namespace OpenRA.Widgets
public class ScrollingTextWidget : Widget public class ScrollingTextWidget : Widget
{ {
public string Text = ""; public string Text = "";
private string ScrollingText = ""; string ScrollingText = "";
public string Background = null; public string Background = null;
@@ -27,10 +27,10 @@ namespace OpenRA.Widgets
// ticks per single letter scroll // ticks per single letter scroll
public int ScrollRate = 4; public int ScrollRate = 4;
private string ScrollBuffer = ""; string ScrollBuffer = "";
private int ScrollLocation = 0; int ScrollLocation = 0;
private int ScrollTick = 0; int ScrollTick = 0;
public Func<string> GetText; public Func<string> GetText;
public Func<string> GetBackground; public Func<string> GetBackground;
@@ -67,22 +67,18 @@ namespace OpenRA.Widgets
ScrollTick = 0; ScrollTick = 0;
} }
private void UpdateScrollBuffer() void UpdateScrollBuffer()
{ {
ScrollTick++; ScrollTick++;
if (ScrollTick < ScrollRate) if (ScrollTick < ScrollRate)
{
return; return;
}
ScrollTick = 0; ScrollTick = 0;
ScrollBuffer = ""; ScrollBuffer = "";
if (ScrollingText.Substring(ScrollingText.Length - 4, 3) != " ") if (ScrollingText.Substring(ScrollingText.Length - 4, 3) != " ")
{
ScrollingText += " "; ScrollingText += " ";
}
int tempScrollLocation = ScrollLocation; int tempScrollLocation = ScrollLocation;
for (int i = 0; i < ScrollLength; ++i) for (int i = 0; i < ScrollLength; ++i)

View File

@@ -27,7 +27,7 @@ namespace OpenRA.Widgets
// This is bogus // This is bogus
public float2 Range = new float2(0f, 1f); public float2 Range = new float2(0f, 1f);
private float Offset = 0; float Offset = 0;
int2 lastMouseLocation; int2 lastMouseLocation;
protected bool isMoving = false; protected bool isMoving = false;

View File

@@ -52,7 +52,7 @@ namespace OpenRA.Widgets
get { return rootWidget; } get { return rootWidget; }
set { rootWidget = value; } set { rootWidget = value; }
} }
private static Widget rootWidget = new ContainerWidget(); static Widget rootWidget = new ContainerWidget();
public Widget(Widget widget) public Widget(Widget widget)
{ {

View File

@@ -19,7 +19,7 @@ namespace OpenRA.Mods.RA.Air
{ {
public readonly int2 Pos; public readonly int2 Pos;
private Fly( int2 px ) { Pos = px; } Fly( int2 px ) { Pos = px; }
public static Fly ToPx( int2 px ) { return new Fly( px ); } public static Fly ToPx( int2 px ) { return new Fly( px ); }
public static Fly ToCell( int2 pos ) { return new Fly( Util.CenterOfCell( pos ) ); } public static Fly ToCell( int2 pos ) { return new Fly( Util.CenterOfCell( pos ) ); }

View File

@@ -29,9 +29,8 @@ namespace OpenRA.Mods.RA
class Contrail : ITick, IPostRender class Contrail : ITick, IPostRender
{ {
private ContrailInfo Info = null; ContrailInfo Info = null;
Turret ContrailTurret = null;
private Turret ContrailTurret = null;
ContrailHistory history; ContrailHistory history;

View File

@@ -439,7 +439,7 @@ namespace OpenRA.Mods.RA
} }
//Build a random unit of the given type. Not going to be needed once there is actual AI... //Build a random unit of the given type. Not going to be needed once there is actual AI...
private void BuildRandom(string category) void BuildRandom(string category)
{ {
// Pick a free queue // Pick a free queue
var queue = world.ActorsWithTrait<ProductionQueue>() var queue = world.ActorsWithTrait<ProductionQueue>()

View File

@@ -21,7 +21,7 @@ namespace OpenRA.Mods.RA
class DefaultShellmapScript: IWorldLoaded, ITick class DefaultShellmapScript: IWorldLoaded, ITick
{ {
Dictionary<string, Actor> Actors; Dictionary<string, Actor> Actors;
private static int2 ViewportOrigin; static int2 ViewportOrigin;
public void WorldLoaded(World w) public void WorldLoaded(World w)
{ {

View File

@@ -13,14 +13,11 @@ using OpenRA.Traits;
namespace OpenRA.Mods.RA namespace OpenRA.Mods.RA
{ {
class SurrenderOnDisconnectInfo : TraitInfo<SurrenderOnDisconnect> class SurrenderOnDisconnectInfo : TraitInfo<SurrenderOnDisconnect> {}
{
}
class SurrenderOnDisconnect : ITick class SurrenderOnDisconnect : ITick
{ {
private bool Disconnected = false; bool Disconnected = false;
public void Tick(Actor self) public void Tick(Actor self)
{ {

View File

@@ -87,7 +87,7 @@ namespace OpenRA.Mods.RA
} }
} }
private void ChangeOwnership(Actor self, Player previousOwner, Player originalOwner) void ChangeOwnership(Actor self, Player previousOwner, Player originalOwner)
{ {
self.World.AddFrameEndTask(w => self.World.AddFrameEndTask(w =>
{ {
@@ -108,7 +108,7 @@ namespace OpenRA.Mods.RA
}); });
} }
private void ChangeOwnership(Actor self, Actor captor, Player previousOwner) void ChangeOwnership(Actor self, Actor captor, Player previousOwner)
{ {
self.World.AddFrameEndTask(w => self.World.AddFrameEndTask(w =>
{ {