diff --git a/src/common/Collision/Management/MMapManager.cpp b/src/common/Collision/Management/MMapManager.cpp index 3c933d47c..5d7b6d241 100644 --- a/src/common/Collision/Management/MMapManager.cpp +++ b/src/common/Collision/Management/MMapManager.cpp @@ -228,7 +228,7 @@ namespace MMAP // 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 sLog->outError("MMAP:unloadMap: Could not unload %03u%02i%02i.mmtile from navmesh", mapId, x, y); - ASSERT(false); + ABORT(); } else { diff --git a/src/common/Debugging/Errors.cpp b/src/common/Debugging/Errors.cpp index 6af5309d8..a455b06a3 100644 --- a/src/common/Debugging/Errors.cpp +++ b/src/common/Debugging/Errors.cpp @@ -6,26 +6,45 @@ #include "Errors.h" -#include -#include +#include #include namespace Trinity { 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%s\n", - file, line, function, message, st.c_str()); + fprintf(stderr, "\n%s:%i in %s ASSERTION FAILED:\n %s\n", + file, line, function, message); *((volatile int*)NULL) = 0; 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", - file, line, function, message); - ACE_OS::sleep(10); + va_list args; + va_start(args, format); + + 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; exit(1); } @@ -44,4 +63,20 @@ void Warning(char const* file, int line, char const* function, char const* messa 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 diff --git a/src/common/Debugging/Errors.h b/src/common/Debugging/Errors.h index 51937fadd..54f2aac0c 100644 --- a/src/common/Debugging/Errors.h +++ b/src/common/Debugging/Errors.h @@ -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, 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 Abort(char const* file, int line, char const* function) ATTR_NORETURN; + void Warning(char const* file, int line, char const* function, char const* message); + DECLSPEC_NORETURN void AbortHandler(int sigval) ATTR_NORETURN; + } // namespace Trinity -#define WPAssert(cond) do { if (!(cond)) Trinity::Assert(__FILE__, __LINE__, __FUNCTION__, #cond); } while (0) -#define WPFatal(cond, msg) do { if (!(cond)) Trinity::Fatal(__FILE__, __LINE__, __FUNCTION__, (msg)); } while (0) -#define WPError(cond, msg) do { if (!(cond)) Trinity::Error(__FILE__, __LINE__, __FUNCTION__, (msg)); } while (0) -#define WPWarning(cond, msg) do { if (!(cond)) Trinity::Warning(__FILE__, __LINE__, __FUNCTION__, (msg)); } while (0) +#if COMPILER == COMPILER_MICROSOFT +#define ASSERT_BEGIN __pragma(warning(push)) __pragma(warning(disable: 4127)) +#define ASSERT_END __pragma(warning(pop)) +#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 ABORT WPAbort -template inline T* ASSERT_NOTNULL(T* pointer) +template +inline T* ASSERT_NOTNULL_IMPL(T* pointer, char const* expr) { - ASSERT(pointer); + ASSERT(pointer, "%s", expr); return pointer; } -#endif +#define ASSERT_NOTNULL(pointer) ASSERT_NOTNULL_IMPL(pointer, #pointer) + +#endif \ No newline at end of file diff --git a/src/common/Utilities/Util.h b/src/common/Utilities/Util.h index 11bbc4f67..ad225f934 100644 --- a/src/common/Utilities/Util.h +++ b/src/common/Utilities/Util.h @@ -542,7 +542,7 @@ bool CompareValues(ComparisionType type, T val1, T val2) return val1 <= val2; default: // incorrect parameter - ASSERT(false); + ABORT(); return false; } } diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp index 59263a2a9..d822517db 100644 --- a/src/server/game/Battlegrounds/Battleground.cpp +++ b/src/server/game/Battlegrounds/Battleground.cpp @@ -1168,7 +1168,7 @@ void Battleground::Init() 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); - ASSERT(false); + ABORT(); } m_BgInvitedPlayers[TEAM_ALLIANCE] = 0; diff --git a/src/server/game/Battlegrounds/BattlegroundMgr.cpp b/src/server/game/Battlegrounds/BattlegroundMgr.cpp index 0d2754b91..c8e3639b7 100644 --- a/src/server/game/Battlegrounds/BattlegroundMgr.cpp +++ b/src/server/game/Battlegrounds/BattlegroundMgr.cpp @@ -1024,7 +1024,7 @@ void RandomBattlegroundSystem::Update(uint32 diff) 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_SA: m_SwitchTimer = 40*IN_MILLISECONDS; break; // max 15 per team - default: ASSERT(false); break; + default: ABORT(); break; } } else diff --git a/src/server/game/Battlegrounds/BattlegroundQueue.cpp b/src/server/game/Battlegrounds/BattlegroundQueue.cpp index 1ec75c957..406ce1a87 100644 --- a/src/server/game/Battlegrounds/BattlegroundQueue.cpp +++ b/src/server/game/Battlegrounds/BattlegroundQueue.cpp @@ -265,7 +265,7 @@ void BattlegroundQueue::RemovePlayer(uint64 guid, bool sentToBg, uint32 playerQu QueuedPlayersMap::iterator itr = m_QueuedPlayers.find(guid); if (itr == m_QueuedPlayers.end()) { - ASSERT(false); + ABORT(); 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 if (group_itr == m_QueuedGroups[_bracketId][_groupType].end()) { - ASSERT(false); + ABORT(); return; } diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp index 67c01114a..c6e57d65a 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp @@ -842,7 +842,7 @@ BG_AV_Nodes BattlegroundAV::GetNodeThroughObject(uint32 object) if (object == BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE) return BG_AV_NODES_SNOWFALL_GRAVE; sLog->outError("BattlegroundAV: ERROR! GetPlace got a wrong object :("); - ASSERT(false); + ABORT(); return BG_AV_Nodes(0); } @@ -882,7 +882,7 @@ uint32 BattlegroundAV::GetObjectThroughNode(BG_AV_Nodes node) else if (m_Nodes[node].OwnerId == TEAM_NEUTRAL) return BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE; sLog->outError("BattlegroundAV: Error! GetPlaceNode couldn't resolve node %i", node); - ASSERT(false); + ABORT(); return 0; } @@ -1464,22 +1464,22 @@ void BattlegroundAV::AssaultNode(BG_AV_Nodes node, TeamId teamId) if (m_Nodes[node].TotalOwnerId == teamId) { sLog->outCrash("Assaulting team is TotalOwner of node"); - ASSERT(false); + ABORT(); } if (m_Nodes[node].OwnerId == teamId) { sLog->outCrash("Assaulting team is owner of node"); - ASSERT(false); + ABORT(); } if (m_Nodes[node].State == POINT_DESTROYED) { 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 { 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 m_Nodes[node].Timer = (m_Nodes[node].PrevOwnerId != TEAM_NEUTRAL)? BG_AV_CAPTIME : BG_AV_SNOWFALL_FIRSTCAP; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp index b28340a9c..56fb3778b 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp @@ -825,7 +825,7 @@ bool BattlegroundSA::CanInteractWithObject(uint32 objectId) return false; break; default: - ASSERT(false); + ABORT(); break; } @@ -988,7 +988,7 @@ void BattlegroundSA::CaptureGraveyard(BG_SA_Graveyards i, Player *Source) SendWarningToAll(LANG_BG_SA_H_GY_SOUTH); break; default: - ASSERT(false); + ABORT(); break; }; } diff --git a/src/server/game/Entities/Creature/TemporarySummon.cpp b/src/server/game/Entities/Creature/TemporarySummon.cpp index 832aeb93f..989aed69f 100644 --- a/src/server/game/Entities/Creature/TemporarySummon.cpp +++ b/src/server/game/Entities/Creature/TemporarySummon.cpp @@ -389,7 +389,7 @@ void Puppet::InitSummon() else { sLog->outMisc("Puppet::InitSummon (B1)"); - //ASSERT(false); // ZOMG! + //ABORT(); // ZOMG! } } } diff --git a/src/server/game/Entities/GameObject/GameObject.h b/src/server/game/Entities/GameObject/GameObject.h index 259934748..9ce7ee545 100644 --- a/src/server/game/Entities/GameObject/GameObject.h +++ b/src/server/game/Entities/GameObject/GameObject.h @@ -700,7 +700,7 @@ class GameObject : public WorldObject, public GridObject, public Mov // Owner already found and different than expected owner - remove object from old owner if (owner && GetOwnerGUID() && GetOwnerGUID() != owner) { - ASSERT(false); + ABORT(); } m_spawnedByDefault = false; // all object with owner is despawned after delay SetUInt64Value(OBJECT_FIELD_CREATED_BY, owner); diff --git a/src/server/game/Entities/Item/Item.cpp b/src/server/game/Entities/Item/Item.cpp index 01cdee5e4..03fd3363b 100644 --- a/src/server/game/Entities/Item/Item.cpp +++ b/src/server/game/Entities/Item/Item.cpp @@ -1036,7 +1036,7 @@ Item* Item::CreateItem(uint32 item, uint32 count, Player const* player) delete pItem; } else - ASSERT(false); + ABORT(); return NULL; } diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index 1d0e3ea89..e6202532e 100644 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -92,7 +92,7 @@ WorldObject::~WorldObject() 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()); - ASSERT(false); + ABORT(); } 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()); if (isType(TYPEMASK_ITEM)) sLog->outCrash("Item slot %u", ((Item*)this)->GetSlot()); - ASSERT(false); + ABORT(); RemoveFromWorld(); } if (m_objectUpdated) { 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); } @@ -2059,7 +2059,7 @@ void WorldObject::SetMap(Map* map) 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()); - ASSERT(false); + ABORT(); } m_currMap = map; m_mapId = map->GetId(); diff --git a/src/server/game/Entities/Pet/Pet.h b/src/server/game/Entities/Pet/Pet.h index 9c19212e9..da5944140 100644 --- a/src/server/game/Entities/Pet/Pet.h +++ b/src/server/game/Entities/Pet/Pet.h @@ -180,11 +180,11 @@ class Pet : public Guardian private: 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 { - ASSERT(false); + ABORT(); } }; #endif diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 9d5509777..041a3d8d9 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -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()); return false; - //ASSERT(false); + //ABORT(); } else if (const SpellInfo* learnSpell = sSpellMgr->GetSpellInfo(spellInfo->Effects[i].TriggerSpell)) _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()); m_spells.erase(spellInfo->Id); // mem leak, but should never happen return false; - //ASSERT(false); + //ABORT(); } // 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)) @@ -20905,7 +20905,7 @@ void Player::StopCastingCharm() if (charm->GetCharmerGUID()) { sLog->outCrash("Charmed unit has charmer guid " UI64FMTD, charm->GetCharmerGUID()); - ASSERT(false); + ABORT(); } else SetCharm(charm, false); @@ -24521,7 +24521,7 @@ void Player::SetBattlegroundOrBattlefieldRaid(Group *group, int8 subgroup) if (GetGroup() && (GetGroup()->isBGGroup() || GetGroup()->isBFGroup())) { 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()); diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 855d3b71d..9555e50b0 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -4052,7 +4052,7 @@ void Unit::_UnapplyAura(AuraApplication * aurApp, AuraRemoveMode removeMode) else ++iter; } - ASSERT(false); + ABORT(); } 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 @@ -9895,7 +9895,7 @@ void Unit::SetMinion(Minion *minion, bool apply) { OutDebugInfo(); (*itr)->OutDebugInfo(); - ASSERT(false); + ABORT(); } ASSERT((*itr)->GetTypeId() == TYPEID_UNIT); @@ -14377,7 +14377,7 @@ void Unit::RemoveFromWorld() if (GetCharmerGUID()) { sLog->outCrash("Unit %u has charmer guid when removed from world", GetEntry()); - ASSERT(false); + ABORT(); } if (Unit* owner = GetOwner()) @@ -14387,7 +14387,7 @@ void Unit::RemoveFromWorld() if (HasUnitTypeMask(UNIT_MASK_MINION|UNIT_MASK_GUARDIAN)) owner->SetMinion((Minion*)this, false); 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, // GetGUID(), GetCharmerGUID(), charmer->GetGUID()); -// ASSERT(false); +// ABORT(); return; } @@ -18260,7 +18260,7 @@ void Unit::ChangeSeat(int8 seatId, bool next) m_vehicle->RemovePassenger(this); if (!m_vehicle->AddPassenger(this, seatId)) - ASSERT(false); + ABORT(); } void Unit::ExitVehicle(Position const* /*exitPosition*/) diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 11a446a83..6ef86f371 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -1327,7 +1327,7 @@ class SafeUnitPointer { public: 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; } ~SafeUnitPointer(); void SetPointedTo(Unit* u); diff --git a/src/server/game/Entities/Vehicle/Vehicle.cpp b/src/server/game/Entities/Vehicle/Vehicle.cpp index 9acd913c6..60214d35b 100644 --- a/src/server/game/Entities/Vehicle/Vehicle.cpp +++ b/src/server/game/Entities/Vehicle/Vehicle.cpp @@ -390,7 +390,7 @@ bool Vehicle::AddPassenger(Unit* unit, int8 seatId) try { if (!_me->SetCharmedBy(unit, CHARM_TYPE_VEHICLE)) - ASSERT(false); + ABORT(); } catch (...) { diff --git a/src/server/game/Handlers/CharacterHandler.cpp b/src/server/game/Handlers/CharacterHandler.cpp index 9d4553a22..7dd7fae12 100644 --- a/src/server/game/Handlers/CharacterHandler.cpp +++ b/src/server/game/Handlers/CharacterHandler.cpp @@ -1331,7 +1331,7 @@ void WorldSession::HandlePlayerLoginToCharInWorld(Player* pCurrChar) void WorldSession::HandlePlayerLoginToCharOutOfWorld(Player* /*pCurrChar*/) { - ASSERT(false); + ABORT(); } void WorldSession::HandleSetFactionAtWar(WorldPacket& recvData) diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp index c5fddd3ca..ba37dfd3f 100644 --- a/src/server/game/Maps/Map.cpp +++ b/src/server/game/Maps/Map.cpp @@ -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) { sLog->outError("map::setNGrid() Invalid grid coordinates found: %d, %d!", x, y); - ASSERT(false); + ABORT(); } i_grids[x][y] = grid; } @@ -2328,7 +2328,7 @@ void Map::AddObjectToSwitchList(WorldObject* obj, bool on) else if (itr->second != on) i_objectsToSwitch.erase(itr); else - ASSERT(false); + ABORT(); } void Map::RemoveAllObjectsInRemoveList() @@ -2539,7 +2539,7 @@ bool InstanceMap::CanEnter(Player* player, bool loginCheck) 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()); - ASSERT(false); + ABORT(); return false; } @@ -2893,7 +2893,7 @@ bool BattlegroundMap::CanEnter(Player* player, bool loginCheck) if (!loginCheck && player->GetMapRef().getTarget() == this) { sLog->outError("BGMap::CanEnter - player %u is already in map!", player->GetGUIDLow()); - ASSERT(false); + ABORT(); return false; } diff --git a/src/server/game/Maps/MapInstanced.cpp b/src/server/game/Maps/MapInstanced.cpp index dad9c23a3..e9ec5a6e9 100644 --- a/src/server/game/Maps/MapInstanced.cpp +++ b/src/server/game/Maps/MapInstanced.cpp @@ -182,13 +182,13 @@ InstanceMap* MapInstanced::CreateInstance(uint32 InstanceId, InstanceSave* save, if (!entry) { sLog->outError("CreateInstance: no entry for map %d", GetId()); - ASSERT(false); + ABORT(); } const InstanceTemplate* iTemplate = sObjectMgr->GetInstanceTemplate(GetId()); if (!iTemplate) { sLog->outError("CreateInstance: no instance template for map %d", GetId()); - ASSERT(false); + ABORT(); } // some instances only have one difficulty @@ -272,6 +272,6 @@ bool MapInstanced::DestroyInstance(InstancedMaps::iterator &itr) bool MapInstanced::CanEnter(Player* /*player*/, bool /*loginCheck*/) { - //ASSERT(false); + //ABORT(); return true; } diff --git a/src/server/game/Movement/Spline/Spline.h b/src/server/game/Movement/Spline/Spline.h index 01666d986..1f4bdc437 100644 --- a/src/server/game/Movement/Spline/Spline.h +++ b/src/server/game/Movement/Spline/Spline.h @@ -71,7 +71,7 @@ protected: typedef void (SplineBase::*InitMethtod)(const Vector3*, index_type, bool, index_type); static InitMethtod initializers[ModesEnd]; - void UninitializedSpline() const { ASSERT(false);} + void UninitializedSpline() const { ABORT();} public: diff --git a/src/server/game/Scripting/ScriptMgr.cpp b/src/server/game/Scripting/ScriptMgr.cpp index 93421a943..588eb1cd7 100644 --- a/src/server/game/Scripting/ScriptMgr.cpp +++ b/src/server/game/Scripting/ScriptMgr.cpp @@ -127,7 +127,7 @@ class ScriptRegistry sLog->outError("Script '%s' already assigned with the same script name, so the script can't work.", script->GetName().c_str()); - ASSERT(false); // Error that should be fixed ASAP. + ABORT(); // Error that should be fixed ASAP. } } else @@ -1120,7 +1120,7 @@ bool ScriptMgr::OnAreaTrigger(Player* player, AreaTrigger const* trigger) Battleground* ScriptMgr::CreateBattleground(BattlegroundTypeId /*typeId*/) { // TODO: Implement script-side battlegrounds. - ASSERT(false); + ABORT(); return NULL; } diff --git a/src/server/game/Scripting/ScriptMgr.h b/src/server/game/Scripting/ScriptMgr.h index 0c61712dd..cde289097 100644 --- a/src/server/game/Scripting/ScriptMgr.h +++ b/src/server/game/Scripting/ScriptMgr.h @@ -1608,7 +1608,7 @@ class ScriptRegistry sLog->outError("Script '%s' already assigned with the same script name, so the script can't work.", script->GetName().c_str()); - ASSERT(false); // Error that should be fixed ASAP. + ABORT(); // Error that should be fixed ASAP. } } else diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp index a1a2281b1..96e030a2a 100644 --- a/src/server/game/Spells/Auras/SpellAuras.cpp +++ b/src/server/game/Spells/Auras/SpellAuras.cpp @@ -384,7 +384,7 @@ Aura* Aura::Create(SpellInfo const* spellproto, uint8 effMask, WorldObject* owne aura = new DynObjAura(spellproto, effMask, owner, caster, baseAmount, castItem, casterGUID); break; default: - ASSERT(false); + ABORT(); return NULL; } // 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!", target->GetGUIDLow(), caster ? caster->GetGUIDLow() : 0, auraApp->GetBase()->GetSpellInfo()->Id); - ASSERT(false); + ABORT(); } // aura has to be already applied @@ -594,7 +594,7 @@ void Aura::UpdateTargetMap(Unit* caster, bool apply) else { // 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, 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)); - ASSERT(false); + ABORT(); } itr->first->_CreateAuraApplication(this, itr->second); ++itr; @@ -715,7 +715,7 @@ void Aura::UpdateOwner(uint32 diff, WorldObject* owner) { if (owner != m_owner) { - ASSERT(false); + ABORT(); } Unit* caster = GetCaster(); diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 89e9c933e..c8b5a0265 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -7595,7 +7595,7 @@ SpellEvent::~SpellEvent() { 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); - ASSERT(false); + ABORT(); } } @@ -8093,7 +8093,7 @@ bool Spell::CallScriptEffectHandlers(SpellEffIndex effIndex, SpellEffectHandleMo hookType = SPELL_SCRIPT_HOOK_EFFECT_HIT_TARGET; break; default: - ASSERT(false); + ABORT(); return false; } (*scritr)->_PrepareScriptCall(hookType); diff --git a/src/server/worldserver/Master.cpp b/src/server/worldserver/Master.cpp index bb0f24bd5..0a91548b3 100644 --- a/src/server/worldserver/Master.cpp +++ b/src/server/worldserver/Master.cpp @@ -99,7 +99,7 @@ public: else if (getMSTimeDiff(_lastChange, curtime) > _delayTime) { sLog->outString("World Thread hangs, kicking out server!"); - ASSERT(false); + ABORT(); } ACORE::Thread::Sleep(1000); diff --git a/src/tools/mesh_extractor/MPQManager.cpp b/src/tools/mesh_extractor/MPQManager.cpp index c299b0588..d67bd5e3b 100644 --- a/src/tools/mesh_extractor/MPQManager.cpp +++ b/src/tools/mesh_extractor/MPQManager.cpp @@ -64,7 +64,7 @@ void MPQManager::InitializeDBC() if (BaseLocale == -1) { 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 printf("Using default locale: %s\n", Languages[BaseLocale]);