From 87906aafb99459149c78fde86b49fd7e2290800d Mon Sep 17 00:00:00 2001 From: Aruki Date: Tue, 23 May 2017 19:58:36 -0600 Subject: [PATCH] Fixed bugs with copy/pasting instances --- src/Core/Resource/Factory/CScriptLoader.cpp | 4 ++-- src/Editor/Undo/CPasteNodesCommand.cpp | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Core/Resource/Factory/CScriptLoader.cpp b/src/Core/Resource/Factory/CScriptLoader.cpp index ad57e7f0..bdb0114b 100644 --- a/src/Core/Resource/Factory/CScriptLoader.cpp +++ b/src/Core/Resource/Factory/CScriptLoader.cpp @@ -260,7 +260,7 @@ CScriptObject* CScriptLoader::LoadObjectMP1(IInputStream& rSCLY) } u32 InstanceID = rSCLY.ReadLong() & 0x03FFFFFF; - if (InstanceID == -1) InstanceID = mpArea->FindUnusedInstanceID(); + if (InstanceID == 0x03FFFFFF) InstanceID = mpArea->FindUnusedInstanceID(); mpObj = new CScriptObject(InstanceID, mpArea, mpLayer, pTemp); // Load connections @@ -374,7 +374,7 @@ CScriptObject* CScriptLoader::LoadObjectMP2(IInputStream& rSCLY) } u32 InstanceID = rSCLY.ReadLong() & 0x03FFFFFF; - if (InstanceID == -1) InstanceID = mpArea->FindUnusedInstanceID(); + if (InstanceID == 0x03FFFFFF) InstanceID = mpArea->FindUnusedInstanceID(); mpObj = new CScriptObject(InstanceID, mpArea, mpLayer, pTemplate); // Load connections diff --git a/src/Editor/Undo/CPasteNodesCommand.cpp b/src/Editor/Undo/CPasteNodesCommand.cpp index b8c2e6a9..84b0ea4a 100644 --- a/src/Editor/Undo/CPasteNodesCommand.cpp +++ b/src/Editor/Undo/CPasteNodesCommand.cpp @@ -116,7 +116,11 @@ void CPasteNodesCommand::redo() } else - mLinkedInstances << pLink->Receiver(); + { + CScriptObject *pReceiver = pLink->Receiver(); + pReceiver->AddLink(eIncoming, pLink); + mLinkedInstances << pReceiver; + } } } }