Minor cleanups here and there.

This commit is contained in:
UnknownShadow200 2015-01-22 08:47:58 +11:00
parent 1ae63a0fee
commit 359060889f
5 changed files with 14 additions and 18 deletions

View File

@ -97,7 +97,6 @@ namespace ClassicalSharp {
textInput.Dispose(); textInput.Dispose();
status.Dispose(); status.Dispose();
bottomRight.Dispose(); bottomRight.Dispose();
status.Dispose();
GraphicsApi.DeleteTexture( ref pageTexture ); GraphicsApi.DeleteTexture( ref pageTexture );
GraphicsApi.DeleteTexture( ref announcementTexture ); GraphicsApi.DeleteTexture( ref announcementTexture );
Window.ChatReceived -= ChatReceived; Window.ChatReceived -= ChatReceived;

View File

@ -86,6 +86,7 @@ namespace ClassicalSharp {
GraphicsApi.DeleteTexture( ref info[i].Texture ); GraphicsApi.DeleteTexture( ref info[i].Texture );
} }
Window.CpeListInfoAdded -= PlayerListInfoAdded; Window.CpeListInfoAdded -= PlayerListInfoAdded;
Window.CpeListInfoChanged -= PlayerListInfoChanged;
Window.CpeListInfoRemoved -= PlayerListInfoRemoved; Window.CpeListInfoRemoved -= PlayerListInfoRemoved;
} }

View File

@ -43,6 +43,14 @@ namespace ClassicalSharp {
B = c.B; 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() { public Color ToColor() {
return Color.FromArgb( A, R, G, B ); return Color.FromArgb( A, R, G, B );
} }

View File

@ -91,9 +91,7 @@ namespace Launcher {
} }
static void HtmlDecode( string value, StringBuilder output ) { static void HtmlDecode( string value, StringBuilder output ) {
int length = value.Length; for( int i = 0; i < value.Length; i++ ) {
for( int i = 0; i < length; i++ ) {
char token = value[i]; char token = value[i];
if( token != '&' ) { if( token != '&' ) {
output.Append( token ); output.Append( token );
@ -122,7 +120,6 @@ namespace Launcher {
i = entityEnd; i = entityEnd;
char decodedEntity; char decodedEntity;
if( Lookup( entity, out decodedEntity ) ) { if( Lookup( entity, out decodedEntity ) ) {
token = decodedEntity;
output.Append( decodedEntity ); output.Append( decodedEntity );
} else { // Invalid token. } else { // Invalid token.
output.Append( '&' ); output.Append( '&' );

15
Map.cs
View File

@ -1,5 +1,4 @@
using System; using System;
using EnvDefault = ClassicalSharp.Renderers.EnvRenderer;
namespace ClassicalSharp { namespace ClassicalSharp {
@ -134,17 +133,9 @@ namespace ClassicalSharp {
} }
void AdjustLight( FastColour normal, ref FastColour xSide, ref FastColour zSide, ref FastColour yBottom ) { void AdjustLight( FastColour normal, ref FastColour xSide, ref FastColour zSide, ref FastColour yBottom ) {
xSide = Scale( normal, 0.6f ); xSide = FastColour.Scale( normal, 0.6f );
zSide = Scale( normal, 0.8f ); zSide = FastColour.Scale( normal, 0.8f );
yBottom = Scale( normal, 0.5f ); yBottom = FastColour.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;
} }
public void UseRawMap( byte[] map, int width, int height, int length ) { public void UseRawMap( byte[] map, int width, int height, int length ) {