diff --git a/src/game/vmap/BIH.cpp b/src/game/vmap/BIH.cpp index 7240a91a4..091c06624 100644 --- a/src/game/vmap/BIH.cpp +++ b/src/game/vmap/BIH.cpp @@ -127,7 +127,7 @@ void BIH::subdivide(int left, int right, std::vector &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 &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); diff --git a/src/game/vmap/BIH.h b/src/game/vmap/BIH.h index 8776a1896..c876ff7a7 100644 --- a/src/game/vmap/BIH.h +++ b/src/game/vmap/BIH.h @@ -126,7 +126,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]; diff --git a/src/game/vmap/WorldModel.cpp b/src/game/vmap/WorldModel.cpp index 0e21ceff5..fe52ccfd9 100644 --- a/src/game/vmap/WorldModel.cpp +++ b/src/game/vmap/WorldModel.cpp @@ -150,10 +150,10 @@ namespace VMAP { float tx_f = (pos.x - iCorner.x)/LIQUID_TILE_SIZE; uint32 tx = uint32(tx_f); - if (tx<0 || tx >= iTilesX) return false; + if (tx >= iTilesX) return false; float ty_f = (pos.y - iCorner.y)/LIQUID_TILE_SIZE; uint32 ty = uint32(ty_f); - if (ty<0 || ty >= iTilesY) return false; + if (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: diff --git a/src/shared/Database/Field.h b/src/shared/Database/Field.h index b9df92c4b..948fff448 100644 --- a/src/shared/Database/Field.h +++ b/src/shared/Database/Field.h @@ -56,14 +56,11 @@ class Field uint32 GetUInt32() const { return mValue ? static_cast(atol(mValue)) : uint32(0); } uint64 GetUInt64() const { - if(mValue) - { - uint64 value; - sscanf(mValue,UI64FMTD,&value); - return value; - } - else + uint64 value = 0; + if(!mValue || sscanf(mValue,UI64FMTD,&value) == -1) return 0; + + return value; } void SetType(enum DataTypes type) { mType = type; } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 14520c748..184a3e2e0 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "11304" + #define REVISION_NR "11305" #endif // __REVISION_NR_H__