mirror of
https://github.com/ENSL/NS.git
synced 2024-11-23 04:52:15 +00:00
fix: Mem leak, use auto boxing for temp value
This commit is contained in:
parent
ea2a5833b7
commit
054f8d929b
1 changed files with 22 additions and 11 deletions
|
@ -454,7 +454,8 @@ void CollisionChecker::SetIgnoreEntityClass(int ignore_entity_class)
|
||||||
|
|
||||||
int CollisionChecker::GetContentsAtPoint(const nspoint_t& point) const
|
int CollisionChecker::GetContentsAtPoint(const nspoint_t& point) const
|
||||||
{
|
{
|
||||||
return GetContents(new PointCollisionTest(point));
|
auto tmp = PointCollisionTest(point);
|
||||||
|
return GetContents(&tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
|
@ -468,14 +469,16 @@ int CollisionChecker::GetWorldContentsAtPoint(const nspoint_t& point) const
|
||||||
|
|
||||||
int CollisionChecker::GetAllEntityContentsAtPoint(const nspoint_t& point) const
|
int CollisionChecker::GetAllEntityContentsAtPoint(const nspoint_t& point) const
|
||||||
{
|
{
|
||||||
return GetAllEntityContents(new PointCollisionTest(point));
|
auto tmp = PointCollisionTest(point);
|
||||||
|
return GetAllEntityContents(&tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
|
|
||||||
int CollisionChecker::GetSingleEntityContentsAtPoint(const nspoint_t& point, int entity_index) const
|
int CollisionChecker::GetSingleEntityContentsAtPoint(const nspoint_t& point, int entity_index) const
|
||||||
{
|
{
|
||||||
return GetSingleEntityContents(new PointCollisionTest(point),entity_index);
|
auto tmp = PointCollisionTest(point);
|
||||||
|
return GetSingleEntityContents(&tmp, entity_index);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
|
@ -486,28 +489,32 @@ const static nspoint_t CYLINDER_UP_DEFAULT = {0,0,1.0f};
|
||||||
|
|
||||||
int CollisionChecker::GetContentsInCylinder(const nspoint_t& base, float radius, float height) const
|
int CollisionChecker::GetContentsInCylinder(const nspoint_t& base, float radius, float height) const
|
||||||
{
|
{
|
||||||
return GetContents(new CylinderCollisionTest(CYLINDER_UP_DEFAULT,base,radius,height));
|
auto tmp = CylinderCollisionTest(CYLINDER_UP_DEFAULT,base,radius,height);
|
||||||
|
return GetContents(&tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
|
|
||||||
int CollisionChecker::GetWorldContentsInCylinder(const nspoint_t& base, float radius, float height) const
|
int CollisionChecker::GetWorldContentsInCylinder(const nspoint_t& base, float radius, float height) const
|
||||||
{
|
{
|
||||||
return GetSingleEntityContents(new CylinderCollisionTest(CYLINDER_UP_DEFAULT,base,radius,height),WORLD_ENTITY);
|
auto tmp = CylinderCollisionTest(CYLINDER_UP_DEFAULT,base,radius,height);
|
||||||
|
return GetSingleEntityContents(&tmp, WORLD_ENTITY);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
|
|
||||||
int CollisionChecker::GetAllEntityContentsInCylinder(const nspoint_t& base, float radius, float height) const
|
int CollisionChecker::GetAllEntityContentsInCylinder(const nspoint_t& base, float radius, float height) const
|
||||||
{
|
{
|
||||||
return GetAllEntityContents(new CylinderCollisionTest(CYLINDER_UP_DEFAULT,base,radius,height));
|
auto tmp = CylinderCollisionTest(CYLINDER_UP_DEFAULT,base,radius,height);
|
||||||
|
return GetAllEntityContents(&tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
|
|
||||||
int CollisionChecker::GetSingleEntityContentsInCylinder(const nspoint_t& base, float radius, float height, int entity_index) const
|
int CollisionChecker::GetSingleEntityContentsInCylinder(const nspoint_t& base, float radius, float height, int entity_index) const
|
||||||
{
|
{
|
||||||
return GetSingleEntityContents(new CylinderCollisionTest(CYLINDER_UP_DEFAULT,base,radius,height),entity_index);
|
auto tmp = CylinderCollisionTest(CYLINDER_UP_DEFAULT,base,radius,height);
|
||||||
|
return GetSingleEntityContents(&tmp,entity_index);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
|
@ -516,28 +523,32 @@ int CollisionChecker::GetSingleEntityContentsInCylinder(const nspoint_t& base, f
|
||||||
|
|
||||||
int CollisionChecker::GetContentsInAABB(const nspoint_t& mins, const nspoint_t& maxs) const
|
int CollisionChecker::GetContentsInAABB(const nspoint_t& mins, const nspoint_t& maxs) const
|
||||||
{
|
{
|
||||||
return GetContents(new AABBCollisionTest(mins,maxs));
|
auto tmp = AABBCollisionTest(mins,maxs);
|
||||||
|
return GetContents(&tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
|
|
||||||
int CollisionChecker::GetWorldContentsInAABB(const nspoint_t& mins, const nspoint_t& maxs) const
|
int CollisionChecker::GetWorldContentsInAABB(const nspoint_t& mins, const nspoint_t& maxs) const
|
||||||
{
|
{
|
||||||
return GetSingleEntityContents(new AABBCollisionTest(mins,maxs),WORLD_ENTITY);
|
auto tmp = AABBCollisionTest(mins,maxs);
|
||||||
|
return GetSingleEntityContents(&tmp, WORLD_ENTITY);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
|
|
||||||
int CollisionChecker::GetAllEntityContentsInAABB(const nspoint_t& mins, const nspoint_t& maxs) const
|
int CollisionChecker::GetAllEntityContentsInAABB(const nspoint_t& mins, const nspoint_t& maxs) const
|
||||||
{
|
{
|
||||||
return GetAllEntityContents(new AABBCollisionTest(mins,maxs));
|
auto tmp = AABBCollisionTest(mins,maxs);
|
||||||
|
return GetAllEntityContents(&tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
|
|
||||||
int CollisionChecker::GetSingleEntityContentsInAABB(const nspoint_t& mins, const nspoint_t& maxs, int entity_index) const
|
int CollisionChecker::GetSingleEntityContentsInAABB(const nspoint_t& mins, const nspoint_t& maxs, int entity_index) const
|
||||||
{
|
{
|
||||||
return GetSingleEntityContents(new AABBCollisionTest(mins,maxs),entity_index);
|
auto tmp = AABBCollisionTest(mins,maxs);
|
||||||
|
return GetSingleEntityContents(&tmp,entity_index);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in a new issue