issue #3401: change getContactData function return value back to pointer.

This commit is contained in:
boyu0 2014-01-26 12:02:42 +08:00
parent a5c26b7da9
commit 682a6819cb
4 changed files with 8 additions and 8 deletions

View File

@ -76,7 +76,7 @@ public:
/** get contact shape B. */ /** get contact shape B. */
inline PhysicsShape* getShapeB() const { return _shapeB; } inline PhysicsShape* getShapeB() const { return _shapeB; }
/** get contact data */ /** get contact data */
inline const PhysicsContactData& getContactData() const { return *_contactData; } inline const PhysicsContactData* getContactData() const { return _contactData; }
/** get data. */ /** get data. */
inline void* getData() const { return _data; } inline void* getData() const { return _data; }
/** /**

View File

@ -1631,23 +1631,23 @@ void physics_raycastinfo_to_luaval(lua_State* L, const PhysicsRayCastInfo& info)
lua_rawset(L, -3); /* table[key] = value, L: table */ lua_rawset(L, -3); /* table[key] = value, L: table */
} }
void physics_contactdata_to_luaval(lua_State* L, const PhysicsContactData& data) void physics_contactdata_to_luaval(lua_State* L, const PhysicsContactData* data)
{ {
if (NULL == L) if (nullptr == L || nullptr == data)
return; return;
lua_newtable(L); /* L: table */ lua_newtable(L); /* L: table */
lua_pushstring(L, "points"); lua_pushstring(L, "points");
points_to_luaval(L, data.points, data.count); points_to_luaval(L, data->points, data->count);
lua_rawset(L, -3); lua_rawset(L, -3);
lua_pushstring(L, "normal"); lua_pushstring(L, "normal");
point_to_luaval(L, data.normal); point_to_luaval(L, data->normal);
lua_rawset(L, -3); lua_rawset(L, -3);
lua_pushstring(L, "POINT_MAX"); lua_pushstring(L, "POINT_MAX");
lua_pushnumber(L, data.POINT_MAX); lua_pushnumber(L, data->POINT_MAX);
lua_rawset(L, -3); lua_rawset(L, -3);
} }

View File

@ -204,7 +204,7 @@ extern void color4b_to_luaval(lua_State* L,const Color4B& cc);
extern void color4f_to_luaval(lua_State* L,const Color4F& cc); extern void color4f_to_luaval(lua_State* L,const Color4F& cc);
extern void physics_material_to_luaval(lua_State* L,const PhysicsMaterial& pm); extern void physics_material_to_luaval(lua_State* L,const PhysicsMaterial& pm);
extern void physics_raycastinfo_to_luaval(lua_State* L, const PhysicsRayCastInfo& info); extern void physics_raycastinfo_to_luaval(lua_State* L, const PhysicsRayCastInfo& info);
extern void physics_contactdata_to_luaval(lua_State* L, const PhysicsContactData& data); extern void physics_contactdata_to_luaval(lua_State* L, const PhysicsContactData* data);
extern void affinetransform_to_luaval(lua_State* L,const AffineTransform& inValue); extern void affinetransform_to_luaval(lua_State* L,const AffineTransform& inValue);
extern void fontdefinition_to_luaval(lua_State* L,const FontDefinition& inValue); extern void fontdefinition_to_luaval(lua_State* L,const FontDefinition& inValue);
extern void array_to_luaval(lua_State* L,Array* inValue); extern void array_to_luaval(lua_State* L,Array* inValue);

View File

@ -1107,7 +1107,7 @@ void PhysicsDemoOneWayPlatform::onEnter()
bool PhysicsDemoOneWayPlatform::onContactBegin(EventCustom* event, const PhysicsContact& contact) bool PhysicsDemoOneWayPlatform::onContactBegin(EventCustom* event, const PhysicsContact& contact)
{ {
return contact.getContactData().normal.y < 0; return contact.getContactData()->normal.y < 0;
} }
std::string PhysicsDemoOneWayPlatform::title() const std::string PhysicsDemoOneWayPlatform::title() const