From 18b856602c160fd726b0f2bc5ed15ba95081f708 Mon Sep 17 00:00:00 2001 From: willemsteller Date: Tue, 23 Oct 2018 09:52:45 +0200 Subject: [PATCH] Move duplicated part up --- main.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/main.cpp b/main.cpp index 5bab5fe..75b8e24 100644 --- a/main.cpp +++ b/main.cpp @@ -254,7 +254,15 @@ void GUDButtonListener::onButton1MouseClick(BaseButtonInstance* button) std::vector newinst; for(size_t i = 0; i < selectedInstances.size(); i++) { - newinst.push_back(selectedInstances.at(i)->clone()); + PhysicalInstance* tempinst = (PhysicalInstance*) selectedInstances.at(i); + Vector3 tempPos = tempinst->getPosition(); + Vector3 tempSize = tempinst->getSize(); + + PhysicalInstance* clonedInstance = (PhysicalInstance*) selectedInstances.at(i)->clone(); + + newinst.push_back(tempinst); + tempinst->setPosition(Vector3(tempPos.x, tempPos.y + tempSize.y, tempPos.z)); + usableApp->cameraController.centerCamera(selectedInstances.at(0)); } selectedInstances = newinst; }