]> code.bitgloo.com Git - clyne/gamedev.git/commitdiff
andy's bad
authorClyne Sullivan <tullivan99@gmail.com>
Tue, 1 Dec 2015 13:42:23 +0000 (08:42 -0500)
committerClyne Sullivan <tullivan99@gmail.com>
Tue, 1 Dec 2015 13:42:23 +0000 (08:42 -0500)
1  2 
src/entities.cpp
src/world.cpp

index 100eefbd910a78da15e52277e38bf73e446537f9,0764284f6f90146daa44c5ab04b360759b014a0a..7dc561b23a587f3c7f75e78e4f7b2b21cc72fae4
@@@ -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 5cc3f2aa7cf0fdb19c8ff84e8e87fa48386e8ee0,281cbadf8592694560e3f856bd07e5486751905f..8067fe7fa106606ac26debcace83bdb68cb445c3
@@@ -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){