mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2025-01-24 04:28:00 +03:00
Warn if trying to init steam client AFTER steam server
This commit is contained in:
parent
d60ebf5fdd
commit
1ccea72a13
@ -29,11 +29,11 @@ namespace Facepunch.Steamworks.Interop
|
|||||||
|
|
||||||
private bool isServer;
|
private bool isServer;
|
||||||
|
|
||||||
private HSteamUser hUser;
|
|
||||||
private HSteamPipe hPipe;
|
|
||||||
|
|
||||||
internal bool InitClient( BaseSteamworks steamworks )
|
internal bool InitClient( BaseSteamworks steamworks )
|
||||||
{
|
{
|
||||||
|
if ( Steamworks.Server.Instance != null )
|
||||||
|
throw new System.Exception("Steam client should be initialized before steam server - or there's big trouble.");
|
||||||
|
|
||||||
isServer = false;
|
isServer = false;
|
||||||
|
|
||||||
api = new SteamNative.SteamApi();
|
api = new SteamNative.SteamApi();
|
||||||
@ -44,8 +44,8 @@ namespace Facepunch.Steamworks.Interop
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
hUser = api.SteamAPI_GetHSteamUser();
|
var hUser = api.SteamAPI_GetHSteamUser();
|
||||||
hPipe = api.SteamAPI_GetHSteamPipe();
|
var hPipe = api.SteamAPI_GetHSteamPipe();
|
||||||
if ( hPipe == 0 )
|
if ( hPipe == 0 )
|
||||||
{
|
{
|
||||||
Console.Error.WriteLine( "InitClient: hPipe == 0" );
|
Console.Error.WriteLine( "InitClient: hPipe == 0" );
|
||||||
@ -83,8 +83,8 @@ namespace Facepunch.Steamworks.Interop
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
hUser = api.SteamGameServer_GetHSteamUser();
|
var hUser = api.SteamGameServer_GetHSteamUser();
|
||||||
hPipe = api.SteamGameServer_GetHSteamPipe();
|
var hPipe = api.SteamGameServer_GetHSteamPipe();
|
||||||
if ( hPipe == 0 )
|
if ( hPipe == 0 )
|
||||||
{
|
{
|
||||||
Console.Error.WriteLine( "InitServer: hPipe == 0" );
|
Console.Error.WriteLine( "InitServer: hPipe == 0" );
|
||||||
@ -216,6 +216,12 @@ namespace Facepunch.Steamworks.Interop
|
|||||||
remoteStorage = null;
|
remoteStorage = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( matchmaking != null )
|
||||||
|
{
|
||||||
|
matchmaking.Dispose();
|
||||||
|
matchmaking = null;
|
||||||
|
}
|
||||||
|
|
||||||
if ( applist != null )
|
if ( applist != null )
|
||||||
{
|
{
|
||||||
applist.Dispose();
|
applist.Dispose();
|
||||||
@ -242,9 +248,6 @@ namespace Facepunch.Steamworks.Interop
|
|||||||
// pointers we stored are not invalid.
|
// pointers we stored are not invalid.
|
||||||
//
|
//
|
||||||
|
|
||||||
hPipe = 0;
|
|
||||||
hUser = 0;
|
|
||||||
|
|
||||||
api.Dispose();
|
api.Dispose();
|
||||||
api = null;
|
api = null;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user