[10432] Rename ASSERT -> MANGOS_ASSERT and related fixes

ASSERT hard use in predictable way because diff. 3rd party libs code
redefine it inf different ways and hard make sure that used in end
of mangos define version. This is real detected problem make some
expected assert checks ignored and so bugs not detected as expected from code.

In addition made related changes:
* Common.h header expected to be first include in any src/game/header except most simple cases.
* Related FILE.h header expected to be first include in FILE.cpp
* Fixed some absent includes and type forwards for safe build without PCH enabled.
* Avoid using MANGOS_ASSERT in src/framework code
This commit is contained in:
VladimirMangos 2010-09-02 04:18:55 +04:00
parent 32e3e252fb
commit acd0716297
77 changed files with 309 additions and 260 deletions

View file

@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "Common.h"
#include "Unit.h"
#include "Log.h"
#include "Opcodes.h"
#include "WorldPacket.h"
@ -25,7 +25,6 @@
#include "ObjectMgr.h"
#include "ObjectGuid.h"
#include "SpellMgr.h"
#include "Unit.h"
#include "QuestDef.h"
#include "Player.h"
#include "Creature.h"
@ -261,10 +260,10 @@ Unit::~Unit()
delete m_charmInfo;
// those should be already removed at "RemoveFromWorld()" call
ASSERT(m_gameObj.size() == 0);
ASSERT(m_dynObjGUIDs.size() == 0);
ASSERT(m_deletedAuras.size() == 0);
ASSERT(m_deletedHolders.size() == 0);
MANGOS_ASSERT(m_gameObj.size() == 0);
MANGOS_ASSERT(m_dynObjGUIDs.size() == 0);
MANGOS_ASSERT(m_deletedAuras.size() == 0);
MANGOS_ASSERT(m_deletedHolders.size() == 0);
}
void Unit::Update( uint32 p_time )
@ -433,7 +432,7 @@ void Unit::resetAttackTimer(WeaponAttackType type)
bool Unit::canReachWithAttack(Unit *pVictim) const
{
ASSERT(pVictim);
MANGOS_ASSERT(pVictim);
float reach = GetFloatValue(UNIT_FIELD_COMBATREACH);
if( reach <= 0.0f )
reach = 1.0f;
@ -850,10 +849,10 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
// last damage from non duel opponent or opponent controlled creature
if(duel_hasEnded)
{
ASSERT(pVictim->GetTypeId()==TYPEID_PLAYER);
MANGOS_ASSERT(pVictim->GetTypeId()==TYPEID_PLAYER);
Player *he = (Player*)pVictim;
ASSERT(he->duel);
MANGOS_ASSERT(he->duel);
he->duel->opponent->CombatStopWithPets(true);
he->CombatStopWithPets(true);
@ -1026,10 +1025,10 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
// last damage from duel opponent
if(duel_hasEnded)
{
ASSERT(pVictim->GetTypeId()==TYPEID_PLAYER);
MANGOS_ASSERT(pVictim->GetTypeId()==TYPEID_PLAYER);
Player *he = (Player*)pVictim;
ASSERT(he->duel);
MANGOS_ASSERT(he->duel);
he->SetHealth(1);
@ -3420,7 +3419,7 @@ void Unit::_UpdateAutoRepeatSpell()
void Unit::SetCurrentCastedSpell( Spell * pSpell )
{
ASSERT(pSpell); // NULL may be never passed here, use InterruptSpell or InterruptNonMeleeSpells
MANGOS_ASSERT(pSpell); // NULL may be never passed here, use InterruptSpell or InterruptNonMeleeSpells
CurrentSpellTypes CSpellType = pSpell->GetCurrentContainer();
@ -3491,7 +3490,7 @@ void Unit::SetCurrentCastedSpell( Spell * pSpell )
void Unit::InterruptSpell(CurrentSpellTypes spellType, bool withDelayed, bool sendAutoRepeatCancelToClient)
{
ASSERT(spellType < CURRENT_MAX_SPELL);
MANGOS_ASSERT(spellType < CURRENT_MAX_SPELL);
if (m_currentSpells[spellType] && (withDelayed || m_currentSpells[spellType]->getState() != SPELL_STATE_DELAYED) )
{
@ -4852,7 +4851,7 @@ GameObject* Unit::GetGameObject(uint32 spellId) const
void Unit::AddGameObject(GameObject* gameObj)
{
ASSERT(gameObj && gameObj->GetOwnerGUID()==0);
MANGOS_ASSERT(gameObj && gameObj->GetOwnerGUID()==0);
m_gameObj.push_back(gameObj);
gameObj->SetOwnerGUID(GetGUID());
@ -4868,7 +4867,7 @@ void Unit::AddGameObject(GameObject* gameObj)
void Unit::RemoveGameObject(GameObject* gameObj, bool del)
{
ASSERT(gameObj && gameObj->GetOwnerGUID()==GetGUID());
MANGOS_ASSERT(gameObj && gameObj->GetOwnerGUID()==GetGUID());
gameObj->SetOwnerGUID(0);
@ -8315,7 +8314,7 @@ void Unit::DeleteThreatList()
void Unit::TauntApply(Unit* taunter)
{
ASSERT(GetTypeId()== TYPEID_UNIT);
MANGOS_ASSERT(GetTypeId()== TYPEID_UNIT);
if(!taunter || (taunter->GetTypeId() == TYPEID_PLAYER && ((Player*)taunter)->isGameMaster()))
return;
@ -8338,7 +8337,7 @@ void Unit::TauntApply(Unit* taunter)
void Unit::TauntFadeOut(Unit *taunter)
{
ASSERT(GetTypeId()== TYPEID_UNIT);
MANGOS_ASSERT(GetTypeId()== TYPEID_UNIT);
if(!taunter || (taunter->GetTypeId() == TYPEID_PLAYER && ((Player*)taunter)->isGameMaster()))
return;
@ -8380,7 +8379,7 @@ bool Unit::SelectHostileTarget()
//next-victim-selection algorithm and evade mode are called
//threat list sorting etc.
ASSERT(GetTypeId()== TYPEID_UNIT);
MANGOS_ASSERT(GetTypeId()== TYPEID_UNIT);
if (!this->isAlive())
return false;