diff --git a/2D/Screens/ChatScreen.cs b/2D/Screens/ChatScreen.cs index ea3e1caa1..1b532ef3f 100644 --- a/2D/Screens/ChatScreen.cs +++ b/2D/Screens/ChatScreen.cs @@ -97,7 +97,6 @@ namespace ClassicalSharp { textInput.Dispose(); status.Dispose(); bottomRight.Dispose(); - status.Dispose(); GraphicsApi.DeleteTexture( ref pageTexture ); GraphicsApi.DeleteTexture( ref announcementTexture ); Window.ChatReceived -= ChatReceived; diff --git a/2D/Widgets/ExtPlayerListWidget.cs b/2D/Widgets/ExtPlayerListWidget.cs index 57f03493d..e991429cb 100644 --- a/2D/Widgets/ExtPlayerListWidget.cs +++ b/2D/Widgets/ExtPlayerListWidget.cs @@ -86,6 +86,7 @@ namespace ClassicalSharp { GraphicsApi.DeleteTexture( ref info[i].Texture ); } Window.CpeListInfoAdded -= PlayerListInfoAdded; + Window.CpeListInfoChanged -= PlayerListInfoChanged; Window.CpeListInfoRemoved -= PlayerListInfoRemoved; } diff --git a/FastColour.cs b/FastColour.cs index 6dd2f542c..a0812f370 100644 --- a/FastColour.cs +++ b/FastColour.cs @@ -42,6 +42,14 @@ namespace ClassicalSharp { G = c.G; B = c.B; } + + public static FastColour Scale( FastColour value, float t ) { + FastColour result = value; + result.R = (byte)( value.R * t ); + result.G = (byte)( value.G * t ); + result.B = (byte)( value.B * t ); + return result; + } public Color ToColor() { return Color.FromArgb( A, R, G, B ); diff --git a/Launcher/WebUtility.cs b/Launcher/WebUtility.cs index 5ee1f7780..5f0d82333 100644 --- a/Launcher/WebUtility.cs +++ b/Launcher/WebUtility.cs @@ -91,9 +91,7 @@ namespace Launcher { } static void HtmlDecode( string value, StringBuilder output ) { - int length = value.Length; - - for( int i = 0; i < length; i++ ) { + for( int i = 0; i < value.Length; i++ ) { char token = value[i]; if( token != '&' ) { output.Append( token ); @@ -122,7 +120,6 @@ namespace Launcher { i = entityEnd; char decodedEntity; if( Lookup( entity, out decodedEntity ) ) { - token = decodedEntity; output.Append( decodedEntity ); } else { // Invalid token. output.Append( '&' ); diff --git a/Map.cs b/Map.cs index d61a3e92d..dfd7cebc4 100644 --- a/Map.cs +++ b/Map.cs @@ -1,5 +1,4 @@ -using System; -using EnvDefault = ClassicalSharp.Renderers.EnvRenderer; +using System; namespace ClassicalSharp { @@ -134,17 +133,9 @@ namespace ClassicalSharp { } void AdjustLight( FastColour normal, ref FastColour xSide, ref FastColour zSide, ref FastColour yBottom ) { - xSide = Scale( normal, 0.6f ); - zSide = Scale( normal, 0.8f ); - yBottom = Scale( normal, 0.5f ); - } - - static FastColour Scale( FastColour value, float t ) { - FastColour result = value; - result.R = (byte)( value.R * t ); - result.G = (byte)( value.G * t ); - result.B = (byte)( value.B * t ); - return result; + xSide = FastColour.Scale( normal, 0.6f ); + zSide = FastColour.Scale( normal, 0.8f ); + yBottom = FastColour.Scale( normal, 0.5f ); } public void UseRawMap( byte[] map, int width, int height, int length ) {