i broke the whole project but its fine

complete pickup rewrite, idle pawns
This commit is contained in:
Milxnor
2023-05-07 17:34:24 -04:00
parent 5e92f2e90b
commit 3405177d20
51 changed files with 1439 additions and 338 deletions

View File

@@ -240,6 +240,14 @@ inline std::vector<T*> GetAllObjectsOfClass(UClass* Class)
return Objects;
}
template<typename T = UObject>
inline T* GetRandomObjectOfClass(UClass* Class)
{
auto AllObjectsVec = GetAllObjectsOfClass<T>(Class);
return AllObjectsVec.size() > 0 ? AllObjectsVec.at(std::rand() % AllObjectsVec.size()) : nullptr;
}
inline void* FindPropertyStruct(const std::string& StructName, const std::string& MemberName, bool bWarnIfNotFound = true)
{
UObject* Struct = FindObject(StructName);
@@ -377,9 +385,9 @@ static void CopyStruct(void* Dest, void* Src, size_t Size, UStruct* Struct = nul
}
template <typename T = __int64>
static T* Alloc(size_t Size = sizeof(T), bool bUseRealloc = false)
static T* Alloc(size_t Size = sizeof(T), bool bUseFMemoryRealloc = false)
{
return bUseRealloc ? (T*)FMemory::Realloc(0, Size, 0) : (T*)VirtualAlloc(0, Size, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE);
return bUseFMemoryRealloc ? (T*)FMemory::Realloc(0, Size, 0) : (T*)VirtualAlloc(0, Size, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE);
}
namespace MemberOffsets