Make sure braces for multi-line statements are on their own lines.
This commit is contained in:
@@ -114,7 +114,8 @@ namespace OpenRA.Mods.Common
|
||||
var s = float2.Lerp(HsvSaturationRange[0], HsvSaturationRange[1], random.NextFloat());
|
||||
var v = float2.Lerp(HsvValueRange[0], HsvValueRange[1], random.NextFloat());
|
||||
color = Color.FromAhsv(h, s, v);
|
||||
} while (!IsValid(color, out forbidden, terrainColors, playerColors, ignoreError));
|
||||
}
|
||||
while (!IsValid(color, out forbidden, terrainColors, playerColors, ignoreError));
|
||||
|
||||
return color;
|
||||
}
|
||||
@@ -172,7 +173,8 @@ namespace OpenRA.Mods.Common
|
||||
color = Color.FromArgb(r, g, b);
|
||||
|
||||
attempt++;
|
||||
} while (!IsValid(color, allForbidden, out forbiddenColor));
|
||||
}
|
||||
while (!IsValid(color, allForbidden, out forbiddenColor));
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
@@ -25,7 +25,8 @@ namespace OpenRA.Mods.Common.FileFormats
|
||||
public static readonly int MAXBITS = 13; // maximum code length
|
||||
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,
|
||||
10, 8, 12, 10, 12, 10, 8, 23, 8, 9,
|
||||
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
|
||||
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
|
||||
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
|
||||
static short[] lengthbase = new short[] {
|
||||
static short[] lengthbase =
|
||||
{
|
||||
3, 2, 4, 5, 6, 7, 8, 9, 10, 12,
|
||||
16, 24, 40, 72, 136, 264
|
||||
};
|
||||
|
||||
// extra bits for length codes
|
||||
static byte[] extra = new byte[] {
|
||||
static byte[] extra =
|
||||
{
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 1, 2,
|
||||
3, 4, 5, 6, 7, 8
|
||||
};
|
||||
@@ -155,7 +158,8 @@ namespace OpenRA.Mods.Common.FileFormats
|
||||
if (onProgress != null)
|
||||
onProgress(input.Position - inputStart, output.Position - outputStart);
|
||||
}
|
||||
} while (len != 0);
|
||||
}
|
||||
while (len != 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -173,7 +177,8 @@ namespace OpenRA.Mods.Common.FileFormats
|
||||
onProgress(input.Position - inputStart, output.Position - outputStart);
|
||||
}
|
||||
}
|
||||
} while (true);
|
||||
}
|
||||
while (true);
|
||||
}
|
||||
|
||||
// Decode a code using Huffman table h.
|
||||
|
||||
@@ -251,7 +251,8 @@ namespace OpenRA.Mods.Common.FileFormats
|
||||
}
|
||||
|
||||
inf.Reset();
|
||||
} while (toExtract > 0);
|
||||
}
|
||||
while (toExtract > 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -262,7 +263,8 @@ namespace OpenRA.Mods.Common.FileFormats
|
||||
|
||||
toExtract -= remainingInArchive;
|
||||
output.Write(GetBytes(remainingInArchive), 0, (int)remainingInArchive);
|
||||
} while (toExtract > 0);
|
||||
}
|
||||
while (toExtract > 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -226,7 +226,9 @@ namespace OpenRA.Mods.Common.FileFormats
|
||||
{
|
||||
*(uint*)op = *(uint*)mPos;
|
||||
op += 4; mPos += 4; t -= 4;
|
||||
} while (t >= 4);
|
||||
}
|
||||
while (t >= 4);
|
||||
|
||||
if (t > 0)
|
||||
do { *op++ = *mPos++; } while (--t > 0);
|
||||
}
|
||||
@@ -252,7 +254,8 @@ namespace OpenRA.Mods.Common.FileFormats
|
||||
}
|
||||
|
||||
t = *ip++;
|
||||
} while (true);
|
||||
}
|
||||
while (true);
|
||||
}
|
||||
|
||||
eof_found:
|
||||
|
||||
@@ -63,9 +63,7 @@ namespace OpenRA.Mods.Common.LoadScreens
|
||||
{
|
||||
var widgetArgs = new WidgetArgs
|
||||
{
|
||||
{ "continueLoading", () =>
|
||||
Game.RunAfterTick(() => Game.InitializeMod(modId, new Arguments()))
|
||||
},
|
||||
{ "continueLoading", () => Game.RunAfterTick(() => Game.InitializeMod(modId, new Arguments())) },
|
||||
{ "mod", selectedMod },
|
||||
{ "content", content },
|
||||
};
|
||||
@@ -78,9 +76,7 @@ namespace OpenRA.Mods.Common.LoadScreens
|
||||
{
|
||||
{ "mod", selectedMod },
|
||||
{ "content", content },
|
||||
{ "onCancel", () =>
|
||||
Game.RunAfterTick(() => Game.InitializeMod(modId, new Arguments()))
|
||||
}
|
||||
{ "onCancel", () => Game.RunAfterTick(() => Game.InitializeMod(modId, new Arguments())) }
|
||||
};
|
||||
|
||||
Ui.OpenWindow("CONTENT_PANEL", widgetArgs);
|
||||
|
||||
@@ -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
|
||||
// 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.
|
||||
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[] { new CVec(-1, -1), new CVec(0, -1), new CVec(1, -1), new CVec(1, 0), new CVec(1, 1) },
|
||||
|
||||
@@ -99,8 +99,13 @@ namespace OpenRA.Mods.Common.Projectiles
|
||||
bool isTailTravelling;
|
||||
bool continueTracking = true;
|
||||
|
||||
bool IsBeamComplete { get { return !isHeadTravelling && headTicks >= length &&
|
||||
!isTailTravelling && tailTicks >= length; } }
|
||||
bool IsBeamComplete
|
||||
{
|
||||
get
|
||||
{
|
||||
return !isHeadTravelling && headTicks >= length && !isTailTravelling && tailTicks >= length;
|
||||
}
|
||||
}
|
||||
|
||||
public AreaBeam(AreaBeamInfo info, ProjectileArgs args, Color color)
|
||||
{
|
||||
|
||||
@@ -86,8 +86,13 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public Order IssueOrder(Actor self, IOrderTargeter order, Target target, bool queued)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -163,8 +163,11 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
public IEnumerable<IOrderTargeter> Orders
|
||||
{
|
||||
get { yield return new DeployOrderTargeter("Unload", 10,
|
||||
() => CanUnload() ? Info.UnloadCursor : Info.UnloadBlockedCursor); }
|
||||
get
|
||||
{
|
||||
yield return new DeployOrderTargeter("Unload", 10,
|
||||
() => CanUnload() ? Info.UnloadCursor : Info.UnloadBlockedCursor);
|
||||
}
|
||||
}
|
||||
|
||||
public Order IssueOrder(Actor self, IOrderTargeter order, Target target, bool queued)
|
||||
|
||||
@@ -192,11 +192,12 @@ namespace OpenRA.Mods.Common.Traits
|
||||
// Find all refineries and their occupancy count:
|
||||
var refs = self.World.ActorsWithTrait<IAcceptResources>()
|
||||
.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,
|
||||
Actor = r.Actor,
|
||||
Occupancy = self.World.ActorsHavingTrait<Harvester>(h => h.LinkedProc == r.Actor).Count() })
|
||||
.ToDictionary(r => r.Location);
|
||||
Occupancy = self.World.ActorsHavingTrait<Harvester>(h => h.LinkedProc == r.Actor).Count()
|
||||
}).ToDictionary(r => r.Location);
|
||||
|
||||
// Start a search from each refinery's delivery location:
|
||||
List<CPos> path;
|
||||
|
||||
@@ -22,7 +22,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
float t = 0;
|
||||
string paletteName = "cloak";
|
||||
|
||||
Color[] colors = {
|
||||
Color[] colors =
|
||||
{
|
||||
Color.FromArgb(55, 205, 205, 220),
|
||||
Color.FromArgb(120, 205, 205, 230),
|
||||
Color.FromArgb(192, 180, 180, 255),
|
||||
|
||||
@@ -147,10 +147,13 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
initializePalettes = false;
|
||||
}
|
||||
|
||||
return new IRenderable[] { new ModelRenderable(
|
||||
components, self.CenterPosition, 0, camera, Info.Scale,
|
||||
lightSource, Info.LightAmbientColor, Info.LightDiffuseColor,
|
||||
colorPalette, normalsPalette, shadowPalette) };
|
||||
return new IRenderable[]
|
||||
{
|
||||
new ModelRenderable(
|
||||
components, self.CenterPosition, 0, camera, Info.Scale,
|
||||
lightSource, Info.LightAmbientColor, Info.LightDiffuseColor,
|
||||
colorPalette, normalsPalette, shadowPalette)
|
||||
};
|
||||
}
|
||||
|
||||
IEnumerable<Rectangle> IRender.ScreenBounds(Actor self, WorldRenderer wr)
|
||||
|
||||
@@ -83,7 +83,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
// Always spawn at least one actor, plus
|
||||
// however many needed to reach the minimum.
|
||||
SpawnActor(self, spawnPoint);
|
||||
} while (actorsPresent < info.Minimum);
|
||||
}
|
||||
while (actorsPresent < info.Minimum);
|
||||
}
|
||||
|
||||
WPos SpawnActor(Actor self, Actor spawnPoint)
|
||||
|
||||
@@ -56,7 +56,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
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], ...")]
|
||||
public readonly Color[] ParticleColors = {
|
||||
public readonly Color[] ParticleColors =
|
||||
{
|
||||
Color.FromArgb(236, 236, 236),
|
||||
Color.FromArgb(228, 228, 228),
|
||||
Color.FromArgb(208, 208, 208),
|
||||
|
||||
@@ -42,42 +42,52 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
|
||||
TraitWrapper[] traits =
|
||||
{
|
||||
new TraitWrapper("PrimaryBuilding", new Dictionary<string, string> {
|
||||
new TraitWrapper("PrimaryBuilding", new Dictionary<string, string>
|
||||
{
|
||||
{ "SelectionNotification", "PrimaryBuildingSelected" }
|
||||
}),
|
||||
new TraitWrapper("RepairableBuilding", new Dictionary<string, string> {
|
||||
new TraitWrapper("RepairableBuilding", new Dictionary<string, string>
|
||||
{
|
||||
{ "RepairingNotification", "Repairing" }
|
||||
}),
|
||||
new TraitWrapper("RepairsUnits", new Dictionary<string, string> {
|
||||
new TraitWrapper("RepairsUnits", new Dictionary<string, string>
|
||||
{
|
||||
{ "StartRepairingNotification", "Repairing" }
|
||||
}),
|
||||
new TraitWrapper("GainsExperience", new Dictionary<string, string> {
|
||||
new TraitWrapper("GainsExperience", new Dictionary<string, string>
|
||||
{
|
||||
{ "LevelUpNotification", "LevelUp" }
|
||||
}),
|
||||
new TraitWrapper("MissionObjectives", new Dictionary<string, string> {
|
||||
new TraitWrapper("MissionObjectives", new Dictionary<string, string>
|
||||
{
|
||||
{ "WinNotification", "Win" },
|
||||
{ "LoseNotification", "Lose" },
|
||||
{ "LeaveNotification", "Leave" }
|
||||
}),
|
||||
new TraitWrapper("PlaceBuilding", new Dictionary<string, string> {
|
||||
new TraitWrapper("PlaceBuilding", new Dictionary<string, string>
|
||||
{
|
||||
{ "NewOptionsNotification", "NewOptions" },
|
||||
{ "CannotPlaceNotification", "BuildingCannotPlaceAudio" }
|
||||
}),
|
||||
new TraitWrapper("PlayerResources", new Dictionary<string, string> {
|
||||
new TraitWrapper("PlayerResources", new Dictionary<string, string>
|
||||
{
|
||||
{ "CashTickUpNotification", "CashTickUp" },
|
||||
{ "CashTickDownNotification", "CashTickDown" }
|
||||
}),
|
||||
new TraitWrapper("ProductionQueue", new Dictionary<string, string> {
|
||||
new TraitWrapper("ProductionQueue", new Dictionary<string, string>
|
||||
{
|
||||
{ "ReadyAudio", "UnitReady" },
|
||||
{ "BlockedAudio", "NoBuild" },
|
||||
{ "QueuedAudio", "Training" },
|
||||
{ "OnHoldAudio", "OnHold" },
|
||||
{ "CancelledAudio", "Cancelled" }
|
||||
}),
|
||||
new TraitWrapper("PowerManager", new Dictionary<string, string> {
|
||||
new TraitWrapper("PowerManager", new Dictionary<string, string>
|
||||
{
|
||||
{ "SpeechNotification", "LowPower" }
|
||||
}),
|
||||
new TraitWrapper("Infiltrates", new Dictionary<string, string> {
|
||||
new TraitWrapper("Infiltrates", new Dictionary<string, string>
|
||||
{
|
||||
{ "Notification", "BuildingInfiltrated" }
|
||||
})
|
||||
};
|
||||
|
||||
@@ -89,11 +89,13 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
Console.WriteLine(" },");
|
||||
}
|
||||
|
||||
var actorProperties = Game.ModData.ObjectCreator.GetTypesImplementing<ScriptActorProperties>().SelectMany(cg => {
|
||||
var actorProperties = Game.ModData.ObjectCreator.GetTypesImplementing<ScriptActorProperties>().SelectMany(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);
|
||||
});
|
||||
|
||||
|
||||
@@ -403,7 +403,8 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
|
||||
var actorType = parts[1].ToLowerInvariant();
|
||||
|
||||
var actor = new ActorReference(actorType) {
|
||||
var actor = new ActorReference(actorType)
|
||||
{
|
||||
new LocationInit(ParseActorLocation(actorType, loc)),
|
||||
new OwnerInit(parts[0]),
|
||||
};
|
||||
|
||||
@@ -25,7 +25,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
if (disconnected || orderManager.Connection.ConnectionState != ConnectionState.NotConnected)
|
||||
return;
|
||||
|
||||
Game.RunAfterTick(() => Ui.OpenWindow("CONNECTIONFAILED_PANEL", new WidgetArgs {
|
||||
Game.RunAfterTick(() => Ui.OpenWindow("CONNECTIONFAILED_PANEL", new WidgetArgs
|
||||
{
|
||||
{ "orderManager", orderManager },
|
||||
{ "onAbort", null },
|
||||
{ "onRetry", null }
|
||||
|
||||
@@ -127,10 +127,14 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
{
|
||||
{ "orderManager", orderManager },
|
||||
{ "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 },
|
||||
});
|
||||
|
||||
|
||||
@@ -40,11 +40,16 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
public static void ShowSlotDropDown(DropDownButtonWidget dropdown, Session.Slot slot,
|
||||
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>();
|
||||
if (slot.AllowBots)
|
||||
|
||||
@@ -81,8 +81,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
{ "orderManager", null },
|
||||
{ "getMap", (Func<MapPreview>)(() => map) },
|
||||
{ "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 },
|
||||
});
|
||||
|
||||
@@ -204,11 +204,12 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
catch (System.Net.Sockets.SocketException e)
|
||||
{
|
||||
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.";
|
||||
} else {
|
||||
else
|
||||
message += "\nError is: \"{0}\" ({1})".F(e.Message, e.ErrorCode);
|
||||
}
|
||||
|
||||
ConfirmationDialogs.ButtonPrompt("Server Creation Failed", message, onCancel: () => { }, cancelText: "Back");
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user