fixes for Issue 56: Fairly minor bugs picked up by static analysis tool

This commit is contained in:
Mikko Mononen
2010-03-18 08:53:45 +00:00
parent 8291ceace2
commit 9cd943264e
5 changed files with 68 additions and 22 deletions

View File

@@ -31,7 +31,7 @@ static const unsigned RC_UNSET_HEIGHT = 0xffff;
struct rcHeightPatch
{
inline rcHeightPatch() : data(0) {}
inline rcHeightPatch() : data(0), xmin(0), ymin(0), width(0), height(0) {}
inline ~rcHeightPatch() { delete [] data; }
unsigned short* data;
int xmin, ymin, width, height;
@@ -770,15 +770,13 @@ static void getHeightData(const rcCompactHeightfield& chf,
}
// Find center of the polygon using flood fill.
int pcx = 0, pcy = 0, pcz = 0;
int pcx = 0, pcz = 0;
for (int j = 0; j < npoly; ++j)
{
pcx += (int)verts[poly[j]*3+0];
pcy += (int)verts[poly[j]*3+1];
pcz += (int)verts[poly[j]*3+2];
}
pcx /= npoly;
pcy /= npoly;
pcz /= npoly;
for (int i = 0; i < stack.size(); i += 3)