Files
Project-Reboot-3.0/Project Reboot 3.0/WeakObjectPtr.h
Gray b3d9ab9e8b Dude 💀
2024-03-20 21:45:38 -04:00

33 lines
806 B
C++

#pragma once
#include "UObjectArray.h"
struct FWeakObjectPtr
{
public:
int ObjectIndex;
int ObjectSerialNumber;
UObject* Get()
{
return ChunkedObjects ? ChunkedObjects->GetObjectByIndex(ObjectIndex) : UnchunkedObjects ? UnchunkedObjects->GetObjectByIndex(ObjectIndex) : nullptr;
}
FORCEINLINE bool operator==(const FWeakObjectPtr& Other) const
{
return
(ObjectIndex == Other.ObjectIndex && ObjectSerialNumber == Other.ObjectSerialNumber)
// || (!IsValid() && !Other.IsValid())
;
}
friend uint32 GetTypeHash(const FWeakObjectPtr& WeakObjectPtr)
{
return uint32(WeakObjectPtr.ObjectIndex ^ WeakObjectPtr.ObjectSerialNumber);
}
bool operator==(const FWeakObjectPtr& other)
{
return ObjectIndex == other.ObjectIndex && ObjectSerialNumber == other.ObjectSerialNumber;
}
};