diff --git a/Recast/Source/RecastRegion.cpp b/Recast/Source/RecastRegion.cpp index a3a0644..120b046 100644 --- a/Recast/Source/RecastRegion.cpp +++ b/Recast/Source/RecastRegion.cpp @@ -438,7 +438,7 @@ static unsigned short* expandRegions(int maxIter, unsigned short level, struct rcRegion { - inline rcRegion() : count(0), id(0), area(0), remap(false) {} + inline rcRegion(unsigned short i) : count(0), id(i), area(0), remap(false) {} int count; unsigned short id; @@ -697,16 +697,17 @@ static bool filterSmallRegions(int minRegionSize, int mergeRegionSize, const int h = chf.height; const int nreg = maxRegionId+1; - rcRegion* regions = new(rcAlloc(sizeof(rcRegion)*nreg, RC_ALLOC_TEMP)) rcRegion[nreg]; + rcRegion* regions = (rcRegion*)rcAlloc(sizeof(rcRegion)*nreg, RC_ALLOC_TEMP); if (!regions) { if (rcGetLog()) rcGetLog()->log(RC_LOG_ERROR, "filterSmallRegions: Out of memory 'regions' (%d).", nreg); return false; } - + + // Construct regions for (int i = 0; i < nreg; ++i) - regions[i].id = (unsigned short)i; + new(®ions[i]) rcRegion((unsigned short)i); // Find edge of a region and find connections around the contour. for (int y = 0; y < h; ++y) diff --git a/RecastDemo/Bin/Recast.exe b/RecastDemo/Bin/Recast.exe index af9db62..31fcb2c 100644 Binary files a/RecastDemo/Bin/Recast.exe and b/RecastDemo/Bin/Recast.exe differ diff --git a/RecastDemo/Build/VC9/Recast.vcproj b/RecastDemo/Build/VC9/Recast.vcproj index 717952c..59b42bf 100644 --- a/RecastDemo/Build/VC9/Recast.vcproj +++ b/RecastDemo/Build/VC9/Recast.vcproj @@ -187,6 +187,10 @@ RelativePath="..\..\..\Recast\Include\Recast.h" > + + @@ -203,6 +207,10 @@ RelativePath="..\..\..\Recast\Source\Recast.cpp" > + + @@ -247,6 +255,10 @@ + + @@ -267,6 +279,10 @@ + +