Core/Errors: Stop using System.Diagnostics.Contracts, Its just closing the server without error or warning. We now log the error and then throw a exception

This commit is contained in:
hondacrx
2018-06-15 12:34:56 -04:00
parent 1289bc3ed1
commit 7aa494d5dd
86 changed files with 520 additions and 558 deletions
+1 -2
View File
@@ -17,7 +17,6 @@
using Framework.GameMath;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
namespace Game.Collision
{
@@ -68,7 +67,7 @@ namespace Game.Collision
bool result = false;
float maxDist = (endPos - startPos).magnitude();
// valid map coords should *never ever* produce float overflow, but this would produce NaNs too
Contract.Assert(maxDist < float.MaxValue);
Cypher.Assert(maxDist < float.MaxValue);
// prevent NaN values which can cause BIH intersection to enter infinite loop
if (maxDist < 1e-10f)
{
@@ -19,7 +19,6 @@ using Framework.Constants;
using Framework.GameMath;
using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
namespace Game.Collision
{
@@ -221,7 +220,7 @@ namespace Game.Collision
if (instanceTree.GetLocationInfo(pos, info))
{
floor = info.ground_Z;
Contract.Assert(floor < float.MaxValue);
Cypher.Assert(floor < float.MaxValue);
type = info.hitModel.GetLiquidType(); // entry from LiquidType.dbc
if (reqLiquidType != 0 && !Convert.ToBoolean(Global.DB2Mgr.GetLiquidFlags(type) & reqLiquidType))
return false;
+2 -3
View File
@@ -19,7 +19,6 @@ using Framework.Constants;
using Framework.GameMath;
using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.IO;
namespace Game.Collision
@@ -328,7 +327,7 @@ namespace Game.Collision
bool result = false;
float maxDist = (pPos2 - pPos1).magnitude();
// valid map coords should *never ever* produce float overflow, but this would produce NaNs too
Contract.Assert(maxDist < float.MaxValue);
Cypher.Assert(maxDist < float.MaxValue);
// prevent NaN values which can cause BIH intersection to enter infinite loop
if (maxDist < 1e-10f)
{
@@ -375,7 +374,7 @@ namespace Game.Collision
return false;
// valid map coords should *never ever* produce float overflow, but this would produce NaNs too
Contract.Assert(maxDist < float.MaxValue);
Cypher.Assert(maxDist < float.MaxValue);
// prevent NaN values which can cause BIH intersection to enter infinite loop
if (maxDist < 1e-10f)
return true;
+1 -2
View File
@@ -18,7 +18,6 @@
using Framework.GameMath;
using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.Collections.Concurrent;
namespace Game.Collision
@@ -102,7 +101,7 @@ namespace Game.Collision
Node getGrid(int x, int y)
{
Contract.Assert(x < CELL_NUMBER && y < CELL_NUMBER);
Cypher.Assert(x < CELL_NUMBER && y < CELL_NUMBER);
if (nodes[x][y] == null)
nodes[x][y] = new Node();
return nodes[x][y];