Merge pull request #7 from NuLL3rr0r/master

Fix template unqualified lookup build errors on clang.
This commit is contained in:
segross 2018-03-13 22:59:51 +00:00 committed by GitHub
commit f3a5e8e6b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 13 deletions

View File

@ -10,6 +10,9 @@
namespace Utilities namespace Utilities
{ {
template<typename T>
FORCEINLINE const FWorldContext* GetWorldContext(const T* Obj);
FORCEINLINE const FWorldContext* GetWorldContext(const UGameInstance& GameInstance) FORCEINLINE const FWorldContext* GetWorldContext(const UGameInstance& GameInstance)
{ {
return GameInstance.GetWorldContext(); return GameInstance.GetWorldContext();
@ -21,12 +24,6 @@ namespace Utilities
return Obj.IsValid() ? GetWorldContext(*Obj.Get()) : nullptr; return Obj.IsValid() ? GetWorldContext(*Obj.Get()) : nullptr;
} }
template<typename T>
FORCEINLINE const FWorldContext* GetWorldContext(const T* Obj)
{
return Obj ? GetWorldContext(*Obj) : nullptr;
}
FORCEINLINE const FWorldContext* GetWorldContext(const UGameViewportClient& GameViewportClient) FORCEINLINE const FWorldContext* GetWorldContext(const UGameViewportClient& GameViewportClient)
{ {
return GetWorldContext(GameViewportClient.GetGameInstance()); return GetWorldContext(GameViewportClient.GetGameInstance());
@ -37,5 +34,11 @@ namespace Utilities
return GetWorldContext(World.GetGameInstance()); return GetWorldContext(World.GetGameInstance());
} }
template<typename T>
FORCEINLINE const FWorldContext* GetWorldContext(const T* Obj)
{
return Obj ? GetWorldContext(*Obj) : nullptr;
}
const FWorldContext* GetWorldContextFromNetMode(ENetMode NetMode); const FWorldContext* GetWorldContextFromNetMode(ENetMode NetMode);
} }

View File

@ -22,13 +22,6 @@ namespace Utilities
// Editor context index. // Editor context index.
static constexpr int32 EDITOR_CONTEXT_INDEX = 0; static constexpr int32 EDITOR_CONTEXT_INDEX = 0;
template<typename T>
FORCEINLINE int32 GetWorldContextIndex(const T& Obj)
{
const FWorldContext* WorldContext = GetWorldContext(Obj);
return WorldContext ? GetWorldContextIndex(*WorldContext) : INVALID_CONTEXT_INDEX;
}
FORCEINLINE int32 GetWorldContextIndex(const FWorldContext& WorldContext) FORCEINLINE int32 GetWorldContextIndex(const FWorldContext& WorldContext)
{ {
// In standalone game (WorldType = Game) we have only one context with index 0 (see GAME_CONTEXT_INDEX). // In standalone game (WorldType = Game) we have only one context with index 0 (see GAME_CONTEXT_INDEX).
@ -51,6 +44,13 @@ namespace Utilities
} }
} }
template<typename T>
FORCEINLINE int32 GetWorldContextIndex(const T& Obj)
{
const FWorldContext* WorldContext = GetWorldContext(Obj);
return WorldContext ? GetWorldContextIndex(*WorldContext) : INVALID_CONTEXT_INDEX;
}
int32 GetWorldContextIndex(const UWorld& World) int32 GetWorldContextIndex(const UWorld& World)
{ {
return (World.WorldType == EWorldType::Editor) ? EDITOR_CONTEXT_INDEX : GetWorldContextIndex(World.GetGameInstance()); return (World.WorldType == EWorldType::Editor) ? EDITOR_CONTEXT_INDEX : GetWorldContextIndex(World.GetGameInstance());