mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2024-10-16 23:37:02 +03:00
Add ISteamMatchmakingServers.HasServerResponded() to partial class instead
This commit is contained in:
parent
09db39d9e3
commit
a80e8590d5
28
Facepunch.Steamworks/Interfaces/ISteamMatchmakingServers.cs
Normal file
28
Facepunch.Steamworks/Interfaces/ISteamMatchmakingServers.cs
Normal file
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user