diff options
author | tartalo <none@none> | 2009-11-07 15:54:33 +0100 |
---|---|---|
committer | tartalo <none@none> | 2009-11-07 15:54:33 +0100 |
commit | c922e2a3052b5353d4a64dbe140e3d5bb291c805 (patch) | |
tree | 083ebd04d06888d15e2496b2924629bd69d09277 /src/game/ObjectMgr.cpp | |
parent | c920e87f15c43081460b588bce16ce63bf7c97c9 (diff) |
Fix to Wintergrasp teleporters (Backout 5866), by Spp. Closes #90
*Wintergrasp: Move attacker questgivers to their corresponding campament, BySpp Closes #101
--HG--
branch : trunk
Diffstat (limited to 'src/game/ObjectMgr.cpp')
-rw-r--r-- | src/game/ObjectMgr.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index 0cb124e4a8b..f63074f044b 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -1464,6 +1464,40 @@ uint32 ObjectMgr::AddGOData(uint32 entry, uint32 mapId, float x, float y, float return guid; } +bool ObjectMgr::MoveCreData(uint32 guid, uint32 mapId, Position pos) +{ + CreatureData& data = NewOrExistCreatureData(guid); + if (!data.id) + return false; + + RemoveCreatureFromGrid(guid, &data); + if (data.posX == pos.GetPositionX() && data.posY == pos.GetPositionY() && data.posZ == pos.GetPositionZ()) + return true; + data.posX = pos.GetPositionX(); + data.posY = pos.GetPositionY(); + data.posZ = pos.GetPositionZ(); + data.orientation = pos.GetOrientation(); + AddCreatureToGrid(guid, &data); + + // Spawn if necessary (loaded grids only) + if(Map* map = const_cast<Map*>(MapManager::Instance().CreateBaseMap(mapId))) + { + // We use spawn coords to spawn + if(!map->Instanceable() && map->IsLoaded(data.posX, data.posY)) + { + Creature *creature = new Creature; + if(!creature->LoadFromDB(guid, map)) + { + sLog.outError("AddCreature: cannot add creature entry %u to map", guid); + delete creature; + return false; + } + map->Add(creature); + } + } + return true; +} + uint32 ObjectMgr::AddCreData(uint32 entry, uint32 team, uint32 mapId, float x, float y, float z, float o, uint32 spawntimedelay) { CreatureInfo const *cInfo = GetCreatureTemplate(entry); |