Beispiel #1
0
void ChatPanelMenu::OnUserMenuJoinSame( wxCommandEvent& /*unused*/ )
{
	const User* user = m_chatpanel->GetSelectedUser();
	if ( user == 0 ) return;
	Battle* battle = user->GetBattle();
	if ( battle == 0 ) return;

	if ( !usync().ModExists( battle->GetHostModName() ) ) {
		customMessageBoxNoModal( SL_MAIN_ICON, _( "You don't have the mod " ) + battle->GetHostModName()
														 + _( " . Please download it first" ), _( "Mod unavailable" ) );
		return;
	}

	if ( battle->IsLocked() ) {
		customMessageBoxNoModal( SL_MAIN_ICON, _( "The battle you requested to join is locked." ) );
		return;
	}
	wxString password;
	if ( battle->IsPassworded() ) {
		if ( !ui().AskPassword( _( "Battle password" ), _( "This battle is password protected, enter the password." ), password ) ) return;
	}
	battle->Join( password );
}