im making a class that will load and store all my textures. when the capacity is reached and you try to load/add a new texture, it should 'expand' the capacity
the code i've written works but when i quit the program i get a an error that pops up and says "Debug Error DAMAGE: after normal block ....." i know it is this function causing it but i dont know why, any ideas?
(MSVC++ 6)
Code:void TexLoader::grow() { int cap = capacity*1.8; // calculate new capacity Texture* temp; // to hold temp data temp = textures; // make temp point to current textures textures = new Texture[cap]; // allocate new space for textures for(int j =0; j < index; j++) // copy textures to new array { textures[j].ID = temp[j].ID; textures[j].tex = temp[j].tex; } capacity = cap; // update capacity delete temp; // delete old/temp objects }



LinkBack URL
About LinkBacks


