feat(Core): Added ABORT() macro to prevent the usage of ASSERT(false) as a quick hack to crash the core misusing assert (#2273)

This commit is contained in:
Viste
2019-09-26 10:51:34 +03:00
committed by Stoabrogga
parent 58f3cfe387
commit 854b426978
28 changed files with 127 additions and 74 deletions
@@ -228,7 +228,7 @@ namespace MMAP
// if the grid is later reloaded, dtNavMesh::addTile will return error but no extra memory is used // if the grid is later reloaded, dtNavMesh::addTile will return error but no extra memory is used
// we cannot recover from this error - assert out // we cannot recover from this error - assert out
sLog->outError("MMAP:unloadMap: Could not unload %03u%02i%02i.mmtile from navmesh", mapId, x, y); sLog->outError("MMAP:unloadMap: Could not unload %03u%02i%02i.mmtile from navmesh", mapId, x, y);
ASSERT(false); ABORT();
} }
else else
{ {
+44 -9
View File
@@ -6,26 +6,45 @@
#include "Errors.h" #include "Errors.h"
#include <ace/Stack_Trace.h> #include <thread>
#include <ace/OS_NS_unistd.h>
#include <cstdlib> #include <cstdlib>
namespace Trinity { namespace Trinity {
void Assert(char const* file, int line, char const* function, char const* message) void Assert(char const* file, int line, char const* function, char const* message)
{ {
ACE_Stack_Trace st; fprintf(stderr, "\n%s:%i in %s ASSERTION FAILED:\n %s\n",
fprintf(stderr, "\n%s:%i in %s ASSERTION FAILED:\n %s\n%s\n", file, line, function, message);
file, line, function, message, st.c_str());
*((volatile int*)NULL) = 0; *((volatile int*)NULL) = 0;
exit(1); exit(1);
} }
void Fatal(char const* file, int line, char const* function, char const* message) void Assert(char const* file, int line, char const* function, char const* message, char const* format, ...)
{ {
fprintf(stderr, "\n%s:%i in %s FATAL ERROR:\n %s\n", va_list args;
file, line, function, message); va_start(args, format);
ACE_OS::sleep(10);
fprintf(stderr, "\n%s:%i in %s ASSERTION FAILED:\n %s ", file, line, function, message);
vfprintf(stderr, format, args);
fprintf(stderr, "\n");
fflush(stderr);
va_end(args);
*((volatile int*)NULL) = 0;
exit(1);
}
void Fatal(char const* file, int line, char const* function, char const* message, ...)
{
va_list args;
va_start(args, message);
fprintf(stderr, "\n%s:%i in %s FATAL ERROR:\n ", file, line, function);
vfprintf(stderr, message, args);
fprintf(stderr, "\n");
fflush(stderr);
std::this_thread::sleep_for(std::chrono::seconds(10));
*((volatile int*)NULL) = 0; *((volatile int*)NULL) = 0;
exit(1); exit(1);
} }
@@ -44,4 +63,20 @@ void Warning(char const* file, int line, char const* function, char const* messa
file, line, function, message); file, line, function, message);
} }
void Abort(char const* file, int line, char const* function)
{
fprintf(stderr, "\n%s:%i in %s ABORTED.\n",
file, line, function);
*((volatile int*)NULL) = 0;
exit(1);
}
void AbortHandler(int /*sigval*/)
{
// nothing useful to log here, no way to pass args
*((volatile int*)NULL) = 0;
exit(1);
}
} // namespace Trinity } // namespace Trinity
+26 -8
View File
@@ -13,26 +13,44 @@ namespace Trinity
{ {
DECLSPEC_NORETURN void Assert(char const* file, int line, char const* function, char const* message) ATTR_NORETURN; DECLSPEC_NORETURN void Assert(char const* file, int line, char const* function, char const* message) ATTR_NORETURN;
DECLSPEC_NORETURN void Assert(char const* file, int line, char const* function, char const* message, char const* format, ...) ATTR_NORETURN ATTR_PRINTF(5, 6);
DECLSPEC_NORETURN void Fatal(char const* file, int line, char const* function, char const* message) ATTR_NORETURN; DECLSPEC_NORETURN void Fatal(char const* file, int line, char const* function, char const* message, ...) ATTR_NORETURN ATTR_PRINTF(4, 5);
DECLSPEC_NORETURN void Error(char const* file, int line, char const* function, char const* message) ATTR_NORETURN; DECLSPEC_NORETURN void Error(char const* file, int line, char const* function, char const* message) ATTR_NORETURN;
DECLSPEC_NORETURN void Abort(char const* file, int line, char const* function) ATTR_NORETURN;
void Warning(char const* file, int line, char const* function, char const* message); void Warning(char const* file, int line, char const* function, char const* message);
DECLSPEC_NORETURN void AbortHandler(int sigval) ATTR_NORETURN;
} // namespace Trinity } // namespace Trinity
#define WPAssert(cond) do { if (!(cond)) Trinity::Assert(__FILE__, __LINE__, __FUNCTION__, #cond); } while (0) #if COMPILER == COMPILER_MICROSOFT
#define WPFatal(cond, msg) do { if (!(cond)) Trinity::Fatal(__FILE__, __LINE__, __FUNCTION__, (msg)); } while (0) #define ASSERT_BEGIN __pragma(warning(push)) __pragma(warning(disable: 4127))
#define WPError(cond, msg) do { if (!(cond)) Trinity::Error(__FILE__, __LINE__, __FUNCTION__, (msg)); } while (0) #define ASSERT_END __pragma(warning(pop))
#define WPWarning(cond, msg) do { if (!(cond)) Trinity::Warning(__FILE__, __LINE__, __FUNCTION__, (msg)); } while (0) #else
#define ASSERT_BEGIN
#define ASSERT_END
#endif
#define WPAssert(cond, ...) ASSERT_BEGIN do { if (!(cond)) Trinity::Assert(__FILE__, __LINE__, __FUNCTION__, #cond, ##__VA_ARGS__); } while(0) ASSERT_END
#define WPFatal(cond, ...) ASSERT_BEGIN do { if (!(cond)) Trinity::Fatal(__FILE__, __LINE__, __FUNCTION__, ##__VA_ARGS__); } while(0) ASSERT_END
#define WPError(cond, msg) ASSERT_BEGIN do { if (!(cond)) Trinity::Error(__FILE__, __LINE__, __FUNCTION__, (msg)); } while(0) ASSERT_END
#define WPWarning(cond, msg) ASSERT_BEGIN do { if (!(cond)) Trinity::Warning(__FILE__, __LINE__, __FUNCTION__, (msg)); } while(0) ASSERT_END
#define WPAbort() ASSERT_BEGIN do { Trinity::Abort(__FILE__, __LINE__, __FUNCTION__); } while(0) ASSERT_END
#define ASSERT WPAssert #define ASSERT WPAssert
#define ABORT WPAbort
template <typename T> inline T* ASSERT_NOTNULL(T* pointer) template <typename T>
inline T* ASSERT_NOTNULL_IMPL(T* pointer, char const* expr)
{ {
ASSERT(pointer); ASSERT(pointer, "%s", expr);
return pointer; return pointer;
} }
#endif #define ASSERT_NOTNULL(pointer) ASSERT_NOTNULL_IMPL(pointer, #pointer)
#endif
+1 -1
View File
@@ -542,7 +542,7 @@ bool CompareValues(ComparisionType type, T val1, T val2)
return val1 <= val2; return val1 <= val2;
default: default:
// incorrect parameter // incorrect parameter
ASSERT(false); ABORT();
return false; return false;
} }
} }
@@ -1168,7 +1168,7 @@ void Battleground::Init()
if (m_BgInvitedPlayers[TEAM_ALLIANCE] > 0 || m_BgInvitedPlayers[TEAM_HORDE] > 0) if (m_BgInvitedPlayers[TEAM_ALLIANCE] > 0 || m_BgInvitedPlayers[TEAM_HORDE] > 0)
{ {
sLog->outError("Battleground::Reset: one of the counters is not 0 (alliance: %u, horde: %u) for BG (map: %u, instance id: %u)!", m_BgInvitedPlayers[TEAM_ALLIANCE], m_BgInvitedPlayers[TEAM_HORDE], m_MapId, m_InstanceID); sLog->outError("Battleground::Reset: one of the counters is not 0 (alliance: %u, horde: %u) for BG (map: %u, instance id: %u)!", m_BgInvitedPlayers[TEAM_ALLIANCE], m_BgInvitedPlayers[TEAM_HORDE], m_MapId, m_InstanceID);
ASSERT(false); ABORT();
} }
m_BgInvitedPlayers[TEAM_ALLIANCE] = 0; m_BgInvitedPlayers[TEAM_ALLIANCE] = 0;
@@ -1024,7 +1024,7 @@ void RandomBattlegroundSystem::Update(uint32 diff)
case BATTLEGROUND_EY: m_SwitchTimer = 40*IN_MILLISECONDS; break; // max 15 per team case BATTLEGROUND_EY: m_SwitchTimer = 40*IN_MILLISECONDS; break; // max 15 per team
case BATTLEGROUND_AB: m_SwitchTimer = 40*IN_MILLISECONDS; break; // max 15 per team case BATTLEGROUND_AB: m_SwitchTimer = 40*IN_MILLISECONDS; break; // max 15 per team
case BATTLEGROUND_SA: m_SwitchTimer = 40*IN_MILLISECONDS; break; // max 15 per team case BATTLEGROUND_SA: m_SwitchTimer = 40*IN_MILLISECONDS; break; // max 15 per team
default: ASSERT(false); break; default: ABORT(); break;
} }
} }
else else
@@ -265,7 +265,7 @@ void BattlegroundQueue::RemovePlayer(uint64 guid, bool sentToBg, uint32 playerQu
QueuedPlayersMap::iterator itr = m_QueuedPlayers.find(guid); QueuedPlayersMap::iterator itr = m_QueuedPlayers.find(guid);
if (itr == m_QueuedPlayers.end()) if (itr == m_QueuedPlayers.end())
{ {
ASSERT(false); ABORT();
return; return;
} }
@@ -286,7 +286,7 @@ void BattlegroundQueue::RemovePlayer(uint64 guid, bool sentToBg, uint32 playerQu
//player can't be in queue without group, but just in case //player can't be in queue without group, but just in case
if (group_itr == m_QueuedGroups[_bracketId][_groupType].end()) if (group_itr == m_QueuedGroups[_bracketId][_groupType].end())
{ {
ASSERT(false); ABORT();
return; return;
} }
@@ -842,7 +842,7 @@ BG_AV_Nodes BattlegroundAV::GetNodeThroughObject(uint32 object)
if (object == BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE) if (object == BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE)
return BG_AV_NODES_SNOWFALL_GRAVE; return BG_AV_NODES_SNOWFALL_GRAVE;
sLog->outError("BattlegroundAV: ERROR! GetPlace got a wrong object :("); sLog->outError("BattlegroundAV: ERROR! GetPlace got a wrong object :(");
ASSERT(false); ABORT();
return BG_AV_Nodes(0); return BG_AV_Nodes(0);
} }
@@ -882,7 +882,7 @@ uint32 BattlegroundAV::GetObjectThroughNode(BG_AV_Nodes node)
else if (m_Nodes[node].OwnerId == TEAM_NEUTRAL) else if (m_Nodes[node].OwnerId == TEAM_NEUTRAL)
return BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE; return BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE;
sLog->outError("BattlegroundAV: Error! GetPlaceNode couldn't resolve node %i", node); sLog->outError("BattlegroundAV: Error! GetPlaceNode couldn't resolve node %i", node);
ASSERT(false); ABORT();
return 0; return 0;
} }
@@ -1464,22 +1464,22 @@ void BattlegroundAV::AssaultNode(BG_AV_Nodes node, TeamId teamId)
if (m_Nodes[node].TotalOwnerId == teamId) if (m_Nodes[node].TotalOwnerId == teamId)
{ {
sLog->outCrash("Assaulting team is TotalOwner of node"); sLog->outCrash("Assaulting team is TotalOwner of node");
ASSERT(false); ABORT();
} }
if (m_Nodes[node].OwnerId == teamId) if (m_Nodes[node].OwnerId == teamId)
{ {
sLog->outCrash("Assaulting team is owner of node"); sLog->outCrash("Assaulting team is owner of node");
ASSERT(false); ABORT();
} }
if (m_Nodes[node].State == POINT_DESTROYED) if (m_Nodes[node].State == POINT_DESTROYED)
{ {
sLog->outCrash("Destroyed node is being assaulted"); sLog->outCrash("Destroyed node is being assaulted");
ASSERT(false); ABORT();
} }
if (m_Nodes[node].State == POINT_ASSAULTED && m_Nodes[node].TotalOwnerId != TEAM_NEUTRAL) //only assault an assaulted node if no totalowner exists if (m_Nodes[node].State == POINT_ASSAULTED && m_Nodes[node].TotalOwnerId != TEAM_NEUTRAL) //only assault an assaulted node if no totalowner exists
{ {
sLog->outCrash("Assault on an not assaulted node with total owner"); sLog->outCrash("Assault on an not assaulted node with total owner");
ASSERT(false); ABORT();
} }
//the timer gets another time, if the previous owner was 0 == Neutral //the timer gets another time, if the previous owner was 0 == Neutral
m_Nodes[node].Timer = (m_Nodes[node].PrevOwnerId != TEAM_NEUTRAL)? BG_AV_CAPTIME : BG_AV_SNOWFALL_FIRSTCAP; m_Nodes[node].Timer = (m_Nodes[node].PrevOwnerId != TEAM_NEUTRAL)? BG_AV_CAPTIME : BG_AV_SNOWFALL_FIRSTCAP;
@@ -825,7 +825,7 @@ bool BattlegroundSA::CanInteractWithObject(uint32 objectId)
return false; return false;
break; break;
default: default:
ASSERT(false); ABORT();
break; break;
} }
@@ -988,7 +988,7 @@ void BattlegroundSA::CaptureGraveyard(BG_SA_Graveyards i, Player *Source)
SendWarningToAll(LANG_BG_SA_H_GY_SOUTH); SendWarningToAll(LANG_BG_SA_H_GY_SOUTH);
break; break;
default: default:
ASSERT(false); ABORT();
break; break;
}; };
} }
@@ -389,7 +389,7 @@ void Puppet::InitSummon()
else else
{ {
sLog->outMisc("Puppet::InitSummon (B1)"); sLog->outMisc("Puppet::InitSummon (B1)");
//ASSERT(false); // ZOMG! //ABORT(); // ZOMG!
} }
} }
} }
@@ -700,7 +700,7 @@ class GameObject : public WorldObject, public GridObject<GameObject>, public Mov
// Owner already found and different than expected owner - remove object from old owner // Owner already found and different than expected owner - remove object from old owner
if (owner && GetOwnerGUID() && GetOwnerGUID() != owner) if (owner && GetOwnerGUID() && GetOwnerGUID() != owner)
{ {
ASSERT(false); ABORT();
} }
m_spawnedByDefault = false; // all object with owner is despawned after delay m_spawnedByDefault = false; // all object with owner is despawned after delay
SetUInt64Value(OBJECT_FIELD_CREATED_BY, owner); SetUInt64Value(OBJECT_FIELD_CREATED_BY, owner);
+1 -1
View File
@@ -1036,7 +1036,7 @@ Item* Item::CreateItem(uint32 item, uint32 count, Player const* player)
delete pItem; delete pItem;
} }
else else
ASSERT(false); ABORT();
return NULL; return NULL;
} }
+4 -4
View File
@@ -92,7 +92,7 @@ WorldObject::~WorldObject()
if (GetTypeId() == TYPEID_CORPSE) if (GetTypeId() == TYPEID_CORPSE)
{ {
sLog->outCrash("Object::~Object Corpse guid=" UI64FMTD ", type=%d, entry=%u deleted but still in map!!", GetGUID(), ((Corpse*)this)->GetType(), GetEntry()); sLog->outCrash("Object::~Object Corpse guid=" UI64FMTD ", type=%d, entry=%u deleted but still in map!!", GetGUID(), ((Corpse*)this)->GetType(), GetEntry());
ASSERT(false); ABORT();
} }
ResetMap(); ResetMap();
} }
@@ -105,14 +105,14 @@ Object::~Object()
sLog->outCrash("Object::~Object - guid=" UI64FMTD ", typeid=%d, entry=%u deleted but still in world!!", GetGUID(), GetTypeId(), GetEntry()); sLog->outCrash("Object::~Object - guid=" UI64FMTD ", typeid=%d, entry=%u deleted but still in world!!", GetGUID(), GetTypeId(), GetEntry());
if (isType(TYPEMASK_ITEM)) if (isType(TYPEMASK_ITEM))
sLog->outCrash("Item slot %u", ((Item*)this)->GetSlot()); sLog->outCrash("Item slot %u", ((Item*)this)->GetSlot());
ASSERT(false); ABORT();
RemoveFromWorld(); RemoveFromWorld();
} }
if (m_objectUpdated) if (m_objectUpdated)
{ {
sLog->outCrash("Object::~Object - guid=" UI64FMTD ", typeid=%d, entry=%u deleted but still in update list!!", GetGUID(), GetTypeId(), GetEntry()); sLog->outCrash("Object::~Object - guid=" UI64FMTD ", typeid=%d, entry=%u deleted but still in update list!!", GetGUID(), GetTypeId(), GetEntry());
ASSERT(false); ABORT();
sObjectAccessor->RemoveUpdateObject(this); sObjectAccessor->RemoveUpdateObject(this);
} }
@@ -2059,7 +2059,7 @@ void WorldObject::SetMap(Map* map)
if (m_currMap) if (m_currMap)
{ {
sLog->outCrash("WorldObject::SetMap: obj %u new map %u %u, old map %u %u", (uint32)GetTypeId(), map->GetId(), map->GetInstanceId(), m_currMap->GetId(), m_currMap->GetInstanceId()); sLog->outCrash("WorldObject::SetMap: obj %u new map %u %u, old map %u %u", (uint32)GetTypeId(), map->GetId(), map->GetInstanceId(), m_currMap->GetId(), m_currMap->GetInstanceId());
ASSERT(false); ABORT();
} }
m_currMap = map; m_currMap = map;
m_mapId = map->GetId(); m_mapId = map->GetId();
+2 -2
View File
@@ -180,11 +180,11 @@ class Pet : public Guardian
private: private:
void SaveToDB(uint32, uint8, uint32) // override of Creature::SaveToDB - must not be called void SaveToDB(uint32, uint8, uint32) // override of Creature::SaveToDB - must not be called
{ {
ASSERT(false); ABORT();
} }
void DeleteFromDB() // override of Creature::DeleteFromDB - must not be called void DeleteFromDB() // override of Creature::DeleteFromDB - must not be called
{ {
ASSERT(false); ABORT();
} }
}; };
#endif #endif
+4 -4
View File
@@ -3890,7 +3890,7 @@ bool Player::_addSpell(uint32 spellId, uint8 addSpecMask, bool temporary)
{ {
sLog->outString("TRYING TO LEARN SPELL WITH EFFECT LEARN: %u, PLAYER: %u", spellId, GetGUIDLow()); sLog->outString("TRYING TO LEARN SPELL WITH EFFECT LEARN: %u, PLAYER: %u", spellId, GetGUIDLow());
return false; return false;
//ASSERT(false); //ABORT();
} }
else if (const SpellInfo* learnSpell = sSpellMgr->GetSpellInfo(spellInfo->Effects[i].TriggerSpell)) else if (const SpellInfo* learnSpell = sSpellMgr->GetSpellInfo(spellInfo->Effects[i].TriggerSpell))
_addSpell(learnSpell->Id, SPEC_MASK_ALL, true); _addSpell(learnSpell->Id, SPEC_MASK_ALL, true);
@@ -3943,7 +3943,7 @@ bool Player::_addSpell(uint32 spellId, uint8 addSpecMask, bool temporary)
sLog->outString("TRYING TO LEARN SPELL WITH EFFECT LEARN 2: %u, PLAYER: %u", spellId, GetGUIDLow()); sLog->outString("TRYING TO LEARN SPELL WITH EFFECT LEARN 2: %u, PLAYER: %u", spellId, GetGUIDLow());
m_spells.erase(spellInfo->Id); // mem leak, but should never happen m_spells.erase(spellInfo->Id); // mem leak, but should never happen
return false; return false;
//ASSERT(false); //ABORT();
} }
// pussywizard: cast passive spells (including all talents without SPELL_EFFECT_LEARN_SPELL) with additional checks // pussywizard: cast passive spells (including all talents without SPELL_EFFECT_LEARN_SPELL) with additional checks
else if (spellInfo->IsPassive() || (spellInfo->HasAttribute(SPELL_ATTR0_HIDDEN_CLIENTSIDE) && spellInfo->Stances)) else if (spellInfo->IsPassive() || (spellInfo->HasAttribute(SPELL_ATTR0_HIDDEN_CLIENTSIDE) && spellInfo->Stances))
@@ -20905,7 +20905,7 @@ void Player::StopCastingCharm()
if (charm->GetCharmerGUID()) if (charm->GetCharmerGUID())
{ {
sLog->outCrash("Charmed unit has charmer guid " UI64FMTD, charm->GetCharmerGUID()); sLog->outCrash("Charmed unit has charmer guid " UI64FMTD, charm->GetCharmerGUID());
ASSERT(false); ABORT();
} }
else else
SetCharm(charm, false); SetCharm(charm, false);
@@ -24521,7 +24521,7 @@ void Player::SetBattlegroundOrBattlefieldRaid(Group *group, int8 subgroup)
if (GetGroup() && (GetGroup()->isBGGroup() || GetGroup()->isBFGroup())) if (GetGroup() && (GetGroup()->isBGGroup() || GetGroup()->isBFGroup()))
{ {
sLog->outMisc("Player::SetBattlegroundOrBattlefieldRaid - current group is %s group!", (GetGroup()->isBGGroup() ? "BG" : "BF")); sLog->outMisc("Player::SetBattlegroundOrBattlefieldRaid - current group is %s group!", (GetGroup()->isBGGroup() ? "BG" : "BF"));
//ASSERT(false); // pussywizard: origanal group can never be bf/bg group //ABORT(); // pussywizard: origanal group can never be bf/bg group
} }
SetOriginalGroup(GetGroup(), GetSubGroup()); SetOriginalGroup(GetGroup(), GetSubGroup());
+7 -7
View File
@@ -4052,7 +4052,7 @@ void Unit::_UnapplyAura(AuraApplication * aurApp, AuraRemoveMode removeMode)
else else
++iter; ++iter;
} }
ASSERT(false); ABORT();
} }
void Unit::_RemoveNoStackAurasDueToAura(Aura* aura) void Unit::_RemoveNoStackAurasDueToAura(Aura* aura)
@@ -4145,7 +4145,7 @@ void Unit::RemoveOwnedAura(Aura* aura, AuraRemoveMode removeMode)
} }
} }
ASSERT(false); ABORT();
} }
Aura* Unit::GetOwnedAura(uint32 spellId, uint64 casterGUID, uint64 itemCasterGUID, uint8 reqEffMask, Aura* except) const Aura* Unit::GetOwnedAura(uint32 spellId, uint64 casterGUID, uint64 itemCasterGUID, uint8 reqEffMask, Aura* except) const
@@ -9895,7 +9895,7 @@ void Unit::SetMinion(Minion *minion, bool apply)
{ {
OutDebugInfo(); OutDebugInfo();
(*itr)->OutDebugInfo(); (*itr)->OutDebugInfo();
ASSERT(false); ABORT();
} }
ASSERT((*itr)->GetTypeId() == TYPEID_UNIT); ASSERT((*itr)->GetTypeId() == TYPEID_UNIT);
@@ -14377,7 +14377,7 @@ void Unit::RemoveFromWorld()
if (GetCharmerGUID()) if (GetCharmerGUID())
{ {
sLog->outCrash("Unit %u has charmer guid when removed from world", GetEntry()); sLog->outCrash("Unit %u has charmer guid when removed from world", GetEntry());
ASSERT(false); ABORT();
} }
if (Unit* owner = GetOwner()) if (Unit* owner = GetOwner())
@@ -14387,7 +14387,7 @@ void Unit::RemoveFromWorld()
if (HasUnitTypeMask(UNIT_MASK_MINION|UNIT_MASK_GUARDIAN)) if (HasUnitTypeMask(UNIT_MASK_MINION|UNIT_MASK_GUARDIAN))
owner->SetMinion((Minion*)this, false); owner->SetMinion((Minion*)this, false);
sLog->outString("Unit %u is in controlled list of %u when removed from world", GetEntry(), owner->GetEntry()); sLog->outString("Unit %u is in controlled list of %u when removed from world", GetEntry(), owner->GetEntry());
//ASSERT(false); //ABORT();
} }
} }
@@ -17151,7 +17151,7 @@ void Unit::RemoveCharmedBy(Unit* charmer)
{ {
// sLog->outCrash("Unit::RemoveCharmedBy: this: " UI64FMTD " true charmer: " UI64FMTD " false charmer: " UI64FMTD, // sLog->outCrash("Unit::RemoveCharmedBy: this: " UI64FMTD " true charmer: " UI64FMTD " false charmer: " UI64FMTD,
// GetGUID(), GetCharmerGUID(), charmer->GetGUID()); // GetGUID(), GetCharmerGUID(), charmer->GetGUID());
// ASSERT(false); // ABORT();
return; return;
} }
@@ -18260,7 +18260,7 @@ void Unit::ChangeSeat(int8 seatId, bool next)
m_vehicle->RemovePassenger(this); m_vehicle->RemovePassenger(this);
if (!m_vehicle->AddPassenger(this, seatId)) if (!m_vehicle->AddPassenger(this, seatId))
ASSERT(false); ABORT();
} }
void Unit::ExitVehicle(Position const* /*exitPosition*/) void Unit::ExitVehicle(Position const* /*exitPosition*/)
+1 -1
View File
@@ -1327,7 +1327,7 @@ class SafeUnitPointer
{ {
public: public:
explicit SafeUnitPointer(Unit* defVal) : ptr(defVal), defaultValue(defVal) {} explicit SafeUnitPointer(Unit* defVal) : ptr(defVal), defaultValue(defVal) {}
SafeUnitPointer(const SafeUnitPointer& /*p*/) { ASSERT(false); } SafeUnitPointer(const SafeUnitPointer& /*p*/) { ABORT(); }
void Initialize(Unit* defVal) { defaultValue = defVal; ptr = defVal; } void Initialize(Unit* defVal) { defaultValue = defVal; ptr = defVal; }
~SafeUnitPointer(); ~SafeUnitPointer();
void SetPointedTo(Unit* u); void SetPointedTo(Unit* u);
+1 -1
View File
@@ -390,7 +390,7 @@ bool Vehicle::AddPassenger(Unit* unit, int8 seatId)
try try
{ {
if (!_me->SetCharmedBy(unit, CHARM_TYPE_VEHICLE)) if (!_me->SetCharmedBy(unit, CHARM_TYPE_VEHICLE))
ASSERT(false); ABORT();
} }
catch (...) catch (...)
{ {
@@ -1331,7 +1331,7 @@ void WorldSession::HandlePlayerLoginToCharInWorld(Player* pCurrChar)
void WorldSession::HandlePlayerLoginToCharOutOfWorld(Player* /*pCurrChar*/) void WorldSession::HandlePlayerLoginToCharOutOfWorld(Player* /*pCurrChar*/)
{ {
ASSERT(false); ABORT();
} }
void WorldSession::HandleSetFactionAtWar(WorldPacket& recvData) void WorldSession::HandleSetFactionAtWar(WorldPacket& recvData)
+4 -4
View File
@@ -2283,7 +2283,7 @@ inline void Map::setNGrid(NGridType *grid, uint32 x, uint32 y)
if (x >= MAX_NUMBER_OF_GRIDS || y >= MAX_NUMBER_OF_GRIDS) if (x >= MAX_NUMBER_OF_GRIDS || y >= MAX_NUMBER_OF_GRIDS)
{ {
sLog->outError("map::setNGrid() Invalid grid coordinates found: %d, %d!", x, y); sLog->outError("map::setNGrid() Invalid grid coordinates found: %d, %d!", x, y);
ASSERT(false); ABORT();
} }
i_grids[x][y] = grid; i_grids[x][y] = grid;
} }
@@ -2328,7 +2328,7 @@ void Map::AddObjectToSwitchList(WorldObject* obj, bool on)
else if (itr->second != on) else if (itr->second != on)
i_objectsToSwitch.erase(itr); i_objectsToSwitch.erase(itr);
else else
ASSERT(false); ABORT();
} }
void Map::RemoveAllObjectsInRemoveList() void Map::RemoveAllObjectsInRemoveList()
@@ -2539,7 +2539,7 @@ bool InstanceMap::CanEnter(Player* player, bool loginCheck)
if (!loginCheck && player->GetMapRef().getTarget() == this) if (!loginCheck && player->GetMapRef().getTarget() == this)
{ {
sLog->outError("InstanceMap::CanEnter - player %s(%u) already in map %d, %d, %d!", player->GetName().c_str(), player->GetGUIDLow(), GetId(), GetInstanceId(), GetSpawnMode()); sLog->outError("InstanceMap::CanEnter - player %s(%u) already in map %d, %d, %d!", player->GetName().c_str(), player->GetGUIDLow(), GetId(), GetInstanceId(), GetSpawnMode());
ASSERT(false); ABORT();
return false; return false;
} }
@@ -2893,7 +2893,7 @@ bool BattlegroundMap::CanEnter(Player* player, bool loginCheck)
if (!loginCheck && player->GetMapRef().getTarget() == this) if (!loginCheck && player->GetMapRef().getTarget() == this)
{ {
sLog->outError("BGMap::CanEnter - player %u is already in map!", player->GetGUIDLow()); sLog->outError("BGMap::CanEnter - player %u is already in map!", player->GetGUIDLow());
ASSERT(false); ABORT();
return false; return false;
} }
+3 -3
View File
@@ -182,13 +182,13 @@ InstanceMap* MapInstanced::CreateInstance(uint32 InstanceId, InstanceSave* save,
if (!entry) if (!entry)
{ {
sLog->outError("CreateInstance: no entry for map %d", GetId()); sLog->outError("CreateInstance: no entry for map %d", GetId());
ASSERT(false); ABORT();
} }
const InstanceTemplate* iTemplate = sObjectMgr->GetInstanceTemplate(GetId()); const InstanceTemplate* iTemplate = sObjectMgr->GetInstanceTemplate(GetId());
if (!iTemplate) if (!iTemplate)
{ {
sLog->outError("CreateInstance: no instance template for map %d", GetId()); sLog->outError("CreateInstance: no instance template for map %d", GetId());
ASSERT(false); ABORT();
} }
// some instances only have one difficulty // some instances only have one difficulty
@@ -272,6 +272,6 @@ bool MapInstanced::DestroyInstance(InstancedMaps::iterator &itr)
bool MapInstanced::CanEnter(Player* /*player*/, bool /*loginCheck*/) bool MapInstanced::CanEnter(Player* /*player*/, bool /*loginCheck*/)
{ {
//ASSERT(false); //ABORT();
return true; return true;
} }
+1 -1
View File
@@ -71,7 +71,7 @@ protected:
typedef void (SplineBase::*InitMethtod)(const Vector3*, index_type, bool, index_type); typedef void (SplineBase::*InitMethtod)(const Vector3*, index_type, bool, index_type);
static InitMethtod initializers[ModesEnd]; static InitMethtod initializers[ModesEnd];
void UninitializedSpline() const { ASSERT(false);} void UninitializedSpline() const { ABORT();}
public: public:
+2 -2
View File
@@ -127,7 +127,7 @@ class ScriptRegistry
sLog->outError("Script '%s' already assigned with the same script name, so the script can't work.", sLog->outError("Script '%s' already assigned with the same script name, so the script can't work.",
script->GetName().c_str()); script->GetName().c_str());
ASSERT(false); // Error that should be fixed ASAP. ABORT(); // Error that should be fixed ASAP.
} }
} }
else else
@@ -1120,7 +1120,7 @@ bool ScriptMgr::OnAreaTrigger(Player* player, AreaTrigger const* trigger)
Battleground* ScriptMgr::CreateBattleground(BattlegroundTypeId /*typeId*/) Battleground* ScriptMgr::CreateBattleground(BattlegroundTypeId /*typeId*/)
{ {
// TODO: Implement script-side battlegrounds. // TODO: Implement script-side battlegrounds.
ASSERT(false); ABORT();
return NULL; return NULL;
} }
+1 -1
View File
@@ -1608,7 +1608,7 @@ class ScriptRegistry
sLog->outError("Script '%s' already assigned with the same script name, so the script can't work.", sLog->outError("Script '%s' already assigned with the same script name, so the script can't work.",
script->GetName().c_str()); script->GetName().c_str());
ASSERT(false); // Error that should be fixed ASAP. ABORT(); // Error that should be fixed ASAP.
} }
} }
else else
+5 -5
View File
@@ -384,7 +384,7 @@ Aura* Aura::Create(SpellInfo const* spellproto, uint8 effMask, WorldObject* owne
aura = new DynObjAura(spellproto, effMask, owner, caster, baseAmount, castItem, casterGUID); aura = new DynObjAura(spellproto, effMask, owner, caster, baseAmount, castItem, casterGUID);
break; break;
default: default:
ASSERT(false); ABORT();
return NULL; return NULL;
} }
// aura can be removed in Unit::_AddAura call // aura can be removed in Unit::_AddAura call
@@ -498,7 +498,7 @@ void Aura::_UnapplyForTarget(Unit* target, Unit* caster, AuraApplication * auraA
{ {
sLog->outError("Aura::_UnapplyForTarget, target:%u, caster:%u, spell:%u was not found in owners application map!", sLog->outError("Aura::_UnapplyForTarget, target:%u, caster:%u, spell:%u was not found in owners application map!",
target->GetGUIDLow(), caster ? caster->GetGUIDLow() : 0, auraApp->GetBase()->GetSpellInfo()->Id); target->GetGUIDLow(), caster ? caster->GetGUIDLow() : 0, auraApp->GetBase()->GetSpellInfo()->Id);
ASSERT(false); ABORT();
} }
// aura has to be already applied // aura has to be already applied
@@ -594,7 +594,7 @@ void Aura::UpdateTargetMap(Unit* caster, bool apply)
else else
{ {
// ok, we have one unit twice in target map (impossible, but...) // ok, we have one unit twice in target map (impossible, but...)
ASSERT(false); ABORT();
} }
} }
@@ -662,7 +662,7 @@ void Aura::UpdateTargetMap(Unit* caster, bool apply)
sLog->outCrash("Aura %u: Owner %s (map %u) is not in the same map as target %s (map %u).", GetSpellInfo()->Id, sLog->outCrash("Aura %u: Owner %s (map %u) is not in the same map as target %s (map %u).", GetSpellInfo()->Id,
GetOwner()->GetName().c_str(), GetOwner()->IsInWorld() ? GetOwner()->GetMap()->GetId() : uint32(-1), GetOwner()->GetName().c_str(), GetOwner()->IsInWorld() ? GetOwner()->GetMap()->GetId() : uint32(-1),
itr->first->GetName().c_str(), itr->first->IsInWorld() ? itr->first->GetMap()->GetId() : uint32(-1)); itr->first->GetName().c_str(), itr->first->IsInWorld() ? itr->first->GetMap()->GetId() : uint32(-1));
ASSERT(false); ABORT();
} }
itr->first->_CreateAuraApplication(this, itr->second); itr->first->_CreateAuraApplication(this, itr->second);
++itr; ++itr;
@@ -715,7 +715,7 @@ void Aura::UpdateOwner(uint32 diff, WorldObject* owner)
{ {
if (owner != m_owner) if (owner != m_owner)
{ {
ASSERT(false); ABORT();
} }
Unit* caster = GetCaster(); Unit* caster = GetCaster();
+2 -2
View File
@@ -7595,7 +7595,7 @@ SpellEvent::~SpellEvent()
{ {
sLog->outError("~SpellEvent: %s %u tried to delete non-deletable spell %u. Was not deleted, causes memory leak.", sLog->outError("~SpellEvent: %s %u tried to delete non-deletable spell %u. Was not deleted, causes memory leak.",
(m_Spell->GetCaster()->GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature"), m_Spell->GetCaster()->GetGUIDLow(), m_Spell->m_spellInfo->Id); (m_Spell->GetCaster()->GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature"), m_Spell->GetCaster()->GetGUIDLow(), m_Spell->m_spellInfo->Id);
ASSERT(false); ABORT();
} }
} }
@@ -8093,7 +8093,7 @@ bool Spell::CallScriptEffectHandlers(SpellEffIndex effIndex, SpellEffectHandleMo
hookType = SPELL_SCRIPT_HOOK_EFFECT_HIT_TARGET; hookType = SPELL_SCRIPT_HOOK_EFFECT_HIT_TARGET;
break; break;
default: default:
ASSERT(false); ABORT();
return false; return false;
} }
(*scritr)->_PrepareScriptCall(hookType); (*scritr)->_PrepareScriptCall(hookType);
+1 -1
View File
@@ -99,7 +99,7 @@ public:
else if (getMSTimeDiff(_lastChange, curtime) > _delayTime) else if (getMSTimeDiff(_lastChange, curtime) > _delayTime)
{ {
sLog->outString("World Thread hangs, kicking out server!"); sLog->outString("World Thread hangs, kicking out server!");
ASSERT(false); ABORT();
} }
ACORE::Thread::Sleep(1000); ACORE::Thread::Sleep(1000);
+1 -1
View File
@@ -64,7 +64,7 @@ void MPQManager::InitializeDBC()
if (BaseLocale == -1) if (BaseLocale == -1)
{ {
printf("No locale data detected. Please make sure that the executable is in the same folder as your WoW installation.\n"); printf("No locale data detected. Please make sure that the executable is in the same folder as your WoW installation.\n");
ASSERT(false); ABORT();
} }
else else
printf("Using default locale: %s\n", Languages[BaseLocale]); printf("Using default locale: %s\n", Languages[BaseLocale]);