fixed memoryleak in CCollision

This commit is contained in:
HMH 2017-07-21 16:02:24 +02:00
parent d3714f7efa
commit 7b3aba8fdc
2 changed files with 10 additions and 1 deletions

View file

@ -30,9 +30,17 @@ CCollision::CCollision()
m_pTune = 0; m_pTune = 0;
} }
CCollision::~CCollision()
{
if(m_pLayers)
m_pLayers->Dest();
Dest();
}
void CCollision::Init(class CLayers *pLayers) void CCollision::Init(class CLayers *pLayers)
{ {
if(m_pLayers) m_pLayers->Dest(); if(m_pLayers)
m_pLayers->Dest();
Dest(); Dest();
m_NumSwitchers = 0; m_NumSwitchers = 0;
m_pLayers = pLayers; m_pLayers = pLayers;

View file

@ -17,6 +17,7 @@ class CCollision
public: public:
CCollision(); CCollision();
~CCollision();
void Init(class CLayers *pLayers); void Init(class CLayers *pLayers);
bool CheckPoint(float x, float y) { return IsSolid(round_to_int(x), round_to_int(y)); } bool CheckPoint(float x, float y) { return IsSolid(round_to_int(x), round_to_int(y)); }
bool CheckPoint(vec2 Pos) { return CheckPoint(Pos.x, Pos.y); } bool CheckPoint(vec2 Pos) { return CheckPoint(Pos.x, Pos.y); }