Some light rearranging prior to AnimQueue stuff
This commit is contained in:
0
Source/Integration/AnimQueue.cpp
Normal file
0
Source/Integration/AnimQueue.cpp
Normal file
0
Source/Integration/AnimQueue.h
Normal file
0
Source/Integration/AnimQueue.h
Normal file
9
Source/Integration/CommonTypes.h
Normal file
9
Source/Integration/CommonTypes.h
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
namespace LuprexCommonTypes {
|
||||||
|
// Array of tangible IDs.
|
||||||
|
using IdArray = TArray<int64>;
|
||||||
|
|
||||||
|
// View of Array of tangible IDs.
|
||||||
|
using IdView = TArrayView<const int64>;
|
||||||
|
}
|
||||||
@@ -38,9 +38,9 @@ int64 FLockedWrapper::GetActor() {
|
|||||||
return Lockable.Wrapper.get_actor_id(Get());
|
return Lockable.Wrapper.get_actor_id(Get());
|
||||||
}
|
}
|
||||||
|
|
||||||
FLockedWrapper::IdList FLockedWrapper::GetNear(int64 id, double rx, double ry, double rz) {
|
FLockedWrapper::IdView FLockedWrapper::GetNear(int64 id, double rx, double ry, double rz) {
|
||||||
uint32 size;
|
uint32 size;
|
||||||
int64* data;
|
int64* data;
|
||||||
Lockable.Wrapper.get_tangibles_near(Get(), id, rx, ry, rz, &size, &data);
|
Lockable.Wrapper.get_tangibles_near(Get(), id, rx, ry, rz, &size, &data);
|
||||||
return IdList(data, size);
|
return IdView(data, size);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "lpx-enginewrapper.hpp"
|
#include "lpx-enginewrapper.hpp"
|
||||||
|
#include "CommonTypes.h"
|
||||||
|
|
||||||
// Class FLockableWrapper
|
// Class FLockableWrapper
|
||||||
//
|
//
|
||||||
@@ -22,7 +23,10 @@ class FLockedWrapper {
|
|||||||
private:
|
private:
|
||||||
FLockableWrapper& Lockable;
|
FLockableWrapper& Lockable;
|
||||||
|
|
||||||
using IdList = TArrayView<const int64>;
|
public:
|
||||||
|
// Import these types into our Namespace.
|
||||||
|
using IdArray = LuprexCommonTypes::IdArray;
|
||||||
|
using IdView = LuprexCommonTypes::IdView;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// The constructor of the FLockedWrapper claims the mutex.
|
// The constructor of the FLockedWrapper claims the mutex.
|
||||||
@@ -66,8 +70,8 @@ public:
|
|||||||
// Get the list of tangibles near the actor.
|
// Get the list of tangibles near the actor.
|
||||||
//
|
//
|
||||||
// This function is fast but not free. You should fetch this
|
// This function is fast but not free. You should fetch this
|
||||||
// once per frame and then store the IdList somewhere (like
|
// once per frame and then store the IdView somewhere (like
|
||||||
// in the TangibleManager, for example).
|
// in the TangibleManager, for example).
|
||||||
//
|
//
|
||||||
IdList GetNear(int64 id, double rx, double ry, double rz);
|
IdView GetNear(int64 id, double rx, double ry, double rz);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -9,14 +9,14 @@ FTangibleManager::FTangibleManager() {
|
|||||||
World = nullptr;
|
World = nullptr;
|
||||||
ClassTangibleActor = nullptr;
|
ClassTangibleActor = nullptr;
|
||||||
Actor = 0;
|
Actor = 0;
|
||||||
Near = IdList();
|
Near = IdView();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FTangibleManager::Init(UWorld *world, UClass* tanact) {
|
void FTangibleManager::Init(UWorld *world, UClass* tanact) {
|
||||||
World = world;
|
World = world;
|
||||||
ClassTangibleActor = tanact;
|
ClassTangibleActor = tanact;
|
||||||
Actor = 0;
|
Actor = 0;
|
||||||
Near = IdList();
|
Near = IdView();
|
||||||
}
|
}
|
||||||
|
|
||||||
AActorPtr FTangibleManager::GetTangible(int64 id) {
|
AActorPtr FTangibleManager::GetTangible(int64 id) {
|
||||||
@@ -28,7 +28,6 @@ AActorPtr FTangibleManager::GetTangible(int64 id) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the tangible if it exists, otherwise create it.
|
|
||||||
AActorPtr FTangibleManager::MakeTangible(int64 id) {
|
AActorPtr FTangibleManager::MakeTangible(int64 id) {
|
||||||
AActorPtr& p = IdToActor.FindOrAdd(id);
|
AActorPtr& p = IdToActor.FindOrAdd(id);
|
||||||
if (p == nullptr) {
|
if (p == nullptr) {
|
||||||
@@ -41,7 +40,16 @@ AActorPtr FTangibleManager::MakeTangible(int64 id) {
|
|||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete the tangible.
|
|
||||||
void FTangibleManager::DeleteTangible(int64 id) {
|
void FTangibleManager::DeleteTangible(int64 id) {
|
||||||
// IMPLEMENT ME
|
// IMPLEMENT ME
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FTangibleManager::IdArray FTangibleManager::GetLive() {
|
||||||
|
IdArray result;
|
||||||
|
result.SetNum(IdToActor.Num());
|
||||||
|
int next = 0;
|
||||||
|
for (auto &pair : IdToActor) {
|
||||||
|
result[next++] = pair.Key;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
@@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "UObject/NoExportTypes.h"
|
#include "UObject/NoExportTypes.h"
|
||||||
|
#include "CommonTypes.h"
|
||||||
#include "TangibleManager.generated.h"
|
#include "TangibleManager.generated.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -14,9 +15,10 @@ struct INTEGRATION_API FTangibleManager
|
|||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
public:
|
public:
|
||||||
using IdList = TArrayView<const int64>;
|
// Import these types into our Namespace.
|
||||||
|
using IdArray = LuprexCommonTypes::IdArray;
|
||||||
|
using IdView = LuprexCommonTypes::IdView;
|
||||||
|
|
||||||
public:
|
|
||||||
// A pointer to the UWorld.
|
// A pointer to the UWorld.
|
||||||
UWorld* World;
|
UWorld* World;
|
||||||
|
|
||||||
@@ -32,7 +34,7 @@ public:
|
|||||||
int64 Actor;
|
int64 Actor;
|
||||||
|
|
||||||
// Tangibles near the actor.
|
// Tangibles near the actor.
|
||||||
IdList Near;
|
IdView Near;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FTangibleManager();
|
FTangibleManager();
|
||||||
@@ -55,9 +57,15 @@ public:
|
|||||||
int64 GetActor() const { return Actor; };
|
int64 GetActor() const { return Actor; };
|
||||||
void SetActor(int64 id) { Actor = id; }
|
void SetActor(int64 id) { Actor = id; }
|
||||||
|
|
||||||
// Get/Set the list of tangibles near the player.
|
// Get/Set the list of tangibles near the player, according to Luprex.
|
||||||
//
|
//
|
||||||
IdList GetNear() const { return Near; }
|
IdView GetNear() const { return Near; }
|
||||||
void SetNear(IdList near) { Near = near; }
|
void SetNear(IdView near) { Near = near; }
|
||||||
|
|
||||||
|
// Get the Live list.
|
||||||
|
//
|
||||||
|
// Efficiency note: this makes a copy of the array.
|
||||||
|
//
|
||||||
|
IdArray GetLive();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user