Commit from Lynx3d: Add assert to values that can cause nasty freeze, but should never occur with
valid input. --HG-- branch : trunk
This commit is contained in:
@@ -16,6 +16,7 @@
|
|||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "Errors.h"
|
||||||
#include "MapTree.h"
|
#include "MapTree.h"
|
||||||
#include "ModelInstance.h"
|
#include "ModelInstance.h"
|
||||||
#include "VMapManager2.h"
|
#include "VMapManager2.h"
|
||||||
@@ -24,6 +25,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
|
#include <limits>
|
||||||
|
|
||||||
using G3D::Vector3;
|
using G3D::Vector3;
|
||||||
|
|
||||||
@@ -146,6 +148,8 @@ namespace VMAP
|
|||||||
{
|
{
|
||||||
bool result = true;
|
bool result = true;
|
||||||
float maxDist = (pos2 - pos1).magnitude();
|
float maxDist = (pos2 - pos1).magnitude();
|
||||||
|
// valid map coords should *never ever* produce float overflow, but this would produce NaNs too
|
||||||
|
ASSERT(maxDist < std::numeric_limits<float>::max());
|
||||||
// prevent NaN values which can cause BIH intersection to enter infinite loop
|
// prevent NaN values which can cause BIH intersection to enter infinite loop
|
||||||
if (maxDist < 1e-10f)
|
if (maxDist < 1e-10f)
|
||||||
return true;
|
return true;
|
||||||
@@ -168,6 +172,8 @@ namespace VMAP
|
|||||||
{
|
{
|
||||||
bool result=false;
|
bool result=false;
|
||||||
float maxDist = (pPos2 - pPos1).magnitude();
|
float maxDist = (pPos2 - pPos1).magnitude();
|
||||||
|
// valid map coords should *never ever* produce float overflow, but this would produce NaNs too
|
||||||
|
ASSERT(maxDist < std::numeric_limits<float>::max());
|
||||||
// prevent NaN values which can cause BIH intersection to enter infinite loop
|
// prevent NaN values which can cause BIH intersection to enter infinite loop
|
||||||
if (maxDist < 1e-10f)
|
if (maxDist < 1e-10f)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ include_directories(
|
|||||||
${CMAKE_SOURCE_DIR}/src/server/collision/Maps
|
${CMAKE_SOURCE_DIR}/src/server/collision/Maps
|
||||||
${CMAKE_SOURCE_DIR}/src/server/collision/Models
|
${CMAKE_SOURCE_DIR}/src/server/collision/Models
|
||||||
${CMAKE_SOURCE_DIR}/src/server/shared
|
${CMAKE_SOURCE_DIR}/src/server/shared
|
||||||
|
${CMAKE_SOURCE_DIR}/src/server/shared/Debugging
|
||||||
${ACE_INCLUDE_DIR}
|
${ACE_INCLUDE_DIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,7 @@
|
|||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="0"
|
Optimization="0"
|
||||||
AdditionalIncludeDirectories="..\..\..\..\externals;..\..\..\..\externals\g3dlite;..\..\..\server\collision;..\..\..\server\collision\Management;..\..\..\server\collision\Maps;..\..\..\server\collision\Models;..\..\..\server\shared"
|
AdditionalIncludeDirectories="..\..\..\..\externals;..\..\..\..\externals\g3dlite;..\..\..\server\collision;..\..\..\server\collision\Management;..\..\..\server\collision\Maps;..\..\..\server\collision\Models;..\..\..\server\shared;..\..\..\server\shared\Debugging"
|
||||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
||||||
MinimalRebuild="true"
|
MinimalRebuild="true"
|
||||||
BasicRuntimeChecks="3"
|
BasicRuntimeChecks="3"
|
||||||
@@ -124,7 +124,7 @@
|
|||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
AdditionalIncludeDirectories="..\..\..\..\externals;..\..\..\..\externals\g3dlite;..\..\..\server\collision;..\..\..\server\collision\Management;..\..\..\server\collision\Maps;..\..\..\server\collision\Models;..\..\..\server\shared"
|
AdditionalIncludeDirectories="..\..\..\..\externals;..\..\..\..\externals\g3dlite;..\..\..\server\collision;..\..\..\server\collision\Management;..\..\..\server\collision\Maps;..\..\..\server\collision\Models;..\..\..\server\shared;..\..\..\server\shared\Debugging"
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
||||||
RuntimeLibrary="2"
|
RuntimeLibrary="2"
|
||||||
EnableEnhancedInstructionSet="1"
|
EnableEnhancedInstructionSet="1"
|
||||||
|
|||||||
Reference in New Issue
Block a user