Switched to epics new hashing setup for unique ids

Also added new function GetLocalSteamIDFromSteam.


Former-commit-id: 7a15f500cd86064444cedb47433417b7bb9298e4
This commit is contained in:
mordentral
2018-11-14 14:08:45 -05:00
parent ce7d8b1bf3
commit ad745512ac
2 changed files with 21 additions and 1 deletions

View File

@@ -197,7 +197,8 @@ public:
/** Needed for TMap::GetTypeHash() */
friend uint32 GetTypeHash(const FUniqueNetIdSteam2& A)
{
return (uint32)(A.UniqueNetId) + ((uint32)((A.UniqueNetId) >> 32) * 23);
return GetTypeHash(A.UniqueNetId);
//return (uint32)(A.UniqueNetId) + ((uint32)((A.UniqueNetId) >> 32) * 23);
}
/** Convenience cast to CSteamID */
@@ -296,6 +297,10 @@ public:
UFUNCTION(BlueprintPure, Category = "Online|AdvancedFriends|SteamAPI")
static FBPUniqueNetId CreateSteamIDFromString(const FString SteamID64);
// Retreives the local steam ID from steam
UFUNCTION(BlueprintPure, Category = "Online|AdvancedFriends|SteamAPI")
static FBPUniqueNetId GetLocalSteamIDFromSteam();
/* Gets the current game played by a friend - AppID is int32 even though steam ids are uint32, can't be helped in blueprint currently
* can use the AppID with the WebAPI GetAppList request.
*/

View File

@@ -196,6 +196,21 @@ FBPUniqueNetId UAdvancedSteamFriendsLibrary::CreateSteamIDFromString(const FStri
return netId;
}
FBPUniqueNetId UAdvancedSteamFriendsLibrary::GetLocalSteamIDFromSteam()
{
FBPUniqueNetId netId;
#if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX
if (SteamAPI_Init())
{
FUniqueNetIdSteam2 SteamID(SteamUser()->GetSteamID());
netId.SetUniqueNetId(&SteamID);
}
#endif
return netId;
}
bool UAdvancedSteamFriendsLibrary::RequestSteamFriendInfo(const FBPUniqueNetId UniqueNetId, bool bRequireNameOnly)
{
#if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX