From ac132862deabbaff188b3835b6a2bd49e0cb87f4 Mon Sep 17 00:00:00 2001 From: jyelon Date: Sat, 2 Sep 2023 01:33:11 -0400 Subject: [PATCH] TangibleManager is a stub now --- Integration.uproject | 3 +- .../Integration/IntegrationGameModeBase.cpp | 9 ++-- Source/Integration/IntegrationGameModeBase.h | 5 ++- Source/Integration/TangibleManager.cpp | 39 +++++++++++++++++ Source/Integration/TangibleManager.h | 42 +++++++++++++++++++ Source/Integration/engineutil.cpp | 8 ---- Source/Integration/engineutil.hpp | 1 - 7 files changed, 90 insertions(+), 17 deletions(-) create mode 100644 Source/Integration/TangibleManager.cpp create mode 100644 Source/Integration/TangibleManager.h diff --git a/Integration.uproject b/Integration.uproject index 0a854e5b..26802a9c 100644 --- a/Integration.uproject +++ b/Integration.uproject @@ -9,7 +9,8 @@ "Type": "Runtime", "LoadingPhase": "Default", "AdditionalDependencies": [ - "Engine" + "Engine", + "CoreUObject" ] } ], diff --git a/Source/Integration/IntegrationGameModeBase.cpp b/Source/Integration/IntegrationGameModeBase.cpp index 60761a03..e3d1fbfc 100644 --- a/Source/Integration/IntegrationGameModeBase.cpp +++ b/Source/Integration/IntegrationGameModeBase.cpp @@ -3,10 +3,10 @@ #include "IntegrationGameModeBase.h" #include "drvutil.hpp" #include "engineutil.hpp" +#include "TangibleManager.h" #include #include - AIntegrationGameModeBase::AIntegrationGameModeBase() { Thread = nullptr; @@ -192,10 +192,9 @@ void AIntegrationGameModeBase::BeginPlay() Thread = FRunnableThread::Create(this, TEXT("Worker Thread")); } - // Create a tangible. - UWorld* w = GetWorld(); - AActor* aa = engineutil::CreateTangible(w, ClassTangibleActor); - Tangibles.Add(aa); + //// Create a tangible. + //TangibleManager.Init(GetWorld(), ClassTangibleActor); + //TangibleManager.MakeTangible(123); } void AIntegrationGameModeBase::EndPlay(const EEndPlayReason::Type EndPlayReason) diff --git a/Source/Integration/IntegrationGameModeBase.h b/Source/Integration/IntegrationGameModeBase.h index aec295f4..2ae5404f 100644 --- a/Source/Integration/IntegrationGameModeBase.h +++ b/Source/Integration/IntegrationGameModeBase.h @@ -6,6 +6,7 @@ #include "GameFramework/GameModeBase.h" #include "enginewrapper.hpp" #include "engineutil.hpp" +#include "TangibleManager.h" #include "LuprexSockets.hpp" #include "IntegrationGameModeBase.generated.h" @@ -46,8 +47,8 @@ public: // Transfer console output from the Luprex engine to unreal. void HandleLuprexConsoleOutput(); - // Array of tangibles. - TArray Tangibles; + //UPROPERTY() + //FTangibleManager TangibleManager; // This stores the entire text currently visible in the console. engineutil::ConsoleOutput ConsoleOutput; diff --git a/Source/Integration/TangibleManager.cpp b/Source/Integration/TangibleManager.cpp new file mode 100644 index 00000000..b638dbc1 --- /dev/null +++ b/Source/Integration/TangibleManager.cpp @@ -0,0 +1,39 @@ +// Fill out your copyright notice in the Description page of Project Settings. + + +#include "TangibleManager.h" + +//using AActorPtr = AActor*; + +//void FTangibleManager::Init(UWorld *world, UClass* tanact) { +// World = world; +// ClassTangibleActor = tanact; +//} +// +//AActorPtr FTangibleManager::GetTangible(int64 id) { +// AActorPtr *p = IdToActor.Find(id); +// if (p == nullptr) { +// return nullptr; +// } else { +// return *p; +// } +//} +// +//// Get the tangible if it exists, otherwise create it. +//AActorPtr FTangibleManager::MakeTangible(int64 id) { +// AActorPtr& p = IdToActor.FindOrAdd(id); +// if (p == nullptr) { +// FVector location; +// FRotator rotation; +// FActorSpawnParameters params; +// p = w->SpawnActor(ClassTangibleActor, &location, &rotation, params); +// assert(p != nullptr); +// } +// return p; +//} +// +//// Delete the tangible. +//void FTangibleManager::DeleteTangible(int64 id) { +// // IMPLEMENT ME +//} + diff --git a/Source/Integration/TangibleManager.h b/Source/Integration/TangibleManager.h new file mode 100644 index 00000000..a36554be --- /dev/null +++ b/Source/Integration/TangibleManager.h @@ -0,0 +1,42 @@ +// Fill out your copyright notice in the Description page of Project Settings. + +#pragma once + +#include "CoreMinimal.h" +#include "UObject/NoExportTypes.h" +#include "TangibleManager.generated.h" + +/** + * + */ +USTRUCT() +struct INTEGRATION_API FTangibleManager +{ + GENERATED_BODY() + +public: + //// A pointer to the UWorld. + //UWorld* world; + + //// A pointer to uclass TangibleActor. + //UPROPERTY() + //TSubclassOf ClassTangibleActor; + + //// Given a tangible ID, look up actor pointer (or NULL if actor was deleted) + //UPROPERTY() + //TMap IdToActor; + +public: + //// Initialize the tangible manager. + //// + //void Init(UWorld *world, UClass* tanact); + + //// Get the tangible if it exists, otherwise return NULL + //AActor* GetTangible(int64 id); + + //// Get the tangible if it exists, otherwise create it. + //AActor* MakeTangible(int64 id); + + //// Delete the tangible. + //void DeleteTangible(int64 id); +}; diff --git a/Source/Integration/engineutil.cpp b/Source/Integration/engineutil.cpp index cc68b2ea..a9cbd96f 100644 --- a/Source/Integration/engineutil.cpp +++ b/Source/Integration/engineutil.cpp @@ -76,13 +76,5 @@ void ConsoleOutput::Truncate() { } } -AActor* CreateTangible(UWorld *w, UClass* uclass) { - FVector location; - FRotator rotation; - FActorSpawnParameters params; - AActor *result = w->SpawnActor(uclass, &location, &rotation, params); - return result; -} - } // namespace engineutil diff --git a/Source/Integration/engineutil.hpp b/Source/Integration/engineutil.hpp index 736a91d7..762eefdf 100644 --- a/Source/Integration/engineutil.hpp +++ b/Source/Integration/engineutil.hpp @@ -43,7 +43,6 @@ public: void ClearDirty() { Dirty = false; } }; -AActor* CreateTangible(UWorld *w, UClass* uclass); } // namespace engineutil