// Project Lab - NHTV Igad

#include "UnrealProject.h"
#include "MatchMaking.h"
#include "Online.h"

/*
const uint8* FUniqueNetIdMatchMaking::GetBytes() const
{
	return (uint8*)&UniqueNetId;
}
int32 FUniqueNetIdMatchMaking::GetSize() const
{
	return sizeof(uint64);
}

#if PLATFORM_SPECIFIC_WIN == 0
#pragma warning(push)
#pragma warning(disable:4996)
#include "steam/steam_api.h"
bool FUniqueNetIdMatchMaking::IsValid() const
{
	return UniqueNetId != 0 && CSteamID(UniqueNetId).IsValid();
}
#pragma warning(pop)
#else
bool FUniqueNetIdMatchMaking::IsValid() const
{
	return UniqueNetId != 0;
}
#endif

FString FUniqueNetIdMatchMaking::ToString() const
{
	return FString::Printf(TEXT("%llu"), UniqueNetId);
}
FString FUniqueNetIdMatchMaking::ToDebugString() const
{
	return ToString();
}


inline uint64 GetNetId(FNamedOnlineSession* session)
{
	FOnlineSessionInfoMatchMaking* SessionInfo = (FOnlineSessionInfoMatchMaking*)(session->SessionInfo.Get());
	FInternetAddrMatchMaking* addr = (FInternetAddrMatchMaking*)SessionInfo->P2PAddr.Get();
	return addr->NetId.UniqueNetId;
}
inline uint32 GetChannelId(FNamedOnlineSession* session)
{
	FOnlineSessionInfoMatchMaking* SessionInfo = (FOnlineSessionInfoMatchMaking*)(session->SessionInfo.Get());
	FInternetAddrMatchMaking* addr = (FInternetAddrMatchMaking*)SessionInfo->P2PAddr.Get();
	return addr->ChannelId;
}

MatchMaking::MatchMaking(FNamedOnlineSession* session) : IMatchMakingInterface(GetNetId(session), GetChannelId(session))
{
	
}

MatchMaking::~MatchMaking()
{
}


void MatchMaking::OnConnect()
{
	JPRINT("Connected to matchmaking server");
}
void MatchMaking::OnDisconnect()
{
	JERROR("Disconnected from matchmaking server");
}
void MatchMaking::OnForceJoinSession(NetID netID, ChannelID channelID)
{

}
*/