From 2cbc450285fb6802d47511c0ef73b3d61d6f4578 Mon Sep 17 00:00:00 2001 From: Sandu Liviu Catalin Date: Sun, 21 Mar 2021 11:01:22 +0200 Subject: [PATCH] Manually identify stream target. --- module/Misc/Official.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/module/Misc/Official.cpp b/module/Misc/Official.cpp index 34e167f4..6195b914 100644 --- a/module/Misc/Official.cpp +++ b/module/Misc/Official.cpp @@ -2248,8 +2248,14 @@ struct LgStream { Write(value.mPtr, length); } } - static void SendStream(LgPlayer * player) { - _Func->SendClientScriptData(player != nullptr ? player->GetIdentifier() : -1, m_OutputStreamData, m_OutputStreamEnd); + static void SendStream(LightObj & target) { + int32_t id; + if (target.IsNull()) id = -1; + else if (target.GetType() == OT_INTEGER || target.GetType() == OT_FLOAT) id = target.Cast< int32_t >(); + else if (static_cast< AbstractStaticClassData * >(target.GetTypeTag()) == StaticClassTypeTag< LgPlayer >::Get()) { + id = target.CastI< LgPlayer >()->GetIdentifier(); + } else STHROWF("Invalid target"); + _Func->SendClientScriptData(id, m_OutputStreamData, m_OutputStreamEnd); ClearOutput(); } // --------------------------------------------------------------------------------------------