mirror of https://github.com/axmolengine/axmol.git
Avoid unnecessary allocation if targetGrid is reusable (#16343)
This commit is contained in:
parent
7f222c92e0
commit
b837dd7a20
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue