diff --git a/OpenRA.Game/Exts.cs b/OpenRA.Game/Exts.cs index af5b35fb1a..5244557755 100644 --- a/OpenRA.Game/Exts.cs +++ b/OpenRA.Game/Exts.cs @@ -164,7 +164,11 @@ namespace OpenRA public static IEnumerable Iterate(this T t, Func f) { - for (;;) { yield return t; t = f(t); } + while (true) + { + yield return t; + t = f(t); + } } public static T MinBy(this IEnumerable ts, Func selector) diff --git a/OpenRA.Game/FileFormats/Png.cs b/OpenRA.Game/FileFormats/Png.cs index 5f980ae33a..6f14abb6a4 100644 --- a/OpenRA.Game/FileFormats/Png.cs +++ b/OpenRA.Game/FileFormats/Png.cs @@ -42,7 +42,7 @@ namespace OpenRA.FileFormats var is24Bit = false; var data = new List(); - for (;;) + while (true) { var length = IPAddress.NetworkToHostOrder(s.ReadInt32()); var type = Encoding.UTF8.GetString(s.ReadBytes(4)); diff --git a/OpenRA.Game/Map/MapCache.cs b/OpenRA.Game/Map/MapCache.cs index 183f725f17..fc1bd41f6c 100644 --- a/OpenRA.Game/Map/MapCache.cs +++ b/OpenRA.Game/Map/MapCache.cs @@ -233,7 +233,7 @@ namespace OpenRA var maxKeepAlive = 5000 / emptyDelay; var keepAlive = maxKeepAlive; - for (;;) + while (true) { List todo; lock (syncRoot) diff --git a/OpenRA.Game/Network/Connection.cs b/OpenRA.Game/Network/Connection.cs index 3c47b2edee..abc4707479 100644 --- a/OpenRA.Game/Network/Connection.cs +++ b/OpenRA.Game/Network/Connection.cs @@ -177,7 +177,7 @@ namespace OpenRA.Network clientId = reader.ReadInt32(); connectionState = ConnectionState.Connected; - for (;;) + while (true) { var len = reader.ReadInt32(); var client = reader.ReadInt32(); diff --git a/OpenRA.Game/Server/Connection.cs b/OpenRA.Game/Server/Connection.cs index 0815917833..5a0c0b6bdf 100644 --- a/OpenRA.Game/Server/Connection.cs +++ b/OpenRA.Game/Server/Connection.cs @@ -47,7 +47,7 @@ namespace OpenRA.Server var rx = new byte[1024]; var len = 0; - for (;;) + while (true) { try { diff --git a/OpenRA.Game/Server/Server.cs b/OpenRA.Game/Server/Server.cs index 22c3ac6a0f..b231c4b4f3 100644 --- a/OpenRA.Game/Server/Server.cs +++ b/OpenRA.Game/Server/Server.cs @@ -172,7 +172,7 @@ namespace OpenRA.Server Log.Write("server", "Initial mod: {0}", ModData.Manifest.Id); Log.Write("server", "Initial map: {0}", LobbyInfo.GlobalSettings.Map); - for (;;) + while (true) { var checkRead = new List(); if (State == ServerState.WaitingPlayers) diff --git a/OpenRA.Mods.Common/EditorBrushes/EditorTileBrush.cs b/OpenRA.Mods.Common/EditorBrushes/EditorTileBrush.cs index 5c52412f37..55120fbca6 100644 --- a/OpenRA.Mods.Common/EditorBrushes/EditorTileBrush.cs +++ b/OpenRA.Mods.Common/EditorBrushes/EditorTileBrush.cs @@ -167,7 +167,7 @@ namespace OpenRA.Mods.Common.Widgets Func findEdge = (refCell, direction) => { - for (;;) + while (true) { var newCell = refCell + direction; if (!shouldPaint(newCell)) diff --git a/OpenRA.Mods.Common/Util.cs b/OpenRA.Mods.Common/Util.cs index 15981af523..3e58bee173 100644 --- a/OpenRA.Mods.Common/Util.cs +++ b/OpenRA.Mods.Common/Util.cs @@ -164,7 +164,7 @@ namespace OpenRA.Mods.Common public static IEnumerable RandomWalk(CPos p, MersenneTwister r) { - for (;;) + while (true) { var dx = r.Next(-1, 2); var dy = r.Next(-1, 2); diff --git a/OpenRA.Mods.Common/Widgets/ColorMixerWidget.cs b/OpenRA.Mods.Common/Widgets/ColorMixerWidget.cs index cdb4bff714..806bd2840f 100644 --- a/OpenRA.Mods.Common/Widgets/ColorMixerWidget.cs +++ b/OpenRA.Mods.Common/Widgets/ColorMixerWidget.cs @@ -109,7 +109,7 @@ namespace OpenRA.Mods.Common.Widgets lock (syncWorker) workerAlive = true; - for (;;) + while (true) { float hue; lock (syncWorker)