aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Globals/ObjectMgr.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/game/Globals/ObjectMgr.cpp')
-rw-r--r--src/server/game/Globals/ObjectMgr.cpp29
1 files changed, 12 insertions, 17 deletions
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp
index f0fc3f5e297..73a0b0c0c6d 100644
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -2187,7 +2187,7 @@ void ObjectMgr::RemoveCreatureFromGrid(ObjectGuid::LowType guid, CreatureData co
}
}
-ObjectGuid::LowType ObjectMgr::AddGOData(uint32 entry, uint32 mapId, float x, float y, float z, float o, uint32 spawntimedelay, float rotation0, float rotation1, float rotation2, float rotation3)
+ObjectGuid::LowType ObjectMgr::AddGOData(uint32 entry, uint32 mapId, Position const& pos, QuaternionData const& rot, uint32 spawntimedelay /*= 0*/)
{
GameObjectTemplate const* goinfo = GetGameObjectTemplate(entry);
if (!goinfo)
@@ -2201,14 +2201,10 @@ ObjectGuid::LowType ObjectMgr::AddGOData(uint32 entry, uint32 mapId, float x, fl
GameObjectData& data = NewGOData(guid);
data.id = entry;
data.mapid = mapId;
- data.posX = x;
- data.posY = y;
- data.posZ = z;
- data.orientation = o;
- data.rotation.x = rotation0;
- data.rotation.y = rotation1;
- data.rotation.z = rotation2;
- data.rotation.w = rotation3;
+
+ pos.GetPosition(data.posX, data.posY, data.posZ, data.orientation);
+
+ data.rotation = rot;
data.spawntimesecs = spawntimedelay;
data.animprogress = 100;
data.spawnDifficulties.push_back(DIFFICULTY_NONE);
@@ -2220,7 +2216,7 @@ ObjectGuid::LowType ObjectMgr::AddGOData(uint32 entry, uint32 mapId, float x, fl
// Spawn if necessary (loaded grids only)
// We use spawn coords to spawn
- if (!map->Instanceable() && map->IsGridLoaded(x, y))
+ if (!map->Instanceable() && map->IsGridLoaded(data.posX, data.posY))
{
GameObject* go = GameObject::CreateGameObjectFromDB(guid, map);
if (!go)
@@ -2230,12 +2226,12 @@ ObjectGuid::LowType ObjectMgr::AddGOData(uint32 entry, uint32 mapId, float x, fl
}
}
- TC_LOG_DEBUG("maps", "AddGOData: dbguid " UI64FMTD " entry %u map %u x %f y %f z %f o %f", guid, entry, mapId, x, y, z, o);
+ TC_LOG_DEBUG("maps", "AddGOData: dbguid " UI64FMTD " entry %u map %u x %f y %f z %f o %f", guid, entry, mapId, data.posX, data.posY, data.posZ, data.orientation);
return guid;
}
-ObjectGuid::LowType ObjectMgr::AddCreatureData(uint32 entry, uint32 mapId, float x, float y, float z, float o, uint32 spawntimedelay /*= 0*/)
+ObjectGuid::LowType ObjectMgr::AddCreatureData(uint32 entry, uint32 mapId, Position const& pos, uint32 spawntimedelay /*= 0*/)
{
CreatureTemplate const* cInfo = GetCreatureTemplate(entry);
if (!cInfo)
@@ -2256,10 +2252,9 @@ ObjectGuid::LowType ObjectMgr::AddCreatureData(uint32 entry, uint32 mapId, float
data.mapid = mapId;
data.displayid = 0;
data.equipmentId = 0;
- data.posX = x;
- data.posY = y;
- data.posZ = z;
- data.orientation = o;
+
+ pos.GetPosition(data.posX, data.posY, data.posZ, data.orientation);
+
data.spawntimesecs = spawntimedelay;
data.spawndist = 0;
data.currentwaypoint = 0;
@@ -2275,7 +2270,7 @@ ObjectGuid::LowType ObjectMgr::AddCreatureData(uint32 entry, uint32 mapId, float
AddCreatureToGrid(guid, &data);
// We use spawn coords to spawn
- if (!map->Instanceable() && !map->IsRemovalGrid(x, y))
+ if (!map->Instanceable() && !map->IsRemovalGrid(data.posX, data.posY))
{
Creature* creature = Creature::CreateCreatureFromDB(guid, map);
if (!creature)