mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 16:37:01 +00:00
[9638] Replace all C assert()s with MaNGOS ASSERT() macro.
This commit is contained in:
parent
4443737005
commit
51fd11c92c
34 changed files with 121 additions and 121 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue