From 8c75a5f8262cefd1bcfbc1250bd828e02abecdf3 Mon Sep 17 00:00:00 2001 From: jyelon Date: Wed, 4 Sep 2024 21:01:20 -0400 Subject: [PATCH] Working on probe: drv_call_function now returns a string --- Source/Integration/IntegrationGameModeBase.cpp | 4 ++-- Source/Integration/LockedWrapper.cpp | 7 +++++++ Source/Integration/LockedWrapper.h | 4 ++++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/Source/Integration/IntegrationGameModeBase.cpp b/Source/Integration/IntegrationGameModeBase.cpp index 29674ce4..fafc208b 100644 --- a/Source/Integration/IntegrationGameModeBase.cpp +++ b/Source/Integration/IntegrationGameModeBase.cpp @@ -166,7 +166,7 @@ void AIntegrationGameModeBase::LuaCallInvoke(AActor *place) { if (place != nullptr) { place_id = UlxTangible::GetActorTangible(place)->TangibleId; } - w->play_call_function(w.Get(), InvocationKind::LUA_CALL, place_id, datapk.size(), datapk.data()); + w.PlayCallFunction(InvocationKind::LUA_CALL, place_id, datapk); } void AIntegrationGameModeBase::ExecuteDebuggingCommand(FlxLockedWrapper &w, const FString &fs) { @@ -183,7 +183,7 @@ void AIntegrationGameModeBase::ExecuteDebuggingCommand(FlxLockedWrapper &w, cons sb.write_fvector(FVector(2,3,4)); std::string_view datapk = sb.view(); int64 player = w.GetActor(); - w->play_call_function(w.Get(), InvocationKind::LUA_CALL, player, datapk.size(), datapk.data()); + w.PlayCallFunction(InvocationKind::LUA_CALL, player, datapk); } else { ConsoleOutput.AppendLine(TEXT("Unknown Command")); } diff --git a/Source/Integration/LockedWrapper.cpp b/Source/Integration/LockedWrapper.cpp index 0b1a4432..30bea28b 100644 --- a/Source/Integration/LockedWrapper.cpp +++ b/Source/Integration/LockedWrapper.cpp @@ -50,6 +50,13 @@ IdView FlxLockedWrapper::GetNear(int64 id, double rx, double ry, double rz) { return IdView(data, size); } +std::string_view FlxLockedWrapper::PlayCallFunction(InvocationKind kind, int64 place, std::string_view datapk) { + uint32_t retpklen; + const char *retpk; + Lockable.Wrapper.play_call_function(Get(), kind, place, datapk.size(), datapk.data(), &retpklen, &retpk); + return std::string_view(retpk, retpklen); +} + StringViewVec FlxLockedWrapper::GetAnimationQueues(IdView ids) { // How many animation queues are we fetching? int num = ids.Num(); diff --git a/Source/Integration/LockedWrapper.h b/Source/Integration/LockedWrapper.h index 746d0962..431e885d 100644 --- a/Source/Integration/LockedWrapper.h +++ b/Source/Integration/LockedWrapper.h @@ -84,6 +84,10 @@ public: // IdView GetNear(int64 id, double rx, double ry, double rz); + // PlayCallFunction - a thin wrapper around play_call_function. + // + std::string_view PlayCallFunction(InvocationKind kind, int64 place, std::string_view datapk); + // Get animation queues. // // The array returned by this is valid until the