From 1dc2bd20a677256c6a7c8c23836567fe33046ebf Mon Sep 17 00:00:00 2001 From: Christopher Whitley Date: Sun, 8 Oct 2023 15:09:06 -0400 Subject: [PATCH] Document formatting applied based on editorconfig --- .../Infiniminer.Client/Engines/BlockEngine.cs | 39 ++++---- .../Engines/InterfaceEngine.cs | 18 ++-- .../Engines/ParticleEngine.cs | 4 +- .../Engines/SkyboxEngine.cs | 2 +- .../Infiniminer.Client/InfiniminerGame.cs | 30 +++--- .../Infiniminer.Client/PropertyBag.cs | 18 ++-- .../Infiniminer.Client/ServerInformation.cs | 2 +- .../StateMasher/StateMachine.cs | 6 +- .../States/ClassSelectionState.cs | 10 +- .../Infiniminer.Client/States/LoadingState.cs | 6 +- .../States/MainGameState.cs | 28 +++--- .../States/ServerBrowserState.cs | 8 +- .../States/TeamSelectionState.cs | 4 +- .../TestGeometryRenderer.cs | 4 +- .../Infiniminer.Server/CaveGenerator.cs | 92 +++++++++---------- .../Infiniminer.Shared/HTTPRequest.cs | 2 +- .../Infiniminer/Infiniminer.Shared/Player.cs | 2 +- .../Infiniminer.Shared/SpriteModel.cs | 6 +- .../Lidgren.Network/NetBase.SimulateLag.cs | 4 +- source/Lidgren/Lidgren.Network/NetBase.cs | 30 +++--- .../NetConnection.Reliability.cs | 4 +- 21 files changed, 158 insertions(+), 161 deletions(-) diff --git a/source/Infiniminer/Infiniminer.Client/Engines/BlockEngine.cs b/source/Infiniminer/Infiniminer.Client/Engines/BlockEngine.cs index 7d69dd0..c85cfee 100644 --- a/source/Infiniminer/Infiniminer.Client/Engines/BlockEngine.cs +++ b/source/Infiniminer/Infiniminer.Client/Engines/BlockEngine.cs @@ -30,9 +30,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE namespace Infiniminer { - - - [Serializable] public struct VertexPositionTextureShade : IVertexType { @@ -44,10 +41,10 @@ public struct VertexPositionTextureShade : IVertexType VertexDeclaration IVertexType.VertexDeclaration => VertexDeclaration; public static readonly VertexElement[] VertexElements = new VertexElement[] - { + { new VertexElement(0, VertexElementFormat.Vector3, VertexElementUsage.Position, 0), new VertexElement(sizeof(float)*3,VertexElementFormat.Vector2, VertexElementUsage.TextureCoordinate, 0), - new VertexElement(sizeof(float)*5,VertexElementFormat.Single, VertexElementUsage.TextureCoordinate, 1) + new VertexElement(sizeof(float)*5,VertexElementFormat.Single, VertexElementUsage.TextureCoordinate, 1) }; public VertexPositionTextureShade(Vector3 position, Vector2 uv, double shade) @@ -103,8 +100,8 @@ public IMTexture(Texture2D texture) public class BlockEngine { BlockType[,,] blockList = null; - public BlockType[, ,] downloadList = null; - Dictionary[,] faceMap = null; + public BlockType[,,] downloadList = null; + Dictionary[,] faceMap = null; BlockTexture[,] blockTextureMap = null; IMTexture[] blockTextures = null; Effect basicEffect; @@ -149,16 +146,16 @@ public BlockEngine(InfiniminerGame gameInstance) } // Initialize the face lists. - faceMap = new Dictionary[(byte)BlockTexture.MAXIMUM, NUMREGIONS]; + faceMap = new Dictionary[(byte)BlockTexture.MAXIMUM, NUMREGIONS]; for (BlockTexture blockTexture = BlockTexture.None; blockTexture < BlockTexture.MAXIMUM; blockTexture++) - for (int r=0; r(); // Initialize the texture map. blockTextureMap = new BlockTexture[(byte)BlockType.MAXIMUM, 6]; for (BlockType blockType = BlockType.None; blockType < BlockType.MAXIMUM; blockType++) for (BlockFaceDirection faceDir = BlockFaceDirection.XIncreasing; faceDir < BlockFaceDirection.MAXIMUM; faceDir++) - blockTextureMap[(byte)blockType,(byte)faceDir] = BlockInformation.GetTexture(blockType, faceDir); + blockTextureMap[(byte)blockType, (byte)faceDir] = BlockInformation.GetTexture(blockType, faceDir); // Load the textures we'll use. blockTextures = new IMTexture[(byte)BlockTexture.MAXIMUM]; @@ -227,7 +224,7 @@ public BlockEngine(InfiniminerGame gameInstance) // Returns true if we are solid at this point. public bool SolidAtPoint(Vector3 point) { - return BlockAtPoint(point) != BlockType.None; + return BlockAtPoint(point) != BlockType.None; } public bool SolidAtPointForPlayer(Vector3 point) @@ -253,14 +250,14 @@ public BlockType BlockAtPoint(Vector3 point) ushort z = (ushort)point.Z; if (x < 0 || y < 0 || z < 0 || x >= MAPSIZE || y >= MAPSIZE || z >= MAPSIZE) return BlockType.None; - return blockList[x, y, z]; + return blockList[x, y, z]; } public bool RayCollision(Vector3 startPosition, Vector3 rayDirection, float distance, int searchGranularity, ref Vector3 hitPoint, ref Vector3 buildPoint) { Vector3 testPos = startPosition; Vector3 buildPos = startPosition; - for (int i=0; i 0.001) gunSprite = texToolBuildSmoke; spriteBatch.Draw(gunSprite, new Rectangle(drawX, drawY, 120 * 3, 126 * 3), Color.White); - spriteBatch.Draw(blockIcons[blockType], new Rectangle(drawX+37*3, drawY+50*3, 117, 63), Color.White); + spriteBatch.Draw(blockIcons[blockType], new Rectangle(drawX + 37 * 3, drawY + 50 * 3, 117, 63), Color.White); } public void Render(GraphicsDevice graphicsDevice) @@ -267,7 +267,7 @@ public void Render(GraphicsDevice graphicsDevice) // Draw the UI. spriteBatch.Begin(blendState: BlendState.AlphaBlend, sortMode: SpriteSortMode.Immediate); - + // Draw the crosshair. spriteBatch.Draw(texCrosshairs, new Rectangle(graphicsDevice.Viewport.Width / 2 - texCrosshairs.Width / 2, graphicsDevice.Viewport.Height / 2 - texCrosshairs.Height / 2, @@ -322,9 +322,9 @@ public void Render(GraphicsDevice graphicsDevice) RenderMessageCenter(spriteBatch, "YOU CANNOT CHANGE YOUR CLASS BELOW THE SURFACE", new Vector2(graphicsDevice.Viewport.Width / 2, graphicsDevice.Viewport.Height / 2 + 90), Color.White, Color.Black); // Draw the text-based information panel. - int textStart = (graphicsDevice.Viewport.Width - 1024)/2; + int textStart = (graphicsDevice.Viewport.Width - 1024) / 2; spriteBatch.Draw(texBlank, new Rectangle(0, 0, graphicsDevice.Viewport.Width, 20), Color.Black); - spriteBatch.DrawString(uiFont, "ORE: " + _P.playerOre + "/" + _P.playerOreMax, new Vector2(textStart+3, 2), Color.White); + spriteBatch.DrawString(uiFont, "ORE: " + _P.playerOre + "/" + _P.playerOreMax, new Vector2(textStart + 3, 2), Color.White); spriteBatch.DrawString(uiFont, "LOOT: $" + _P.playerCash, new Vector2(textStart + 170, 2), Color.White); spriteBatch.DrawString(uiFont, "WEIGHT: " + _P.playerWeight + "/" + _P.playerWeightMax, new Vector2(textStart + 340, 2), Color.White); spriteBatch.DrawString(uiFont, "TEAM ORE: " + _P.teamOre, new Vector2(textStart + 515, 2), Color.White); @@ -343,13 +343,13 @@ public void Render(GraphicsDevice graphicsDevice) string gameOverMessage = "GAME OVER - " + teamName + " TEAM WINS!"; RenderMessageCenter(spriteBatch, gameOverMessage, new Vector2(graphicsDevice.Viewport.Width / 2, 150), teamColor, new Color(0, 0, 0, 0)); } - + int drawY = 200; foreach (Player p in _P.playerList.Values) { if (p.Team != PlayerTeam.Red) continue; - RenderMessageCenter(spriteBatch, p.Handle + " ( $" + p.Score + " )", new Vector2(graphicsDevice.Viewport.Width/4, drawY), Defines.IM_RED, new Color(0, 0, 0, 0)); + RenderMessageCenter(spriteBatch, p.Handle + " ( $" + p.Score + " )", new Vector2(graphicsDevice.Viewport.Width / 4, drawY), Defines.IM_RED, new Color(0, 0, 0, 0)); drawY += 35; } drawY = 200; @@ -402,14 +402,14 @@ public void Render(GraphicsDevice graphicsDevice) RenderMessageCenter(spriteBatch, "PRESS Y TO CONFIRM THAT YOU WANT TO QUIT.", new Vector2(graphicsDevice.Viewport.Width / 2, graphicsDevice.Viewport.Height / 2 + 30), Color.White, Color.Black); RenderMessageCenter(spriteBatch, "PRESS K TO COMMIT PIXELCIDE.", new Vector2(graphicsDevice.Viewport.Width / 2, graphicsDevice.Viewport.Height / 2 + 80), Color.White, Color.Black); } - + // Draw the current screen effect. if (_P.screenEffect == ScreenEffect.Death) { Color drawColor = new Color(1 - (float)_P.screenEffectCounter * 0.5f, 0f, 0f); spriteBatch.Draw(texBlank, new Rectangle(0, 0, graphicsDevice.Viewport.Width, graphicsDevice.Viewport.Height), drawColor); if (_P.screenEffectCounter >= 2) - RenderMessageCenter(spriteBatch, "You have died. Click to respawn.", new Vector2(graphicsDevice.Viewport.Width / 2, graphicsDevice.Viewport.Height/2), Color.White, Color.Black); + RenderMessageCenter(spriteBatch, "You have died. Click to respawn.", new Vector2(graphicsDevice.Viewport.Width / 2, graphicsDevice.Viewport.Height / 2), Color.White, Color.Black); } if (_P.screenEffect == ScreenEffect.Teleport || _P.screenEffect == ScreenEffect.Explosion) { diff --git a/source/Infiniminer/Infiniminer.Client/Engines/ParticleEngine.cs b/source/Infiniminer/Infiniminer.Client/Engines/ParticleEngine.cs index ce69098..afdd24b 100644 --- a/source/Infiniminer/Infiniminer.Client/Engines/ParticleEngine.cs +++ b/source/Infiniminer/Infiniminer.Client/Engines/ParticleEngine.cs @@ -142,7 +142,7 @@ public void CreateExplosionDebris(Vector3 explosionPosition) for (int i = 0; i < 50; i++) { Particle p = new Particle(); - p.Color = new Color(90,60,40); + p.Color = new Color(90, 60, 40); p.Size = (float)(randGen.NextDouble() * 0.4 + 0.05); p.Position = explosionPosition; p.Position.Y += (float)randGen.NextDouble() - 0.5f; @@ -157,7 +157,7 @@ public void CreateBloodSplatter(Vector3 playerPosition, Color color) { Particle p = new Particle(); p.Color = color; - p.Size = (float)(randGen.NextDouble()*0.2 + 0.05); + p.Size = (float)(randGen.NextDouble() * 0.2 + 0.05); p.Position = playerPosition; p.Position.Y -= (float)randGen.NextDouble(); p.Velocity = new Vector3((float)randGen.NextDouble() * 5 - 2.5f, (float)randGen.NextDouble() * 4f, (float)randGen.NextDouble() * 5 - 2.5f); diff --git a/source/Infiniminer/Infiniminer.Client/Engines/SkyboxEngine.cs b/source/Infiniminer/Infiniminer.Client/Engines/SkyboxEngine.cs index 843d445..ee4fd7d 100644 --- a/source/Infiniminer/Infiniminer.Client/Engines/SkyboxEngine.cs +++ b/source/Infiniminer/Infiniminer.Client/Engines/SkyboxEngine.cs @@ -47,7 +47,7 @@ public SkyplaneEngine(InfiniminerGame gameInstance) // Generate a noise texture. randGen = new Random(); texNoise = new Texture2D(gameInstance.GraphicsDevice, 64, 64); - uint[] noiseData = new uint[64*64]; + uint[] noiseData = new uint[64 * 64]; for (int i = 0; i < 64 * 64; i++) if (randGen.Next(32) == 0) noiseData[i] = Color.White.PackedValue; diff --git a/source/Infiniminer/Infiniminer.Client/InfiniminerGame.cs b/source/Infiniminer/Infiniminer.Client/InfiniminerGame.cs index 8149619..95bc732 100644 --- a/source/Infiniminer/Infiniminer.Client/InfiniminerGame.cs +++ b/source/Infiniminer/Infiniminer.Client/InfiniminerGame.cs @@ -55,10 +55,10 @@ public InfiniminerGame(string[] args) public void JoinGame(IPEndPoint serverEndPoint) { // Clear out the map load progress indicator. - propertyBag.mapLoadProgress = new bool[64,64]; + propertyBag.mapLoadProgress = new bool[64, 64]; for (int i = 0; i < 64; i++) - for (int j=0; j<64; j++) - propertyBag.mapLoadProgress[i,j] = false; + for (int j = 0; j < 64; j++) + propertyBag.mapLoadProgress[i, j] = false; // Create our connect message. NetBuffer connectBuffer = propertyBag.netClient.CreateBuffer(); @@ -72,7 +72,7 @@ public void JoinGame(IPEndPoint serverEndPoint) public List EnumerateServers(float discoveryTime) { List serverList = new List(); - + // Discover local servers. propertyBag.netClient.DiscoverLocalServers(5565); NetBuffer msgBuffer = propertyBag.netClient.CreateBuffer(); @@ -173,18 +173,18 @@ public void UpdateNetwork(GameTime gameTime) { byte x = msgBuffer.ReadByte(); byte y = msgBuffer.ReadByte(); - propertyBag.mapLoadProgress[x,y] = true; - for (byte dy=0; dy<16; dy++) - for (byte z=0; z<64; z++) + propertyBag.mapLoadProgress[x, y] = true; + for (byte dy = 0; dy < 16; dy++) + for (byte z = 0; z < 64; z++) { BlockType blockType = (BlockType)msgBuffer.ReadByte(); if (blockType != BlockType.None) - propertyBag.blockEngine.downloadList[x, y+dy, z] = blockType; + propertyBag.blockEngine.downloadList[x, y + dy, z] = blockType; } bool downloadComplete = true; - for (x=0; x<64; x++) - for (y=0; y<64; y+=16) - if (propertyBag.mapLoadProgress[x,y] == false) + for (x = 0; x < 64; x++) + for (y = 0; y < 64; y += 16) + if (propertyBag.mapLoadProgress[x, y] == false) { downloadComplete = false; break; @@ -259,7 +259,7 @@ public void UpdateNetwork(GameTime gameTime) if (propertyBag.blockEngine.BlockAtPoint(new Vector3(x, y, z)) != BlockType.None) propertyBag.blockEngine.RemoveBlock(x, y, z); propertyBag.blockEngine.AddBlock(x, y, z, blockType); - CheckForStandingInLava(); + CheckForStandingInLava(); } } break; @@ -267,7 +267,7 @@ public void UpdateNetwork(GameTime gameTime) case InfiniminerMessage.TriggerExplosion: { Vector3 blockPos = msgBuffer.ReadVector3(); - + // Play the explosion sound. propertyBag.PlaySound(InfiniminerSound.Explosion, blockPos); @@ -460,7 +460,7 @@ protected override void Initialize() if (dataFile.Data.ContainsKey("pretty")) RenderPretty = bool.Parse(dataFile.Data["pretty"]); if (dataFile.Data.ContainsKey("volume")) - volumeLevel = Math.Max(0,Math.Min(1,float.Parse(dataFile.Data["volume"], System.Globalization.CultureInfo.InvariantCulture))); + volumeLevel = Math.Max(0, Math.Min(1, float.Parse(dataFile.Data["volume"], System.Globalization.CultureInfo.InvariantCulture))); graphicsDeviceManager.ApplyChanges(); base.Initialize(); @@ -474,7 +474,7 @@ protected override void Update(GameTime gameTime) protected override void OnExiting(object sender, EventArgs args) { propertyBag.netClient.Shutdown("Client exiting."); - + base.OnExiting(sender, args); } diff --git a/source/Infiniminer/Infiniminer.Client/PropertyBag.cs b/source/Infiniminer/Infiniminer.Client/PropertyBag.cs index db0000d..113b5c4 100644 --- a/source/Infiniminer/Infiniminer.Client/PropertyBag.cs +++ b/source/Infiniminer/Infiniminer.Client/PropertyBag.cs @@ -55,8 +55,8 @@ public ChatMessage(string message, ChatMessageType type, float timestamp) } } - public class PropertyBag - { + public class PropertyBag + { // Game engines. public BlockEngine blockEngine = null; public InterfaceEngine interfaceEngine = null; @@ -76,7 +76,7 @@ public class PropertyBag public PlayerClass playerClass; public PlayerTools[] playerTools = new PlayerTools[1] { PlayerTools.Pickaxe }; public int playerToolSelected = 0; - public BlockType[] playerBlocks = new BlockType[1] {BlockType.None}; + public BlockType[] playerBlocks = new BlockType[1] { BlockType.None }; public int playerBlockSelected = 0; public PlayerTeam playerTeam = PlayerTeam.Red; public bool playerDead = true; @@ -120,7 +120,7 @@ public PropertyBag(InfiniminerGame gameInstance) { // Initialize our network device. NetConfiguration netConfig = new NetConfiguration("InfiniminerPlus"); - + netClient = new NetClient(netConfig); netClient.SetMessageTypeEnabled(NetMessageType.ConnectionRejected, true); //netClient.SimulatedMinimumLatency = 0.1f; @@ -292,7 +292,7 @@ public void UpdateCamera(GameTime gameTime) newPosition.X += (float)(2 - screenEffectCounter) * (float)(randGen.NextDouble() - 0.5) * 0.5f; newPosition.Y += (float)(2 - screenEffectCounter) * (float)(randGen.NextDouble() - 0.5) * 0.5f; newPosition.Z += (float)(2 - screenEffectCounter) * (float)(randGen.NextDouble() - 0.5) * 0.5f; - if (!blockEngine.SolidAtPointForPlayer(newPosition) && (newPosition-playerPosition).Length() < 0.7f) + if (!blockEngine.SolidAtPointForPlayer(newPosition) && (newPosition - playerPosition).Length() < 0.7f) playerCamera.Position = newPosition; } // For 2 to 3, move the camera back. @@ -401,7 +401,7 @@ public void SetPlayerClass(PlayerClass playerClass) case PlayerClass.Engineer: playerTools = new PlayerTools[3] { PlayerTools.Pickaxe, - PlayerTools.ConstructionGun, + PlayerTools.ConstructionGun, PlayerTools.DeconstructionGun }; playerBlocks = new BlockType[9] { playerTeam == PlayerTeam.Red ? BlockType.SolidRed : BlockType.SolidBlue, BlockType.TransRed, @@ -455,7 +455,7 @@ public void FirePickaxe() msgBuffer.Write(playerCamera.GetLookVector()); msgBuffer.Write((byte)PlayerTools.Pickaxe); msgBuffer.Write((byte)BlockType.None); - netClient.SendMessage(msgBuffer, NetChannel.ReliableUnordered); + netClient.SendMessage(msgBuffer, NetChannel.ReliableUnordered); } public void FireConstructionGun(BlockType blockType) @@ -505,7 +505,7 @@ public void FireDetonator() msgBuffer.Write(playerCamera.GetLookVector()); msgBuffer.Write((byte)PlayerTools.Detonator); msgBuffer.Write((byte)BlockType.None); - netClient.SendMessage(msgBuffer, NetChannel.ReliableUnordered); + netClient.SendMessage(msgBuffer, NetChannel.ReliableUnordered); } public void ToggleRadar() @@ -520,7 +520,7 @@ public void ReadRadar(ref float distanceReading, ref float valueReading) distanceReading = 30; // Scan out along the camera axis for 30 meters. - for (int i=-3;i<=3; i++) + for (int i = -3; i <= 3; i++) for (int j = -3; j <= 3; j++) { Matrix rotation = Matrix.CreateRotationX((float)(i * Math.PI / 128)) * Matrix.CreateRotationY((float)(j * Math.PI / 128)); diff --git a/source/Infiniminer/Infiniminer.Client/ServerInformation.cs b/source/Infiniminer/Infiniminer.Client/ServerInformation.cs index 9aaa137..9667bae 100644 --- a/source/Infiniminer/Infiniminer.Client/ServerInformation.cs +++ b/source/Infiniminer/Infiniminer.Client/ServerInformation.cs @@ -68,7 +68,7 @@ public string GetServerDesc() if (serverExtra.Trim() != "") serverDesc += " - " + serverExtra.Trim(); } - + return serverDesc; } diff --git a/source/Infiniminer/Infiniminer.Client/StateMasher/StateMachine.cs b/source/Infiniminer/Infiniminer.Client/StateMasher/StateMachine.cs index aa0a3c3..655a9fb 100644 --- a/source/Infiniminer/Infiniminer.Client/StateMasher/StateMachine.cs +++ b/source/Infiniminer/Infiniminer.Client/StateMasher/StateMachine.cs @@ -39,7 +39,7 @@ namespace StateMasher public class StateMachine : Microsoft.Xna.Framework.Game { [DllImport("user32.dll")] - public static extern int GetForegroundWindow(); + public static extern int GetForegroundWindow(); public GraphicsDeviceManager graphicsDeviceManager; public Infiniminer.PropertyBag propertyBag = null; @@ -100,7 +100,7 @@ protected override void Initialize() protected override void LoadContent() { - + } protected override void UnloadContent() @@ -177,7 +177,7 @@ protected override void Draw(GameTime gameTime) needToRenderOnEnter = false; currentState.OnRenderAtEnter(GraphicsDevice); } - + base.Draw(gameTime); } } diff --git a/source/Infiniminer/Infiniminer.Client/States/ClassSelectionState.cs b/source/Infiniminer/Infiniminer.Client/States/ClassSelectionState.cs index 6a8d899..86144ed 100644 --- a/source/Infiniminer/Infiniminer.Client/States/ClassSelectionState.cs +++ b/source/Infiniminer/Infiniminer.Client/States/ClassSelectionState.cs @@ -37,10 +37,10 @@ public class ClassSelectionState : State string nextState = null; ClickRegion[] clkClassMenu = new ClickRegion[4] { - new ClickRegion(new Rectangle(54,168,142,190), "miner"), - new ClickRegion(new Rectangle(300,169,142,190), "prospector"), - new ClickRegion(new Rectangle(580,170,133,187), "engineer"), - new ClickRegion(new Rectangle(819,172,133,190), "sapper") + new ClickRegion(new Rectangle(54,168,142,190), "miner"), + new ClickRegion(new Rectangle(300,169,142,190), "prospector"), + new ClickRegion(new Rectangle(580,170,133,187), "engineer"), + new ClickRegion(new Rectangle(819,172,133,190), "sapper") }; public override void OnEnter(string oldState) @@ -85,7 +85,7 @@ public override void OnRenderAtUpdate(GraphicsDevice graphicsDevice, GameTime ga { SpriteBatch spriteBatch = new SpriteBatch(graphicsDevice); spriteBatch.Begin(blendState: BlendState.AlphaBlend, sortMode: SpriteSortMode.Deferred); - spriteBatch.Draw((_P.playerTeam == PlayerTeam.Red)?texMenuRed:texMenuBlue, drawRect, Color.White); + spriteBatch.Draw((_P.playerTeam == PlayerTeam.Red) ? texMenuRed : texMenuBlue, drawRect, Color.White); spriteBatch.End(); } diff --git a/source/Infiniminer/Infiniminer.Client/States/LoadingState.cs b/source/Infiniminer/Infiniminer.Client/States/LoadingState.cs index 1ccb357..bdc0ef3 100644 --- a/source/Infiniminer/Infiniminer.Client/States/LoadingState.cs +++ b/source/Infiniminer/Infiniminer.Client/States/LoadingState.cs @@ -101,7 +101,7 @@ public override void OnRenderAtUpdate(GraphicsDevice graphicsDevice, GameTime ga { uint dataPacketsRecieved = 0; for (int x = 0; x < 64; x++) - for (int y = 0; y < 64; y+=16) + for (int y = 0; y < 64; y += 16) if (_P.mapLoadProgress[x, y]) dataPacketsRecieved += 1; string progressText = String.Format("{0:00}% LOADED", dataPacketsRecieved / 256.0f * 100); @@ -110,8 +110,8 @@ public override void OnRenderAtUpdate(GraphicsDevice graphicsDevice, GameTime ga spriteBatch.Begin(blendState: BlendState.AlphaBlend, sortMode: SpriteSortMode.Deferred); spriteBatch.Draw(texMenu, drawRect, Color.White); spriteBatch.DrawString(uiFont, progressText, new Vector2(((int)(_SM.GraphicsDevice.Viewport.Width / 2 - uiFont.MeasureString(progressText).X / 2)), drawRect.Y + 430), Color.White); - for (int i=0; i 2) { @@ -510,7 +510,7 @@ public override void OnMouseDown(MouseButton button, int x, int y) public override void OnMouseUp(MouseButton button, int x, int y) { - + } public override void OnMouseScroll(int scrollDelta) @@ -531,7 +531,7 @@ public override void OnMouseScroll(int scrollDelta) _P.PlaySound(InfiniminerSound.ClickLow); _P.playerBlockSelected -= 1; if (_P.playerBlockSelected < 0) - _P.playerBlockSelected = _P.playerBlocks.Length-1; + _P.playerBlockSelected = _P.playerBlocks.Length - 1; } } } diff --git a/source/Infiniminer/Infiniminer.Client/States/ServerBrowserState.cs b/source/Infiniminer/Infiniminer.Client/States/ServerBrowserState.cs index 50ce69f..b7cca74 100644 --- a/source/Infiniminer/Infiniminer.Client/States/ServerBrowserState.cs +++ b/source/Infiniminer/Infiniminer.Client/States/ServerBrowserState.cs @@ -46,7 +46,7 @@ public class ServerBrowserState : State KeyMap keyMap; ClickRegion[] clkMenuServer = new ClickRegion[2] { - new ClickRegion(new Rectangle(763,713,243,42), "refresh"), + new ClickRegion(new Rectangle(763,713,243,42), "refresh"), new ClickRegion(new Rectangle(0,713,425,42), "direct") }; @@ -65,7 +65,7 @@ public override void OnEnter(string oldState) uiFont = _SM.Content.Load("font_04b08"); keyMap = new KeyMap(); - + serverList = (_SM as InfiniminerGame).EnumerateServers(0.5f); } @@ -97,7 +97,7 @@ public override void OnRenderAtUpdate(GraphicsDevice graphicsDevice, GameTime ga if (drawY < 660) { int textWidth = (int)(uiFont.MeasureString(server.GetServerDesc()).X); - descWidths.Add(textWidth+30); + descWidths.Add(textWidth + 30); spriteBatch.DrawString(uiFont, server.GetServerDesc(), new Vector2(_SM.GraphicsDevice.Viewport.Width / 2 - textWidth / 2, drawRect.Y + drawY), Color.White); drawY += 25; } @@ -150,7 +150,7 @@ public override void OnKeyDown(Keys key) // So, GetHostAddresses() might fail, but we don't really care. Just leave connectIp as null. } } - if (connectIp != null) + if (connectIp != null) { (_SM as InfiniminerGame).JoinGame(new IPEndPoint(connectIp, 5565)); nextState = "Infiniminer.States.LoadingState"; diff --git a/source/Infiniminer/Infiniminer.Client/States/TeamSelectionState.cs b/source/Infiniminer/Infiniminer.Client/States/TeamSelectionState.cs index 81306de..6e9318a 100644 --- a/source/Infiniminer/Infiniminer.Client/States/TeamSelectionState.cs +++ b/source/Infiniminer/Infiniminer.Client/States/TeamSelectionState.cs @@ -39,8 +39,8 @@ public class TeamSelectionState : State bool canCancel = false; ClickRegion[] clkTeamMenu = new ClickRegion[2] { - new ClickRegion(new Rectangle(229,156,572,190), "red"), - new ClickRegion(new Rectangle(135,424,761,181), "blue") + new ClickRegion(new Rectangle(229,156,572,190), "red"), + new ClickRegion(new Rectangle(135,424,761,181), "blue") }; public override void OnEnter(string oldState) diff --git a/source/Infiniminer/Infiniminer.Client/TestGeometryRenderer.cs b/source/Infiniminer/Infiniminer.Client/TestGeometryRenderer.cs index 614767d..1bfce1b 100644 --- a/source/Infiniminer/Infiniminer.Client/TestGeometryRenderer.cs +++ b/source/Infiniminer/Infiniminer.Client/TestGeometryRenderer.cs @@ -61,13 +61,13 @@ public void DrawSphere(Vector3 position, float radius, Color color) public void DrawLine(Vector3 posStart, Vector3 posEnd, Color color) { - + } public VertexPositionColor[] ConstructSphereVertices(Vector3 position, float radius, Color color) { VertexPositionColor[] vertices = new VertexPositionColor[3 * 8]; - VertexPositionColor top = new VertexPositionColor(Vector3.Up*radius+position, color); + VertexPositionColor top = new VertexPositionColor(Vector3.Up * radius + position, color); VertexPositionColor bottom = new VertexPositionColor(Vector3.Down * radius + position, color); VertexPositionColor left = new VertexPositionColor(Vector3.Left * radius + position, color); VertexPositionColor right = new VertexPositionColor(Vector3.Right * radius + position, color); diff --git a/source/Infiniminer/Infiniminer.Server/CaveGenerator.cs b/source/Infiniminer/Infiniminer.Server/CaveGenerator.cs index 07fc03e..da9bb78 100644 --- a/source/Infiniminer/Infiniminer.Server/CaveGenerator.cs +++ b/source/Infiniminer/Infiniminer.Server/CaveGenerator.cs @@ -35,13 +35,13 @@ public class CaveGenerator private static Random randGen = new Random(); // Create a cave system. - public static BlockType[, ,] GenerateCaveSystem(int size, bool includeLava, uint oreFactor) + public static BlockType[,,] GenerateCaveSystem(int size, bool includeLava, uint oreFactor) { float gradientStrength = (float)randGen.NextDouble(); - BlockType[, ,] caveData = CaveGenerator.GenerateConstant(size, BlockType.Dirt); + BlockType[,,] caveData = CaveGenerator.GenerateConstant(size, BlockType.Dirt); // Add ore. - float[, ,] oreNoise = CaveGenerator.GeneratePerlinNoise(32); + float[,,] oreNoise = CaveGenerator.GeneratePerlinNoise(32); oreNoise = InterpolateData(ref oreNoise, 32, size); for (int i = 0; i < oreFactor; i++) CaveGenerator.PaintWithRandomWalk(ref caveData, ref oreNoise, size, 1, BlockType.Ore, false); @@ -51,15 +51,15 @@ public class CaveGenerator AddDiamond(ref caveData, size); // Level off everything above ground level, replacing it with mountains. - float[, ,] mountainNoise = CaveGenerator.GeneratePerlinNoise(32); + float[,,] mountainNoise = CaveGenerator.GeneratePerlinNoise(32); mountainNoise = InterpolateData(ref mountainNoise, 32, size); for (int x = 0; x < size; x++) for (int y = 0; y < size; y++) - for (int z = 0; z <= Defines.GROUND_LEVEL*2; z++) + for (int z = 0; z <= Defines.GROUND_LEVEL * 2; z++) mountainNoise[x, y, z] = z < 3 ? 0 : Math.Min(1, z / (Defines.GROUND_LEVEL * 2)); - float[, ,] gradient = CaveGenerator.GenerateGradient(size); + float[,,] gradient = CaveGenerator.GenerateGradient(size); CaveGenerator.AddDataTo(ref mountainNoise, ref gradient, size, 0.1f, 0.9f); - BlockType[, ,] mountainData = CaveGenerator.GenerateConstant(size, BlockType.None); + BlockType[,,] mountainData = CaveGenerator.GenerateConstant(size, BlockType.None); int numMountains = randGen.Next(size, size * 3); for (int i = 0; i < numMountains; i++) CaveGenerator.PaintWithRandomWalk(ref mountainData, ref mountainNoise, size, randGen.Next(2, 3), BlockType.Dirt, false); @@ -68,9 +68,9 @@ public class CaveGenerator for (int z = 0; z <= Defines.GROUND_LEVEL; z++) if (mountainData[x, y, z] == BlockType.None) caveData[x, y, z] = BlockType.None; - + // Carve some caves into the ground. - float[, ,] caveNoise = CaveGenerator.GeneratePerlinNoise(32); + float[,,] caveNoise = CaveGenerator.GeneratePerlinNoise(32); caveNoise = InterpolateData(ref caveNoise, 32, size); gradient = CaveGenerator.GenerateGradient(size); CaveGenerator.AddDataTo(ref caveNoise, ref gradient, size, 1 - gradientStrength, gradientStrength); @@ -79,7 +79,7 @@ public class CaveGenerator CaveGenerator.PaintWithRandomWalk(ref caveData, ref caveNoise, size, randGen.Next(1, 2), BlockType.None, false); // Carve the map into a sphere. - float[, ,] sphereGradient = CaveGenerator.GenerateRadialGradient(size); + float[,,] sphereGradient = CaveGenerator.GenerateRadialGradient(size); cavesToCarve = randGen.Next(size / 8, size / 2); for (int i = 0; i < cavesToCarve; i++) CaveGenerator.PaintWithRandomWalk(ref caveData, ref sphereGradient, size, randGen.Next(1, 2), BlockType.None, true); @@ -123,9 +123,9 @@ public class CaveGenerator // data[x, y, z] = blockType; //} - public static void AddRocks(ref BlockType[, ,] data, int size) + public static void AddRocks(ref BlockType[,,] data, int size) { - int numRocks = randGen.Next(size, 2*size); + int numRocks = randGen.Next(size, 2 * size); CaveInfo += " numRocks=" + numRocks; for (int i = 0; i < numRocks; i++) { @@ -146,7 +146,7 @@ public static void AddRocks(ref BlockType[, ,] data, int size) } } - public static void AddLava(ref BlockType[, ,] data, int size) + public static void AddLava(ref BlockType[,,] data, int size) { int numFlows = randGen.Next(size / 16, size / 2); while (numFlows > 0) @@ -170,16 +170,16 @@ public static void AddLava(ref BlockType[, ,] data, int size) zf = 1 - Math.Abs(zf - 1); int z = (int)(zf * size); - if (data[x, y, z] == BlockType.None && z+1 < size-1) + if (data[x, y, z] == BlockType.None && z + 1 < size - 1) { data[x, y, z] = BlockType.Rock; - data[x, y, z+1] = BlockType.Lava; + data[x, y, z + 1] = BlockType.Lava; numFlows -= 1; } } } - public static void AddDiamond(ref BlockType[, ,] data, int size) + public static void AddDiamond(ref BlockType[,,] data, int size) { CaveInfo += "diamond"; @@ -202,17 +202,17 @@ public static void AddDiamond(ref BlockType[, ,] data, int size) } // Gold appears in fairly numerous streaks, located at medium depths. - public static void AddGold(ref BlockType[, ,] data, int size) + public static void AddGold(ref BlockType[,,] data, int size) { CaveInfo += "gold"; int numVeins = 16; for (int i = 0; i < numVeins; i++) { - int fieldLength = randGen.Next(size/3, size); + int fieldLength = randGen.Next(size / 3, size); float x = randGen.Next(0, size); float y = randGen.Next(0, size); - + // generate a random z-value weighted toward a medium depth float zf = 0; for (int j = 0; j < 4; j++) @@ -247,15 +247,15 @@ public static void AddGold(ref BlockType[, ,] data, int size) tz += 1; break; } - if (x + tx >= 0 && y + ty>= 0 && z+tz >= 0 && x+tx < size && y+ty < size && z+tz < size) - data[(int)x+tx, (int)y+ty, (int)z+tz] = BlockType.Gold; + if (x + tx >= 0 && y + ty >= 0 && z + tz >= 0 && x + tx < size && y + ty < size && z + tz < size) + data[(int)x + tx, (int)y + ty, (int)z + tz] = BlockType.Gold; } } } // Generates a cube of noise with sides of length size. Noise falls in a linear // distribution ranging from 0 to magnitude. - public static float[, ,] GenerateNoise(int size, float magnitude) + public static float[,,] GenerateNoise(int size, float magnitude) { float[,,] noiseArray = new float[size, size, size]; for (int x = 0; x < size; x++) @@ -282,13 +282,13 @@ public static void AddGold(ref BlockType[, ,] data, int size) } // Does a random walk of noiseData, setting cells to 0 in caveData in the process. - public static void PaintWithRandomWalk(ref BlockType[, ,] caveData, ref float[, ,] noiseData, int size, int paintRadius, BlockType paintValue, bool dontStopAtEdge) + public static void PaintWithRandomWalk(ref BlockType[,,] caveData, ref float[,,] noiseData, int size, int paintRadius, BlockType paintValue, bool dontStopAtEdge) { int x = randGen.Next(0, size); int y = randGen.Next(0, size); int z = randGen.Next(0, size); - if (z < size/50) + if (z < size / 50) z = 0; int count = 0; @@ -297,7 +297,7 @@ public static void PaintWithRandomWalk(ref BlockType[, ,] caveData, ref float[, { float oldNoise = noiseData[x, y, z]; - PaintAtPoint(ref caveData, x, y, z, size, paintRadius+1, paintValue); + PaintAtPoint(ref caveData, x, y, z, size, paintRadius + 1, paintValue); int dx = randGen.Next(0, paintRadius * 2 + 1) - paintRadius; int dy = randGen.Next(0, paintRadius * 2 + 1) - paintRadius; int dz = randGen.Next(0, paintRadius * 2 + 1) - paintRadius; @@ -330,7 +330,7 @@ public static void PaintWithRandomWalk(ref BlockType[, ,] caveData, ref float[, // If we're jumping to a higher value on the noise gradient, move twice as far. if (newNoise > oldNoise) { - PaintAtPoint(ref caveData, x, y, z, size, paintRadius+1, paintValue); + PaintAtPoint(ref caveData, x, y, z, size, paintRadius + 1, paintValue); x += dx; y += dy; z += dz; @@ -353,24 +353,24 @@ public static void PaintWithRandomWalk(ref BlockType[, ,] caveData, ref float[, if (z < 0) z = 0; - } + } } } - public static void PaintAtPoint(ref BlockType[, ,] caveData, int x, int y, int z, int size, int paintRadius, BlockType paintValue) + public static void PaintAtPoint(ref BlockType[,,] caveData, int x, int y, int z, int size, int paintRadius, BlockType paintValue) { for (int dx = -paintRadius; dx <= paintRadius; dx++) for (int dy = -paintRadius; dy <= paintRadius; dy++) for (int dz = -paintRadius; dz <= paintRadius; dz++) - if (x+dx >= 0 && y+dy>= 0 && z+dz >= 0 && x+dx < size && y+dy < size && z+dz < size) - if (dx*dx+dy*dy+dz*dz= 0 && y + dy >= 0 && z + dz >= 0 && x + dx < size && y + dy < size && z + dz < size) + if (dx * dx + dy * dy + dz * dz < paintRadius * paintRadius) caveData[x + dx, y + dy, z + dz] = paintValue; } // Generates a set of constant values. - public static BlockType[, ,] GenerateConstant(int size, BlockType value) + public static BlockType[,,] GenerateConstant(int size, BlockType value) { - BlockType[, ,] data = new BlockType[size, size, size]; + BlockType[,,] data = new BlockType[size, size, size]; for (int x = 0; x < size; x++) for (int y = 0; y < size; y++) for (int z = 0; z < size; z++) @@ -378,9 +378,9 @@ public static void PaintAtPoint(ref BlockType[, ,] caveData, int x, int y, int z return data; } - public static float[, ,] GenerateGradient(int size) + public static float[,,] GenerateGradient(int size) { - float[, ,] data = new float[size, size, size]; + float[,,] data = new float[size, size, size]; for (int x = 0; x < size; x++) for (int y = 0; y < size; y++) @@ -391,9 +391,9 @@ public static void PaintAtPoint(ref BlockType[, ,] caveData, int x, int y, int z } // Radial gradient concentrated with high values at the outside. - public static float[, ,] GenerateRadialGradient(int size) + public static float[,,] GenerateRadialGradient(int size) { - float[, ,] data = new float[size, size, size]; + float[,,] data = new float[size, size, size]; for (int x = 0; x < size; x++) for (int y = 0; y < size; y++) @@ -406,20 +406,20 @@ public static void PaintAtPoint(ref BlockType[, ,] caveData, int x, int y, int z } // Adds the values in dataSrc to the values in dataDst, storing the result in dataDst. - public static void AddDataTo(ref float[, ,] dataDst, ref float[, ,] dataSrc, int size, float scalarDst, float scalarSrc) + public static void AddDataTo(ref float[,,] dataDst, ref float[,,] dataSrc, int size, float scalarDst, float scalarSrc) { for (int x = 0; x < size; x++) for (int y = 0; y < size; y++) for (int z = 0; z < size; z++) - dataDst[x, y, z] = Math.Max(Math.Min(dataDst[x, y, z]*scalarDst + dataSrc[x, y, z]*scalarSrc, 1), 0); + dataDst[x, y, z] = Math.Max(Math.Min(dataDst[x, y, z] * scalarDst + dataSrc[x, y, z] * scalarSrc, 1), 0); } - public static void AddDataTo(ref float[, ,] dataDst, ref float[, ,] dataSrc, int size) + public static void AddDataTo(ref float[,,] dataDst, ref float[,,] dataSrc, int size) { AddDataTo(ref dataDst, ref dataSrc, size, 1, 1); } // Resizes dataIn, with size sizeIn, to be of size sizeOut. - public static float[, ,] InterpolateData(ref float[, ,] dataIn, int sizeIn, int sizeOut) + public static float[,,] InterpolateData(ref float[,,] dataIn, int sizeIn, int sizeOut) { Debug.Assert(sizeOut > sizeIn, "sizeOut must be greater than sizeIn"); Debug.Assert(sizeOut % sizeIn == 0, "sizeOut must be a multiple of sizeIn"); @@ -428,12 +428,12 @@ public static void AddDataTo(ref float[, ,] dataDst, ref float[, ,] dataSrc, int int r = sizeOut / sizeIn; - for (int x=0; x= sizeIn) xIn1 = 0; if (yIn1 >= sizeIn) @@ -454,7 +454,7 @@ public static void AddDataTo(ref float[, ,] dataDst, ref float[, ,] dataSrc, int float yS = ((float)(y % r)) / r; float zS = ((float)(z % r)) / r; - dataOut[x, y, z] = v000 * (1 - xS) * (1 - yS) * (1 - zS) + + dataOut[x, y, z] = v000 * (1 - xS) * (1 - yS) * (1 - zS) + v100 * xS * (1 - yS) * (1 - zS) + v010 * (1 - xS) * yS * (1 - zS) + v001 * (1 - xS) * (1 - yS) * zS + @@ -469,13 +469,13 @@ public static void AddDataTo(ref float[, ,] dataDst, ref float[, ,] dataSrc, int // Renders a specific z-level of a 256x256x256 data array to a texture. private static uint[] pixelData = new uint[256 * 256]; - public static void RenderSlice(ref BlockType[, ,] data, int z, Texture2D renderTexture) + public static void RenderSlice(ref BlockType[,,] data, int z, Texture2D renderTexture) { for (int x = 0; x < 256; x++) for (int y = 0; y < 256; y++) { uint c = 0xFF000000; - if (data[x,y,z] == BlockType.Dirt) + if (data[x, y, z] == BlockType.Dirt) c = 0xFFFFFFFF; if (data[x, y, z] == BlockType.Ore) c = 0xFF888888; diff --git a/source/Infiniminer/Infiniminer.Shared/HTTPRequest.cs b/source/Infiniminer/Infiniminer.Shared/HTTPRequest.cs index ac06ba5..7b751d7 100644 --- a/source/Infiniminer/Infiniminer.Shared/HTTPRequest.cs +++ b/source/Infiniminer/Infiniminer.Shared/HTTPRequest.cs @@ -45,7 +45,7 @@ public static string Post(string url, Dictionary parameters) { request.ContentLength = bytes.Length; os = request.GetRequestStream(); - os.Write (bytes, 0, bytes.Length); + os.Write(bytes, 0, bytes.Length); } catch (WebException ex) { diff --git a/source/Infiniminer/Infiniminer.Shared/Player.cs b/source/Infiniminer/Infiniminer.Shared/Player.cs index c5cf369..81740d5 100644 --- a/source/Infiniminer/Infiniminer.Shared/Player.cs +++ b/source/Infiniminer/Infiniminer.Shared/Player.cs @@ -126,7 +126,7 @@ public void StepInterpolation(double gameTime) Vector3 a = interpList[8].position, b = interpList[9].position; double ta = interpList[8].gameTime, tb = interpList[9].gameTime; Vector3 d = b - a; - double timeScale = (interpList[9].gameTime - interpList[0].gameTime)/9; + double timeScale = (interpList[9].gameTime - interpList[0].gameTime) / 9; double timeAmount = Math.Min((gameTime - ta) / timeScale, 1); Position = a + d * (float)timeAmount; } diff --git a/source/Infiniminer/Infiniminer.Shared/SpriteModel.cs b/source/Infiniminer/Infiniminer.Shared/SpriteModel.cs index e2414d6..4804b1d 100644 --- a/source/Infiniminer/Infiniminer.Shared/SpriteModel.cs +++ b/source/Infiniminer/Infiniminer.Shared/SpriteModel.cs @@ -46,7 +46,7 @@ public struct AnimationFrame public int spriteColumn; public float length; } - + public class SpriteModel { /* Animation scripts provide a light-weight way to define animations. They consist of a sequence of frames @@ -85,7 +85,7 @@ public class SpriteModel Effect effect; Game gameInstance; SpriteFont nameFont = null; - + // Constructor for SpriteModel. Loads up the texture referenced by spriteSheetPath to use for drawing. // Each individual sprite should be fit to a 24×32 box with the bottom center of the box corresponding to // the SpriteModel's origin. A sprite sheet is expected to have a column of four sprites for every frame @@ -251,7 +251,7 @@ public VertexPositionTexture[] GenerateVertices(Vector3 cameraPosition, Vector3 //} // Advance the animation counter by the time-delta in gameTime. - + public void Update(GameTime gameTime) { List currentAnimation = runningActive ? activeAnimation : passiveAnimation; diff --git a/source/Lidgren/Lidgren.Network/NetBase.SimulateLag.cs b/source/Lidgren/Lidgren.Network/NetBase.SimulateLag.cs index 49c5560..73b6023 100644 --- a/source/Lidgren/Lidgren.Network/NetBase.SimulateLag.cs +++ b/source/Lidgren/Lidgren.Network/NetBase.SimulateLag.cs @@ -138,8 +138,8 @@ private bool SimulatedSendPacket(byte[] data, int length, IPEndPoint remoteEP) private void DelayPacket(byte[] data, int length, IPEndPoint remoteEP, float delay) { #if DEBUG - if (Thread.CurrentThread != m_heartbeatThread) - throw new Exception("Threading error; should be heartbeat thread. Please check callstack!"); + if (Thread.CurrentThread != m_heartbeatThread) + throw new Exception("Threading error; should be heartbeat thread. Please check callstack!"); #endif DelayedPacket pk = new DelayedPacket(); pk.Data = new byte[length]; diff --git a/source/Lidgren/Lidgren.Network/NetBase.cs b/source/Lidgren/Lidgren.Network/NetBase.cs index 98879c8..07c6fbc 100644 --- a/source/Lidgren/Lidgren.Network/NetBase.cs +++ b/source/Lidgren/Lidgren.Network/NetBase.cs @@ -392,7 +392,7 @@ protected void BaseHeartbeat(double now) try { #if DEBUG - SendDelayedPackets(now); + SendDelayedPackets(now); #endif while (true) @@ -771,15 +771,15 @@ internal void SendPacket(byte[] data, int length, IPEndPoint remoteEP) Start(); #if DEBUG - if (!m_suppressSimulatedLag) + if (!m_suppressSimulatedLag) + { + bool send = SimulatedSendPacket(data, length, remoteEP); + if (!send) { - bool send = SimulatedSendPacket(data, length, remoteEP); - if (!send) - { - m_statistics.CountPacketSent(length); - return; - } + m_statistics.CountPacketSent(length); + return; } + } #endif try @@ -788,8 +788,8 @@ internal void SendPacket(byte[] data, int length, IPEndPoint remoteEP) int bytesSent = m_socket.SendTo(data, 0, length, SocketFlags.None, remoteEP); //LogVerbose("Sent " + bytesSent + " bytes"); #if DEBUG || USE_RELEASE_STATISTICS - if (!m_suppressSimulatedLag) - m_statistics.CountPacketSent(bytesSent); + if (!m_suppressSimulatedLag) + m_statistics.CountPacketSent(bytesSent); #endif return; } @@ -798,9 +798,9 @@ internal void SendPacket(byte[] data, int length, IPEndPoint remoteEP) if (sex.SocketErrorCode == SocketError.WouldBlock) { #if DEBUG - // send buffer overflow? - LogWrite("SocketException.WouldBlock thrown during sending; send buffer overflow? Increase buffer using NetAppConfiguration.SendBufferSize"); - throw new NetException("SocketException.WouldBlock thrown during sending; send buffer overflow? Increase buffer using NetConfiguration.SendBufferSize", sex); + // send buffer overflow? + LogWrite("SocketException.WouldBlock thrown during sending; send buffer overflow? Increase buffer using NetAppConfiguration.SendBufferSize"); + throw new NetException("SocketException.WouldBlock thrown during sending; send buffer overflow? Increase buffer using NetConfiguration.SendBufferSize", sex); #else // gulp return; @@ -922,8 +922,8 @@ protected virtual void PerformShutdown(string reason) { LogWrite("Performing shutdown (" + reason + ")"); #if DEBUG - // just send all delayed packets; since we won't have the possibility to do it after socket is closed - SendDelayedPackets(NetTime.Now + this.SimulatedMinimumLatency + this.SimulatedLatencyVariance + 1000.0); + // just send all delayed packets; since we won't have the possibility to do it after socket is closed + SendDelayedPackets(NetTime.Now + this.SimulatedMinimumLatency + this.SimulatedLatencyVariance + 1000.0); #endif lock (m_bindLock) { diff --git a/source/Lidgren/Lidgren.Network/NetConnection.Reliability.cs b/source/Lidgren/Lidgren.Network/NetConnection.Reliability.cs index f058372..cb6d590 100644 --- a/source/Lidgren/Lidgren.Network/NetConnection.Reliability.cs +++ b/source/Lidgren/Lidgren.Network/NetConnection.Reliability.cs @@ -116,8 +116,8 @@ private int Relate(int receivedSequenceNumber, int expected) internal void HandleUserMessage(IncomingNetMessage msg) { #if DEBUG - if (System.Threading.Thread.CurrentThread != m_owner.m_heartbeatThread) - throw new Exception("Threading error; should be heartbeat thread. Please check callstack!"); + if (System.Threading.Thread.CurrentThread != m_owner.m_heartbeatThread) + throw new Exception("Threading error; should be heartbeat thread. Please check callstack!"); #endif //