From b837dd7a20d7ef7a3cee5755af8db9997d0bda91 Mon Sep 17 00:00:00 2001 From: mogemimi Date: Mon, 15 Aug 2016 15:07:37 +0900 Subject: [PATCH] Avoid unnecessary allocation if targetGrid is reusable (#16343) --- cocos/2d/CCActionGrid.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cocos/2d/CCActionGrid.cpp b/cocos/2d/CCActionGrid.cpp index fa23e163e3..4f049722c0 100644 --- a/cocos/2d/CCActionGrid.cpp +++ b/cocos/2d/CCActionGrid.cpp @@ -50,8 +50,6 @@ void GridAction::startWithTarget(Node *target) ActionInterval::startWithTarget(target); cacheTargetAsGridNode(); - GridBase *newgrid = this->getGrid(); - GridBase *targetGrid = _gridNodeTarget->getGrid(); if (targetGrid && targetGrid->getReuseGrid() > 0) @@ -73,6 +71,7 @@ void GridAction::startWithTarget(Node *target) targetGrid->setActive(false); } + auto newgrid = this->getGrid(); _gridNodeTarget->setGrid(newgrid); _gridNodeTarget->getGrid()->setActive(true); }