Core/Vmaps: Made code more safe and fixed problems in WmoLiquid::GetLiquidHeight()
This commit is contained in:
@@ -127,7 +127,7 @@ void BIH::subdivide(int left, int right, std::vector<uint32> &tempTree, buildDat
|
||||
if (right == rightOrig)
|
||||
{
|
||||
// all left
|
||||
if (prevAxis == axis && prevSplit == split) {
|
||||
if (prevAxis == axis && G3D::fuzzyEq(prevSplit, split)) {
|
||||
// we are stuck here - create a leaf
|
||||
stats.updateLeaf(depth, right - left + 1);
|
||||
createNode(tempTree, nodeIndex, left, right);
|
||||
@@ -146,7 +146,7 @@ void BIH::subdivide(int left, int right, std::vector<uint32> &tempTree, buildDat
|
||||
else if (left > right)
|
||||
{
|
||||
// all right
|
||||
if (prevAxis == axis && prevSplit == split) {
|
||||
if (prevAxis == axis && G3D::fuzzyEq(prevSplit, split)) {
|
||||
// we are stuck here - create a leaf
|
||||
stats.updateLeaf(depth, right - left + 1);
|
||||
createNode(tempTree, nodeIndex, left, right);
|
||||
|
||||
@@ -128,7 +128,7 @@ class BIH
|
||||
for (int i=0; i<3; ++i)
|
||||
{
|
||||
invDir[i] = 1.f / dir[i];
|
||||
if (dir[i] != 0.f)
|
||||
if (G3D::fuzzyNe(dir[i], 0.0f))
|
||||
{
|
||||
float t1 = (bounds.low()[i] - org[i]) * invDir[i];
|
||||
float t2 = (bounds.high()[i] - org[i]) * invDir[i];
|
||||
|
||||
@@ -149,10 +149,12 @@ namespace VMAP
|
||||
{
|
||||
float tx_f = (pos.x - iCorner.x)/LIQUID_TILE_SIZE;
|
||||
uint32 tx = uint32(tx_f);
|
||||
if (tx >= iTilesX) return false;
|
||||
if (tx_f < 0.0f || tx >= iTilesX)
|
||||
return false;
|
||||
float ty_f = (pos.y - iCorner.y)/LIQUID_TILE_SIZE;
|
||||
uint32 ty = uint32(ty_f);
|
||||
if (ty >= iTilesY) return false;
|
||||
if (ty_f < 0.0f || ty >= iTilesY)
|
||||
return false;
|
||||
|
||||
// check if tile shall be used for liquid level
|
||||
// checking for 0x08 *might* be enough, but disabled tiles always are 0x?F:
|
||||
|
||||
Reference in New Issue
Block a user