void QuickQuitCommand(char * szParams) { CNetworkManager * pNetworkManager = g_pClient->GetNetworkManager(); if(pNetworkManager) pNetworkManager->Disconnect(); TerminateProcess(GetCurrentProcess(), 0); }
void QuitCommand(char * szParams) { // If we are connected to a server, disconnect CNetworkManager * pNetworkManager = g_pClient->GetNetworkManager(); if(pNetworkManager && pNetworkManager->IsConnected()) pNetworkManager->Disconnect(); // Delete the network manager interface SAFE_DELETE(pNetworkManager); // Exit TerminateProcess(GetCurrentProcess(), 0); }
bool CSettingsMenu::OnSaveButtonClick(const CEGUI::EventArgs &eventArgs) { bool bWindowed = ((CEGUI::Checkbox *)m_GUIElements.pWindowedCheckBox)->isSelected(); bool bShowFPS = ((CEGUI::Checkbox *)m_GUIElements.pFPSCheckBox)->isSelected(); String strNick(m_GUIElements.pNickEditBox->getText().c_str()); String strFont(m_GUIElements.pChatFontEditBox->getText().c_str()); String strFontSize(m_GUIElements.pChatFontSizeEditBox->getText().c_str()); String strBackgroundAlpha(m_GUIElements.pChatBGColorAEditBox->getText().c_str()); String strBackgroundRed(m_GUIElements.pChatBGColorREditBox->getText().c_str()); String strBackgroundGreen(m_GUIElements.pChatBGColorGEditBox->getText().c_str()); String strBackgroundBlue(m_GUIElements.pChatBGColorBEditBox->getText().c_str()); CVAR_SET_BOOL("windowed", bWindowed); CVAR_SET_BOOL("fps", g_pClient->GetFPSToggle()); g_pClient->SetFPSToggle(bShowFPS); CVAR_SET_INTEGER("chatfont", strFont.ToInteger()); CVAR_SET_INTEGER("chatsize", strFontSize.ToInteger()); CVAR_SET_INTEGER("chatbga", strBackgroundAlpha.ToInteger()); CVAR_SET_INTEGER("chatbgr", strBackgroundRed.ToInteger()); CVAR_SET_INTEGER("chatbgg", strBackgroundGreen.ToInteger()); CVAR_SET_INTEGER("chatbgb", strBackgroundBlue.ToInteger()); // Init the chat window font and background g_pClient->GetChatWindow()->InitFontAndBackground(); if(CVAR_GET_STRING("nick").Compare(strNick) != 0) { CVAR_SET_STRING("nick", strNick); g_pClient->SetNick(strNick); CNetworkManager * pNetworkManager = g_pClient->GetNetworkManager(); if(pNetworkManager && pNetworkManager->IsConnected()) { CBitStream bsSend; bsSend.Write(strNick); pNetworkManager->RPC(RPC_NameChange, &bsSend, PRIORITY_HIGH, RELIABILITY_RELIABLE_ORDERED); } } if(bWindowed != g_pClient->IsWindowedMode()) g_pClient->GetGUI()->ShowMessageBox("You must restart IV:MP for the windowed mode option to take effect", "Information."); SetVisible(false); return true; }