Thanks Arya alot Great additions. I will test out the crashing soon. And also I see that you added SolidHueOverride better than me, I forgot about the base CreatePeice method. Nice
As a note *yes I am that maticulous*
Would make no difference since the character and everyone on it and their backpack would be the hue of the SolidHueOverride property
That statement in the OnPlayerDisconnected method, will still result in a crash if m_Black or m_White are null because you didn't check that first. I think that was the underlying reason for a crash.
So the code for OnPlayerDisconnected, would in turn have to look like -
Also there is no reason (as you can see from the change) to have multiple if statements when you can use an &&. You would be redirecting code twice, when in a single if statement, there is short curcuit, so that the NetState would never be checked if the initial object was null. Optimization is all
As a note *yes I am that maticulous*
Code:
if ( m_Chessboard.OverrideMinorHue )
m_Piece.Hue = Hue;
else
m_Piece.Hue = m_Chessboard.SkinHue;
Would make no difference since the character and everyone on it and their backpack would be the hue of the SolidHueOverride property
Code:
if ( e.Mobile != m_Black && e.Mobile != m_White )
That statement in the OnPlayerDisconnected method, will still result in a crash if m_Black or m_White are null because you didn't check that first. I think that was the underlying reason for a crash.
So the code for OnPlayerDisconnected, would in turn have to look like -
Code:
private void OnPlayerDisconnected(DisconnectedEventArgs e)
{
if ( (m_Black != null && e.Mobile != m_Black) && (m_White != null && e.Mobile != m_White) )
return;
if ( m_Status == GameStatus.Setup )
{
Cleanup(); // No game to loose, just end.
return;
}
if ( m_Status == GameStatus.Over )
{
// If game is over, logging out = confirming game over through the gump
NotifyGameOver( e.Mobile );
return;
}
// Game in progress
m_Pending = true;
if ( m_Black != null && m_Black.NetState != null )
{
m_Black.CloseGump( typeof( GameGump ) );
m_Black.SendGump( new EndGameGump( m_Black, this, false,
"Your partner has been disconnected", ChessConfig.DisconnectTimeOut.Minutes ) );
}
if ( m_White != null && m_White.NetState != null )
{
m_White.CloseGump( typeof( GameGump ) );
m_White.SendGump( new EndGameGump( m_White, this, false,
"Your partner has been disconnected", ChessConfig.DisconnectTimeOut.Minutes ) );
}
if ( m_Timer != null )
m_Timer.OnPlayerDisconnected();
}
Also there is no reason (as you can see from the change) to have multiple if statements when you can use an &&. You would be redirecting code twice, when in a single if statement, there is short curcuit, so that the NetState would never be checked if the initial object was null. Optimization is all