From 2436ad8d615c61f17e0b273abb619c5057e82a37 Mon Sep 17 00:00:00 2001 From: Shamus Young Date: Fri, 8 May 2009 13:25:42 +0000 Subject: [PATCH] Killed the last of the memory leaks, and included a change to Entity.h, which should have been with PREVIOUS memory-leak plugs. --- Entity.h | 3 ++- Mesh.cpp | 8 ++++++-- Mesh.h | 3 --- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Entity.h b/Entity.h index 9c58a93..c9d1fae 100644 --- a/Entity.h +++ b/Entity.h @@ -15,13 +15,14 @@ protected: public: CEntity (void); - GLvector Center () { return _center; } + virtual ~CEntity () {}; virtual void Render (void); virtual void RenderFlat (bool wirefame); virtual unsigned Texture () { return 0; } virtual void Update (void); virtual bool Alpha () { return false; } virtual int PolyCount () { return 0; } + GLvector Center () { return _center; } }; diff --git a/Mesh.cpp b/Mesh.cpp index 2530e35..80749bc 100644 --- a/Mesh.cpp +++ b/Mesh.cpp @@ -43,8 +43,12 @@ CMesh::CMesh () CMesh::~CMesh () { - if (_list) - glDeleteLists (_list, 1); + glDeleteLists (_list, 1); + _vertex.clear (); + _fan.clear (); + _quad_strip.clear (); + _cube.clear (); + } diff --git a/Mesh.h b/Mesh.h index 2d0639b..4513a62 100644 --- a/Mesh.h +++ b/Mesh.h @@ -24,14 +24,11 @@ public: unsigned _list; int _polycount; std::vector _vertex; - std::vector _normal; - std::vector _triangle; std::vector _cube; std::vector _quad_strip; std::vector _fan; bool _compiled; - void NormalAdd (const GLvector& n); void VertexAdd (const GLvertex& v); int VertexCount () { return _vertex.size(); } int PolyCount () { return _polycount; }