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:
@@ -23,7 +23,6 @@ using Game.Groups;
|
||||
using Game.Scenarios;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Linq;
|
||||
|
||||
namespace Game.Maps
|
||||
@@ -426,7 +425,7 @@ namespace Game.Maps
|
||||
InstanceBind bind = player.GetBoundInstance(pair.Value.GetMapId(), pair.Value.GetDifficultyID());
|
||||
if (bind != null)
|
||||
{
|
||||
Contract.Assert(bind.save == pair.Value);
|
||||
Cypher.Assert(bind.save == pair.Value);
|
||||
if (bind.perm && bind.extendState != 0) // permanent and not already expired
|
||||
{
|
||||
// actual promotion in DB already happened in caller
|
||||
@@ -602,7 +601,7 @@ namespace Game.Maps
|
||||
void SetResetTimeFor(uint mapid, Difficulty d, long t)
|
||||
{
|
||||
var key = MathFunctions.MakePair64(mapid, (uint)d);
|
||||
Contract.Assert(m_resetTimeByMapDifficulty.ContainsKey(key));
|
||||
Cypher.Assert(m_resetTimeByMapDifficulty.ContainsKey(key));
|
||||
m_resetTimeByMapDifficulty[key] = t;
|
||||
}
|
||||
|
||||
@@ -662,7 +661,7 @@ namespace Game.Maps
|
||||
Map map = Global.MapMgr.FindMap(GetMapId(), m_instanceid);
|
||||
if (map != null)
|
||||
{
|
||||
Contract.Assert(map.IsDungeon());
|
||||
Cypher.Assert(map.IsDungeon());
|
||||
InstanceScript instanceScript = ((InstanceMap)map).GetInstanceScript();
|
||||
if (instanceScript != null)
|
||||
{
|
||||
|
||||
@@ -23,7 +23,6 @@ using Game.Groups;
|
||||
using Game.Network.Packets;
|
||||
using Game.Scenarios;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Text;
|
||||
|
||||
namespace Game.Maps
|
||||
@@ -157,7 +156,7 @@ namespace Game.Maps
|
||||
{
|
||||
foreach (var data in objectData)
|
||||
{
|
||||
Contract.Assert(!objectInfo.ContainsKey(data.entry));
|
||||
Cypher.Assert(!objectInfo.ContainsKey(data.entry));
|
||||
objectInfo[data.entry] = data.type;
|
||||
}
|
||||
}
|
||||
@@ -216,7 +215,7 @@ namespace Game.Maps
|
||||
|
||||
public BossInfo GetBossInfo(uint id)
|
||||
{
|
||||
Contract.Assert(id < bosses.Count);
|
||||
Cypher.Assert(id < bosses.Count);
|
||||
return bosses[id];
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@ using Game.Garrisons;
|
||||
using Game.Groups;
|
||||
using Game.Scenarios;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Linq;
|
||||
|
||||
namespace Game.Maps
|
||||
@@ -181,13 +180,13 @@ namespace Game.Maps
|
||||
if (entry == null)
|
||||
{
|
||||
Log.outError(LogFilter.Maps, "CreateInstance: no record for map {0}", GetId());
|
||||
Contract.Assert(false);
|
||||
Cypher.Assert(false);
|
||||
}
|
||||
InstanceTemplate iTemplate = Global.ObjectMgr.GetInstanceTemplate(GetId());
|
||||
if (iTemplate == null)
|
||||
{
|
||||
Log.outError(LogFilter.Maps, "CreateInstance: no instance template for map {0}", GetId());
|
||||
Contract.Assert(false);
|
||||
Cypher.Assert(false);
|
||||
}
|
||||
|
||||
// some instances only have one difficulty
|
||||
@@ -196,7 +195,7 @@ namespace Game.Maps
|
||||
Log.outDebug(LogFilter.Maps, "MapInstanced.CreateInstance: {0} map instance {1} for {2} created with difficulty {3}", save != null ? "" : "new ", InstanceId, GetId(), difficulty);
|
||||
|
||||
InstanceMap map = new InstanceMap(GetId(), GetGridExpiry(), InstanceId, difficulty, this);
|
||||
Contract.Assert(map.IsDungeon());
|
||||
Cypher.Assert(map.IsDungeon());
|
||||
|
||||
map.LoadRespawnTimes();
|
||||
map.LoadCorpseData();
|
||||
@@ -222,7 +221,7 @@ namespace Game.Maps
|
||||
Log.outDebug(LogFilter.Maps, "MapInstanced.CreateBattleground: map bg {0} for {1} created.", InstanceId, GetId());
|
||||
|
||||
BattlegroundMap map = new BattlegroundMap(GetId(), (uint)GetGridExpiry(), InstanceId, this, Difficulty.None);
|
||||
Contract.Assert(map.IsBattlegroundOrArena());
|
||||
Cypher.Assert(map.IsBattlegroundOrArena());
|
||||
map.SetBG(bg);
|
||||
bg.SetBgMap(map);
|
||||
|
||||
@@ -236,7 +235,7 @@ namespace Game.Maps
|
||||
lock (_mapLock)
|
||||
{
|
||||
GarrisonMap map = new GarrisonMap(GetId(), GetGridExpiry(), instanceId, this, owner.GetGUID());
|
||||
Contract.Assert(map.IsGarrison());
|
||||
Cypher.Assert(map.IsGarrison());
|
||||
|
||||
m_InstancedMaps[instanceId] = map;
|
||||
return map;
|
||||
|
||||
Reference in New Issue
Block a user