[9638] Replace all C assert()s with MaNGOS ASSERT() macro.

This commit is contained in:
XTZGZoReX 2010-03-29 19:28:58 +02:00
parent 4443737005
commit 51fd11c92c
34 changed files with 121 additions and 121 deletions

View file

@ -1915,7 +1915,7 @@ void AchievementGlobalMgr::LoadAchievementCriteriaList()
if(!criteria)
continue;
assert(criteria->requiredType < ACHIEVEMENT_CRITERIA_TYPE_TOTAL && "Not updated ACHIEVEMENT_CRITERIA_TYPE_TOTAL?");
ASSERT(criteria->requiredType < ACHIEVEMENT_CRITERIA_TYPE_TOTAL && "Not updated ACHIEVEMENT_CRITERIA_TYPE_TOTAL?");
m_AchievementCriteriasByType[criteria->requiredType].push_back(criteria);
m_AchievementCriteriaListByAchievement[criteria->referredAchievement].push_back(criteria);

View file

@ -466,7 +466,7 @@ void WorldSession::HandleAuctionRemoveItem( WorldPacket & recv_data )
else
{
SendAuctionCommandResult( 0, AUCTION_CANCEL, AUCTION_INTERNAL_ERROR );
//this code isn't possible ... maybe there should be assert
//this code isn't possible ... maybe there should be ASSERT
sLog.outError("CHEATER : %u, he tried to cancel auction (id: %u) of another player, or auction is NULL", pl->GetGUIDLow(), auctionId );
return;
}

View file

@ -136,7 +136,7 @@ uint32 Bag::GetFreeSlots() const
void Bag::RemoveItem( uint8 slot, bool /*update*/ )
{
assert(slot < MAX_BAG_SIZE);
ASSERT(slot < MAX_BAG_SIZE);
if (m_bagslot[slot])
m_bagslot[slot]->SetContainer(NULL);
@ -147,7 +147,7 @@ void Bag::RemoveItem( uint8 slot, bool /*update*/ )
void Bag::StoreItem( uint8 slot, Item *pItem, bool /*update*/ )
{
assert(slot < MAX_BAG_SIZE);
ASSERT(slot < MAX_BAG_SIZE);
if( pItem )
{

View file

@ -210,7 +210,7 @@ void BattleGroundAV::HandleQuestComplete(uint32 questid, Player *player)
void BattleGroundAV::UpdateScore(BattleGroundTeamId team, int32 points )
{
// note: to remove reinforcements points must be negative, for adding reinforcements points must be positive
assert( team == BG_TEAM_ALLIANCE || team == BG_TEAM_HORDE);
ASSERT( team == BG_TEAM_ALLIANCE || team == BG_TEAM_HORDE);
m_TeamScores[team] += points; // m_TeamScores is int32 - so no problems here
if (points < 0)
@ -449,7 +449,7 @@ void BattleGroundAV::ChangeMineOwner(uint8 mine, uint32 team)
// TODO implement quest 7122
// mine=0 northmine, mine=1 southmine
// TODO changing the owner should result in setting respawntime to infinite for current creatures (they should fight the new ones), spawning new mine owners creatures and changing the chest - objects so that the current owning team can use them
assert(mine == BG_AV_NORTH_MINE || mine == BG_AV_SOUTH_MINE);
ASSERT(mine == BG_AV_NORTH_MINE || mine == BG_AV_SOUTH_MINE);
if (m_Mine_Owner[mine] == int8(team))
return;
@ -533,7 +533,7 @@ void BattleGroundAV::EventPlayerClickedOnFlag(Player *source, GameObject* target
void BattleGroundAV::EventPlayerDefendsPoint(Player* player, BG_AV_Nodes node)
{
assert(GetStatus() == STATUS_IN_PROGRESS);
ASSERT(GetStatus() == STATUS_IN_PROGRESS);
uint32 team = GetTeamIndexByTeamId(player->GetTeam());
@ -543,7 +543,7 @@ void BattleGroundAV::EventPlayerDefendsPoint(Player* player, BG_AV_Nodes node)
{
// until snowfall doesn't belong to anyone it is better handled in assault - code (best would be to have a special function
// for neutral nodes.. but doing this just for snowfall will be a bit to much i think
assert(node == BG_AV_NODES_SNOWFALL_GRAVE); // currently the only neutral grave
ASSERT(node == BG_AV_NODES_SNOWFALL_GRAVE); // currently the only neutral grave
EventPlayerAssaultsPoint(player, node);
return;
}
@ -651,9 +651,9 @@ void BattleGroundAV::UpdateNodeWorldState(BG_AV_Nodes node)
void BattleGroundAV::SendMineWorldStates(uint32 mine)
{
assert(mine == BG_AV_NORTH_MINE || mine == BG_AV_SOUTH_MINE);
assert(m_Mine_PrevOwner[mine] == BG_TEAM_ALLIANCE || m_Mine_PrevOwner[mine] == BG_TEAM_HORDE || m_Mine_PrevOwner[mine] == BG_AV_NEUTRAL_TEAM);
assert(m_Mine_Owner[mine] == BG_TEAM_ALLIANCE || m_Mine_Owner[mine] == BG_TEAM_HORDE || m_Mine_Owner[mine] == BG_AV_NEUTRAL_TEAM);
ASSERT(mine == BG_AV_NORTH_MINE || mine == BG_AV_SOUTH_MINE);
ASSERT(m_Mine_PrevOwner[mine] == BG_TEAM_ALLIANCE || m_Mine_PrevOwner[mine] == BG_TEAM_HORDE || m_Mine_PrevOwner[mine] == BG_AV_NEUTRAL_TEAM);
ASSERT(m_Mine_Owner[mine] == BG_TEAM_ALLIANCE || m_Mine_Owner[mine] == BG_TEAM_HORDE || m_Mine_Owner[mine] == BG_AV_NEUTRAL_TEAM);
UpdateWorldState(BG_AV_MineWorldStates[mine][m_Mine_Owner[mine]], 1);
if (m_Mine_Owner[mine] != m_Mine_PrevOwner[mine])
@ -717,11 +717,11 @@ uint32 BattleGroundAV::GetNodeName(BG_AV_Nodes node)
void BattleGroundAV::AssaultNode(BG_AV_Nodes node, uint32 team)
{
assert(team < 3); // alliance:0, horde:1, neutral:2
assert(m_Nodes[node].TotalOwner != team);
assert(m_Nodes[node].Owner != team);
ASSERT(team < 3); // alliance:0, horde:1, neutral:2
ASSERT(m_Nodes[node].TotalOwner != team);
ASSERT(m_Nodes[node].Owner != team);
// only assault an assaulted node if no totalowner exists:
assert(m_Nodes[node].State != POINT_ASSAULTED || m_Nodes[node].TotalOwner == BG_AV_NEUTRAL_TEAM);
ASSERT(m_Nodes[node].State != POINT_ASSAULTED || m_Nodes[node].TotalOwner == BG_AV_NEUTRAL_TEAM);
// the timer gets another time, if the previous owner was 0 == Neutral
m_Nodes[node].Timer = (m_Nodes[node].PrevOwner != BG_AV_NEUTRAL_TEAM) ? BG_AV_CAPTIME : BG_AV_SNOWFALL_FIRSTCAP;
m_Nodes[node].PrevOwner = m_Nodes[node].Owner;
@ -732,7 +732,7 @@ void BattleGroundAV::AssaultNode(BG_AV_Nodes node, uint32 team)
void BattleGroundAV::DestroyNode(BG_AV_Nodes node)
{
assert(m_Nodes[node].State == POINT_ASSAULTED);
ASSERT(m_Nodes[node].State == POINT_ASSAULTED);
m_Nodes[node].TotalOwner = m_Nodes[node].Owner;
m_Nodes[node].PrevOwner = m_Nodes[node].Owner;
@ -743,7 +743,7 @@ void BattleGroundAV::DestroyNode(BG_AV_Nodes node)
void BattleGroundAV::InitNode(BG_AV_Nodes node, uint32 team, bool tower)
{
assert(team < 3); // alliance:0, horde:1, neutral:2
ASSERT(team < 3); // alliance:0, horde:1, neutral:2
m_Nodes[node].TotalOwner = team;
m_Nodes[node].Owner = team;
m_Nodes[node].PrevOwner = team;
@ -759,10 +759,10 @@ void BattleGroundAV::InitNode(BG_AV_Nodes node, uint32 team, bool tower)
void BattleGroundAV::DefendNode(BG_AV_Nodes node, uint32 team)
{
assert(team < 3); // alliance:0, horde:1, neutral:2
assert(m_Nodes[node].TotalOwner == team);
assert(m_Nodes[node].Owner != team);
assert(m_Nodes[node].State != POINT_CONTROLLED);
ASSERT(team < 3); // alliance:0, horde:1, neutral:2
ASSERT(m_Nodes[node].TotalOwner == team);
ASSERT(m_Nodes[node].Owner != team);
ASSERT(m_Nodes[node].State != POINT_CONTROLLED);
m_Nodes[node].PrevOwner = m_Nodes[node].Owner;
m_Nodes[node].Owner = team;
m_Nodes[node].PrevState = m_Nodes[node].State;

View file

@ -108,7 +108,7 @@ Cell::Visit(const CellPair &standing_cell, TypeContainerVisitor<T, CONTAINER> &v
}
default:
{
assert( false );
ASSERT( false );
break;
}
}

View file

@ -140,7 +140,7 @@ bool ConfusedMovementGenerator<T>::Update(T &unit, const uint32 &diff)
{
// start moving
unit.addUnitState(UNIT_STAT_CONFUSED_MOVE);
assert( i_nextMove <= MAX_CONF_WAYPOINTS );
ASSERT( i_nextMove <= MAX_CONF_WAYPOINTS );
const float x = i_waypoints[i_nextMove][0];
const float y = i_waypoints[i_nextMove][1];
const float z = i_waypoints[i_nextMove][2];

View file

@ -101,7 +101,7 @@ bool Corpse::Create( uint32 guidlow, Player *owner)
void Corpse::SaveToDB()
{
// bones should not be saved to DB (would be deleted on startup anyway)
assert(GetType() != CORPSE_BONES);
ASSERT(GetType() != CORPSE_BONES);
// prevent DB data inconsistence problems and duplicates
CharacterDatabase.BeginTransaction();
@ -126,7 +126,7 @@ void Corpse::SaveToDB()
void Corpse::DeleteBonesFromWorld()
{
assert(GetType() == CORPSE_BONES);
ASSERT(GetType() == CORPSE_BONES);
Corpse* corpse = GetMap()->GetCorpse(GetGUID());
if (!corpse)
@ -141,7 +141,7 @@ void Corpse::DeleteBonesFromWorld()
void Corpse::DeleteFromDB()
{
// bones should not be saved to DB (would be deleted on startup anyway)
assert(GetType() != CORPSE_BONES);
ASSERT(GetType() != CORPSE_BONES);
// all corpses (not bones)
CharacterDatabase.PExecute("DELETE FROM corpse WHERE player = '%d' AND corpse_type <> '0'", GUID_LOPART(GetOwnerGUID()));

View file

@ -69,7 +69,7 @@ namespace FactorySelector
{
const CreatureAICreator *factory = iter->second;
const SelectableAI *p = dynamic_cast<const SelectableAI *>(factory);
assert( p != NULL );
ASSERT( p != NULL );
int val = p->Permit(creature);
if( val > best_val )
{
@ -89,7 +89,7 @@ namespace FactorySelector
MovementGenerator* selectMovementGenerator(Creature *creature)
{
MovementGeneratorRegistry &mv_registry(MovementGeneratorRepository::Instance());
assert( creature->GetCreatureInfo() != NULL );
ASSERT( creature->GetCreatureInfo() != NULL );
const MovementGeneratorCreator *mv_factory = mv_registry.GetRegistryItem( creature->GetDefaultMovementType());
/* if( mv_factory == NULL )
@ -101,7 +101,7 @@ namespace FactorySelector
{
const MovementGeneratorCreator *factory = mv_registry.GetRegistryItem((*iter).c_str());
const SelectableMovement *p = dynamic_cast<const SelectableMovement *>(factory);
assert( p != NULL );
ASSERT( p != NULL );
int val = p->Permit(creature);
if( val > best_val )
{

View file

@ -233,7 +233,7 @@ static bool LoadDBC_assert_print(uint32 fsize,uint32 rsize, const std::string& f
{
sLog.outError("ERROR: Size of '%s' setted by format string (%u) not equal size of C++ structure (%u).",filename.c_str(),fsize,rsize);
// assert must fail after function call
// ASSERT must fail after function call
return false;
}
@ -251,7 +251,7 @@ template<class T>
inline void LoadDBC(LocalData& localeData,barGoLink& bar, StoreProblemList& errlist, DBCStorage<T>& storage, const std::string& dbc_path, const std::string& filename)
{
// compatibility format and C++ structure sizes
assert(DBCFileLoader::GetFormatRecordSize(storage.GetFormat()) == sizeof(T) || LoadDBC_assert_print(DBCFileLoader::GetFormatRecordSize(storage.GetFormat()),sizeof(T),filename));
ASSERT(DBCFileLoader::GetFormatRecordSize(storage.GetFormat()) == sizeof(T) || LoadDBC_assert_print(DBCFileLoader::GetFormatRecordSize(storage.GetFormat()),sizeof(T),filename));
std::string dbc_filename = dbc_path + filename;
if(storage.Load(dbc_filename.c_str()))
@ -429,7 +429,7 @@ void LoadDBCStores(const std::string& dataPath)
for(uint32 i = 0; i < sPvPDifficultyStore.GetNumRows(); ++i)
if (PvPDifficultyEntry const* entry = sPvPDifficultyStore.LookupEntry(i))
if (entry->bracketId > MAX_BATTLEGROUND_BRACKETS)
assert(false && "Need update MAX_BATTLEGROUND_BRACKETS by DBC data");
ASSERT(false && "Need update MAX_BATTLEGROUND_BRACKETS by DBC data");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sRandomPropertiesPointsStore, dbcPath,"RandPropPoints.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sScalingStatDistributionStore, dbcPath,"ScalingStatDistribution.dbc");

View file

@ -157,7 +157,7 @@ InstanceSave::InstanceSave(uint16 MapId, uint32 InstanceId, Difficulty difficult
InstanceSave::~InstanceSave()
{
// the players and groups must be unbound before deleting the save
assert(m_playerList.empty() && m_groupList.empty());
ASSERT(m_playerList.empty() && m_groupList.empty());
}
/*
@ -171,7 +171,7 @@ void InstanceSave::SaveToDB()
Map *map = sMapMgr.FindMap(GetMapId(),m_instanceid);
if(map)
{
assert(map->IsDungeon());
ASSERT(map->IsDungeon());
InstanceData *iData = ((InstanceMap *)map)->GetInstanceData();
if(iData && iData->Save())
{
@ -225,7 +225,7 @@ bool InstanceSave::UnloadIfEmpty()
void InstanceSaveManager::_DelHelper(DatabaseType &db, const char *fields, const char *table, const char *queryTail,...)
{
Tokens fieldTokens = StrSplit(fields, ", ");
assert(fieldTokens.size() != 0);
ASSERT(fieldTokens.size() != 0);
va_list ap;
char szQueryTail [MAX_QUERY_LEN];

View file

@ -159,7 +159,7 @@ void RemoveItemsSetItem(Player*player,ItemPrototype const *proto)
if(!eff->item_count) //all items of a set were removed
{
assert(eff == player->ItemSetEff[setindex]);
ASSERT(eff == player->ItemSetEff[setindex]);
delete eff;
player->ItemSetEff[setindex] = NULL;
}
@ -946,7 +946,7 @@ Item* Item::CreateItem( uint32 item, uint32 count, Player const* player )
if ( count > pProto->GetMaxStackSize())
count = pProto->GetMaxStackSize();
assert(count !=0 && "pProto->Stackable==0 but checked at loading already");
ASSERT(count !=0 && "pProto->Stackable==0 but checked at loading already");
Item *pItem = NewItemOrBag( pProto );
if( pItem->Create(sObjectMgr.GenerateLowGuid(HIGHGUID_ITEM), item, player) )

View file

@ -406,7 +406,7 @@ bool Map::EnsureGridLoaded(const Cell &cell)
EnsureGridCreated(GridPair(cell.GridX(), cell.GridY()));
NGridType *grid = getNGrid(cell.GridX(), cell.GridY());
assert(grid != NULL);
ASSERT(grid != NULL);
if( !isGridObjectDataLoaded(cell.GridX(), cell.GridY()) )
{
ObjectGridLoader loader(*grid, this, cell);
@ -455,7 +455,7 @@ template<class T>
void
Map::Add(T *obj)
{
assert(obj);
ASSERT(obj);
CellPair p = MaNGOS::ComputeCellPair(obj->GetPositionX(), obj->GetPositionY());
if(p.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || p.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP )
@ -473,7 +473,7 @@ Map::Add(T *obj)
EnsureGridCreated(GridPair(cell.GridX(), cell.GridY()));
NGridType *grid = getNGrid(cell.GridX(), cell.GridY());
assert( grid != NULL );
ASSERT( grid != NULL );
AddToGrid(obj,grid,cell);
obj->AddToWorld();
@ -706,7 +706,7 @@ void Map::Update(const uint32 &t_diff)
NGridType *grid = i->getSource();
GridInfo *info = i->getSource()->getGridInfoRef();
++i; // The update might delete the map and we need the next map before the iterator gets invalid
assert(grid->GetGridState() >= 0 && grid->GetGridState() < MAX_GRID_STATE);
ASSERT(grid->GetGridState() >= 0 && grid->GetGridState() < MAX_GRID_STATE);
si_GridStates[grid->GetGridState()]->Update(*this, *grid, *info, grid->getX(), grid->getY(), t_diff);
}
}
@ -753,7 +753,7 @@ void Map::Remove(Player *player, bool remove)
DEBUG_LOG("Remove player %s from grid[%u,%u]", player->GetName(), cell.GridX(), cell.GridY());
NGridType *grid = getNGrid(cell.GridX(), cell.GridY());
assert(grid != NULL);
ASSERT(grid != NULL);
RemoveFromGrid(player,grid,cell);
@ -818,7 +818,7 @@ Map::Remove(T *obj, bool remove)
DEBUG_LOG("Remove object (GUID: %u TypeId:%u) from grid[%u,%u]", obj->GetGUIDLow(), obj->GetTypeId(), cell.data.Part.grid_x, cell.data.Part.grid_y);
NGridType *grid = getNGrid(cell.GridX(), cell.GridY());
assert( grid != NULL );
ASSERT( grid != NULL );
if(obj->isActiveObject())
RemoveFromActive(obj);
@ -845,7 +845,7 @@ Map::Remove(T *obj, bool remove)
void
Map::PlayerRelocation(Player *player, float x, float y, float z, float orientation)
{
assert(player);
ASSERT(player);
CellPair old_val = MaNGOS::ComputeCellPair(player->GetPositionX(), player->GetPositionY());
CellPair new_val = MaNGOS::ComputeCellPair(x, y);
@ -888,7 +888,7 @@ Map::PlayerRelocation(Player *player, float x, float y, float z, float orientati
void
Map::CreatureRelocation(Creature *creature, float x, float y, float z, float ang)
{
assert(CheckGridIntegrity(creature,false));
ASSERT(CheckGridIntegrity(creature,false));
Cell old_cell = creature->GetCurrentCell();
@ -933,7 +933,7 @@ Map::CreatureRelocation(Creature *creature, float x, float y, float z, float ang
creature->SetNeedNotify();
}
assert(CheckGridIntegrity(creature,true));
ASSERT(CheckGridIntegrity(creature,true));
}
bool Map::CreatureCellRelocation(Creature *c, Cell new_cell)
@ -1039,7 +1039,7 @@ bool Map::CreatureRespawnRelocation(Creature *c)
bool Map::UnloadGrid(const uint32 &x, const uint32 &y, bool pForce)
{
NGridType *grid = getNGrid(x, y);
assert( grid != NULL);
ASSERT( grid != NULL);
{
if(!pForce && ActiveObjectsNearGrid(x, y) )
@ -1114,7 +1114,7 @@ uint32 Map::GetMaxPlayers() const
return normalDiff ? normalDiff->maxPlayers : 0;
}
}
else // I'd rather assert(false);
else // I'd rather ASSERT(false);
return 0;
}
@ -2185,14 +2185,14 @@ 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);
ASSERT(false);
}
i_grids[x][y] = grid;
}
void Map::AddObjectToRemoveList(WorldObject *obj)
{
assert(obj->GetMapId()==GetId() && obj->GetInstanceId()==GetInstanceId());
ASSERT(obj->GetMapId()==GetId() && obj->GetInstanceId()==GetInstanceId());
obj->CleanupsBeforeDelete(); // remove or simplify at least cross referenced links
@ -2385,7 +2385,7 @@ bool InstanceMap::CanEnter(Player *player)
if(player->GetMapRef().getTarget() == this)
{
sLog.outError("InstanceMap::CanEnter - player %s(%u) already in map %d,%d,%d!", player->GetName(), player->GetGUIDLow(), GetId(), GetInstanceId(), GetSpawnMode());
assert(false);
ASSERT(false);
return false;
}
@ -2442,7 +2442,7 @@ bool InstanceMap::Add(Player *player)
if(playerBind->save != mapSave)
{
sLog.outError("InstanceMap::Add: player %s(%d) is permanently bound to instance %d,%d,%d,%d,%d,%d but he is being put in instance %d,%d,%d,%d,%d,%d", player->GetName(), player->GetGUIDLow(), playerBind->save->GetMapId(), playerBind->save->GetInstanceId(), playerBind->save->GetDifficulty(), playerBind->save->GetPlayerCount(), playerBind->save->GetGroupCount(), playerBind->save->CanReset(), mapSave->GetMapId(), mapSave->GetInstanceId(), mapSave->GetDifficulty(), mapSave->GetPlayerCount(), mapSave->GetGroupCount(), mapSave->CanReset());
assert(false);
ASSERT(false);
}
}
else
@ -2456,7 +2456,7 @@ bool InstanceMap::Add(Player *player)
{
sLog.outError("InstanceMap::Add: player %s(%d) is being put in instance %d,%d,%d,%d,%d,%d but he is in group %d and is bound to instance %d,%d,%d,%d,%d,%d!", player->GetName(), player->GetGUIDLow(), mapSave->GetMapId(), mapSave->GetInstanceId(), mapSave->GetDifficulty(), mapSave->GetPlayerCount(), mapSave->GetGroupCount(), mapSave->CanReset(), GUID_LOPART(pGroup->GetLeaderGUID()), playerBind->save->GetMapId(), playerBind->save->GetInstanceId(), playerBind->save->GetDifficulty(), playerBind->save->GetPlayerCount(), playerBind->save->GetGroupCount(), playerBind->save->CanReset());
if(groupBind) sLog.outError("InstanceMap::Add: the group is bound to instance %d,%d,%d,%d,%d,%d", groupBind->save->GetMapId(), groupBind->save->GetInstanceId(), groupBind->save->GetDifficulty(), groupBind->save->GetPlayerCount(), groupBind->save->GetGroupCount(), groupBind->save->CanReset());
assert(false);
ASSERT(false);
}
// bind to the group or keep using the group save
if(!groupBind)
@ -2475,7 +2475,7 @@ bool InstanceMap::Add(Player *player)
sLog.outError("GroupBind save players: %d, group count: %d", groupBind->save->GetPlayerCount(), groupBind->save->GetGroupCount());
else
sLog.outError("GroupBind save NULL");
assert(false);
ASSERT(false);
}
// if the group/leader is permanently bound to the instance
// players also become permanently bound when they enter
@ -2495,7 +2495,7 @@ bool InstanceMap::Add(Player *player)
player->BindToInstance(mapSave, false);
else
// cannot jump to a different instance without resetting it
assert(playerBind->save == mapSave);
ASSERT(playerBind->save == mapSave);
}
}
}
@ -2720,7 +2720,7 @@ bool BattleGroundMap::CanEnter(Player * player)
if(player->GetMapRef().getTarget() == this)
{
sLog.outError("BGMap::CanEnter - player %u already in map!", player->GetGUIDLow());
assert(false);
ASSERT(false);
return false;
}

View file

@ -321,7 +321,7 @@ class MANGOS_DLL_SPEC Map : public GridRefManager<NGridType>, public MaNGOS::Obj
bool CreatureRespawnRelocation(Creature *c); // used only in CreatureRelocation and ObjectGridUnloader
// assert print helper
// ASSERT print helper
bool CheckGridIntegrity(Creature* c, bool moved) const;
uint32 GetInstanceId() const { return i_InstanceId; }

View file

@ -170,12 +170,12 @@ InstanceMap* MapInstanced::CreateInstance(uint32 InstanceId, InstanceSave *save,
if (!sMapStore.LookupEntry(GetId()))
{
sLog.outError("CreateInstance: no entry for map %d", GetId());
assert(false);
ASSERT(false);
}
if (!ObjectMgr::GetInstanceTemplate(GetId()))
{
sLog.outError("CreateInstance: no instance template for map %d", GetId());
assert(false);
ASSERT(false);
}
// some instances only have one difficulty

View file

@ -99,7 +99,7 @@ void MapManager::checkAndCorrectGridStatesArray()
if(!ok)
++i_GridStateErrorCount;
if(i_GridStateErrorCount > 2)
assert(false); // force a crash. Too many errors
ASSERT(false); // force a crash. Too many errors
}
Map*
@ -123,7 +123,7 @@ MapManager::_createBaseMap(uint32 id)
i_maps[id] = m;
}
assert(m != NULL);
ASSERT(m != NULL);
return m;
}

View file

@ -65,7 +65,7 @@ MotionMaster::UpdateMotion(uint32 diff)
{
if( i_owner->hasUnitState(UNIT_STAT_CAN_NOT_MOVE) )
return;
assert( !empty() );
ASSERT( !empty() );
m_cleanFlag |= MMCF_UPDATE;
if (!top()->Update(*i_owner, diff))
{
@ -112,7 +112,7 @@ MotionMaster::DirectClean(bool reset, bool all)
if (!all && reset)
{
assert( !empty() );
ASSERT( !empty() );
top()->Reset(*i_owner);
}
}

View file

@ -1047,7 +1047,7 @@ bool Object::PrintIndexError(uint32 index, bool set) const
{
sLog.outError("Attempt %s non-existed value field: %u (count: %u) for object typeid: %u type mask: %u",(set ? "set value to" : "get value from"),index,m_valuesCount,GetTypeId(),m_objectType);
// assert must fail after function call
// ASSERT must fail after function call
return false;
}
@ -1058,7 +1058,7 @@ void Object::BuildUpdateDataForPlayer(Player* pl, UpdateDataMapType& update_play
if (iter == update_players.end())
{
std::pair<UpdateDataMapType::iterator, bool> p = update_players.insert( UpdateDataMapType::value_type(pl, UpdateData()) );
assert(p.second);
ASSERT(p.second);
iter = p.first;
}

View file

@ -314,7 +314,7 @@ class MANGOS_DLL_SPEC Object
PackedGuid m_PackGUID;
// for output helpfull error messages from asserts
// for output helpfull error messages from ASSERTs
bool PrintIndexError(uint32 index, bool set) const;
Object(const Object&); // prevent generation copy constructor
Object& operator=(Object const&); // prevent generation assigment operator

View file

@ -129,7 +129,7 @@ ObjectAccessor::GetCorpseForPlayerGUID(ObjectGuid guid)
Player2CorpsesMapType::iterator iter = i_player2corpse.find(guid.GetRawValue());
if( iter == i_player2corpse.end() ) return NULL;
assert(iter->second->GetType() != CORPSE_BONES);
ASSERT(iter->second->GetType() != CORPSE_BONES);
return iter->second;
}
@ -137,7 +137,7 @@ ObjectAccessor::GetCorpseForPlayerGUID(ObjectGuid guid)
void
ObjectAccessor::RemoveCorpse(Corpse *corpse)
{
assert(corpse && corpse->GetType() != CORPSE_BONES);
ASSERT(corpse && corpse->GetType() != CORPSE_BONES);
Guard guard(i_corpseGuard);
Player2CorpsesMapType::iterator iter = i_player2corpse.find(corpse->GetOwnerGUID());
@ -157,10 +157,10 @@ ObjectAccessor::RemoveCorpse(Corpse *corpse)
void
ObjectAccessor::AddCorpse(Corpse *corpse)
{
assert(corpse && corpse->GetType() != CORPSE_BONES);
ASSERT(corpse && corpse->GetType() != CORPSE_BONES);
Guard guard(i_corpseGuard);
assert(i_player2corpse.find(corpse->GetOwnerGUID()) == i_player2corpse.end());
ASSERT(i_player2corpse.find(corpse->GetOwnerGUID()) == i_player2corpse.end());
i_player2corpse[corpse->GetOwnerGUID()] = corpse;
// build mapid*cellid -> guid_set map

View file

@ -56,7 +56,7 @@ ObjectGridRespawnMover::Visit(CreatureMapType &m)
Creature * c = iter->getSource();
assert((!c->isPet() || !c->isVehicle()) && "ObjectGridRespawnMover don't must be called for pets");
ASSERT((!c->isPet() || !c->isVehicle()) && "ObjectGridRespawnMover don't must be called for pets");
Cell const& cur_cell = c->GetCurrentCell();

View file

@ -492,7 +492,7 @@ void Pet::Update(uint32 diff)
{
if( m_deathTimer <= diff )
{
assert(getPetType()!=SUMMON_PET && "Must be already removed.");
ASSERT(getPetType()!=SUMMON_PET && "Must be already removed.");
Remove(PET_SAVE_NOT_IN_SLOT); //hunters' pets never get removed because of death, NEVER!
return;
}
@ -797,7 +797,7 @@ bool Pet::CreateBaseAtCreature(Creature* creature)
bool Pet::InitStatsForLevel(uint32 petlevel, Unit* owner)
{
CreatureInfo const *cinfo = GetCreatureInfo();
assert(cinfo);
ASSERT(cinfo);
if(!owner)
{

View file

@ -260,11 +260,11 @@ class Pet : public Creature
void SaveToDB(uint32, uint8) // overwrited of Creature::SaveToDB - don't must be called
{
assert(false);
ASSERT(false);
}
void DeleteFromDB() // overwrited of Creature::DeleteFromDB - don't must be called
{
assert(false);
ASSERT(false);
}
};
#endif

View file

@ -4162,7 +4162,7 @@ void Player::BuildPlayerRepop()
if(GetCorpse())
{
sLog.outError("BuildPlayerRepop: player %s(%d) already has a corpse", GetName(), GetGUIDLow());
assert(false);
ASSERT(false);
}
// create a corpse and place it at the player's location
@ -4356,7 +4356,7 @@ void Player::CreateCorpse()
// we don't SaveToDB for players in battlegrounds so don't do it for corpses either
const MapEntry *entry = sMapStore.LookupEntry(corpse->GetMapId());
assert(entry);
ASSERT(entry);
if(entry->map_type != MAP_BATTLEGROUND)
corpse->SaveToDB();
@ -8255,7 +8255,7 @@ void Player::SendPetSkillWipeConfirm()
void Player::SetVirtualItemSlot( uint8 i, Item* item)
{
assert(i < 3);
ASSERT(i < 3);
if(i < 2 && item)
{
if(!item->GetEnchantmentId(TEMP_ENCHANTMENT_SLOT))
@ -11872,7 +11872,7 @@ void Player::UpdateEnchantTime(uint32 time)
{
for(EnchantDurationList::iterator itr = m_enchantDuration.begin(),next;itr != m_enchantDuration.end();itr=next)
{
assert(itr->item);
ASSERT(itr->item);
next = itr;
if (!itr->item->GetEnchantmentId(itr->slot))
{
@ -13146,7 +13146,7 @@ void Player::SendPetTameFailure(PetTameFailureReason reason)
void Player::AddQuest( Quest const *pQuest, Object *questGiver )
{
uint16 log_slot = FindQuestSlot( 0 );
assert(log_slot < MAX_QUEST_LOG_SIZE);
ASSERT(log_slot < MAX_QUEST_LOG_SIZE);
uint32 quest_id = pQuest->GetQuestId();
@ -13535,7 +13535,7 @@ bool Player::SatisfyQuestPreviousQuest( Quest const* qInfo, bool msg )
ObjectMgr::ExclusiveQuestGroups::const_iterator iter2 = sObjectMgr.mExclusiveQuestGroups.lower_bound(qPrevInfo->GetExclusiveGroup());
ObjectMgr::ExclusiveQuestGroups::const_iterator end = sObjectMgr.mExclusiveQuestGroups.upper_bound(qPrevInfo->GetExclusiveGroup());
assert(iter2!=end); // always must be found if qPrevInfo->ExclusiveGroup != 0
ASSERT(iter2!=end); // always must be found if qPrevInfo->ExclusiveGroup != 0
for(; iter2 != end; ++iter2)
{
@ -13570,7 +13570,7 @@ bool Player::SatisfyQuestPreviousQuest( Quest const* qInfo, bool msg )
ObjectMgr::ExclusiveQuestGroups::const_iterator iter2 = sObjectMgr.mExclusiveQuestGroups.lower_bound(qPrevInfo->GetExclusiveGroup());
ObjectMgr::ExclusiveQuestGroups::const_iterator end = sObjectMgr.mExclusiveQuestGroups.upper_bound(qPrevInfo->GetExclusiveGroup());
assert(iter2!=end); // always must be found if qPrevInfo->ExclusiveGroup != 0
ASSERT(iter2!=end); // always must be found if qPrevInfo->ExclusiveGroup != 0
for(; iter2 != end; ++iter2)
{
@ -13673,7 +13673,7 @@ bool Player::SatisfyQuestExclusiveGroup( Quest const* qInfo, bool msg )
ObjectMgr::ExclusiveQuestGroups::const_iterator iter = sObjectMgr.mExclusiveQuestGroups.lower_bound(qInfo->GetExclusiveGroup());
ObjectMgr::ExclusiveQuestGroups::const_iterator end = sObjectMgr.mExclusiveQuestGroups.upper_bound(qInfo->GetExclusiveGroup());
assert(iter!=end); // always must be found if qInfo->ExclusiveGroup != 0
ASSERT(iter!=end); // always must be found if qInfo->ExclusiveGroup != 0
for(; iter != end; ++iter)
{
@ -14483,7 +14483,7 @@ void Player::SendQuestUpdateAddItem( Quest const* /*pQuest*/, uint32 /*item_idx*
void Player::SendQuestUpdateAddCreatureOrGo( Quest const* pQuest, ObjectGuid guid, uint32 creatureOrGO_idx, uint32 old_count, uint32 add_count )
{
assert(old_count + add_count < 65536 && "mob/GO count store in 16 bits 2^16 = 65536 (0..65536)");
ASSERT(old_count + add_count < 65536 && "mob/GO count store in 16 bits 2^16 = 65536 (0..65536)");
int32 entry = pQuest->ReqCreatureOrGOId[ creatureOrGO_idx ];
if (entry < 0)
@ -15146,7 +15146,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
{
// save source node as recall coord to prevent recall and fall from sky
TaxiNodesEntry const* nodeEntry = sTaxiNodesStore.LookupEntry(node_id);
assert(nodeEntry); // checked in m_taxi.LoadTaxiDestinationsFromString
ASSERT(nodeEntry); // checked in m_taxi.LoadTaxiDestinationsFromString
m_recallMap = nodeEntry->map_id;
m_recallX = nodeEntry->x;
m_recallY = nodeEntry->y;
@ -16109,7 +16109,7 @@ void Player::ConvertInstancesToGroup(Player *player, Group *group, uint64 player
bool has_solo = false;
if(player) { player_guid = player->GetGUID(); if(!group) group = player->GetGroup(); }
assert(player_guid);
ASSERT(player_guid);
// copy all binds to the group, when changing leader it's assumed the character
// will not have any solo binds
@ -16200,7 +16200,7 @@ bool Player::_LoadHomeBind(QueryResult *result)
void Player::SaveToDB()
{
// we should assure this: assert((m_nextSave != sWorld.getConfig(CONFIG_UINT32_INTERVAL_SAVE)));
// we should assure this: ASSERT((m_nextSave != sWorld.getConfig(CONFIG_UINT32_INTERVAL_SAVE)));
// delay auto save at any saves (manual, in code, or autosave)
m_nextSave = sWorld.getConfig(CONFIG_UINT32_INTERVAL_SAVE);
@ -18915,7 +18915,7 @@ void Player::SetGroup(Group *group, int8 subgroup)
else
{
// never use SetGroup without a subgroup unless you specify NULL for group
assert(subgroup >= 0);
ASSERT(subgroup >= 0);
m_group.link(group, this);
m_group.setSubGroup((uint8)subgroup);
}
@ -20083,7 +20083,7 @@ void Player::SetOriginalGroup(Group *group, int8 subgroup)
else
{
// never use SetOriginalGroup without a subgroup unless you specify NULL for group
assert(subgroup >= 0);
ASSERT(subgroup >= 0);
m_originalGroup.link(group, this);
m_originalGroup.setSubGroup((uint8)subgroup);
}

View file

@ -368,7 +368,7 @@ struct Runes
struct EnchantDuration
{
EnchantDuration() : item(NULL), slot(MAX_ENCHANTMENT_SLOT), leftduration(0) {};
EnchantDuration(Item * _item, EnchantmentSlot _slot, uint32 _leftduration) : item(_item), slot(_slot), leftduration(_leftduration) { assert(item); };
EnchantDuration(Item * _item, EnchantmentSlot _slot, uint32 _leftduration) : item(_item), slot(_slot), leftduration(_leftduration) { ASSERT(item); };
Item * item;
EnchantmentSlot slot;
@ -1509,7 +1509,7 @@ class MANGOS_DLL_SPEC Player : public Unit
void AddMItem(Item* it)
{
ASSERT( it );
//assert deleted, because items can be added before loading
//ASSERT deleted, because items can be added before loading
mMitems[it->GetGUIDLow()] = it;
}

View file

@ -276,8 +276,8 @@ void PoolGroup<T>::SpawnObject(SpawnedPoolData& spawns, uint32 limit, uint32 tri
if (obj->guid == triggerFrom)
{
assert(spawns.IsSpawnedObject<T>(obj->guid));
assert(spawns.GetSpawnedObjects(poolId) > 0);
ASSERT(spawns.IsSpawnedObject<T>(obj->guid));
ASSERT(spawns.GetSpawnedObjects(poolId) > 0);
ReSpawn1Object(obj);
triggerFrom = 0;
continue;

View file

@ -695,7 +695,7 @@ namespace MaNGOS
template<class T> inline void Visit(GridRefManager<T> &m)
{
assert(i_data);
ASSERT(i_data);
if(!i_originalCaster)
return;

View file

@ -378,9 +378,9 @@ m_effIndex(eff), m_auraSlot(MAX_AURAS), m_auraFlags(AFLAG_NONE), m_auraLevel(1),
m_positive(false), m_permanent(false), m_isPeriodic(false), m_isAreaAura(false), m_isPersistent(false),
m_isRemovedOnShapeLost(true), m_in_use(0), m_deleted(false)
{
assert(target);
ASSERT(target);
assert(spellproto && spellproto == sSpellStore.LookupEntry( spellproto->Id ) && "`info` must be pointer to sSpellStore element");
ASSERT(spellproto && spellproto == sSpellStore.LookupEntry( spellproto->Id ) && "`info` must be pointer to sSpellStore element");
m_spellProto = spellproto;
@ -8190,7 +8190,7 @@ void Aura::UnregisterSingleCastAura()
else
{
sLog.outError("Couldn't find the caster of the single target aura (SpellId %u), may crash later!", GetId());
assert(false);
ASSERT(false);
}
m_isSingleTargetAura = false;
}

View file

@ -2553,7 +2553,7 @@ bool LoadPetDefaultSpells_helper(CreatureInfo const* cInfo, PetDefaultSpellsEntr
void SpellMgr::LoadPetDefaultSpells()
{
assert(MAX_CREATURE_SPELL_DATA_SLOT==CREATURE_MAX_SPELLS);
ASSERT(MAX_CREATURE_SPELL_DATA_SLOT==CREATURE_MAX_SPELLS);
mPetDefaultSpellsMap.clear();

View file

@ -291,7 +291,7 @@ HostileReference* ThreatContainer::selectNextVictim(Creature* pAttacker, Hostile
currentRef = (*iter);
Unit* target = currentRef->getTarget();
assert(target); // if the ref has status online the target must be there !
ASSERT(target); // if the ref has status online the target must be there !
// some units are prefered in comparison to others
if(!noPriorityTargetFound && (target->IsImmunedToDamage(pAttacker->GetMeleeDamageSchoolMask()) || target->hasNegativeAuraWithInterruptFlag(AURA_INTERRUPT_FLAG_DAMAGE)) )
@ -388,7 +388,7 @@ void ThreatManager::addThreat(Unit* pVictim, float pThreat, bool crit, SpellScho
if(!pVictim->isAlive() || !getOwner()->isAlive() )
return;
assert(getOwner()->GetTypeId()== TYPEID_UNIT);
ASSERT(getOwner()->GetTypeId()== TYPEID_UNIT);
float threat = ThreatCalcHelper::calcThreat(pVictim, iOwner, pThreat, crit, schoolMask, pThreatSpell);

View file

@ -48,7 +48,7 @@ struct MANGOS_DLL_DECL Traveller
float GetPositionZ() const { return i_traveller.GetPositionZ(); }
T& GetTraveller(void) { return i_traveller; }
float Speed(void) { assert(false); return 0.0f; }
float Speed(void) { ASSERT(false); return 0.0f; }
float GetMoveDestinationTo(float x, float y, float z);
uint32 GetTotalTrevelTimeTo(float x, float y, float z);

View file

@ -269,9 +269,9 @@ 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_gameObj.size() == 0);
ASSERT(m_dynObjGUIDs.size() == 0);
ASSERT(m_deletedAuras.size() == 0);
}
void Unit::Update( uint32 p_time )
@ -466,7 +466,7 @@ void Unit::resetAttackTimer(WeaponAttackType type)
bool Unit::canReachWithAttack(Unit *pVictim) const
{
assert(pVictim);
ASSERT(pVictim);
float reach = GetFloatValue(UNIT_FIELD_COMBATREACH);
if( reach <= 0.0f )
reach = 1.0f;
@ -860,10 +860,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);
ASSERT(pVictim->GetTypeId()==TYPEID_PLAYER);
Player *he = (Player*)pVictim;
assert(he->duel);
ASSERT(he->duel);
he->duel->opponent->CombatStopWithPets(true);
he->CombatStopWithPets(true);
@ -1037,10 +1037,10 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
// last damage from duel opponent
if(duel_hasEnded)
{
assert(pVictim->GetTypeId()==TYPEID_PLAYER);
ASSERT(pVictim->GetTypeId()==TYPEID_PLAYER);
Player *he = (Player*)pVictim;
assert(he->duel);
ASSERT(he->duel);
he->SetHealth(1);
@ -3346,7 +3346,7 @@ void Unit::_UpdateAutoRepeatSpell()
void Unit::SetCurrentCastedSpell( Spell * pSpell )
{
assert(pSpell); // NULL may be never passed here, use InterruptSpell or InterruptNonMeleeSpells
ASSERT(pSpell); // NULL may be never passed here, use InterruptSpell or InterruptNonMeleeSpells
CurrentSpellTypes CSpellType = pSpell->GetCurrentContainer();
@ -3417,7 +3417,7 @@ void Unit::SetCurrentCastedSpell( Spell * pSpell )
void Unit::InterruptSpell(CurrentSpellTypes spellType, bool withDelayed, bool sendAutoRepeatCancelToClient)
{
assert(spellType < CURRENT_MAX_SPELL);
ASSERT(spellType < CURRENT_MAX_SPELL);
if (m_currentSpells[spellType] && (withDelayed || m_currentSpells[spellType]->getState() != SPELL_STATE_DELAYED) )
{
@ -4668,7 +4668,7 @@ GameObject* Unit::GetGameObject(uint32 spellId) const
void Unit::AddGameObject(GameObject* gameObj)
{
assert(gameObj && gameObj->GetOwnerGUID()==0);
ASSERT(gameObj && gameObj->GetOwnerGUID()==0);
m_gameObj.push_back(gameObj);
gameObj->SetOwnerGUID(GetGUID());
@ -4684,7 +4684,7 @@ void Unit::AddGameObject(GameObject* gameObj)
void Unit::RemoveGameObject(GameObject* gameObj, bool del)
{
assert(gameObj && gameObj->GetOwnerGUID()==GetGUID());
ASSERT(gameObj && gameObj->GetOwnerGUID()==GetGUID());
gameObj->SetOwnerGUID(0);
@ -11091,7 +11091,7 @@ void Unit::DeleteThreatList()
void Unit::TauntApply(Unit* taunter)
{
assert(GetTypeId()== TYPEID_UNIT);
ASSERT(GetTypeId()== TYPEID_UNIT);
if(!taunter || (taunter->GetTypeId() == TYPEID_PLAYER && ((Player*)taunter)->isGameMaster()))
return;
@ -11114,7 +11114,7 @@ void Unit::TauntApply(Unit* taunter)
void Unit::TauntFadeOut(Unit *taunter)
{
assert(GetTypeId()== TYPEID_UNIT);
ASSERT(GetTypeId()== TYPEID_UNIT);
if(!taunter || (taunter->GetTypeId() == TYPEID_PLAYER && ((Player*)taunter)->isGameMaster()))
return;
@ -11152,7 +11152,7 @@ bool Unit::SelectHostileTarget()
//next-victim-selection algorithm and evade mode are called
//threat list sorting etc.
assert(GetTypeId()== TYPEID_UNIT);
ASSERT(GetTypeId()== TYPEID_UNIT);
if (!this->isAlive())
return false;

View file

@ -48,11 +48,11 @@ class Vehicle : public Creature
private:
void SaveToDB(uint32, uint8) // overwrited of Creature::SaveToDB - don't must be called
{
assert(false);
ASSERT(false);
}
void DeleteFromDB() // overwrited of Creature::DeleteFromDB - don't must be called
{
assert(false);
ASSERT(false);
}
};
#endif

View file

@ -103,7 +103,7 @@ void WaypointManager::Load()
WaypointPath &path = m_pathMap[id];
// the cleanup queries make sure the following is true
assert(point >= 1 && point <= path.size());
ASSERT(point >= 1 && point <= path.size());
WaypointNode &node = path[point-1];
node.x = fields[0].GetFloat();
@ -191,7 +191,7 @@ void WaypointManager::Cleanup()
WorldDatabase.DirectExecute("UPDATE creature_movement AS T SET point = (SELECT COUNT(*) FROM temp WHERE id = T.id AND point <= T.point)");
WorldDatabase.DirectExecute("ALTER TABLE creature_movement ADD PRIMARY KEY (id, point)");
WorldDatabase.DirectExecute("DROP TABLE temp");
assert(!(result = WorldDatabase.Query("SELECT 1 from creature_movement As T WHERE point <> (SELECT COUNT(*) FROM creature_movement WHERE id = T.id AND point <= T.point) LIMIT 1")));
ASSERT(!(result = WorldDatabase.Query("SELECT 1 from creature_movement As T WHERE point <> (SELECT COUNT(*) FROM creature_movement WHERE id = T.id AND point <= T.point) LIMIT 1")));
}
}

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "9637"
#define REVISION_NR "9638"
#endif // __REVISION_NR_H__