From b1ffc45307aa95e1316cfbdef090c76851f1fdaa Mon Sep 17 00:00:00 2001 From: Henrique Gemignani Passos Lima Date: Wed, 30 Nov 2022 23:28:00 +0200 Subject: [PATCH] Some decomp fixes for CScriptGenerator::AcceptScriptMsg --- Runtime/World/CScriptGenerator.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Runtime/World/CScriptGenerator.cpp b/Runtime/World/CScriptGenerator.cpp index e58b743fd..4244e91df 100644 --- a/Runtime/World/CScriptGenerator.cpp +++ b/Runtime/World/CScriptGenerator.cpp @@ -35,8 +35,11 @@ void CScriptGenerator::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId sende } const TUniqueId uid = stateMgr.GetIdForScript(conn.x8_objId); - if (stateMgr.GetObjectById(uid) != nullptr) { - follows.push_back(uid); + if (uid != kInvalidUniqueId) { + const CEntity* ent = stateMgr.GetObjectById(uid); + if (ent && ent->GetActive()) { + follows.push_back(uid); + } } } @@ -82,6 +85,7 @@ void CScriptGenerator::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId sende for (u32 j = 0; j < activates.size(); ++j) { if (TCastToConstPtr(stateMgr.GetObjectById(activates[j].first))) { activatesRand = j; + break; } }