Created Destructor for Layers and Collision but making them default Destructor didn't work so i made them normal functions and called them as needed, i am not sure this is the right way though. Closes #74, Closes #35.(#35 Needs in depth testing, i tested for 3 minutes copying stuff around)

Signed-off-by: GreYFoXGTi <GreYFoXGTi@GMaiL.CoM>
This commit is contained in:
GreYFoXGTi 2010-10-06 23:44:10 +02:00
parent c4b6094ebb
commit 304084434b
5 changed files with 28 additions and 0 deletions

View file

@ -419,6 +419,8 @@ void CGameClient::OnReset()
m_ShowOthers = -1;
m_FlagPos = vec2(-1, -1);
m_Teams.Reset();
Layers()->Dest();
Collision()->Dest();
}

View file

@ -20,6 +20,15 @@ CCollision::CCollision()
m_pTele = 0;
m_pSpeedup = 0;
m_pFront = 0;
m_pSwitch = 0;
m_pDoor = 0;
}
void CCollision::Dest()
{
if(m_pDoor)
delete[] m_pDoor;
m_pDoor = 0;
}
void CCollision::Init(class CLayers *pLayers)

View file

@ -26,6 +26,7 @@ public:
COLFLAG_THROUGH=16
};
CCollision();
void Dest();
void Init(class CLayers *pLayers);
bool CheckPoint(float x, float y) { return IsSolid(round(x), round(y)); }
bool CheckPoint(vec2 p) { return CheckPoint(p.x, p.y); }

View file

@ -15,6 +15,21 @@ CLayers::CLayers()
m_pMap = 0;
}
void CLayers::Dest()
{
m_GroupsNum = 0;
m_GroupsStart = 0;
m_LayersNum = 0;
m_LayersStart = 0;
m_pGameGroup = 0;
m_pGameLayer = 0;
m_pTeleLayer = 0;
m_pSpeedupLayer = 0;
m_pFrontLayer = 0;
m_pSwitchLayer = 0;
m_pMap = 0;
}
void CLayers::Init(class IKernel *pKernel)
{
m_pMap = pKernel->RequestInterface<IMap>();

View file

@ -20,6 +20,7 @@ class CLayers
public:
CLayers();
void Dest();
void Init(class IKernel *pKernel);
int NumGroups() const { return m_GroupsNum; }
class IMap *Map() const { return m_pMap; }