From: Clyne Sullivan Date: Tue, 1 Dec 2015 13:42:23 +0000 (-0500) Subject: andy's bad X-Git-Url: https://code.bitgloo.com/?a=commitdiff_plain;h=8426dc094bf9a0da94c01e46bb34d7d95ba21548;p=clyne%2Fgamedev.git andy's bad --- 8426dc094bf9a0da94c01e46bb34d7d95ba21548 diff --cc src/entities.cpp index 100eefb,0764284..7dc561b --- a/src/entities.cpp +++ b/src/entities.cpp @@@ -173,15 -149,9 +173,14 @@@ Object::Object(ITEM_ID id, bool qo, con maxHealth = health = 1; tex = new Texturec(1,getItemTexturePath(id)); -- } - +Object::~Object(){ + delete[] pickupDialog; + + delete inv; + delete tex; + delete[] name; +} void Entity::draw(void){ //draws the entities glPushMatrix(); diff --cc src/world.cpp index 5cc3f2a,281cbad..8067fe7 --- a/src/world.cpp +++ b/src/world.cpp @@@ -71,37 -71,16 +71,37 @@@ World::World(void) memset(star,0,100*sizeof(vec2)); } +void World::deleteEntities(void){ + while(!mob.empty()){ + delete mob.back(); + mob.pop_back(); + } + while(!npc.empty()){ + delete npc.back(); + npc.pop_back(); + } + while(!build.empty()){ + delete build.back(); + build.pop_back(); + } + while(!object.empty()){ + delete object.back(); + object.pop_back(); + } + while(!entity.empty()) entity.pop_back(); +} + World::~World(void){ + + if(behind){ + delete behind; + } - ++ delete bgTex; delete[] star; delete[] line; -- - delete &mob; - delete &npc; - delete &build; - delete &object; - delete &entity; ++ + deleteEntities(); } void World::generate(unsigned int width){ // Generates the world and sets all variables contained in the World class. @@@ -934,8 -917,12 +934,8 @@@ Arena::~Arena(void) delete bgTex; delete[] star; delete[] line; -- - delete &mob; - delete &npc; - delete &build; - delete &object; - delete &entity; ++ + deleteEntities(); } World *Arena::exitArena(Player *p){