Exemplo n.º 1
0
void Battle::OnUserBattleStatusUpdated( User &user, UserBattleStatus status )
{
    if ( IsFounderMe() )
    {
			if ( ( &user != &GetMe() ) && !status.IsBot() && ( m_opts.rankneeded != UserStatus::RANK_1 ) && !status.spectator )
			{
				if ( m_opts.rankneeded > UserStatus::RANK_1 && user.GetStatus().rank < m_opts.rankneeded )
				{
					DoAction( _T("Rank limit autospec: ") + user.GetNick() );
					ForceSpectator( user, true );
				}
				else if ( m_opts.rankneeded < UserStatus::RANK_1 && user.GetStatus().rank > ( -m_opts.rankneeded - 1 ) )
				{
					DoAction( _T("Rank limit autospec: ") + user.GetNick() );
					ForceSpectator( user, true );
				}
			}
			UserBattleStatus previousstatus = user.BattleStatus();
			if ( m_opts.lockexternalbalancechanges )
			{
				if ( previousstatus.team != status.team )
				{
					 ForceTeam( user, previousstatus.team );
					 status.team = previousstatus.team;
				}
				if ( previousstatus.ally != status.ally )
				{
					ForceAlly( user, previousstatus.ally );
					status.ally = previousstatus.ally;
				}
			}
    }
		IBattle::OnUserBattleStatusUpdated( user, status );
    if ( status.handicap != 0 )
    {
		UiEvents::GetUiEventSender( UiEvents::OnBattleActionEvent ).SendEvent(
				UiEvents::OnBattleActionData( wxString(_T(" ")) , ( _T("Warning: user ") + user.GetNick() + _T(" got bonus ") ) << status.handicap )
			);
    }
		if ( IsFounderMe() )
		{
			if ( ShouldAutoStart() )
			{
				if ( sett().GetBattleLastAutoStartState() )
				{
					if ( !spring().IsRunning() ) StartHostedBattle();
				}
			}
		}
	if ( !GetMe().BattleStatus().spectator ) SetAutoUnspec(false); // we don't need auto unspec anymore
	ShouldAutoUnspec();
#ifndef SL_QT_MODE
	ui().OnUserBattleStatus( *this, user );
#endif
}
Exemplo n.º 2
0
void Battle::OnUserRemoved( User& user )
{
    m_ah.OnUserRemoved(user);
    IBattle::OnUserRemoved( user );
	ShouldAutoUnspec();
}
Exemplo n.º 3
0
void Battle::SetAutoUnspec(bool value)
{
	m_auto_unspec = value;
	m_auto_unspec_num_players = GetNumActivePlayers();
	ShouldAutoUnspec();
}
Exemplo n.º 4
0
void Battle::SetAutoUnspec(bool value)
{
	m_auto_unspec = value;
	ShouldAutoUnspec();
}