2015-12-28 20:52:31 -05:00
# include "..\..\STDInclude.hpp"
2015-12-27 14:05:43 -05:00
namespace Components
{
bool Singleton : : FirstInstance = true ;
bool Singleton : : IsFirstInstance ( )
{
return Singleton : : FirstInstance ;
}
Singleton : : Singleton ( )
{
if ( Dedicated : : IsDedicated ( ) ) return ;
2015-12-27 14:16:01 -05:00
Singleton : : FirstInstance = ( CreateMutex ( NULL , FALSE , " iw4x_mutex " ) & & GetLastError ( ) ! = ERROR_ALREADY_EXISTS ) ;
2016-01-04 07:05:42 -05:00
if ( ! Singleton : : FirstInstance & & ! ConnectProtocol : : Used ( ) & & MessageBoxA ( 0 , " Do you want to start another instance? " , " Game already running " , MB_ICONEXCLAMATION | MB_YESNO ) = = IDNO )
2015-12-27 14:05:43 -05:00
{
2016-01-04 07:05:42 -05:00
ExitProcess ( 0 ) ;
2015-12-27 14:05:43 -05:00
}
}
}