-
Notifications
You must be signed in to change notification settings - Fork 354
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ISteamMatchmakingServers.HasServerResponded() to partial class in…
…stead
- Loading branch information
Showing
1 changed file
with
28 additions
and
0 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
Facepunch.Steamworks/Interfaces/ISteamMatchmakingServers.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using Steamworks.Data; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Runtime.InteropServices; | ||
using System.Text; | ||
|
||
namespace Steamworks | ||
{ | ||
internal partial class ISteamMatchmakingServers | ||
{ | ||
/// <summary> | ||
/// Read gameserveritem_t.m_bHadSuccessfulResponse without allocating the struct on the heap | ||
/// </summary> | ||
/// <param name="hRequest"></param> | ||
/// <param name="iServer"></param> | ||
/// <returns></returns> | ||
internal bool HasServerResponded( HServerListRequest hRequest, int iServer ) | ||
{ | ||
IntPtr returnValue = _GetServerDetails( Self, hRequest, iServer ); | ||
|
||
// Return false if steam returned null | ||
if ( returnValue == IntPtr.Zero ) return false; | ||
|
||
// first 8 bytes is IPAddress, next 4 bytes is ping, next 1 byte is m_bHadSuccessfulResponse | ||
return Marshal.ReadByte( IntPtr.Add( returnValue, 12 ) ) == 1; | ||
} | ||
} | ||
} |