From 2a853ba73e8fbd820f75c3356ee914c425e6f078 Mon Sep 17 00:00:00 2001 From: mogemimi Date: Mon, 27 Jun 2016 19:33:45 +0900 Subject: [PATCH] Avoid const_cast when calling Node::setAdditionalTransform --- cocos/2d/CCNode.cpp | 5 ++--- cocos/2d/CCNode.h | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/cocos/2d/CCNode.cpp b/cocos/2d/CCNode.cpp index 6c0d4eed84..849c0dc9bb 100644 --- a/cocos/2d/CCNode.cpp +++ b/cocos/2d/CCNode.cpp @@ -1800,7 +1800,7 @@ void Node::setAdditionalTransform(const AffineTransform& additionalTransform) setAdditionalTransform(&tmp); } -void Node::setAdditionalTransform(Mat4* additionalTransform) +void Node::setAdditionalTransform(const Mat4* additionalTransform) { if (additionalTransform == nullptr) { @@ -1823,8 +1823,7 @@ void Node::setAdditionalTransform(Mat4* additionalTransform) void Node::setAdditionalTransform(const Mat4& additionalTransform) { - Mat4* mat4= const_cast(&additionalTransform); - setAdditionalTransform(mat4); + setAdditionalTransform(&additionalTransform); } AffineTransform Node::getParentToNodeAffineTransform() const diff --git a/cocos/2d/CCNode.h b/cocos/2d/CCNode.h index 0549f3915d..e1d94190c7 100644 --- a/cocos/2d/CCNode.h +++ b/cocos/2d/CCNode.h @@ -1643,7 +1643,7 @@ public: * * @param additionalTransform An additional transform matrix. */ - void setAdditionalTransform(Mat4* additionalTransform); + void setAdditionalTransform(const Mat4* additionalTransform); void setAdditionalTransform(const Mat4& additionalTransform); void setAdditionalTransform(const AffineTransform& additionalTransform);