Merge branch 'master' of github.com:TrinityCore/TrinityCore into 4.x

Conflicts:
	src/server/game/Entities/Creature/GossipDef.cpp
	src/server/game/Globals/ObjectMgr.cpp
	src/server/game/Quests/QuestDef.cpp
This commit is contained in:
Machiavelli committed 2011-12-06 12:01:51 +01:00
commit fe69bd654a
27 files changed
+204 -109

No files matched your search

+13 -9
View File
@@ -415,21 +415,25 @@ void Map::InitializeObject(Creature* obj)
}
template<class T>
void Map::AddToMap(T *obj)
bool Map::AddToMap(T *obj)
{
//TODO: Needs clean up. An object should not be added to map twice.
if (obj->IsInWorld())
{
ASSERT(obj->IsInGrid());
obj->UpdateObjectVisibility(true);
return;
return true;
}
CellCoord cellCoord = Trinity::ComputeCellCoord(obj->GetPositionX(), obj->GetPositionY());
//It will create many problems (including crashes) if an object is not added to grid after creation
//The correct way to fix it is to make AddToMap return false and delete the object if it is not added to grid
//But now AddToMap is used in too many places, I will just see how many ASSERT failures it will cause
ASSERT(cellCoord.IsCoordValid());
if (!cellCoord.IsCoordValid())
{
sLog->outError("Map::Add: Object " UI64FMTD " has invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUID(), obj->GetPositionX(), obj->GetPositionY(), cellCoord.x_coord, cellCoord.y_coord);
return;
return false; //Should delete object
}
Cell cell(cellCoord);
@@ -452,6 +456,7 @@ void Map::AddToMap(T *obj)
//something, such as vehicle, needs to be update immediately
//also, trigger needs to cast spell, if not update, cannot see visual
obj->UpdateObjectVisibility(true);
return true;
}
bool Map::IsGridLoaded(const GridCoord &p) const
@@ -660,8 +665,7 @@ void Map::RemovePlayerFromMap(Player* player, bool remove)
}
template<class T>
void
Map::RemoveFromMap(T *obj, bool remove)
void Map::RemoveFromMap(T *obj, bool remove)
{
obj->RemoveFromWorld();
if (obj->isActiveObject())
@@ -2137,10 +2141,10 @@ void Map::RemoveFromActive(Creature* c)
}
}
template void Map::AddToMap(Corpse*);
template void Map::AddToMap(Creature*);
template void Map::AddToMap(GameObject*);
template void Map::AddToMap(DynamicObject*);
template bool Map::AddToMap(Corpse*);
template bool Map::AddToMap(Creature*);
template bool Map::AddToMap(GameObject*);
template bool Map::AddToMap(DynamicObject*);
template void Map::RemoveFromMap(Corpse*, bool);
template void Map::RemoveFromMap(Creature*, bool);