Simplify names, remove unused usings, remove redundant casts.
This commit is contained in:
@@ -288,7 +288,7 @@ namespace OpenRA
|
|||||||
if (wasInWorld)
|
if (wasInWorld)
|
||||||
w.Add(this);
|
w.Add(this);
|
||||||
|
|
||||||
foreach (var t in this.TraitsImplementing<INotifyOwnerChanged>())
|
foreach (var t in TraitsImplementing<INotifyOwnerChanged>())
|
||||||
t.OnOwnerChanged(this, oldOwner, newOwner);
|
t.OnOwnerChanged(this, oldOwner, newOwner);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -381,7 +381,7 @@ namespace OpenRA
|
|||||||
public LuaValue Equals(LuaRuntime runtime, LuaValue left, LuaValue right)
|
public LuaValue Equals(LuaRuntime runtime, LuaValue left, LuaValue right)
|
||||||
{
|
{
|
||||||
Actor a, b;
|
Actor a, b;
|
||||||
if (!left.TryGetClrValue<Actor>(out a) || !right.TryGetClrValue<Actor>(out b))
|
if (!left.TryGetClrValue(out a) || !right.TryGetClrValue(out b))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return a == b;
|
return a == b;
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ namespace OpenRA
|
|||||||
{
|
{
|
||||||
CPos a;
|
CPos a;
|
||||||
CVec b;
|
CVec b;
|
||||||
if (!left.TryGetClrValue<CPos>(out a) || !right.TryGetClrValue<CVec>(out b))
|
if (!left.TryGetClrValue(out a) || !right.TryGetClrValue(out b))
|
||||||
throw new LuaException("Attempted to call CPos.Add(CPos, CVec) with invalid arguments ({0}, {1})".F(left.WrappedClrType().Name, right.WrappedClrType().Name));
|
throw new LuaException("Attempted to call CPos.Add(CPos, CVec) with invalid arguments ({0}, {1})".F(left.WrappedClrType().Name, right.WrappedClrType().Name));
|
||||||
|
|
||||||
return new LuaCustomClrObject(a + b);
|
return new LuaCustomClrObject(a + b);
|
||||||
@@ -83,7 +83,7 @@ namespace OpenRA
|
|||||||
{
|
{
|
||||||
CPos a;
|
CPos a;
|
||||||
CVec b;
|
CVec b;
|
||||||
if (!left.TryGetClrValue<CPos>(out a) || !right.TryGetClrValue<CVec>(out b))
|
if (!left.TryGetClrValue(out a) || !right.TryGetClrValue(out b))
|
||||||
throw new LuaException("Attempted to call CPos.Subtract(CPos, CVec) with invalid arguments ({0}, {1})".F(left.WrappedClrType().Name, right.WrappedClrType().Name));
|
throw new LuaException("Attempted to call CPos.Subtract(CPos, CVec) with invalid arguments ({0}, {1})".F(left.WrappedClrType().Name, right.WrappedClrType().Name));
|
||||||
|
|
||||||
return new LuaCustomClrObject(a - b);
|
return new LuaCustomClrObject(a - b);
|
||||||
@@ -92,7 +92,7 @@ namespace OpenRA
|
|||||||
public LuaValue Equals(LuaRuntime runtime, LuaValue left, LuaValue right)
|
public LuaValue Equals(LuaRuntime runtime, LuaValue left, LuaValue right)
|
||||||
{
|
{
|
||||||
CPos a, b;
|
CPos a, b;
|
||||||
if (!left.TryGetClrValue<CPos>(out a) || !right.TryGetClrValue<CPos>(out b))
|
if (!left.TryGetClrValue(out a) || !right.TryGetClrValue(out b))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return a == b;
|
return a == b;
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ namespace OpenRA
|
|||||||
public LuaValue Add(LuaRuntime runtime, LuaValue left, LuaValue right)
|
public LuaValue Add(LuaRuntime runtime, LuaValue left, LuaValue right)
|
||||||
{
|
{
|
||||||
CVec a, b;
|
CVec a, b;
|
||||||
if (!left.TryGetClrValue<CVec>(out a) || !right.TryGetClrValue<CVec>(out b))
|
if (!left.TryGetClrValue(out a) || !right.TryGetClrValue(out b))
|
||||||
throw new LuaException("Attempted to call CVec.Add(CVec, CVec) with invalid arguments ({0}, {1})".F(left.WrappedClrType().Name, right.WrappedClrType().Name));
|
throw new LuaException("Attempted to call CVec.Add(CVec, CVec) with invalid arguments ({0}, {1})".F(left.WrappedClrType().Name, right.WrappedClrType().Name));
|
||||||
|
|
||||||
return new LuaCustomClrObject(a + b);
|
return new LuaCustomClrObject(a + b);
|
||||||
@@ -84,7 +84,7 @@ namespace OpenRA
|
|||||||
public LuaValue Subtract(LuaRuntime runtime, LuaValue left, LuaValue right)
|
public LuaValue Subtract(LuaRuntime runtime, LuaValue left, LuaValue right)
|
||||||
{
|
{
|
||||||
CVec a, b;
|
CVec a, b;
|
||||||
if (!left.TryGetClrValue<CVec>(out a) || !right.TryGetClrValue<CVec>(out b))
|
if (!left.TryGetClrValue(out a) || !right.TryGetClrValue(out b))
|
||||||
throw new LuaException("Attempted to call CVec.Subtract(CVec, CVec) with invalid arguments ({0}, {1})".F(left.WrappedClrType().Name, right.WrappedClrType().Name));
|
throw new LuaException("Attempted to call CVec.Subtract(CVec, CVec) with invalid arguments ({0}, {1})".F(left.WrappedClrType().Name, right.WrappedClrType().Name));
|
||||||
|
|
||||||
return new LuaCustomClrObject(a - b);
|
return new LuaCustomClrObject(a - b);
|
||||||
@@ -98,7 +98,7 @@ namespace OpenRA
|
|||||||
public LuaValue Equals(LuaRuntime runtime, LuaValue left, LuaValue right)
|
public LuaValue Equals(LuaRuntime runtime, LuaValue left, LuaValue right)
|
||||||
{
|
{
|
||||||
CVec a, b;
|
CVec a, b;
|
||||||
if (!left.TryGetClrValue<CVec>(out a) || !right.TryGetClrValue<CVec>(out b))
|
if (!left.TryGetClrValue(out a) || !right.TryGetClrValue(out b))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return a == b;
|
return a == b;
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ namespace OpenRA
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (t.IsGenericType && t.GetGenericTypeDefinition() == typeof(OpenRA.Primitives.Cache<,>))
|
if (t.IsGenericType && t.GetGenericTypeDefinition() == typeof(Primitives.Cache<,>))
|
||||||
return ""; // TODO
|
return ""; // TODO
|
||||||
|
|
||||||
if (t == typeof(DateTime))
|
if (t == typeof(DateTime))
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ namespace OpenRA.FileFormats
|
|||||||
{
|
{
|
||||||
var pn = (byte*)tempPn;
|
var pn = (byte*)tempPn;
|
||||||
var i = blen * 4;
|
var i = blen * 4;
|
||||||
for (; i > klen; i--) pn[i - 1] = (byte)sign;
|
for (; i > klen; i--) pn[i - 1] = sign;
|
||||||
for (; i > 0; i--) pn[i - 1] = key[klen - i];
|
for (; i > 0; i--) pn[i - 1] = key[klen - i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,6 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
|
||||||
using OpenRA.Graphics;
|
using OpenRA.Graphics;
|
||||||
|
|
||||||
namespace OpenRA.FileFormats
|
namespace OpenRA.FileFormats
|
||||||
|
|||||||
@@ -8,7 +8,6 @@
|
|||||||
*/
|
*/
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
namespace OpenRA.FileFormats
|
namespace OpenRA.FileFormats
|
||||||
|
|||||||
@@ -49,11 +49,11 @@ namespace OpenRA.FileFormats
|
|||||||
writer.Write(Encoding.ASCII.GetBytes("XCC by Olaf van der Spek"));
|
writer.Write(Encoding.ASCII.GetBytes("XCC by Olaf van der Spek"));
|
||||||
writer.Write(new byte[] { 0x1A, 0x04, 0x17, 0x27, 0x10, 0x19, 0x80, 0x00 });
|
writer.Write(new byte[] { 0x1A, 0x04, 0x17, 0x27, 0x10, 0x19, 0x80, 0x00 });
|
||||||
|
|
||||||
writer.Write((int)(Entries.Aggregate(Entries.Length, (a, b) => a + b.Length) + 52)); // Size
|
writer.Write(Entries.Aggregate(Entries.Length, (a, b) => a + b.Length) + 52); // Size
|
||||||
writer.Write((int)0); // Type
|
writer.Write(0); // Type
|
||||||
writer.Write((int)0); // Version
|
writer.Write(0); // Version
|
||||||
writer.Write((int)0); // Game/Format (0 == TD)
|
writer.Write(0); // Game/Format (0 == TD)
|
||||||
writer.Write((int)Entries.Length); // Entries
|
writer.Write(Entries.Length); // Entries
|
||||||
foreach (var e in Entries)
|
foreach (var e in Entries)
|
||||||
{
|
{
|
||||||
writer.Write(Encoding.ASCII.GetBytes(e));
|
writer.Write(Encoding.ASCII.GetBytes(e));
|
||||||
|
|||||||
@@ -8,7 +8,6 @@
|
|||||||
*/
|
*/
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ namespace OpenRA.FileSystem
|
|||||||
FirstFile = reader.ReadUInt32();
|
FirstFile = reader.ReadUInt32();
|
||||||
LastFile = reader.ReadUInt32();
|
LastFile = reader.ReadUInt32();
|
||||||
|
|
||||||
reader.Seek(offset + (long)nameOffset, SeekOrigin.Begin);
|
reader.Seek(offset + nameOffset, SeekOrigin.Begin);
|
||||||
Name = reader.ReadASCIIZ();
|
Name = reader.ReadASCIIZ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -107,7 +107,7 @@ namespace OpenRA.FileSystem
|
|||||||
{
|
{
|
||||||
Version = reader.ReadUInt32();
|
Version = reader.ReadUInt32();
|
||||||
VolumeInfo = reader.ReadUInt32();
|
VolumeInfo = reader.ReadUInt32();
|
||||||
CabDescriptorOffset = (long)reader.ReadUInt32();
|
CabDescriptorOffset = reader.ReadUInt32();
|
||||||
CabDescriptorSize = reader.ReadUInt32();
|
CabDescriptorSize = reader.ReadUInt32();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -125,7 +125,7 @@ namespace OpenRA.FileSystem
|
|||||||
public CabDescriptor(Stream reader, CommonHeader commonHeader)
|
public CabDescriptor(Stream reader, CommonHeader commonHeader)
|
||||||
{
|
{
|
||||||
reader.Seek(commonHeader.CabDescriptorOffset + 12, SeekOrigin.Begin);
|
reader.Seek(commonHeader.CabDescriptorOffset + 12, SeekOrigin.Begin);
|
||||||
FileTableOffset = (long)reader.ReadUInt32();
|
FileTableOffset = reader.ReadUInt32();
|
||||||
/* unknown */ reader.ReadUInt32();
|
/* unknown */ reader.ReadUInt32();
|
||||||
FileTableSize = reader.ReadUInt32();
|
FileTableSize = reader.ReadUInt32();
|
||||||
|
|
||||||
@@ -134,7 +134,7 @@ namespace OpenRA.FileSystem
|
|||||||
/* unknown */ reader.ReadBytes(8);
|
/* unknown */ reader.ReadBytes(8);
|
||||||
FileCount = reader.ReadUInt32();
|
FileCount = reader.ReadUInt32();
|
||||||
|
|
||||||
FileTableOffset2 = (long)reader.ReadUInt32();
|
FileTableOffset2 = reader.ReadUInt32();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -201,7 +201,7 @@ namespace OpenRA.FileSystem
|
|||||||
this.index = index;
|
this.index = index;
|
||||||
this.commonName = commonName;
|
this.commonName = commonName;
|
||||||
this.context = context;
|
this.context = context;
|
||||||
volumeNumber = (ushort)((uint)fileDes.Volume - 1u);
|
volumeNumber = (ushort)(fileDes.Volume - 1u);
|
||||||
RemainingArchiveStream = 0;
|
RemainingArchiveStream = 0;
|
||||||
if ((fileDes.Flags & FileCompressed) > 0)
|
if ((fileDes.Flags & FileCompressed) > 0)
|
||||||
RemainingFileStream = fileDes.CompressedSize;
|
RemainingFileStream = fileDes.CompressedSize;
|
||||||
@@ -374,7 +374,7 @@ namespace OpenRA.FileSystem
|
|||||||
hdrFile.Seek((long)nextOffset + 4 + commonHeader.CabDescriptorOffset, SeekOrigin.Begin);
|
hdrFile.Seek((long)nextOffset + 4 + commonHeader.CabDescriptorOffset, SeekOrigin.Begin);
|
||||||
var descriptorOffset = hdrFile.ReadUInt32();
|
var descriptorOffset = hdrFile.ReadUInt32();
|
||||||
nextOffset = hdrFile.ReadUInt32();
|
nextOffset = hdrFile.ReadUInt32();
|
||||||
hdrFile.Seek((long)descriptorOffset + commonHeader.CabDescriptorOffset, SeekOrigin.Begin);
|
hdrFile.Seek(descriptorOffset + commonHeader.CabDescriptorOffset, SeekOrigin.Begin);
|
||||||
|
|
||||||
fileGroups.Add(new FileGroup(hdrFile, commonHeader.CabDescriptorOffset));
|
fileGroups.Add(new FileGroup(hdrFile, commonHeader.CabDescriptorOffset));
|
||||||
}
|
}
|
||||||
@@ -387,7 +387,7 @@ namespace OpenRA.FileSystem
|
|||||||
{
|
{
|
||||||
AddFileDescriptorToList(index);
|
AddFileDescriptorToList(index);
|
||||||
var fileDescriptor = fileDescriptors[index];
|
var fileDescriptor = fileDescriptors[index];
|
||||||
var fullFilePath = "{0}\\{1}\\{2}".F(fileGroup.Name, DirectoryName((uint)fileDescriptor.DirectoryIndex), fileDescriptor.Filename);
|
var fullFilePath = "{0}\\{1}\\{2}".F(fileGroup.Name, DirectoryName(fileDescriptor.DirectoryIndex), fileDescriptor.Filename);
|
||||||
fileLookup.Add(fullFilePath, index);
|
fileLookup.Add(fullFilePath, index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,6 @@
|
|||||||
*/
|
*/
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,6 @@
|
|||||||
*/
|
*/
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ namespace OpenRA
|
|||||||
|
|
||||||
// More accurate replacement for Environment.TickCount
|
// More accurate replacement for Environment.TickCount
|
||||||
static Stopwatch stopwatch = Stopwatch.StartNew();
|
static Stopwatch stopwatch = Stopwatch.StartNew();
|
||||||
public static int RunTime { get { return (int)Game.stopwatch.ElapsedMilliseconds; } }
|
public static int RunTime { get { return (int)stopwatch.ElapsedMilliseconds; } }
|
||||||
|
|
||||||
public static int RenderFrame = 0;
|
public static int RenderFrame = 0;
|
||||||
public static int NetFrameNumber { get { return OrderManager.NetFrameNumber; } }
|
public static int NetFrameNumber { get { return OrderManager.NetFrameNumber; } }
|
||||||
@@ -461,8 +461,8 @@ namespace OpenRA
|
|||||||
// Note: These delayed actions should only be used by widgets or disposing objects
|
// Note: These delayed actions should only be used by widgets or disposing objects
|
||||||
// - things that depend on a particular world should be queuing them on the world actor.
|
// - things that depend on a particular world should be queuing them on the world actor.
|
||||||
static volatile ActionQueue delayedActions = new ActionQueue();
|
static volatile ActionQueue delayedActions = new ActionQueue();
|
||||||
public static void RunAfterTick(Action a) { delayedActions.Add(a, Game.RunTime); }
|
public static void RunAfterTick(Action a) { delayedActions.Add(a, RunTime); }
|
||||||
public static void RunAfterDelay(int delayMilliseconds, Action a) { delayedActions.Add(a, Game.RunTime + delayMilliseconds); }
|
public static void RunAfterDelay(int delayMilliseconds, Action a) { delayedActions.Add(a, RunTime + delayMilliseconds); }
|
||||||
|
|
||||||
static void TakeScreenshotInner()
|
static void TakeScreenshotInner()
|
||||||
{
|
{
|
||||||
@@ -489,7 +489,7 @@ namespace OpenRA
|
|||||||
|
|
||||||
bitmap.Dispose();
|
bitmap.Dispose();
|
||||||
|
|
||||||
Game.RunAfterTick(() => Debug("Saved screenshot " + filename));
|
RunAfterTick(() => Debug("Saved screenshot " + filename));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -571,7 +571,7 @@ namespace OpenRA
|
|||||||
|
|
||||||
static void LogicTick()
|
static void LogicTick()
|
||||||
{
|
{
|
||||||
delayedActions.PerformActions(Game.RunTime);
|
delayedActions.PerformActions(RunTime);
|
||||||
|
|
||||||
if (OrderManager.Connection.ConnectionState != lastConnectionState)
|
if (OrderManager.Connection.ConnectionState != lastConnectionState)
|
||||||
{
|
{
|
||||||
@@ -604,9 +604,9 @@ namespace OpenRA
|
|||||||
|
|
||||||
using (new PerfSample("render_widgets"))
|
using (new PerfSample("render_widgets"))
|
||||||
{
|
{
|
||||||
Game.Renderer.WorldVoxelRenderer.BeginFrame();
|
Renderer.WorldVoxelRenderer.BeginFrame();
|
||||||
Ui.PrepareRenderables();
|
Ui.PrepareRenderables();
|
||||||
Game.Renderer.WorldVoxelRenderer.EndFrame();
|
Renderer.WorldVoxelRenderer.EndFrame();
|
||||||
|
|
||||||
Ui.Draw();
|
Ui.Draw();
|
||||||
|
|
||||||
@@ -684,7 +684,7 @@ namespace OpenRA
|
|||||||
{
|
{
|
||||||
// Ideal time between logic updates. Timestep = 0 means the game is paused
|
// Ideal time between logic updates. Timestep = 0 means the game is paused
|
||||||
// but we still call LogicTick() because it handles pausing internally.
|
// but we still call LogicTick() because it handles pausing internally.
|
||||||
var logicInterval = worldRenderer != null && worldRenderer.World.Timestep != 0 ? worldRenderer.World.Timestep : Game.Timestep;
|
var logicInterval = worldRenderer != null && worldRenderer.World.Timestep != 0 ? worldRenderer.World.Timestep : Timestep;
|
||||||
|
|
||||||
// Ideal time between screen updates
|
// Ideal time between screen updates
|
||||||
var maxFramerate = Settings.Graphics.CapFramerate ? Settings.Graphics.MaxFramerate.Clamp(1, 1000) : 1000;
|
var maxFramerate = Settings.Graphics.CapFramerate ? Settings.Graphics.MaxFramerate.Clamp(1, 1000) : 1000;
|
||||||
|
|||||||
@@ -8,10 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using OpenRA.Graphics;
|
|
||||||
|
|
||||||
namespace OpenRA
|
namespace OpenRA
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -10,11 +10,9 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using Meebey.SmartIrc4net;
|
using Meebey.SmartIrc4net;
|
||||||
using OpenRA;
|
|
||||||
using OpenRA.Primitives;
|
using OpenRA.Primitives;
|
||||||
|
|
||||||
namespace OpenRA.Chat
|
namespace OpenRA.Chat
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace OpenRA.Graphics
|
namespace OpenRA.Graphics
|
||||||
|
|||||||
@@ -12,8 +12,6 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using OpenRA.Graphics;
|
|
||||||
using OpenRA.Primitives;
|
|
||||||
|
|
||||||
namespace OpenRA.Graphics
|
namespace OpenRA.Graphics
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ namespace OpenRA.Graphics
|
|||||||
if (defaultSrc != Src)
|
if (defaultSrc != Src)
|
||||||
root.Add(new MiniYamlNode("Src", Src));
|
root.Add(new MiniYamlNode("Src", Src));
|
||||||
|
|
||||||
return new MiniYaml(FieldSaver.FormatValue(this, this.GetType().GetField("rect")), root);
|
return new MiniYaml(FieldSaver.FormatValue(this, GetType().GetField("rect")), root);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ namespace OpenRA.Graphics
|
|||||||
var b = new Bitmap(Size, 1, PixelFormat.Format32bppArgb);
|
var b = new Bitmap(Size, 1, PixelFormat.Format32bppArgb);
|
||||||
var data = b.LockBits(new Rectangle(0, 0, b.Width, b.Height),
|
var data = b.LockBits(new Rectangle(0, 0, b.Width, b.Height),
|
||||||
ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb);
|
ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb);
|
||||||
var temp = new uint[Palette.Size];
|
var temp = new uint[Size];
|
||||||
palette.CopyToArray(temp, 0);
|
palette.CopyToArray(temp, 0);
|
||||||
Marshal.Copy((int[])(object)temp, 0, data.Scan0, Size);
|
Marshal.Copy((int[])(object)temp, 0, data.Scan0, Size);
|
||||||
b.UnlockBits(data);
|
b.UnlockBits(data);
|
||||||
|
|||||||
@@ -8,12 +8,6 @@
|
|||||||
*/
|
*/
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Linq;
|
|
||||||
using OpenRA.Traits;
|
|
||||||
|
|
||||||
namespace OpenRA.Graphics
|
namespace OpenRA.Graphics
|
||||||
{
|
{
|
||||||
public sealed class PaletteReference
|
public sealed class PaletteReference
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ namespace OpenRA.Graphics
|
|||||||
{
|
{
|
||||||
// Increase luminosity if required to represent the full ramp
|
// Increase luminosity if required to represent the full ramp
|
||||||
var rampRange = (byte)((1 - rampFraction) * c.L);
|
var rampRange = (byte)((1 - rampFraction) * c.L);
|
||||||
var c1 = new HSLColor(c.H, c.S, (byte)Math.Max(rampRange, c.L)).RGB;
|
var c1 = new HSLColor(c.H, c.S, Math.Max(rampRange, c.L)).RGB;
|
||||||
var c2 = new HSLColor(c.H, c.S, (byte)Math.Max(0, c.L - rampRange)).RGB;
|
var c2 = new HSLColor(c.H, c.S, (byte)Math.Max(0, c.L - rampRange)).RGB;
|
||||||
var baseIndex = ramp[0];
|
var baseIndex = ramp[0];
|
||||||
var remapRamp = ramp.Select(r => r - ramp[0]);
|
var remapRamp = ramp.Select(r => r - ramp[0]);
|
||||||
|
|||||||
@@ -8,9 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace OpenRA.Graphics
|
namespace OpenRA.Graphics
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using OpenRA.Graphics;
|
|
||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
|
|
||||||
namespace OpenRA.Graphics
|
namespace OpenRA.Graphics
|
||||||
|
|||||||
@@ -10,9 +10,7 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
|
||||||
|
|
||||||
namespace OpenRA.Graphics
|
namespace OpenRA.Graphics
|
||||||
{
|
{
|
||||||
@@ -50,8 +48,8 @@ namespace OpenRA.Graphics
|
|||||||
|
|
||||||
public SequenceProvider(SequenceCache cache, Map map)
|
public SequenceProvider(SequenceCache cache, Map map)
|
||||||
{
|
{
|
||||||
this.sequences = Exts.Lazy(() => cache.LoadSequences(map));
|
sequences = Exts.Lazy(() => cache.LoadSequences(map));
|
||||||
this.SpriteCache = cache.SpriteCache;
|
SpriteCache = cache.SpriteCache;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ISpriteSequence GetSequence(string unitName, string sequenceName)
|
public ISpriteSequence GetSequence(string unitName, string sequenceName)
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ using System;
|
|||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Drawing.Imaging;
|
using System.Drawing.Imaging;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace OpenRA.Graphics
|
namespace OpenRA.Graphics
|
||||||
|
|||||||
@@ -11,7 +11,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace OpenRA.Graphics
|
namespace OpenRA.Graphics
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -10,9 +10,7 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using OpenRA.Graphics;
|
|
||||||
using OpenRA.Primitives;
|
using OpenRA.Primitives;
|
||||||
|
|
||||||
namespace OpenRA.Graphics
|
namespace OpenRA.Graphics
|
||||||
|
|||||||
@@ -11,8 +11,6 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using OpenRA.Graphics;
|
|
||||||
using OpenRA.Traits;
|
|
||||||
|
|
||||||
namespace OpenRA.Graphics
|
namespace OpenRA.Graphics
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,8 +12,6 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
|
||||||
using OpenRA.Traits;
|
|
||||||
|
|
||||||
namespace OpenRA.Graphics
|
namespace OpenRA.Graphics
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using OpenRA.FileSystem;
|
|
||||||
using OpenRA.Support;
|
using OpenRA.Support;
|
||||||
|
|
||||||
namespace OpenRA.Graphics
|
namespace OpenRA.Graphics
|
||||||
|
|||||||
@@ -8,9 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace OpenRA.Graphics
|
namespace OpenRA.Graphics
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -11,7 +11,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Drawing.Imaging;
|
using System.Drawing.Imaging;
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
namespace OpenRA.Graphics
|
namespace OpenRA.Graphics
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ namespace OpenRA.Graphics
|
|||||||
|
|
||||||
public VoxelRenderProxy(Sprite sprite, Sprite shadowSprite, float2[] projectedShadowBounds, float shadowDirection)
|
public VoxelRenderProxy(Sprite sprite, Sprite shadowSprite, float2[] projectedShadowBounds, float shadowDirection)
|
||||||
{
|
{
|
||||||
this.Sprite = sprite;
|
Sprite = sprite;
|
||||||
ShadowSprite = shadowSprite;
|
ShadowSprite = shadowSprite;
|
||||||
ProjectedShadowBounds = projectedShadowBounds;
|
ProjectedShadowBounds = projectedShadowBounds;
|
||||||
ShadowDirection = shadowDirection;
|
ShadowDirection = shadowDirection;
|
||||||
|
|||||||
@@ -86,12 +86,12 @@ namespace OpenRA
|
|||||||
Player player;
|
Player player;
|
||||||
|
|
||||||
public OwnerInit() { }
|
public OwnerInit() { }
|
||||||
public OwnerInit(string playerName) { this.PlayerName = playerName; }
|
public OwnerInit(string playerName) { PlayerName = playerName; }
|
||||||
|
|
||||||
public OwnerInit(Player player)
|
public OwnerInit(Player player)
|
||||||
{
|
{
|
||||||
this.player = player;
|
this.player = player;
|
||||||
this.PlayerName = player.InternalName;
|
PlayerName = player.InternalName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Player Value(World world)
|
public Player Value(World world)
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ namespace OpenRA
|
|||||||
return uv.V * Size.Width + uv.U;
|
return uv.V * Size.Width + uv.U;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Gets or sets the <see cref="OpenRA.CellLayer"/> using cell coordinates</summary>
|
/// <summary>Gets or sets the <see cref="CellLayer"/> using cell coordinates</summary>
|
||||||
public T this[CPos cell]
|
public T this[CPos cell]
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ using System.Linq;
|
|||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using OpenRA.FileSystem;
|
using OpenRA.FileSystem;
|
||||||
using OpenRA.GameRules;
|
|
||||||
using OpenRA.Graphics;
|
using OpenRA.Graphics;
|
||||||
using OpenRA.Network;
|
using OpenRA.Network;
|
||||||
using OpenRA.Support;
|
using OpenRA.Support;
|
||||||
@@ -277,7 +276,7 @@ namespace OpenRA
|
|||||||
{
|
{
|
||||||
var size = new Size(width, height);
|
var size = new Size(width, height);
|
||||||
Grid = Game.ModData.Manifest.Get<MapGrid>();
|
Grid = Game.ModData.Manifest.Get<MapGrid>();
|
||||||
var tileRef = new TerrainTile(tileset.Templates.First().Key, (byte)0);
|
var tileRef = new TerrainTile(tileset.Templates.First().Key, 0);
|
||||||
|
|
||||||
Title = "Name your map here";
|
Title = "Name your map here";
|
||||||
Description = "Describe your map here";
|
Description = "Describe your map here";
|
||||||
@@ -604,7 +603,7 @@ namespace OpenRA
|
|||||||
|
|
||||||
foreach (var field in fields)
|
foreach (var field in fields)
|
||||||
{
|
{
|
||||||
var f = this.GetType().GetField(field);
|
var f = GetType().GetField(field);
|
||||||
if (f.GetValue(this) == null)
|
if (f.GetValue(this) == null)
|
||||||
continue;
|
continue;
|
||||||
root.Add(new MiniYamlNode(field, FieldSaver.FormatValue(this, f)));
|
root.Add(new MiniYamlNode(field, FieldSaver.FormatValue(this, f)));
|
||||||
|
|||||||
@@ -8,10 +8,8 @@
|
|||||||
*/
|
*/
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace OpenRA
|
namespace OpenRA
|
||||||
{
|
{
|
||||||
@@ -64,8 +62,8 @@ namespace OpenRA
|
|||||||
|
|
||||||
public MapCoordsRegion(MPos mapTopLeft, MPos mapBottomRight)
|
public MapCoordsRegion(MPos mapTopLeft, MPos mapBottomRight)
|
||||||
{
|
{
|
||||||
this.topLeft = mapTopLeft;
|
topLeft = mapTopLeft;
|
||||||
this.bottomRight = mapBottomRight;
|
bottomRight = mapBottomRight;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MapCoordsEnumerator GetEnumerator()
|
public MapCoordsEnumerator GetEnumerator()
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ using System.Collections.Generic;
|
|||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Drawing.Imaging;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
|
|||||||
@@ -79,9 +79,9 @@ namespace OpenRA
|
|||||||
|
|
||||||
public TerrainTemplateInfo(ushort id, string[] images, int2 size, byte[] tiles)
|
public TerrainTemplateInfo(ushort id, string[] images, int2 size, byte[] tiles)
|
||||||
{
|
{
|
||||||
this.Id = id;
|
Id = id;
|
||||||
this.Images = images;
|
Images = images;
|
||||||
this.Size = size;
|
Size = size;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TerrainTemplateInfo(TileSet tileSet, MiniYaml my)
|
public TerrainTemplateInfo(TileSet tileSet, MiniYaml my)
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ namespace OpenRA.Network
|
|||||||
public virtual void SendImmediate(List<byte[]> orders)
|
public virtual void SendImmediate(List<byte[]> orders)
|
||||||
{
|
{
|
||||||
var ms = new MemoryStream();
|
var ms = new MemoryStream();
|
||||||
ms.Write(BitConverter.GetBytes((int)0));
|
ms.Write(BitConverter.GetBytes(0));
|
||||||
foreach (var o in orders)
|
foreach (var o in orders)
|
||||||
ms.Write(o);
|
ms.Write(o);
|
||||||
Send(ms.ToArray());
|
Send(ms.ToArray());
|
||||||
@@ -196,12 +196,12 @@ namespace OpenRA.Network
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
var ms = new MemoryStream();
|
var ms = new MemoryStream();
|
||||||
ms.Write(BitConverter.GetBytes((int)packet.Length));
|
ms.Write(BitConverter.GetBytes(packet.Length));
|
||||||
ms.Write(packet);
|
ms.Write(packet);
|
||||||
|
|
||||||
foreach (var q in queuedSyncPackets)
|
foreach (var q in queuedSyncPackets)
|
||||||
{
|
{
|
||||||
ms.Write(BitConverter.GetBytes((int)q.Length));
|
ms.Write(BitConverter.GetBytes(q.Length));
|
||||||
ms.Write(q);
|
ms.Write(q);
|
||||||
base.Send(q);
|
base.Send(q);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,6 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using ICSharpCode.SharpZipLib.Core;
|
|
||||||
using ICSharpCode.SharpZipLib.GZip;
|
using ICSharpCode.SharpZipLib.GZip;
|
||||||
using MaxMind.GeoIP2;
|
using MaxMind.GeoIP2;
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,6 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
|
||||||
using OpenRA.Network;
|
using OpenRA.Network;
|
||||||
|
|
||||||
namespace OpenRA
|
namespace OpenRA
|
||||||
@@ -52,14 +51,14 @@ namespace OpenRA
|
|||||||
Order(string orderString, Actor subject,
|
Order(string orderString, Actor subject,
|
||||||
Actor targetActor, CPos targetLocation, string targetString, bool queued, CPos extraLocation, uint extraData)
|
Actor targetActor, CPos targetLocation, string targetString, bool queued, CPos extraLocation, uint extraData)
|
||||||
{
|
{
|
||||||
this.OrderString = orderString;
|
OrderString = orderString;
|
||||||
this.Subject = subject;
|
Subject = subject;
|
||||||
this.TargetActor = targetActor;
|
TargetActor = targetActor;
|
||||||
this.TargetLocation = targetLocation;
|
TargetLocation = targetLocation;
|
||||||
this.TargetString = targetString;
|
TargetString = targetString;
|
||||||
this.Queued = queued;
|
Queued = queued;
|
||||||
this.ExtraLocation = extraLocation;
|
ExtraLocation = extraLocation;
|
||||||
this.ExtraData = extraData;
|
ExtraData = extraData;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Order Deserialize(World world, BinaryReader r)
|
public static Order Deserialize(World world, BinaryReader r)
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using OpenRA.FileFormats;
|
using OpenRA.FileFormats;
|
||||||
@@ -64,7 +63,7 @@ namespace OpenRA.Network
|
|||||||
}
|
}
|
||||||
|
|
||||||
file.Write(initialContent);
|
file.Write(initialContent);
|
||||||
this.writer = new BinaryWriter(file);
|
writer = new BinaryWriter(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Receive(int clientID, byte[] data)
|
public void Receive(int clientID, byte[] data)
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using OpenRA.Graphics;
|
|
||||||
|
|
||||||
namespace OpenRA.Orders
|
namespace OpenRA.Orders
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -167,11 +167,11 @@ namespace OpenRA.Orders
|
|||||||
|
|
||||||
public UnitOrderResult(Actor actor, IOrderTargeter order, IIssueOrder trait, string cursor, Target target)
|
public UnitOrderResult(Actor actor, IOrderTargeter order, IIssueOrder trait, string cursor, Target target)
|
||||||
{
|
{
|
||||||
this.Actor = actor;
|
Actor = actor;
|
||||||
this.Order = order;
|
Order = order;
|
||||||
this.Trait = trait;
|
Trait = trait;
|
||||||
this.Cursor = cursor;
|
Cursor = cursor;
|
||||||
this.Target = target;
|
Target = target;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ namespace OpenRA
|
|||||||
public struct int2 : IEquatable<int2>
|
public struct int2 : IEquatable<int2>
|
||||||
{
|
{
|
||||||
public readonly int X, Y;
|
public readonly int X, Y;
|
||||||
public int2(int x, int y) { this.X = x; this.Y = y; }
|
public int2(int x, int y) { X = x; Y = y; }
|
||||||
public int2(Point p) { X = p.X; Y = p.Y; }
|
public int2(Point p) { X = p.X; Y = p.Y; }
|
||||||
public int2(Size p) { X = p.Width; Y = p.Height; }
|
public int2(Size p) { X = p.Width; Y = p.Height; }
|
||||||
|
|
||||||
@@ -66,7 +66,7 @@ namespace OpenRA
|
|||||||
// Change endianness of a uint32
|
// Change endianness of a uint32
|
||||||
public static uint Swap(uint orig)
|
public static uint Swap(uint orig)
|
||||||
{
|
{
|
||||||
return (uint)((orig & 0xff000000) >> 24) | ((orig & 0x00ff0000) >> 8) | ((orig & 0x0000ff00) << 8) | ((orig & 0x000000ff) << 24);
|
return ((orig & 0xff000000) >> 24) | ((orig & 0x00ff0000) >> 8) | ((orig & 0x0000ff00) << 8) | ((orig & 0x000000ff) << 24);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int Lerp(int a, int b, int mul, int div)
|
public static int Lerp(int a, int b, int mul, int div)
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ namespace OpenRA
|
|||||||
if (Fonts != null)
|
if (Fonts != null)
|
||||||
foreach (var font in Fonts.Values)
|
foreach (var font in Fonts.Values)
|
||||||
font.Dispose();
|
font.Dispose();
|
||||||
using (new Support.PerfTimer("SpriteFonts"))
|
using (new PerfTimer("SpriteFonts"))
|
||||||
{
|
{
|
||||||
if (fontSheetBuilder != null)
|
if (fontSheetBuilder != null)
|
||||||
fontSheetBuilder.Dispose();
|
fontSheetBuilder.Dispose();
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace OpenRA.Scripting
|
namespace OpenRA.Scripting
|
||||||
|
|||||||
@@ -86,8 +86,8 @@ namespace OpenRA.Scripting
|
|||||||
public ScriptGlobal(ScriptContext context)
|
public ScriptGlobal(ScriptContext context)
|
||||||
: base(context)
|
: base(context)
|
||||||
{
|
{
|
||||||
// The 'this.' resolves the actual (subclass) type
|
// GetType resolves the actual (subclass) type
|
||||||
var type = this.GetType();
|
var type = GetType();
|
||||||
var names = type.GetCustomAttributes<ScriptGlobalAttribute>(true);
|
var names = type.GetCustomAttributes<ScriptGlobalAttribute>(true);
|
||||||
if (names.Length != 1)
|
if (names.Length != 1)
|
||||||
throw new InvalidOperationException("[ScriptGlobal] attribute not found for global table '{0}'".F(type));
|
throw new InvalidOperationException("[ScriptGlobal] attribute not found for global table '{0}'".F(type));
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
|
||||||
using Eluant;
|
using Eluant;
|
||||||
|
|
||||||
namespace OpenRA.Scripting
|
namespace OpenRA.Scripting
|
||||||
@@ -145,16 +144,16 @@ namespace OpenRA.Scripting
|
|||||||
return LuaNil.Instance;
|
return LuaNil.Instance;
|
||||||
|
|
||||||
if (obj is double)
|
if (obj is double)
|
||||||
return (LuaValue)(double)obj;
|
return (double)obj;
|
||||||
|
|
||||||
if (obj is int)
|
if (obj is int)
|
||||||
return (LuaValue)(int)obj;
|
return (int)obj;
|
||||||
|
|
||||||
if (obj is bool)
|
if (obj is bool)
|
||||||
return (LuaValue)(bool)obj;
|
return (bool)obj;
|
||||||
|
|
||||||
if (obj is string)
|
if (obj is string)
|
||||||
return (LuaValue)(string)obj;
|
return (string)obj;
|
||||||
|
|
||||||
if (obj is IScriptBindable)
|
if (obj is IScriptBindable)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ namespace OpenRA
|
|||||||
if (args == null)
|
if (args == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
foreach (var f in this.GetType().GetFields())
|
foreach (var f in GetType().GetFields())
|
||||||
if (args.Contains("Launch" + "." + f.Name))
|
if (args.Contains("Launch" + "." + f.Name))
|
||||||
FieldLoader.LoadField(this, f.Name, args.GetValue("Launch" + "." + f.Name, ""));
|
FieldLoader.LoadField(this, f.Name, args.GetValue("Launch" + "." + f.Name, ""));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,9 +8,6 @@
|
|||||||
*/
|
*/
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using OpenRA.Primitives;
|
using OpenRA.Primitives;
|
||||||
|
|
||||||
|
|||||||
@@ -8,11 +8,8 @@
|
|||||||
*/
|
*/
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using OpenRA.Primitives;
|
|
||||||
|
|
||||||
namespace OpenRA.Support
|
namespace OpenRA.Support
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,10 +9,7 @@
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Drawing;
|
|
||||||
using OpenRA.Primitives;
|
|
||||||
|
|
||||||
namespace OpenRA.Support
|
namespace OpenRA.Support
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -38,11 +38,11 @@ namespace OpenRA
|
|||||||
{ typeof(int2), ((Func<int2, int>)HashInt2).Method },
|
{ typeof(int2), ((Func<int2, int>)HashInt2).Method },
|
||||||
{ typeof(CPos), ((Func<CPos, int>)HashCPos).Method },
|
{ typeof(CPos), ((Func<CPos, int>)HashCPos).Method },
|
||||||
{ typeof(CVec), ((Func<CVec, int>)HashCVec).Method },
|
{ typeof(CVec), ((Func<CVec, int>)HashCVec).Method },
|
||||||
{ typeof(WDist), ((Func<WDist, int>)Hash<WDist>).Method },
|
{ typeof(WDist), ((Func<WDist, int>)Hash).Method },
|
||||||
{ typeof(WPos), ((Func<WPos, int>)Hash<WPos>).Method },
|
{ typeof(WPos), ((Func<WPos, int>)Hash).Method },
|
||||||
{ typeof(WVec), ((Func<WVec, int>)Hash<WVec>).Method },
|
{ typeof(WVec), ((Func<WVec, int>)Hash).Method },
|
||||||
{ typeof(WAngle), ((Func<WAngle, int>)Hash<WAngle>).Method },
|
{ typeof(WAngle), ((Func<WAngle, int>)Hash).Method },
|
||||||
{ typeof(WRot), ((Func<WRot, int>)Hash<WRot>).Method },
|
{ typeof(WRot), ((Func<WRot, int>)Hash).Method },
|
||||||
{ typeof(TypeDictionary), ((Func<TypeDictionary, int>)HashTDict).Method },
|
{ typeof(TypeDictionary), ((Func<TypeDictionary, int>)HashTDict).Method },
|
||||||
{ typeof(Actor), ((Func<Actor, int>)HashActor).Method },
|
{ typeof(Actor), ((Func<Actor, int>)HashActor).Method },
|
||||||
{ typeof(Player), ((Func<Player, int>)HashPlayer).Method },
|
{ typeof(Player), ((Func<Player, int>)HashPlayer).Method },
|
||||||
@@ -152,7 +152,7 @@ namespace OpenRA
|
|||||||
return (int)(t.FrozenActor.Actor.ActorID << 16) * 0x567;
|
return (int)(t.FrozenActor.Actor.ActorID << 16) * 0x567;
|
||||||
|
|
||||||
case TargetType.Terrain:
|
case TargetType.Terrain:
|
||||||
return Hash<WPos>(t.CenterPosition);
|
return Hash(t.CenterPosition);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
case TargetType.Invalid:
|
case TargetType.Invalid:
|
||||||
|
|||||||
@@ -8,7 +8,6 @@
|
|||||||
*/
|
*/
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using OpenRA.Graphics;
|
using OpenRA.Graphics;
|
||||||
|
|
||||||
namespace OpenRA.Traits
|
namespace OpenRA.Traits
|
||||||
|
|||||||
@@ -8,7 +8,6 @@
|
|||||||
*/
|
*/
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using OpenRA.Graphics;
|
using OpenRA.Graphics;
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace OpenRA.Traits
|
namespace OpenRA.Traits
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ namespace OpenRA.Traits
|
|||||||
|
|
||||||
public ResourceType(ResourceTypeInfo info, World world)
|
public ResourceType(ResourceTypeInfo info, World world)
|
||||||
{
|
{
|
||||||
this.Info = info;
|
Info = info;
|
||||||
Variants = new Dictionary<string, Sprite[]>();
|
Variants = new Dictionary<string, Sprite[]>();
|
||||||
foreach (var v in info.Variants)
|
foreach (var v in info.Variants)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,8 +8,6 @@
|
|||||||
*/
|
*/
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ namespace OpenRA
|
|||||||
public struct WDist : IComparable, IComparable<WDist>, IEquatable<WDist>, IScriptBindable, ILuaAdditionBinding, ILuaSubtractionBinding, ILuaEqualityBinding, ILuaTableBinding
|
public struct WDist : IComparable, IComparable<WDist>, IEquatable<WDist>, IScriptBindable, ILuaAdditionBinding, ILuaSubtractionBinding, ILuaEqualityBinding, ILuaTableBinding
|
||||||
{
|
{
|
||||||
public readonly int Length;
|
public readonly int Length;
|
||||||
public long LengthSquared { get { return (long)Length * (long)Length; } }
|
public long LengthSquared { get { return (long)Length * Length; } }
|
||||||
|
|
||||||
public WDist(int r) { Length = r; }
|
public WDist(int r) { Length = r; }
|
||||||
public static readonly WDist Zero = new WDist(0);
|
public static readonly WDist Zero = new WDist(0);
|
||||||
@@ -57,7 +57,7 @@ namespace OpenRA
|
|||||||
|
|
||||||
public static bool TryParse(string s, out WDist result)
|
public static bool TryParse(string s, out WDist result)
|
||||||
{
|
{
|
||||||
result = WDist.Zero;
|
result = Zero;
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(s))
|
if (string.IsNullOrEmpty(s))
|
||||||
return false;
|
return false;
|
||||||
@@ -115,7 +115,7 @@ namespace OpenRA
|
|||||||
{
|
{
|
||||||
WDist a;
|
WDist a;
|
||||||
WDist b;
|
WDist b;
|
||||||
if (!left.TryGetClrValue<WDist>(out a) || !right.TryGetClrValue<WDist>(out b))
|
if (!left.TryGetClrValue(out a) || !right.TryGetClrValue(out b))
|
||||||
throw new LuaException("Attempted to call WDist.Add(WDist, WDist) with invalid arguments.");
|
throw new LuaException("Attempted to call WDist.Add(WDist, WDist) with invalid arguments.");
|
||||||
|
|
||||||
return new LuaCustomClrObject(a + b);
|
return new LuaCustomClrObject(a + b);
|
||||||
@@ -125,7 +125,7 @@ namespace OpenRA
|
|||||||
{
|
{
|
||||||
WDist a;
|
WDist a;
|
||||||
WDist b;
|
WDist b;
|
||||||
if (!left.TryGetClrValue<WDist>(out a) || !right.TryGetClrValue<WDist>(out b))
|
if (!left.TryGetClrValue(out a) || !right.TryGetClrValue(out b))
|
||||||
throw new LuaException("Attempted to call WDist.Subtract(WDist, WDist) with invalid arguments.");
|
throw new LuaException("Attempted to call WDist.Subtract(WDist, WDist) with invalid arguments.");
|
||||||
|
|
||||||
return new LuaCustomClrObject(a - b);
|
return new LuaCustomClrObject(a - b);
|
||||||
@@ -135,7 +135,7 @@ namespace OpenRA
|
|||||||
{
|
{
|
||||||
WDist a;
|
WDist a;
|
||||||
WDist b;
|
WDist b;
|
||||||
if (!left.TryGetClrValue<WDist>(out a) || !right.TryGetClrValue<WDist>(out b))
|
if (!left.TryGetClrValue(out a) || !right.TryGetClrValue(out b))
|
||||||
throw new LuaException("Attempted to call WDist.Equals(WDist, WDist) with invalid arguments.");
|
throw new LuaException("Attempted to call WDist.Equals(WDist, WDist) with invalid arguments.");
|
||||||
|
|
||||||
return a == b;
|
return a == b;
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ namespace OpenRA
|
|||||||
{
|
{
|
||||||
WPos a;
|
WPos a;
|
||||||
WVec b;
|
WVec b;
|
||||||
if (!left.TryGetClrValue<WPos>(out a) || !right.TryGetClrValue<WVec>(out b))
|
if (!left.TryGetClrValue(out a) || !right.TryGetClrValue(out b))
|
||||||
throw new LuaException("Attempted to call WPos.Add(WPos, WVec) with invalid arguments ({0}, {1})".F(left.WrappedClrType().Name, right.WrappedClrType().Name));
|
throw new LuaException("Attempted to call WPos.Add(WPos, WVec) with invalid arguments ({0}, {1})".F(left.WrappedClrType().Name, right.WrappedClrType().Name));
|
||||||
|
|
||||||
return new LuaCustomClrObject(a + b);
|
return new LuaCustomClrObject(a + b);
|
||||||
@@ -91,19 +91,19 @@ namespace OpenRA
|
|||||||
{
|
{
|
||||||
WPos a;
|
WPos a;
|
||||||
var rightType = right.WrappedClrType();
|
var rightType = right.WrappedClrType();
|
||||||
if (!left.TryGetClrValue<WPos>(out a))
|
if (!left.TryGetClrValue(out a))
|
||||||
throw new LuaException("Attempted to call WPos.Subtract(WPos, WVec) with invalid arguments ({0}, {1})".F(left.WrappedClrType().Name, rightType));
|
throw new LuaException("Attempted to call WPos.Subtract(WPos, WVec) with invalid arguments ({0}, {1})".F(left.WrappedClrType().Name, rightType));
|
||||||
|
|
||||||
if (rightType == typeof(WPos))
|
if (rightType == typeof(WPos))
|
||||||
{
|
{
|
||||||
WPos b;
|
WPos b;
|
||||||
right.TryGetClrValue<WPos>(out b);
|
right.TryGetClrValue(out b);
|
||||||
return new LuaCustomClrObject(a - b);
|
return new LuaCustomClrObject(a - b);
|
||||||
}
|
}
|
||||||
else if (rightType == typeof(WVec))
|
else if (rightType == typeof(WVec))
|
||||||
{
|
{
|
||||||
WVec b;
|
WVec b;
|
||||||
right.TryGetClrValue<WVec>(out b);
|
right.TryGetClrValue(out b);
|
||||||
return new LuaCustomClrObject(a - b);
|
return new LuaCustomClrObject(a - b);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -113,7 +113,7 @@ namespace OpenRA
|
|||||||
public LuaValue Equals(LuaRuntime runtime, LuaValue left, LuaValue right)
|
public LuaValue Equals(LuaRuntime runtime, LuaValue left, LuaValue right)
|
||||||
{
|
{
|
||||||
WPos a, b;
|
WPos a, b;
|
||||||
if (!left.TryGetClrValue<WPos>(out a) || !right.TryGetClrValue<WPos>(out b))
|
if (!left.TryGetClrValue(out a) || !right.TryGetClrValue(out b))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return a == b;
|
return a == b;
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ namespace OpenRA
|
|||||||
|
|
||||||
// Add an additional quadratic variation to height
|
// Add an additional quadratic variation to height
|
||||||
// Uses fp to avoid integer overflow
|
// Uses fp to avoid integer overflow
|
||||||
var offset = (int)((float)((float)(b - a).Length * pitch.Tan() * mul * (div - mul)) / (float)(1024 * div * div));
|
var offset = (int)((float)(b - a).Length * pitch.Tan() * mul * (div - mul) / (1024 * div * div));
|
||||||
return new WVec(ret.X, ret.Y, ret.Z + offset);
|
return new WVec(ret.X, ret.Y, ret.Z + offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -108,7 +108,7 @@ namespace OpenRA
|
|||||||
public LuaValue Add(LuaRuntime runtime, LuaValue left, LuaValue right)
|
public LuaValue Add(LuaRuntime runtime, LuaValue left, LuaValue right)
|
||||||
{
|
{
|
||||||
WVec a, b;
|
WVec a, b;
|
||||||
if (!left.TryGetClrValue<WVec>(out a) || !right.TryGetClrValue<WVec>(out b))
|
if (!left.TryGetClrValue(out a) || !right.TryGetClrValue(out b))
|
||||||
throw new LuaException("Attempted to call WVec.Add(WVec, WVec) with invalid arguments ({0}, {1})".F(left.WrappedClrType().Name, right.WrappedClrType().Name));
|
throw new LuaException("Attempted to call WVec.Add(WVec, WVec) with invalid arguments ({0}, {1})".F(left.WrappedClrType().Name, right.WrappedClrType().Name));
|
||||||
|
|
||||||
return new LuaCustomClrObject(a + b);
|
return new LuaCustomClrObject(a + b);
|
||||||
@@ -117,7 +117,7 @@ namespace OpenRA
|
|||||||
public LuaValue Subtract(LuaRuntime runtime, LuaValue left, LuaValue right)
|
public LuaValue Subtract(LuaRuntime runtime, LuaValue left, LuaValue right)
|
||||||
{
|
{
|
||||||
WVec a, b;
|
WVec a, b;
|
||||||
if (!left.TryGetClrValue<WVec>(out a) || !right.TryGetClrValue<WVec>(out b))
|
if (!left.TryGetClrValue(out a) || !right.TryGetClrValue(out b))
|
||||||
throw new LuaException("Attempted to call WVec.Subtract(WVec, WVec) with invalid arguments ({0}, {1})".F(left.WrappedClrType().Name, right.WrappedClrType().Name));
|
throw new LuaException("Attempted to call WVec.Subtract(WVec, WVec) with invalid arguments ({0}, {1})".F(left.WrappedClrType().Name, right.WrappedClrType().Name));
|
||||||
|
|
||||||
return new LuaCustomClrObject(a - b);
|
return new LuaCustomClrObject(a - b);
|
||||||
@@ -131,7 +131,7 @@ namespace OpenRA
|
|||||||
public LuaValue Equals(LuaRuntime runtime, LuaValue left, LuaValue right)
|
public LuaValue Equals(LuaRuntime runtime, LuaValue left, LuaValue right)
|
||||||
{
|
{
|
||||||
WVec a, b;
|
WVec a, b;
|
||||||
if (!left.TryGetClrValue<WVec>(out a) || !right.TryGetClrValue<WVec>(out b))
|
if (!left.TryGetClrValue(out a) || !right.TryGetClrValue(out b))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return a == b;
|
return a == b;
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ namespace OpenRA.Widgets
|
|||||||
|
|
||||||
if (hk == Game.Settings.Keys.HideUserInterfaceKey)
|
if (hk == Game.Settings.Keys.HideUserInterfaceKey)
|
||||||
{
|
{
|
||||||
foreach (var child in this.Children)
|
foreach (var child in Children)
|
||||||
child.Visible ^= true;
|
child.Visible ^= true;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -503,7 +503,7 @@ namespace OpenRA.Widgets
|
|||||||
|
|
||||||
public Widget GetOrNull(string id)
|
public Widget GetOrNull(string id)
|
||||||
{
|
{
|
||||||
if (this.Id == id)
|
if (Id == id)
|
||||||
return this;
|
return this;
|
||||||
|
|
||||||
foreach (var child in Children)
|
foreach (var child in Children)
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ using System.Linq;
|
|||||||
using OpenRA.Effects;
|
using OpenRA.Effects;
|
||||||
using OpenRA.Graphics;
|
using OpenRA.Graphics;
|
||||||
using OpenRA.Orders;
|
using OpenRA.Orders;
|
||||||
using OpenRA.Primitives;
|
|
||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
|
|
||||||
namespace OpenRA.Widgets
|
namespace OpenRA.Widgets
|
||||||
@@ -37,7 +36,7 @@ namespace OpenRA.Widgets
|
|||||||
[ObjectCreator.UseCtor]
|
[ObjectCreator.UseCtor]
|
||||||
public WorldInteractionControllerWidget(World world, WorldRenderer worldRenderer)
|
public WorldInteractionControllerWidget(World world, WorldRenderer worldRenderer)
|
||||||
{
|
{
|
||||||
this.World = world;
|
World = world;
|
||||||
this.worldRenderer = worldRenderer;
|
this.worldRenderer = worldRenderer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -196,7 +196,7 @@ namespace OpenRA
|
|||||||
public void LoadComplete(WorldRenderer wr)
|
public void LoadComplete(WorldRenderer wr)
|
||||||
{
|
{
|
||||||
// ScreenMap must be initialized before anything else
|
// ScreenMap must be initialized before anything else
|
||||||
using (new Support.PerfTimer("ScreenMap.WorldLoaded"))
|
using (new PerfTimer("ScreenMap.WorldLoaded"))
|
||||||
ScreenMap.WorldLoaded(this, wr);
|
ScreenMap.WorldLoaded(this, wr);
|
||||||
|
|
||||||
foreach (var wlh in WorldActor.TraitsImplementing<IWorldLoaded>())
|
foreach (var wlh in WorldActor.TraitsImplementing<IWorldLoaded>())
|
||||||
@@ -205,7 +205,7 @@ namespace OpenRA
|
|||||||
if (wlh == ScreenMap)
|
if (wlh == ScreenMap)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
using (new Support.PerfTimer(wlh.GetType().Name + ".WorldLoaded"))
|
using (new PerfTimer(wlh.GetType().Name + ".WorldLoaded"))
|
||||||
wlh.WorldLoaded(this, wr);
|
wlh.WorldLoaded(this, wr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -374,7 +374,7 @@ namespace OpenRA
|
|||||||
|
|
||||||
public IEnumerable<Actor> ActorsHavingTrait<T>(Func<T, bool> predicate)
|
public IEnumerable<Actor> ActorsHavingTrait<T>(Func<T, bool> predicate)
|
||||||
{
|
{
|
||||||
return TraitDict.ActorsHavingTrait<T>(predicate);
|
return TraitDict.ActorsHavingTrait(predicate);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnPlayerWinStateChanged(Player player)
|
public void OnPlayerWinStateChanged(Player player)
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using OpenRA.GameRules;
|
|
||||||
using OpenRA.Support;
|
using OpenRA.Support;
|
||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
|
|
||||||
|
|||||||
@@ -8,9 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using OpenRA.Graphics;
|
using OpenRA.Graphics;
|
||||||
using OpenRA.Mods.Common.Traits;
|
using OpenRA.Mods.Common.Traits;
|
||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
|
|||||||
@@ -9,9 +9,7 @@
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using OpenRA.Mods.Common.Graphics;
|
|
||||||
using OpenRA.Mods.Common.Traits;
|
using OpenRA.Mods.Common.Traits;
|
||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
|
|
||||||
|
|||||||
@@ -160,10 +160,10 @@ namespace OpenRA.Mods.Common.AI
|
|||||||
public bool CanAttack(IEnumerable<Actor> ownUnits, IEnumerable<Actor> enemyUnits)
|
public bool CanAttack(IEnumerable<Actor> ownUnits, IEnumerable<Actor> enemyUnits)
|
||||||
{
|
{
|
||||||
var inputValues = new Dictionary<FuzzyVariable, double>();
|
var inputValues = new Dictionary<FuzzyVariable, double>();
|
||||||
inputValues.Add(fuzzyEngine.InputByName("OwnHealth"), (double)NormalizedHealth(ownUnits, 100));
|
inputValues.Add(fuzzyEngine.InputByName("OwnHealth"), NormalizedHealth(ownUnits, 100));
|
||||||
inputValues.Add(fuzzyEngine.InputByName("EnemyHealth"), (double)NormalizedHealth(enemyUnits, 100));
|
inputValues.Add(fuzzyEngine.InputByName("EnemyHealth"), NormalizedHealth(enemyUnits, 100));
|
||||||
inputValues.Add(fuzzyEngine.InputByName("RelativeAttackPower"), (double)RelativePower(ownUnits, enemyUnits));
|
inputValues.Add(fuzzyEngine.InputByName("RelativeAttackPower"), RelativePower(ownUnits, enemyUnits));
|
||||||
inputValues.Add(fuzzyEngine.InputByName("RelativeSpeed"), (double)RelativeSpeed(ownUnits, enemyUnits));
|
inputValues.Add(fuzzyEngine.InputByName("RelativeSpeed"), RelativeSpeed(ownUnits, enemyUnits));
|
||||||
|
|
||||||
var result = fuzzyEngine.Calculate(inputValues);
|
var result = fuzzyEngine.Calculate(inputValues);
|
||||||
var attackChance = result[fuzzyEngine.OutputByName("AttackOrFlee")];
|
var attackChance = result[fuzzyEngine.OutputByName("AttackOrFlee")];
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ namespace OpenRA.Mods.Common.AI
|
|||||||
[Desc("Should the AI repair its buildings if damaged?")]
|
[Desc("Should the AI repair its buildings if damaged?")]
|
||||||
public readonly bool ShouldRepairBuildings = true;
|
public readonly bool ShouldRepairBuildings = true;
|
||||||
|
|
||||||
string IBotInfo.Name { get { return this.Name; } }
|
string IBotInfo.Name { get { return Name; } }
|
||||||
|
|
||||||
[Desc("What units to the AI should build.", "What % of the total army must be this type of unit.")]
|
[Desc("What units to the AI should build.", "What % of the total army must be this type of unit.")]
|
||||||
public readonly Dictionary<string, float> UnitsToBuild = null;
|
public readonly Dictionary<string, float> UnitsToBuild = null;
|
||||||
@@ -245,7 +245,7 @@ namespace OpenRA.Mods.Common.AI
|
|||||||
|
|
||||||
public readonly World World;
|
public readonly World World;
|
||||||
public Map Map { get { return World.Map; } }
|
public Map Map { get { return World.Map; } }
|
||||||
IBotInfo IBot.Info { get { return this.Info; } }
|
IBotInfo IBot.Info { get { return Info; } }
|
||||||
|
|
||||||
int rushTicks;
|
int rushTicks;
|
||||||
int assignRolesTicks;
|
int assignRolesTicks;
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using OpenRA.Mods.Common.Traits;
|
using OpenRA.Mods.Common.Traits;
|
||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,6 @@
|
|||||||
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using OpenRA.Activities;
|
using OpenRA.Activities;
|
||||||
using OpenRA.GameRules;
|
|
||||||
using OpenRA.Mods.Common.Traits;
|
using OpenRA.Mods.Common.Traits;
|
||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
|
|
||||||
|
|||||||
@@ -8,8 +8,6 @@
|
|||||||
*/
|
*/
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using OpenRA.Activities;
|
using OpenRA.Activities;
|
||||||
using OpenRA.Mods.Common.Traits;
|
using OpenRA.Mods.Common.Traits;
|
||||||
|
|||||||
@@ -8,12 +8,9 @@
|
|||||||
*/
|
*/
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using OpenRA.Activities;
|
using OpenRA.Activities;
|
||||||
using OpenRA.Mods.Common.Traits;
|
using OpenRA.Mods.Common.Traits;
|
||||||
using OpenRA.Primitives;
|
|
||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
|
|
||||||
namespace OpenRA.Mods.Common.Activities
|
namespace OpenRA.Mods.Common.Activities
|
||||||
|
|||||||
@@ -8,7 +8,6 @@
|
|||||||
*/
|
*/
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using OpenRA.Effects;
|
using OpenRA.Effects;
|
||||||
using OpenRA.Mods.Common.Traits;
|
using OpenRA.Mods.Common.Traits;
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
|
|
||||||
protected Enter(Actor self, Actor target, EnterBehaviour enterBehaviour, int maxTries = 1, bool targetCenter = false)
|
protected Enter(Actor self, Actor target, EnterBehaviour enterBehaviour, int maxTries = 1, bool targetCenter = false)
|
||||||
{
|
{
|
||||||
this.move = self.Trait<IMove>();
|
move = self.Trait<IMove>();
|
||||||
this.target = Target.FromActor(target);
|
this.target = Target.FromActor(target);
|
||||||
this.maxTries = maxTries;
|
this.maxTries = maxTries;
|
||||||
this.enterBehaviour = enterBehaviour;
|
this.enterBehaviour = enterBehaviour;
|
||||||
|
|||||||
@@ -10,7 +10,6 @@
|
|||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Linq;
|
|
||||||
using OpenRA.Activities;
|
using OpenRA.Activities;
|
||||||
using OpenRA.Mods.Common.Pathfinder;
|
using OpenRA.Mods.Common.Pathfinder;
|
||||||
using OpenRA.Mods.Common.Traits;
|
using OpenRA.Mods.Common.Traits;
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using OpenRA.Activities;
|
using OpenRA.Activities;
|
||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
return path;
|
return path;
|
||||||
};
|
};
|
||||||
this.destination = destination;
|
this.destination = destination;
|
||||||
this.nearEnough = WDist.Zero;
|
nearEnough = WDist.Zero;
|
||||||
}
|
}
|
||||||
|
|
||||||
// HACK: for legacy code
|
// HACK: for legacy code
|
||||||
@@ -95,7 +95,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
};
|
};
|
||||||
|
|
||||||
this.destination = destination;
|
this.destination = destination;
|
||||||
this.nearEnough = WDist.Zero;
|
nearEnough = WDist.Zero;
|
||||||
this.ignoredActor = ignoredActor;
|
this.ignoredActor = ignoredActor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,6 @@
|
|||||||
*/
|
*/
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|||||||
@@ -10,8 +10,6 @@
|
|||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using OpenRA.Activities;
|
|
||||||
using OpenRA.Mods.Common.Traits;
|
|
||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
|
|
||||||
namespace OpenRA.Mods.Common.Activities
|
namespace OpenRA.Mods.Common.Activities
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ using System.Linq;
|
|||||||
using OpenRA.Activities;
|
using OpenRA.Activities;
|
||||||
using OpenRA.Mods.Common.Traits;
|
using OpenRA.Mods.Common.Traits;
|
||||||
using OpenRA.Primitives;
|
using OpenRA.Primitives;
|
||||||
using OpenRA.Traits;
|
|
||||||
|
|
||||||
namespace OpenRA.Mods.Common.Activities
|
namespace OpenRA.Mods.Common.Activities
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,10 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using OpenRA.Activities;
|
using OpenRA.Activities;
|
||||||
using OpenRA.Mods.Common.Traits;
|
|
||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
|
|
||||||
namespace OpenRA.Mods.Common.Activities
|
namespace OpenRA.Mods.Common.Activities
|
||||||
|
|||||||
@@ -8,19 +8,11 @@
|
|||||||
*/
|
*/
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using OpenRA.FileFormats;
|
|
||||||
using OpenRA.Graphics;
|
using OpenRA.Graphics;
|
||||||
using OpenRA.Mods.Common;
|
|
||||||
using OpenRA.Mods.Common.Graphics;
|
|
||||||
using OpenRA.Mods.Common.Traits;
|
using OpenRA.Mods.Common.Traits;
|
||||||
using OpenRA.Orders;
|
|
||||||
using OpenRA.Primitives;
|
using OpenRA.Primitives;
|
||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
using OpenRA.Widgets;
|
|
||||||
|
|
||||||
namespace OpenRA.Mods.Common.Widgets
|
namespace OpenRA.Mods.Common.Widgets
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -10,17 +10,9 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using OpenRA.FileFormats;
|
|
||||||
using OpenRA.Graphics;
|
using OpenRA.Graphics;
|
||||||
using OpenRA.Mods.Common;
|
|
||||||
using OpenRA.Mods.Common.Graphics;
|
|
||||||
using OpenRA.Mods.Common.Traits;
|
using OpenRA.Mods.Common.Traits;
|
||||||
using OpenRA.Orders;
|
|
||||||
using OpenRA.Primitives;
|
|
||||||
using OpenRA.Traits;
|
|
||||||
using OpenRA.Widgets;
|
|
||||||
|
|
||||||
namespace OpenRA.Mods.Common.Widgets
|
namespace OpenRA.Mods.Common.Widgets
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -10,17 +10,10 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using OpenRA.FileFormats;
|
|
||||||
using OpenRA.Graphics;
|
using OpenRA.Graphics;
|
||||||
using OpenRA.Mods.Common;
|
|
||||||
using OpenRA.Mods.Common.Graphics;
|
|
||||||
using OpenRA.Mods.Common.Traits;
|
using OpenRA.Mods.Common.Traits;
|
||||||
using OpenRA.Orders;
|
|
||||||
using OpenRA.Primitives;
|
|
||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
using OpenRA.Widgets;
|
|
||||||
|
|
||||||
namespace OpenRA.Mods.Common.Widgets
|
namespace OpenRA.Mods.Common.Widgets
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,19 +8,9 @@
|
|||||||
*/
|
*/
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using OpenRA.FileFormats;
|
|
||||||
using OpenRA.Graphics;
|
using OpenRA.Graphics;
|
||||||
using OpenRA.Mods.Common;
|
|
||||||
using OpenRA.Mods.Common.Graphics;
|
|
||||||
using OpenRA.Mods.Common.Traits;
|
|
||||||
using OpenRA.Orders;
|
|
||||||
using OpenRA.Primitives;
|
|
||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
using OpenRA.Widgets;
|
|
||||||
|
|
||||||
namespace OpenRA.Mods.Common.Widgets
|
namespace OpenRA.Mods.Common.Widgets
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,19 +8,9 @@
|
|||||||
*/
|
*/
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using OpenRA.FileFormats;
|
|
||||||
using OpenRA.Graphics;
|
using OpenRA.Graphics;
|
||||||
using OpenRA.Mods.Common;
|
|
||||||
using OpenRA.Mods.Common.Graphics;
|
|
||||||
using OpenRA.Mods.Common.Traits;
|
|
||||||
using OpenRA.Orders;
|
|
||||||
using OpenRA.Primitives;
|
|
||||||
using OpenRA.Traits;
|
|
||||||
using OpenRA.Widgets;
|
|
||||||
|
|
||||||
namespace OpenRA.Mods.Common.Widgets
|
namespace OpenRA.Mods.Common.Widgets
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -11,7 +11,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Linq;
|
|
||||||
using OpenRA.Effects;
|
using OpenRA.Effects;
|
||||||
using OpenRA.GameRules;
|
using OpenRA.GameRules;
|
||||||
using OpenRA.Graphics;
|
using OpenRA.Graphics;
|
||||||
|
|||||||
@@ -11,7 +11,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Linq;
|
|
||||||
using OpenRA.Effects;
|
using OpenRA.Effects;
|
||||||
using OpenRA.GameRules;
|
using OpenRA.GameRules;
|
||||||
using OpenRA.Graphics;
|
using OpenRA.Graphics;
|
||||||
@@ -100,7 +99,7 @@ namespace OpenRA.Mods.Common.Effects
|
|||||||
{
|
{
|
||||||
this.info = info;
|
this.info = info;
|
||||||
this.args = args;
|
this.args = args;
|
||||||
this.pos = args.Source;
|
pos = args.Source;
|
||||||
|
|
||||||
var world = args.SourceActor.World;
|
var world = args.SourceActor.World;
|
||||||
|
|
||||||
|
|||||||
@@ -29,11 +29,11 @@ namespace OpenRA.Mods.Common.Effects
|
|||||||
|
|
||||||
public FloatingText(WPos pos, Color color, string text, int duration)
|
public FloatingText(WPos pos, Color color, string text, int duration)
|
||||||
{
|
{
|
||||||
this.font = Game.Renderer.Fonts["TinyBold"];
|
font = Game.Renderer.Fonts["TinyBold"];
|
||||||
this.pos = pos;
|
this.pos = pos;
|
||||||
this.color = color;
|
this.color = color;
|
||||||
this.text = text;
|
this.text = text;
|
||||||
this.remaining = duration;
|
remaining = duration;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Tick(World world)
|
public void Tick(World world)
|
||||||
|
|||||||
@@ -68,10 +68,10 @@ namespace OpenRA.Mods.Common.Effects
|
|||||||
this.args = args;
|
this.args = args;
|
||||||
this.info = info;
|
this.info = info;
|
||||||
this.color = color;
|
this.color = color;
|
||||||
this.target = args.PassiveTarget;
|
target = args.PassiveTarget;
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(info.HitAnim))
|
if (!string.IsNullOrEmpty(info.HitAnim))
|
||||||
this.hitanim = new Animation(args.SourceActor.World, info.HitAnim);
|
hitanim = new Animation(args.SourceActor.World, info.HitAnim);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Tick(World world)
|
public void Tick(World world)
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ namespace OpenRA.Mods.Common.Effects
|
|||||||
this.firedBy = firedBy;
|
this.firedBy = firedBy;
|
||||||
this.weapon = weapon;
|
this.weapon = weapon;
|
||||||
this.delay = delay;
|
this.delay = delay;
|
||||||
this.turn = delay / 2;
|
turn = delay / 2;
|
||||||
this.flashType = flashType;
|
this.flashType = flashType;
|
||||||
|
|
||||||
var offset = new WVec(WDist.Zero, WDist.Zero, velocity * turn);
|
var offset = new WVec(WDist.Zero, WDist.Zero, velocity * turn);
|
||||||
|
|||||||
@@ -122,25 +122,25 @@ namespace OpenRA.Mods.Common.Graphics
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Start = LoadField<int>(d, "Start", 0);
|
Start = LoadField(d, "Start", 0);
|
||||||
ShadowStart = LoadField<int>(d, "ShadowStart", -1);
|
ShadowStart = LoadField(d, "ShadowStart", -1);
|
||||||
ShadowZOffset = LoadField<WDist>(d, "ShadowZOffset", DefaultShadowSpriteZOffset).Length;
|
ShadowZOffset = LoadField(d, "ShadowZOffset", DefaultShadowSpriteZOffset).Length;
|
||||||
ZOffset = LoadField<WDist>(d, "ZOffset", WDist.Zero).Length;
|
ZOffset = LoadField(d, "ZOffset", WDist.Zero).Length;
|
||||||
Tick = LoadField<int>(d, "Tick", 40);
|
Tick = LoadField(d, "Tick", 40);
|
||||||
transpose = LoadField<bool>(d, "Transpose", false);
|
transpose = LoadField(d, "Transpose", false);
|
||||||
Frames = LoadField<int[]>(d, "Frames", null);
|
Frames = LoadField<int[]>(d, "Frames", null);
|
||||||
var flipX = LoadField<bool>(d, "FlipX", false);
|
var flipX = LoadField(d, "FlipX", false);
|
||||||
var flipY = LoadField<bool>(d, "FlipY", false);
|
var flipY = LoadField(d, "FlipY", false);
|
||||||
|
|
||||||
Facings = LoadField<int>(d, "Facings", 1);
|
Facings = LoadField(d, "Facings", 1);
|
||||||
if (Facings < 0)
|
if (Facings < 0)
|
||||||
{
|
{
|
||||||
reverseFacings = true;
|
reverseFacings = true;
|
||||||
Facings = -Facings;
|
Facings = -Facings;
|
||||||
}
|
}
|
||||||
|
|
||||||
var offset = LoadField<float2>(d, "Offset", float2.Zero);
|
var offset = LoadField(d, "Offset", float2.Zero);
|
||||||
var blendMode = LoadField<BlendMode>(d, "BlendMode", BlendMode.Alpha);
|
var blendMode = LoadField(d, "BlendMode", BlendMode.Alpha);
|
||||||
|
|
||||||
MiniYaml combine;
|
MiniYaml combine;
|
||||||
if (d.TryGetValue("Combine", out combine))
|
if (d.TryGetValue("Combine", out combine))
|
||||||
@@ -151,10 +151,10 @@ namespace OpenRA.Mods.Common.Graphics
|
|||||||
var sd = sub.Value.ToDictionary();
|
var sd = sub.Value.ToDictionary();
|
||||||
|
|
||||||
// Allow per-sprite offset, start, and length
|
// Allow per-sprite offset, start, and length
|
||||||
var subStart = LoadField<int>(sd, "Start", 0);
|
var subStart = LoadField(sd, "Start", 0);
|
||||||
var subOffset = LoadField<float2>(sd, "Offset", float2.Zero);
|
var subOffset = LoadField(sd, "Offset", float2.Zero);
|
||||||
var subFlipX = LoadField<bool>(sd, "FlipX", false);
|
var subFlipX = LoadField(sd, "FlipX", false);
|
||||||
var subFlipY = LoadField<bool>(sd, "FlipY", false);
|
var subFlipY = LoadField(sd, "FlipY", false);
|
||||||
|
|
||||||
var subSrc = GetSpriteSrc(modData, tileSet, sequence, animation, sub.Key, sd);
|
var subSrc = GetSpriteSrc(modData, tileSet, sequence, animation, sub.Key, sd);
|
||||||
var subSprites = cache[subSrc].Select(
|
var subSprites = cache[subSrc].Select(
|
||||||
@@ -165,7 +165,7 @@ namespace OpenRA.Mods.Common.Graphics
|
|||||||
if (sd.TryGetValue("Length", out subLengthYaml) && subLengthYaml.Value == "*")
|
if (sd.TryGetValue("Length", out subLengthYaml) && subLengthYaml.Value == "*")
|
||||||
subLength = subSprites.Count() - subStart;
|
subLength = subSprites.Count() - subStart;
|
||||||
else
|
else
|
||||||
subLength = LoadField<int>(sd, "Length", 1);
|
subLength = LoadField(sd, "Length", 1);
|
||||||
|
|
||||||
combined = combined.Concat(subSprites.Skip(subStart).Take(subLength));
|
combined = combined.Concat(subSprites.Skip(subStart).Take(subLength));
|
||||||
}
|
}
|
||||||
@@ -185,17 +185,17 @@ namespace OpenRA.Mods.Common.Graphics
|
|||||||
if (d.TryGetValue("Length", out length) && length.Value == "*")
|
if (d.TryGetValue("Length", out length) && length.Value == "*")
|
||||||
Length = sprites.Length - Start;
|
Length = sprites.Length - Start;
|
||||||
else
|
else
|
||||||
Length = LoadField<int>(d, "Length", 1);
|
Length = LoadField(d, "Length", 1);
|
||||||
|
|
||||||
// Plays the animation forwards, and then in reverse
|
// Plays the animation forwards, and then in reverse
|
||||||
if (LoadField<bool>(d, "Reverses", false))
|
if (LoadField(d, "Reverses", false))
|
||||||
{
|
{
|
||||||
var frames = Frames ?? Exts.MakeArray(Length, i => Start + i);
|
var frames = Frames ?? Exts.MakeArray(Length, i => Start + i);
|
||||||
Frames = frames.Concat(frames.Skip(1).Take(frames.Length - 2).Reverse()).ToArray();
|
Frames = frames.Concat(frames.Skip(1).Take(frames.Length - 2).Reverse()).ToArray();
|
||||||
Length = 2 * Length - 2;
|
Length = 2 * Length - 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
Stride = LoadField<int>(d, "Stride", Length);
|
Stride = LoadField(d, "Stride", Length);
|
||||||
|
|
||||||
if (Length > Stride)
|
if (Length > Stride)
|
||||||
throw new InvalidOperationException(
|
throw new InvalidOperationException(
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ namespace OpenRA.Mods.Common.Graphics
|
|||||||
this.centerPosition = centerPosition;
|
this.centerPosition = centerPosition;
|
||||||
this.radius = radius;
|
this.radius = radius;
|
||||||
this.zOffset = zOffset;
|
this.zOffset = zOffset;
|
||||||
this.trailCount = lineTrails;
|
trailCount = lineTrails;
|
||||||
this.trailSeparation = trailSeparation;
|
this.trailSeparation = trailSeparation;
|
||||||
this.trailAngle = trailAngle;
|
this.trailAngle = trailAngle;
|
||||||
this.color = color;
|
this.color = color;
|
||||||
|
|||||||
@@ -55,10 +55,10 @@ namespace OpenRA.Mods.Common.Graphics
|
|||||||
{
|
{
|
||||||
var wcr = Game.Renderer.WorldRgbaColorRenderer;
|
var wcr = Game.Renderer.WorldRgbaColorRenderer;
|
||||||
var offset = new WVec(radius.Length, 0, 0);
|
var offset = new WVec(radius.Length, 0, 0);
|
||||||
for (var i = 0; i < RangeCircleRenderable.RangeCircleSegments; i++)
|
for (var i = 0; i < RangeCircleSegments; i++)
|
||||||
{
|
{
|
||||||
var a = wr.ScreenPosition(centerPosition + offset.Rotate(RangeCircleRenderable.RangeCircleStartRotations[i]));
|
var a = wr.ScreenPosition(centerPosition + offset.Rotate(RangeCircleStartRotations[i]));
|
||||||
var b = wr.ScreenPosition(centerPosition + offset.Rotate(RangeCircleRenderable.RangeCircleEndRotations[i]));
|
var b = wr.ScreenPosition(centerPosition + offset.Rotate(RangeCircleEndRotations[i]));
|
||||||
|
|
||||||
if (contrastWidth > 0)
|
if (contrastWidth > 0)
|
||||||
wcr.DrawLine(a, b, contrastWidth / wr.Viewport.Zoom, contrastColor);
|
wcr.DrawLine(a, b, contrastWidth / wr.Viewport.Zoom, contrastColor);
|
||||||
|
|||||||
@@ -10,7 +10,6 @@
|
|||||||
|
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using OpenRA.Graphics;
|
using OpenRA.Graphics;
|
||||||
using OpenRA.Traits;
|
|
||||||
|
|
||||||
namespace OpenRA.Mods.Common.Graphics
|
namespace OpenRA.Mods.Common.Graphics
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,10 +8,8 @@
|
|||||||
*/
|
*/
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using OpenRA.Graphics;
|
using OpenRA.Graphics;
|
||||||
using OpenRA.Primitives;
|
|
||||||
|
|
||||||
namespace OpenRA.Mods.Common.Graphics
|
namespace OpenRA.Mods.Common.Graphics
|
||||||
{
|
{
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user