Make sure braces for multi-line statements are on their own lines.

This commit is contained in:
Paul Chote
2019-06-08 15:04:36 +01:00
committed by reaperrr
parent c89f8dbb89
commit ebf2ce32c0
34 changed files with 180 additions and 91 deletions

View File

@@ -201,7 +201,8 @@ namespace OpenRA
// Reseed the RNG so this isn't an exact repeat of the last game // Reseed the RNG so this isn't an exact repeat of the last game
lobbyInfo.GlobalSettings.RandomSeed = CosmeticRandom.Next(); lobbyInfo.GlobalSettings.RandomSeed = CosmeticRandom.Next();
var orders = new[] { var orders = new[]
{
Order.Command("sync_lobby {0}".F(lobbyInfo.Serialize())), Order.Command("sync_lobby {0}".F(lobbyInfo.Serialize())),
Order.Command("startgame") Order.Command("startgame")
}; };

View File

@@ -320,7 +320,7 @@ namespace OpenRA.Graphics
public static float[] MakeFloatMatrix(Int32Matrix4x4 imtx) public static float[] MakeFloatMatrix(Int32Matrix4x4 imtx)
{ {
var multipler = 1f / imtx.M44; var multipler = 1f / imtx.M44;
return new float[] return new[]
{ {
imtx.M11 * multipler, imtx.M11 * multipler,
imtx.M12 * multipler, imtx.M12 * multipler,
@@ -352,13 +352,16 @@ namespace OpenRA.Graphics
var iz = new uint[] { 2, 5, 2, 5, 2, 5, 2, 5 }; var iz = new uint[] { 2, 5, 2, 5, 2, 5, 2, 5 };
// Vectors to opposing corner // Vectors to opposing corner
var ret = new float[] { float.MaxValue, float.MaxValue, float.MaxValue, var ret = new[]
float.MinValue, float.MinValue, float.MinValue }; {
float.MaxValue, float.MaxValue, float.MaxValue,
float.MinValue, float.MinValue, float.MinValue
};
// Transform vectors and find new bounding box // Transform vectors and find new bounding box
for (var i = 0; i < 8; i++) for (var i = 0; i < 8; i++)
{ {
var vec = new float[] { bounds[ix[i]], bounds[iy[i]], bounds[iz[i]], 1 }; var vec = new[] { bounds[ix[i]], bounds[iy[i]], bounds[iz[i]], 1 };
var tvec = MatrixVectorMultiply(mtx, vec); var tvec = MatrixVectorMultiply(mtx, vec);
ret[0] = Math.Min(ret[0], tvec[0] / tvec[3]); ret[0] = Math.Min(ret[0], tvec[0] / tvec[3]);

View File

@@ -72,11 +72,14 @@ namespace OpenRA
public readonly string[] SpriteFormats = { }; public readonly string[] SpriteFormats = { };
public readonly string[] PackageFormats = { }; public readonly string[] PackageFormats = { };
readonly string[] reservedModuleNames = { "Metadata", "Folders", "MapFolders", "Packages", "Rules", readonly string[] reservedModuleNames =
{
"Metadata", "Folders", "MapFolders", "Packages", "Rules",
"Sequences", "ModelSequences", "Cursors", "Chrome", "Assemblies", "ChromeLayout", "Weapons", "Sequences", "ModelSequences", "Cursors", "Chrome", "Assemblies", "ChromeLayout", "Weapons",
"Voices", "Notifications", "Music", "Translations", "TileSets", "ChromeMetrics", "Missions", "Hotkeys", "Voices", "Notifications", "Music", "Translations", "TileSets", "ChromeMetrics", "Missions", "Hotkeys",
"ServerTraits", "LoadScreen", "Fonts", "SupportsMapsFrom", "SoundFormats", "SpriteFormats", "ServerTraits", "LoadScreen", "Fonts", "SupportsMapsFrom", "SoundFormats", "SpriteFormats",
"RequiresMods", "PackageFormats" }; "RequiresMods", "PackageFormats"
};
readonly TypeDictionary modules = new TypeDictionary(); readonly TypeDictionary modules = new TypeDictionary();
readonly Dictionary<string, MiniYaml> yaml; readonly Dictionary<string, MiniYaml> yaml;

View File

@@ -1079,7 +1079,8 @@ namespace OpenRA
var v = rand.Next(Bounds.Top, Bounds.Bottom); var v = rand.Next(Bounds.Top, Bounds.Bottom);
cells = Unproject(new PPos(u, v)); cells = Unproject(new PPos(u, v));
} while (!cells.Any()); }
while (!cells.Any());
return cells.Random(rand).ToCPos(Grid.Type); return cells.Random(rand).ToCPos(Grid.Type);
} }

View File

@@ -28,8 +28,14 @@ namespace OpenRA.Network
static bool initialized; static bool initialized;
public static IPAddress ExternalIP { get; private set; } public static IPAddress ExternalIP { get; private set; }
public static UPnPStatus Status { get { return initialized ? natDevice != null ? public static UPnPStatus Status
UPnPStatus.Enabled : UPnPStatus.NotSupported : UPnPStatus.Disabled; } } {
get
{
return initialized ? natDevice != null ?
UPnPStatus.Enabled : UPnPStatus.NotSupported : UPnPStatus.Disabled;
}
}
public static async Task DiscoverNatDevices(int timeout) public static async Task DiscoverNatDevices(int timeout)
{ {

View File

@@ -15,11 +15,14 @@ namespace OpenRA.Support
{ {
public static class PerfHistory public static class PerfHistory
{ {
static readonly Color[] Colors = { Color.Red, Color.Green, static readonly Color[] Colors =
{
Color.Red, Color.Green,
Color.Orange, Color.Yellow, Color.Orange, Color.Yellow,
Color.Fuchsia, Color.Lime, Color.Fuchsia, Color.Lime,
Color.LightBlue, Color.Blue, Color.LightBlue, Color.Blue,
Color.White, Color.Teal }; Color.White, Color.Teal
};
static int nextColor; static int nextColor;

View File

@@ -34,7 +34,8 @@ namespace OpenRA.Mods.Cnc.Activities
if (spriteOverlay != null && !spriteOverlay.Visible) if (spriteOverlay != null && !spriteOverlay.Visible)
{ {
spriteOverlay.Visible = true; spriteOverlay.Visible = true;
spriteOverlay.WithOffset.Animation.PlayThen(spriteOverlay.Info.Sequence, () => { spriteOverlay.WithOffset.Animation.PlayThen(spriteOverlay.Info.Sequence, () =>
{
dockingState = DockingState.Loop; dockingState = DockingState.Loop;
spriteOverlay.Visible = false; spriteOverlay.Visible = false;
}); });
@@ -52,7 +53,8 @@ namespace OpenRA.Mods.Cnc.Activities
if (spriteOverlay != null && !spriteOverlay.Visible) if (spriteOverlay != null && !spriteOverlay.Visible)
{ {
spriteOverlay.Visible = true; spriteOverlay.Visible = true;
spriteOverlay.WithOffset.Animation.PlayBackwardsThen(spriteOverlay.Info.Sequence, () => { spriteOverlay.WithOffset.Animation.PlayBackwardsThen(spriteOverlay.Info.Sequence, () =>
{
dockingState = DockingState.Complete; dockingState = DockingState.Complete;
body.Docked = false; body.Docked = false;
spriteOverlay.Visible = false; spriteOverlay.Visible = false;

View File

@@ -130,7 +130,8 @@ namespace OpenRA.Mods.Cnc.FileFormats
return i; return i;
} }
uint[] lookupMfromP = new uint[] { uint[] lookupMfromP =
{
0x243f6a88, 0x85a308d3, 0x13198a2e, 0x03707344, 0x243f6a88, 0x85a308d3, 0x13198a2e, 0x03707344,
0xa4093822, 0x299f31d0, 0x082efa98, 0xec4e6c89, 0xa4093822, 0x299f31d0, 0x082efa98, 0xec4e6c89,
0x452821e6, 0x38d01377, 0xbe5466cf, 0x34e90c6c, 0x452821e6, 0x38d01377, 0xbe5466cf, 0x34e90c6c,
@@ -138,7 +139,8 @@ namespace OpenRA.Mods.Cnc.FileFormats
0x9216d5d9, 0x8979fb1b 0x9216d5d9, 0x8979fb1b
}; };
uint[,] lookupMfromS = new uint[,] { uint[,] lookupMfromS =
{
{ {
0xd1310ba6, 0x98dfb5ac, 0x2ffd72db, 0xd01adfb7, 0xd1310ba6, 0x98dfb5ac, 0x2ffd72db, 0xd01adfb7,
0xb8e1afed, 0x6a267e96, 0xba7c9045, 0xf12c7f99, 0xb8e1afed, 0x6a267e96, 0xba7c9045, 0xf12c7f99,

View File

@@ -66,7 +66,8 @@ namespace OpenRA.Mods.Cnc.FileFormats
z += count; z += count;
l.VoxelCount += count; l.VoxelCount += count;
s.Seek(2 * count + 1, SeekOrigin.Current); s.Seek(2 * count + 1, SeekOrigin.Current);
} while (z < l.Size[2]); }
while (z < l.Size[2]);
} }
// Read the data // Read the data
@@ -99,7 +100,8 @@ namespace OpenRA.Mods.Cnc.FileFormats
// Skip duplicate count // Skip duplicate count
s.ReadUInt8(); s.ReadUInt8();
} while (z < l.Size[2]); }
while (z < l.Size[2]);
} }
} }

View File

@@ -101,18 +101,21 @@ namespace OpenRA.Mods.Cnc.Graphics
public float[] Bounds(uint frame) public float[] Bounds(uint frame)
{ {
var ret = new float[] { float.MaxValue, float.MaxValue, float.MaxValue, var ret = new[]
float.MinValue, float.MinValue, float.MinValue }; {
float.MaxValue, float.MaxValue, float.MaxValue,
float.MinValue, float.MinValue, float.MinValue
};
for (uint j = 0; j < limbs; j++) for (uint j = 0; j < limbs; j++)
{ {
var l = limbData[j]; var l = limbData[j];
var b = new float[] var b = new[]
{ {
0, 0, 0, 0, 0, 0,
(l.Bounds[3] - l.Bounds[0]), l.Bounds[3] - l.Bounds[0],
(l.Bounds[4] - l.Bounds[1]), l.Bounds[4] - l.Bounds[1],
(l.Bounds[5] - l.Bounds[2]) l.Bounds[5] - l.Bounds[2]
}; };
// Calculate limb bounding box // Calculate limb bounding box

View File

@@ -206,12 +206,19 @@ namespace OpenRA.Mods.Cnc.UtilityCommands
static readonly Dictionary<byte, byte[]> ResourceFromOverlay = new Dictionary<byte, byte[]>() static readonly Dictionary<byte, byte[]> ResourceFromOverlay = new Dictionary<byte, byte[]>()
{ {
// "tib" - Regular Tiberium // "tib" - Regular Tiberium
{ 0x01, new byte[] { 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, {
0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79 } 0x01, new byte[]
{
0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F,
0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79
}
}, },
// "btib" - Blue Tiberium // "btib" - Blue Tiberium
{ 0x02, new byte[] { 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, {
0x02, new byte[]
{
0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26,
// Should be "tib2" // Should be "tib2"
0x7F, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x7F, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88,
@@ -219,7 +226,8 @@ namespace OpenRA.Mods.Cnc.UtilityCommands
// Should be "tib3" // Should be "tib3"
0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9A, 0x9B, 0x9C, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9A, 0x9B, 0x9C,
0x9D, 0x9E, 0x9F, 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6 } 0x9D, 0x9E, 0x9F, 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6
}
}, },
// Veins // Veins

View File

@@ -114,7 +114,8 @@ namespace OpenRA.Mods.Common
var s = float2.Lerp(HsvSaturationRange[0], HsvSaturationRange[1], random.NextFloat()); var s = float2.Lerp(HsvSaturationRange[0], HsvSaturationRange[1], random.NextFloat());
var v = float2.Lerp(HsvValueRange[0], HsvValueRange[1], random.NextFloat()); var v = float2.Lerp(HsvValueRange[0], HsvValueRange[1], random.NextFloat());
color = Color.FromAhsv(h, s, v); color = Color.FromAhsv(h, s, v);
} while (!IsValid(color, out forbidden, terrainColors, playerColors, ignoreError)); }
while (!IsValid(color, out forbidden, terrainColors, playerColors, ignoreError));
return color; return color;
} }
@@ -172,7 +173,8 @@ namespace OpenRA.Mods.Common
color = Color.FromArgb(r, g, b); color = Color.FromArgb(r, g, b);
attempt++; attempt++;
} while (!IsValid(color, allForbidden, out forbiddenColor)); }
while (!IsValid(color, allForbidden, out forbiddenColor));
return color; return color;
} }

View File

@@ -25,7 +25,8 @@ namespace OpenRA.Mods.Common.FileFormats
public static readonly int MAXBITS = 13; // maximum code length public static readonly int MAXBITS = 13; // maximum code length
public static readonly int MAXWIN = 4096; // maximum window size public static readonly int MAXWIN = 4096; // maximum window size
static byte[] litlen = new byte[] { static byte[] litlen =
{
11, 124, 8, 7, 28, 7, 188, 13, 76, 4, 11, 124, 8, 7, 28, 7, 188, 13, 76, 4,
10, 8, 12, 10, 12, 10, 8, 23, 8, 9, 10, 8, 12, 10, 12, 10, 8, 23, 8, 9,
7, 6, 7, 8, 7, 6, 55, 8, 23, 24, 7, 6, 7, 8, 7, 6, 55, 8, 23, 24,
@@ -39,19 +40,21 @@ namespace OpenRA.Mods.Common.FileFormats
}; };
// bit lengths of length codes 0..15 // bit lengths of length codes 0..15
static byte[] lenlen = new byte[] { 2, 35, 36, 53, 38, 23 }; static byte[] lenlen = { 2, 35, 36, 53, 38, 23 };
// bit lengths of distance codes 0..63 // bit lengths of distance codes 0..63
static byte[] distlen = new byte[] { 2, 20, 53, 230, 247, 151, 248 }; static byte[] distlen = { 2, 20, 53, 230, 247, 151, 248 };
// base for length codes // base for length codes
static short[] lengthbase = new short[] { static short[] lengthbase =
{
3, 2, 4, 5, 6, 7, 8, 9, 10, 12, 3, 2, 4, 5, 6, 7, 8, 9, 10, 12,
16, 24, 40, 72, 136, 264 16, 24, 40, 72, 136, 264
}; };
// extra bits for length codes // extra bits for length codes
static byte[] extra = new byte[] { static byte[] extra =
{
0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2,
3, 4, 5, 6, 7, 8 3, 4, 5, 6, 7, 8
}; };
@@ -155,7 +158,8 @@ namespace OpenRA.Mods.Common.FileFormats
if (onProgress != null) if (onProgress != null)
onProgress(input.Position - inputStart, output.Position - outputStart); onProgress(input.Position - inputStart, output.Position - outputStart);
} }
} while (len != 0); }
while (len != 0);
} }
else else
{ {
@@ -173,7 +177,8 @@ namespace OpenRA.Mods.Common.FileFormats
onProgress(input.Position - inputStart, output.Position - outputStart); onProgress(input.Position - inputStart, output.Position - outputStart);
} }
} }
} while (true); }
while (true);
} }
// Decode a code using Huffman table h. // Decode a code using Huffman table h.

View File

@@ -251,7 +251,8 @@ namespace OpenRA.Mods.Common.FileFormats
} }
inf.Reset(); inf.Reset();
} while (toExtract > 0); }
while (toExtract > 0);
} }
else else
{ {
@@ -262,7 +263,8 @@ namespace OpenRA.Mods.Common.FileFormats
toExtract -= remainingInArchive; toExtract -= remainingInArchive;
output.Write(GetBytes(remainingInArchive), 0, (int)remainingInArchive); output.Write(GetBytes(remainingInArchive), 0, (int)remainingInArchive);
} while (toExtract > 0); }
while (toExtract > 0);
} }
} }

View File

@@ -226,7 +226,9 @@ namespace OpenRA.Mods.Common.FileFormats
{ {
*(uint*)op = *(uint*)mPos; *(uint*)op = *(uint*)mPos;
op += 4; mPos += 4; t -= 4; op += 4; mPos += 4; t -= 4;
} while (t >= 4); }
while (t >= 4);
if (t > 0) if (t > 0)
do { *op++ = *mPos++; } while (--t > 0); do { *op++ = *mPos++; } while (--t > 0);
} }
@@ -252,7 +254,8 @@ namespace OpenRA.Mods.Common.FileFormats
} }
t = *ip++; t = *ip++;
} while (true); }
while (true);
} }
eof_found: eof_found:

View File

@@ -63,9 +63,7 @@ namespace OpenRA.Mods.Common.LoadScreens
{ {
var widgetArgs = new WidgetArgs var widgetArgs = new WidgetArgs
{ {
{ "continueLoading", () => { "continueLoading", () => Game.RunAfterTick(() => Game.InitializeMod(modId, new Arguments())) },
Game.RunAfterTick(() => Game.InitializeMod(modId, new Arguments()))
},
{ "mod", selectedMod }, { "mod", selectedMod },
{ "content", content }, { "content", content },
}; };
@@ -78,9 +76,7 @@ namespace OpenRA.Mods.Common.LoadScreens
{ {
{ "mod", selectedMod }, { "mod", selectedMod },
{ "content", content }, { "content", content },
{ "onCancel", () => { "onCancel", () => Game.RunAfterTick(() => Game.InitializeMod(modId, new Arguments())) }
Game.RunAfterTick(() => Game.InitializeMod(modId, new Arguments()))
}
}; };
Ui.OpenWindow("CONTENT_PANEL", widgetArgs); Ui.OpenWindow("CONTENT_PANEL", widgetArgs);

View File

@@ -116,7 +116,8 @@ namespace OpenRA.Mods.Common.Pathfinder
// For horizontal/vertical directions, the set is the three cells 'ahead'. For diagonal directions, the set // For horizontal/vertical directions, the set is the three cells 'ahead'. For diagonal directions, the set
// is the three cells ahead, plus the two cells to the side, which we cannot exclude without knowing if // is the three cells ahead, plus the two cells to the side, which we cannot exclude without knowing if
// the cell directly between them and our parent is passable. // the cell directly between them and our parent is passable.
static readonly CVec[][] DirectedNeighbors = { static readonly CVec[][] DirectedNeighbors =
{
new[] { new CVec(-1, -1), new CVec(0, -1), new CVec(1, -1), new CVec(-1, 0), new CVec(-1, 1) }, new[] { new CVec(-1, -1), new CVec(0, -1), new CVec(1, -1), new CVec(-1, 0), new CVec(-1, 1) },
new[] { new CVec(-1, -1), new CVec(0, -1), new CVec(1, -1) }, new[] { new CVec(-1, -1), new CVec(0, -1), new CVec(1, -1) },
new[] { new CVec(-1, -1), new CVec(0, -1), new CVec(1, -1), new CVec(1, 0), new CVec(1, 1) }, new[] { new CVec(-1, -1), new CVec(0, -1), new CVec(1, -1), new CVec(1, 0), new CVec(1, 1) },

View File

@@ -99,8 +99,13 @@ namespace OpenRA.Mods.Common.Projectiles
bool isTailTravelling; bool isTailTravelling;
bool continueTracking = true; bool continueTracking = true;
bool IsBeamComplete { get { return !isHeadTravelling && headTicks >= length && bool IsBeamComplete
!isTailTravelling && tailTicks >= length; } } {
get
{
return !isHeadTravelling && headTicks >= length && !isTailTravelling && tailTicks >= length;
}
}
public AreaBeam(AreaBeamInfo info, ProjectileArgs args, Color color) public AreaBeam(AreaBeamInfo info, ProjectileArgs args, Color color)
{ {

View File

@@ -86,8 +86,13 @@ namespace OpenRA.Mods.Common.Traits
public Order IssueOrder(Actor self, IOrderTargeter order, Target target, bool queued) public Order IssueOrder(Actor self, IOrderTargeter order, Target target, bool queued)
{ {
if (order.OrderID == OrderID) if (order.OrderID == OrderID)
return new Order(order.OrderID, self, target, false) { SuppressVisualFeedback = true, {
ExtraData = ((RallyPointOrderTargeter)order).ForceSet ? ForceSet : 0 }; return new Order(order.OrderID, self, target, false)
{
SuppressVisualFeedback = true,
ExtraData = ((RallyPointOrderTargeter)order).ForceSet ? ForceSet : 0
};
}
return null; return null;
} }

View File

@@ -163,8 +163,11 @@ namespace OpenRA.Mods.Common.Traits
public IEnumerable<IOrderTargeter> Orders public IEnumerable<IOrderTargeter> Orders
{ {
get { yield return new DeployOrderTargeter("Unload", 10, get
() => CanUnload() ? Info.UnloadCursor : Info.UnloadBlockedCursor); } {
yield return new DeployOrderTargeter("Unload", 10,
() => CanUnload() ? Info.UnloadCursor : Info.UnloadBlockedCursor);
}
} }
public Order IssueOrder(Actor self, IOrderTargeter order, Target target, bool queued) public Order IssueOrder(Actor self, IOrderTargeter order, Target target, bool queued)

View File

@@ -192,11 +192,12 @@ namespace OpenRA.Mods.Common.Traits
// Find all refineries and their occupancy count: // Find all refineries and their occupancy count:
var refs = self.World.ActorsWithTrait<IAcceptResources>() var refs = self.World.ActorsWithTrait<IAcceptResources>()
.Where(r => r.Actor != ignore && r.Actor.Owner == self.Owner && IsAcceptableProcType(r.Actor)) .Where(r => r.Actor != ignore && r.Actor.Owner == self.Owner && IsAcceptableProcType(r.Actor))
.Select(r => new { .Select(r => new
{
Location = r.Actor.Location + r.Trait.DeliveryOffset, Location = r.Actor.Location + r.Trait.DeliveryOffset,
Actor = r.Actor, Actor = r.Actor,
Occupancy = self.World.ActorsHavingTrait<Harvester>(h => h.LinkedProc == r.Actor).Count() }) Occupancy = self.World.ActorsHavingTrait<Harvester>(h => h.LinkedProc == r.Actor).Count()
.ToDictionary(r => r.Location); }).ToDictionary(r => r.Location);
// Start a search from each refinery's delivery location: // Start a search from each refinery's delivery location:
List<CPos> path; List<CPos> path;

View File

@@ -22,7 +22,8 @@ namespace OpenRA.Mods.Common.Traits
float t = 0; float t = 0;
string paletteName = "cloak"; string paletteName = "cloak";
Color[] colors = { Color[] colors =
{
Color.FromArgb(55, 205, 205, 220), Color.FromArgb(55, 205, 205, 220),
Color.FromArgb(120, 205, 205, 230), Color.FromArgb(120, 205, 205, 230),
Color.FromArgb(192, 180, 180, 255), Color.FromArgb(192, 180, 180, 255),

View File

@@ -147,10 +147,13 @@ namespace OpenRA.Mods.Common.Traits.Render
initializePalettes = false; initializePalettes = false;
} }
return new IRenderable[] { new ModelRenderable( return new IRenderable[]
components, self.CenterPosition, 0, camera, Info.Scale, {
lightSource, Info.LightAmbientColor, Info.LightDiffuseColor, new ModelRenderable(
colorPalette, normalsPalette, shadowPalette) }; components, self.CenterPosition, 0, camera, Info.Scale,
lightSource, Info.LightAmbientColor, Info.LightDiffuseColor,
colorPalette, normalsPalette, shadowPalette)
};
} }
IEnumerable<Rectangle> IRender.ScreenBounds(Actor self, WorldRenderer wr) IEnumerable<Rectangle> IRender.ScreenBounds(Actor self, WorldRenderer wr)

View File

@@ -83,7 +83,8 @@ namespace OpenRA.Mods.Common.Traits
// Always spawn at least one actor, plus // Always spawn at least one actor, plus
// however many needed to reach the minimum. // however many needed to reach the minimum.
SpawnActor(self, spawnPoint); SpawnActor(self, spawnPoint);
} while (actorsPresent < info.Minimum); }
while (actorsPresent < info.Minimum);
} }
WPos SpawnActor(Actor self, Actor spawnPoint) WPos SpawnActor(Actor self, Actor spawnPoint)

View File

@@ -56,7 +56,8 @@ namespace OpenRA.Mods.Common.Traits
public readonly float[] SwingAmplitude = { 1.0f, 1.5f }; public readonly float[] SwingAmplitude = { 1.0f, 1.5f };
[Desc("The randomly selected rgb(a) hex colors for the particles. Use this order: rrggbb[aa], rrggbb[aa], ...")] [Desc("The randomly selected rgb(a) hex colors for the particles. Use this order: rrggbb[aa], rrggbb[aa], ...")]
public readonly Color[] ParticleColors = { public readonly Color[] ParticleColors =
{
Color.FromArgb(236, 236, 236), Color.FromArgb(236, 236, 236),
Color.FromArgb(228, 228, 228), Color.FromArgb(228, 228, 228),
Color.FromArgb(208, 208, 208), Color.FromArgb(208, 208, 208),

View File

@@ -42,42 +42,52 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules
TraitWrapper[] traits = TraitWrapper[] traits =
{ {
new TraitWrapper("PrimaryBuilding", new Dictionary<string, string> { new TraitWrapper("PrimaryBuilding", new Dictionary<string, string>
{
{ "SelectionNotification", "PrimaryBuildingSelected" } { "SelectionNotification", "PrimaryBuildingSelected" }
}), }),
new TraitWrapper("RepairableBuilding", new Dictionary<string, string> { new TraitWrapper("RepairableBuilding", new Dictionary<string, string>
{
{ "RepairingNotification", "Repairing" } { "RepairingNotification", "Repairing" }
}), }),
new TraitWrapper("RepairsUnits", new Dictionary<string, string> { new TraitWrapper("RepairsUnits", new Dictionary<string, string>
{
{ "StartRepairingNotification", "Repairing" } { "StartRepairingNotification", "Repairing" }
}), }),
new TraitWrapper("GainsExperience", new Dictionary<string, string> { new TraitWrapper("GainsExperience", new Dictionary<string, string>
{
{ "LevelUpNotification", "LevelUp" } { "LevelUpNotification", "LevelUp" }
}), }),
new TraitWrapper("MissionObjectives", new Dictionary<string, string> { new TraitWrapper("MissionObjectives", new Dictionary<string, string>
{
{ "WinNotification", "Win" }, { "WinNotification", "Win" },
{ "LoseNotification", "Lose" }, { "LoseNotification", "Lose" },
{ "LeaveNotification", "Leave" } { "LeaveNotification", "Leave" }
}), }),
new TraitWrapper("PlaceBuilding", new Dictionary<string, string> { new TraitWrapper("PlaceBuilding", new Dictionary<string, string>
{
{ "NewOptionsNotification", "NewOptions" }, { "NewOptionsNotification", "NewOptions" },
{ "CannotPlaceNotification", "BuildingCannotPlaceAudio" } { "CannotPlaceNotification", "BuildingCannotPlaceAudio" }
}), }),
new TraitWrapper("PlayerResources", new Dictionary<string, string> { new TraitWrapper("PlayerResources", new Dictionary<string, string>
{
{ "CashTickUpNotification", "CashTickUp" }, { "CashTickUpNotification", "CashTickUp" },
{ "CashTickDownNotification", "CashTickDown" } { "CashTickDownNotification", "CashTickDown" }
}), }),
new TraitWrapper("ProductionQueue", new Dictionary<string, string> { new TraitWrapper("ProductionQueue", new Dictionary<string, string>
{
{ "ReadyAudio", "UnitReady" }, { "ReadyAudio", "UnitReady" },
{ "BlockedAudio", "NoBuild" }, { "BlockedAudio", "NoBuild" },
{ "QueuedAudio", "Training" }, { "QueuedAudio", "Training" },
{ "OnHoldAudio", "OnHold" }, { "OnHoldAudio", "OnHold" },
{ "CancelledAudio", "Cancelled" } { "CancelledAudio", "Cancelled" }
}), }),
new TraitWrapper("PowerManager", new Dictionary<string, string> { new TraitWrapper("PowerManager", new Dictionary<string, string>
{
{ "SpeechNotification", "LowPower" } { "SpeechNotification", "LowPower" }
}), }),
new TraitWrapper("Infiltrates", new Dictionary<string, string> { new TraitWrapper("Infiltrates", new Dictionary<string, string>
{
{ "Notification", "BuildingInfiltrated" } { "Notification", "BuildingInfiltrated" }
}) })
}; };

View File

@@ -89,11 +89,13 @@ namespace OpenRA.Mods.Common.UtilityCommands
Console.WriteLine(" },"); Console.WriteLine(" },");
} }
var actorProperties = Game.ModData.ObjectCreator.GetTypesImplementing<ScriptActorProperties>().SelectMany(cg => { var actorProperties = Game.ModData.ObjectCreator.GetTypesImplementing<ScriptActorProperties>().SelectMany(cg =>
{
return ScriptMemberWrapper.WrappableMembers(cg); return ScriptMemberWrapper.WrappableMembers(cg);
}); });
var scriptProperties = Game.ModData.ObjectCreator.GetTypesImplementing<ScriptPlayerProperties>().SelectMany(cg => { var scriptProperties = Game.ModData.ObjectCreator.GetTypesImplementing<ScriptPlayerProperties>().SelectMany(cg =>
{
return ScriptMemberWrapper.WrappableMembers(cg); return ScriptMemberWrapper.WrappableMembers(cg);
}); });

View File

@@ -403,7 +403,8 @@ namespace OpenRA.Mods.Common.UtilityCommands
var actorType = parts[1].ToLowerInvariant(); var actorType = parts[1].ToLowerInvariant();
var actor = new ActorReference(actorType) { var actor = new ActorReference(actorType)
{
new LocationInit(ParseActorLocation(actorType, loc)), new LocationInit(ParseActorLocation(actorType, loc)),
new OwnerInit(parts[0]), new OwnerInit(parts[0]),
}; };

View File

@@ -25,7 +25,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
if (disconnected || orderManager.Connection.ConnectionState != ConnectionState.NotConnected) if (disconnected || orderManager.Connection.ConnectionState != ConnectionState.NotConnected)
return; return;
Game.RunAfterTick(() => Ui.OpenWindow("CONNECTIONFAILED_PANEL", new WidgetArgs { Game.RunAfterTick(() => Ui.OpenWindow("CONNECTIONFAILED_PANEL", new WidgetArgs
{
{ "orderManager", orderManager }, { "orderManager", orderManager },
{ "onAbort", null }, { "onAbort", null },
{ "onRetry", null } { "onRetry", null }

View File

@@ -127,10 +127,14 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{ {
{ "orderManager", orderManager }, { "orderManager", orderManager },
{ "getMap", (Func<MapPreview>)(() => map) }, { "getMap", (Func<MapPreview>)(() => map) },
{ "onMouseDown", (Action<MapPreviewWidget, MapPreview, MouseInput>)((preview, mapPreview, mi) => {
LobbyUtils.SelectSpawnPoint(orderManager, preview, mapPreview, mi)) "onMouseDown", (Action<MapPreviewWidget, MapPreview, MouseInput>)((preview, mapPreview, mi) =>
LobbyUtils.SelectSpawnPoint(orderManager, preview, mapPreview, mi))
},
{
"getSpawnOccupants", (Func<MapPreview, Dictionary<CPos, SpawnOccupant>>)(mapPreview =>
LobbyUtils.GetSpawnOccupants(orderManager.LobbyInfo, mapPreview))
}, },
{ "getSpawnOccupants", (Func<MapPreview, Dictionary<CPos, SpawnOccupant>>)(mapPreview => LobbyUtils.GetSpawnOccupants(orderManager.LobbyInfo, mapPreview)) },
{ "showUnoccupiedSpawnpoints", true }, { "showUnoccupiedSpawnpoints", true },
}); });

View File

@@ -40,11 +40,16 @@ namespace OpenRA.Mods.Common.Widgets.Logic
public static void ShowSlotDropDown(DropDownButtonWidget dropdown, Session.Slot slot, public static void ShowSlotDropDown(DropDownButtonWidget dropdown, Session.Slot slot,
Session.Client client, OrderManager orderManager, MapPreview map) Session.Client client, OrderManager orderManager, MapPreview map)
{ {
var options = new Dictionary<string, IEnumerable<SlotDropDownOption>>() { { "Slot", new List<SlotDropDownOption>() var options = new Dictionary<string, IEnumerable<SlotDropDownOption>>
{ {
new SlotDropDownOption("Open", "slot_open " + slot.PlayerReference, () => (!slot.Closed && client == null)), {
new SlotDropDownOption("Closed", "slot_close " + slot.PlayerReference, () => slot.Closed) "Slot", new List<SlotDropDownOption>
} } }; {
new SlotDropDownOption("Open", "slot_open " + slot.PlayerReference, () => (!slot.Closed && client == null)),
new SlotDropDownOption("Closed", "slot_close " + slot.PlayerReference, () => slot.Closed)
}
}
};
var bots = new List<SlotDropDownOption>(); var bots = new List<SlotDropDownOption>();
if (slot.AllowBots) if (slot.AllowBots)

View File

@@ -81,8 +81,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{ "orderManager", null }, { "orderManager", null },
{ "getMap", (Func<MapPreview>)(() => map) }, { "getMap", (Func<MapPreview>)(() => map) },
{ "onMouseDown", (Action<MapPreviewWidget, MapPreview, MouseInput>)((preview, mapPreview, mi) => { }) }, { "onMouseDown", (Action<MapPreviewWidget, MapPreview, MouseInput>)((preview, mapPreview, mi) => { }) },
{ "getSpawnOccupants", (Func<MapPreview, Dictionary<CPos, SpawnOccupant>>)(mapPreview => {
LobbyUtils.GetSpawnOccupants(selectedReplay.GameInfo.Players, mapPreview)) "getSpawnOccupants", (Func<MapPreview, Dictionary<CPos, SpawnOccupant>>)(mapPreview =>
LobbyUtils.GetSpawnOccupants(selectedReplay.GameInfo.Players, mapPreview))
}, },
{ "showUnoccupiedSpawnpoints", false }, { "showUnoccupiedSpawnpoints", false },
}); });

View File

@@ -204,11 +204,12 @@ namespace OpenRA.Mods.Common.Widgets.Logic
catch (System.Net.Sockets.SocketException e) catch (System.Net.Sockets.SocketException e)
{ {
var message = "Could not listen on port {0}.".F(Game.Settings.Server.ListenPort); var message = "Could not listen on port {0}.".F(Game.Settings.Server.ListenPort);
if (e.ErrorCode == 10048) { // AddressAlreadyInUse (WSAEADDRINUSE)
// AddressAlreadyInUse (WSAEADDRINUSE)
if (e.ErrorCode == 10048)
message += "\nCheck if the port is already being used."; message += "\nCheck if the port is already being used.";
} else { else
message += "\nError is: \"{0}\" ({1})".F(e.Message, e.ErrorCode); message += "\nError is: \"{0}\" ({1})".F(e.Message, e.ErrorCode);
}
ConfirmationDialogs.ButtonPrompt("Server Creation Failed", message, onCancel: () => { }, cancelText: "Back"); ConfirmationDialogs.ButtonPrompt("Server Creation Failed", message, onCancel: () => { }, cancelText: "Back");
return; return;

View File

@@ -199,7 +199,8 @@ namespace OpenRA.Test
Is.EqualTo(878)); Is.EqualTo(878));
// Plus shaped dodecagon // Plus shaped dodecagon
shape = new PolygonShape(new int2[] { shape = new PolygonShape(new[]
{
new int2(-511, -1535), new int2(511, -1535), new int2(511, -511), new int2(1535, -511), new int2(-511, -1535), new int2(511, -1535), new int2(511, -511), new int2(1535, -511),
new int2(1535, 511), new int2(511, 511), new int2(511, 1535), new int2(-511, 1535), new int2(1535, 511), new int2(511, 511), new int2(511, 1535), new int2(-511, 1535),
new int2(-511, 511), new int2(-1535, 511), new int2(-1535, -511), new int2(-511, -511) new int2(-511, 511), new int2(-1535, 511), new int2(-1535, -511), new int2(-511, -511)