diff options
author | jonas <himself@jonasgunz.de> | 2019-03-05 15:44:02 +0100 |
---|---|---|
committer | jonas <himself@jonasgunz.de> | 2019-03-05 15:44:02 +0100 |
commit | 209bc3d1f9c330a32981c55a6f90bf230b9e67fd (patch) | |
tree | fac3da7979511ae4de5276ca6a468a0df1f97073 | |
parent | a94557f5119ca5cac0ecf970b02180152af83f5d (diff) | |
download | termgl-209bc3d1f9c330a32981c55a6f90bf230b9e67fd.tar.gz |
Memory leak fixes
-rw-r--r-- | cObjectHandler.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/cObjectHandler.cpp b/cObjectHandler.cpp index 5f2782b..1daf3c5 100644 --- a/cObjectHandler.cpp +++ b/cObjectHandler.cpp @@ -54,6 +54,11 @@ int cObjectHandler::moveObject(int _object, sPos _pos, int _mode) if(!abort) objects[_object]->setPosition(newPosition); + if(coll.idv) + free (coll.idv); + if(coll.hitv) + free (coll.hitv); + buildHitmap(); return 0; } @@ -285,6 +290,8 @@ sCollision cObjectHandler::checkCollision(sPos _pos, sPos _size) vector<unsigned int> collisions; vector<int> hitTypes; ret.idc = 0; + ret.idv = NULL; + ret.hitv = NULL; int sizeX, sizeY; @@ -304,6 +311,7 @@ sCollision cObjectHandler::checkCollision(sPos _pos, sPos _size) { if(!(x >= sizeX || x < 0 || y >= sizeY || y < 0)) { + //Triggers multiple times for one Object. Fix! if(iHitMap[x][y]) collisions.push_back(iHitMap[x][y]); } |