diff options
author | ariel- <ariel-@users.noreply.github.com> | 2017-06-11 16:41:11 -0300 |
---|---|---|
committer | ariel- <ariel-@users.noreply.github.com> | 2017-06-11 17:02:01 -0300 |
commit | 3e7b64b2f765bebc722c1194b7fc2f749fae77f7 (patch) | |
tree | b0a7c819e98cf06585fbd5228f40daba4b9399f2 /src/server/game/Globals/ObjectMgr.cpp | |
parent | c210b935942f8f2202f1436f2cf73821614c041d (diff) |
Core/OutdoorPvP: refactor using Position and Quat to pack parameters
- Moved statics to cpp
- Save scriptids into an array
Diffstat (limited to 'src/server/game/Globals/ObjectMgr.cpp')
-rw-r--r-- | src/server/game/Globals/ObjectMgr.cpp | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index fbb238f8084..048eff35504 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -1934,7 +1934,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, G3D::Quat const& rot, uint32 spawntimedelay /*= 0*/) { GameObjectTemplate const* goinfo = GetGameObjectTemplate(entry); if (!goinfo) @@ -1949,14 +1949,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.spawnMask = 1; @@ -1969,7 +1965,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 = new GameObject; if (!go->LoadGameObjectFromDB(guid, map)) @@ -1980,13 +1976,13 @@ ObjectGuid::LowType ObjectMgr::AddGOData(uint32 entry, uint32 mapId, float x, fl } } - TC_LOG_DEBUG("maps", "AddGOData: dbguid %u 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 %u 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) @@ -2004,10 +2000,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; @@ -2024,7 +2019,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 = new Creature(); if (!creature->LoadCreatureFromDB(guid, map)) |