Tools/MMapGenerator: Fix an edge case of infinite loop

Fix a (pseudo) infinite loop happening when generating mmaps for single tile maps (like 249) but with vmaps not present in the correct folder. This would trigger a 18446744065119600000 (uint32 max ^ 2) iterations loop.
This commit is contained in:
jackpoz committed 2015-11-25 21:49:27 +01:00
1 parent e9bd786351
commit 981b871d2f
1 file changed
+6 -4
+6 -4
View File
@@ -215,10 +215,12 @@ namespace MMAP
/**************************************************************************/
void MapBuilder::getGridBounds(uint32 mapID, uint32 &minX, uint32 &minY, uint32 &maxX, uint32 &maxY) const
{
maxX = std::numeric_limits<uint32>::max();
maxY = std::numeric_limits<uint32>::max();
minX = 0;
minY = 0;
// min and max are initialized to invalid values so the caller iterating the [min, max] range
// will never enter the loop unless valid min/max values are found
maxX = 0;
maxY = 0;
minX = std::numeric_limits<uint32>::max();
minY = std::numeric_limits<uint32>::max();
float bmin[3] = { 0, 0, 0 };
float bmax[3] = { 0, 0, 0 };