Download this source code in text format (Utility.cpp)
***********************************************************
* WindowMud - Window Mud Server *
* File: Utility.cpp *
* Usage: General purpose utility stuff *
* *
* No warranty is given or implied. *
* There is no license associated with this code. *
* There are no restrictions on the use of this code. *
* This code may be used in any way the reader wishes. *
* No credit or credits are given and none are required. *
* The reader may take this code and claim they wrote it. *
************************************************************/
/***********************************************************
* Includes *
************************************************************/
#include "stdafx.h" // precompiled headers
#include "Utility.h"
// Server
#include "Log.h"
/***********************************************************
* Globals *
************************************************************/
extern CString ErrorMsg;
extern int ListenSocket;
extern bool WinSockCleanUp;
////////////////////////////////////////////////////////////
// Public functions static //
////////////////////////////////////////////////////////////
/***********************************************************
* BlowUp - Fatal error - Crash and burn - Shut 'er down *
***********************************************************/
void Utility::BlowUp()
{
Log::LogIt(ErrorMsg);
AfxMessageBox(ErrorMsg, MB_ICONSTOP);
if (WinSockCleanUp)
{ // If WSAStartup has been called, then we must call WSACleanup (pg 328)
::closesocket(ListenSocket); // Try to clean up open socket
WSACleanup(); // Tell WinSock it's not needed anymore
WinSockCleanUp = false; // Not really needed because of _endthread()
}
_endthread();
}