Exemplo n.º 1
0
bool ScmdServer_Impl::HandleLogin( HCLIENT hClient, ILTMessage_Read& msg )
{
	// Check if we're already controlled by an admin.
	if( m_eAdminControl != kAdminControlNone )
	{
		if( !SendStatusMessage( hClient, kScmdCommandLogin, kScmdCommandStatusAdminAlreadyLoggedIn ))
			return false;

		return true;
	}

	// Read the password they sent in.
	uint32 nHashedPassword = msg.Readuint32( );

	// Read the current password.
	uint32 nCurrentHashedPassword = str_Hash( m_sPassword.c_str( ));

	// Make sure the hashed values match.
	if( nCurrentHashedPassword != nHashedPassword )
	{
		if( !SendStatusMessage( hClient, kScmdCommandLogin, kScmdCommandStatusIncorrectPassword ))
			return false;

		return true;
	}

	// Admin is now controlled.
	m_eAdminControl = ( hClient ) ? kAdminControlClient : kAdminControlServerapp;

	// This is our admin.  It will be NULL for a standalone server.
	m_hAdminClient = hClient;

	// If the admin was just taken by a client, then tell all the clients.
	if( m_eAdminControl == kAdminControlClient )
	{
		CPlayerObj* pPlayerObj = ( CPlayerObj* )g_pLTServer->GetClientUserData( hClient );
		g_pGameServerShell->SendPlayerInfoMsgToClients( NULL, pPlayerObj, MID_PI_UPDATE );
	}

	// Tell the client it worked.
	if( !SendStatusMessage( hClient, kScmdCommandLogin, kScmdCommandStatusOk ))
		return false;

	return true;
}
Exemplo n.º 2
0
bool CPhysicsCollisionSystemFX::Update( )
{
	if( !CSpecialFX::Update( ))
		return false;

	ILTMessage_Read *pMsg = m_cInitMsg->Clone( );

	// Read the message to see if all dependent objects are available...
	uint32 nNumObjects = pMsg->Readuint32( );

	for( uint32 nObject = 0; nObject < nNumObjects; ++nObject )
	{
		// If any of the objects are invalid we can't create the system.
		// Try again next update...
		if( pMsg->ReadObject( ) == INVALID_HOBJECT )
			return true;
	}

	CreatePhysicsCollisionSystem( );
	
	// After the collision system has been setup this object is no longer needed...
	return false;
}