diff --git a/src/gl/data/gl_data.cpp b/src/gl/data/gl_data.cpp index 07fac1b2e..d386428a2 100644 --- a/src/gl/data/gl_data.cpp +++ b/src/gl/data/gl_data.cpp @@ -483,7 +483,7 @@ FTextureID gl_GetSpriteFrame(unsigned sprite, int frame, int rot, angle_t ang, b //========================================================================== // -// Recalculate all heights affectting this vertex. +// Recalculate all heights affecting this vertex. // //========================================================================== void gl_RecalcVertexHeights(vertex_t * v) diff --git a/src/gl/data/gl_setup.cpp b/src/gl/data/gl_setup.cpp index 6bdf57d4c..7959b2083 100644 --- a/src/gl/data/gl_setup.cpp +++ b/src/gl/data/gl_setup.cpp @@ -623,20 +623,6 @@ void gl_CleanLevelData() mo=next; } - for(auto &v : level.vertexes) if (v.numsectors > 0) - { - if (v.sectors != nullptr) - { - delete [] v.sectors; - v.sectors = nullptr; - } - if (v.heightlist != nullptr) - { - delete [] v.heightlist; - v.heightlist = nullptr; - } - } - if (level.sides.Size() > 0 && level.sides[0].segs) { delete [] level.sides[0].segs; diff --git a/src/gl/textures/gl_texture.cpp b/src/gl/textures/gl_texture.cpp index 8aaa98ae6..2b338513a 100644 --- a/src/gl/textures/gl_texture.cpp +++ b/src/gl/textures/gl_texture.cpp @@ -394,16 +394,20 @@ bool FTexture::FindHoles(const unsigned char * buffer, int w, int h) } if (startdraw==0 && lendraw==h) return false; // nothing saved so don't create a split list - FloatRect * rcs = new FloatRect[gapc]; - - for(x=0;x 0) { - // gaps are stored as texture (u/v) coordinates - rcs[x].width=rcs[x].left=-1.0f; - rcs[x].top=(float)gaps[x][0]/(float)h; - rcs[x].height=(float)gaps[x][1]/(float)h; + FloatRect * rcs = new FloatRect[gapc]; + + for (x = 0; x < gapc; x++) + { + // gaps are stored as texture (u/v) coordinates + rcs[x].width = rcs[x].left = -1.0f; + rcs[x].top = (float)gaps[x][0] / (float)h; + rcs[x].height = (float)gaps[x][1] / (float)h; + } + gl_info.areas = rcs; } - gl_info.areas=rcs; + else gl_info.areas = nullptr; gl_info.areacount=gapc; return true; diff --git a/src/r_defs.h b/src/r_defs.h index 86eb7c8c6..f2c089900 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -157,6 +157,12 @@ struct vertex_t heightlist = NULL; } + ~vertex_t() + { + if (sectors != nullptr) delete[] sectors; + if (heightlist != nullptr) delete[] heightlist; + } + bool operator== (const vertex_t &other) { return p == other.p;