diff options
author | jackpoz <giacomopoz@gmail.com> | 2014-04-25 21:19:30 +0200 |
---|---|---|
committer | jackpoz <giacomopoz@gmail.com> | 2014-04-25 21:19:30 +0200 |
commit | 2585e799f95f259dd4b422daf15ef7963173c408 (patch) | |
tree | 96335cb3da64afc64af4ad3c3e994f441059832d | |
parent | dc8a7a6fa5a3afb8f95958db2bdc0888361e56f8 (diff) |
Core/Misc: Change how Position struct is retrieved
Update Position::GetPosition() and similar methods signatures to reflect 2a4c9bcaf910430cdf3070987ce085da3c2666da changes by return a Position object instead of accepting a Position parameter by reference.
51 files changed, 102 insertions, 158 deletions
diff --git a/src/server/game/AI/CreatureAI.cpp b/src/server/game/AI/CreatureAI.cpp index 07c75eb424f..dd8b42deb9f 100644 --- a/src/server/game/AI/CreatureAI.cpp +++ b/src/server/game/AI/CreatureAI.cpp @@ -252,15 +252,13 @@ Creature* CreatureAI::DoSummon(uint32 entry, const Position& pos, uint32 despawn Creature* CreatureAI::DoSummon(uint32 entry, WorldObject* obj, float radius, uint32 despawnTime, TempSummonType summonType) { - Position pos; - obj->GetRandomNearPosition(pos, radius); + Position pos = obj->GetRandomNearPosition(radius); return me->SummonCreature(entry, pos, summonType, despawnTime); } Creature* CreatureAI::DoSummonFlyer(uint32 entry, WorldObject* obj, float flightZ, float radius, uint32 despawnTime, TempSummonType summonType) { - Position pos; - obj->GetRandomNearPosition(pos, radius); + Position pos = obj->GetRandomNearPosition(radius); pos.m_positionZ += flightZ; return me->SummonCreature(entry, pos, summonType, despawnTime); } diff --git a/src/server/game/AI/SmartScripts/SmartAI.cpp b/src/server/game/AI/SmartScripts/SmartAI.cpp index 3b055cabbfa..521f39171af 100644 --- a/src/server/game/AI/SmartScripts/SmartAI.cpp +++ b/src/server/game/AI/SmartScripts/SmartAI.cpp @@ -47,7 +47,7 @@ SmartAI::SmartAI(Creature* c) : CreatureAI(c) me->SetWalk(false); mRun = false; - me->GetPosition(&mLastOOCPos); + mLastOOCPos = me->GetPosition(); mCanAutoAttack = true; mCanCombatMove = true; @@ -132,7 +132,7 @@ void SmartAI::StartPath(bool run, uint32 path, bool repeat, Unit* /*invoker*/) if (WayPoint* wp = GetNextWayPoint()) { - me->GetPosition(&mLastOOCPos); + mLastOOCPos = me->GetPosition(); me->GetMotionMaster()->MovePoint(wp->id, wp->x, wp->y, wp->z); GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_START, NULL, wp->id, GetScript()->GetPathId()); } @@ -162,7 +162,7 @@ void SmartAI::PausePath(uint32 delay, bool forced) return; } mForcedPaused = forced; - me->GetPosition(&mLastOOCPos); + mLastOOCPos = me->GetPosition(); AddEscortState(SMART_ESCORT_PAUSED); mWPPauseTimer = delay; if (forced) @@ -184,7 +184,7 @@ void SmartAI::StopPath(uint32 DespawnTime, uint32 quest, bool fail) SetDespawnTime(DespawnTime); //mDespawnTime = DespawnTime; - me->GetPosition(&mLastOOCPos); + mLastOOCPos = me->GetPosition(); me->StopMoving();//force stop me->GetMotionMaster()->MoveIdle(); GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_STOPPED, NULL, mLastWP->id, GetScript()->GetPathId()); @@ -572,7 +572,7 @@ void SmartAI::EnterCombat(Unit* enemy) { me->InterruptNonMeleeSpells(false); // must be before ProcessEvents GetScript()->ProcessEventsFor(SMART_EVENT_AGGRO, enemy); - me->GetPosition(&mLastOOCPos); + mLastOOCPos = me->GetPosition(); SetRun(mRun); if (me->GetMotionMaster()->GetMotionSlotType(MOTION_SLOT_ACTIVE) == POINT_MOTION_TYPE) me->GetMotionMaster()->MovementExpired(); diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp index 7ec5a09508a..5555f2a824c 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp @@ -156,8 +156,7 @@ bool BattlefieldWG::SetupBattlefield() // Spawn turrets and hide them per default for (uint8 i = 0; i < WG_MAX_TURRET; i++) { - Position towerCannonPos; - WGTurret[i].GetPosition(&towerCannonPos); + Position towerCannonPos = WGTurret[i].GetPosition(); if (Creature* creature = SpawnCreature(NPC_WINTERGRASP_TOWER_CANNON, towerCannonPos, TEAM_ALLIANCE)) { CanonList.insert(creature->GetGUID()); diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.h b/src/server/game/Battlefield/Zones/BattlefieldWG.h index c54d8915a33..3a64458c48b 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.h +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.h @@ -1309,8 +1309,7 @@ struct BfWGGameObjectBuilding // Spawn Turret bottom for (uint8 i = 0; i < TowerCannon[towerid].nbTowerCannonBottom; i++) { - Position turretPos; - TowerCannon[towerid].TowerCannonBottom[i].GetPosition(&turretPos); + Position turretPos = TowerCannon[towerid].TowerCannonBottom[i].GetPosition(); if (Creature* turret = m_WG->SpawnCreature(NPC_WINTERGRASP_TOWER_CANNON, turretPos, TEAM_ALLIANCE)) { m_TowerCannonBottomList.insert(turret->GetGUID()); @@ -1335,8 +1334,7 @@ struct BfWGGameObjectBuilding // Spawn Turret top for (uint8 i = 0; i < TowerCannon[towerid].nbTurretTop; i++) { - Position towerCannonPos; - TowerCannon[towerid].TurretTop[i].GetPosition(&towerCannonPos); + Position towerCannonPos = TowerCannon[towerid].TurretTop[i].GetPosition(); if (Creature* turret = m_WG->SpawnCreature(NPC_WINTERGRASP_TOWER_CANNON, towerCannonPos, TeamId(0))) { m_TurretTopList.insert(turret->GetGUID()); diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp index c4aa3ef4481..eba3af70f21 100644 --- a/src/server/game/Battlegrounds/Battleground.cpp +++ b/src/server/game/Battlegrounds/Battleground.cpp @@ -300,12 +300,11 @@ inline void Battleground::_CheckSafePositions(uint32 diff) { m_ValidStartPositionTimer = 0; - Position pos; float x, y, z, o; for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr) if (Player* player = ObjectAccessor::FindPlayer(itr->first)) { - player->GetPosition(&pos); + Position pos = player->GetPosition(); GetTeamStartLoc(player->GetBGTeam(), x, y, z, o); if (pos.GetExactDistSq(x, y, z) > maxDist) { diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index c0a54060298..9827babddd7 100644 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -1555,11 +1555,11 @@ void WorldObject::GetRandomPoint(const Position &pos, float distance, float &ran UpdateGroundPositionZ(rand_x, rand_y, rand_z); // update to LOS height if available } -void WorldObject::GetRandomPoint(const Position &srcPos, float distance, Position &pos) const +Position WorldObject::GetRandomPoint(const Position &srcPos, float distance) const { float x, y, z; GetRandomPoint(srcPos, distance, x, y, z); - pos.Relocate(x, y, z, GetOrientation()); + return Position(x, y, z, GetOrientation()); } void WorldObject::UpdateGroundPositionZ(float x, float y, float &z) const @@ -2527,22 +2527,25 @@ void WorldObject::GetClosePoint(float &x, float &y, float &z, float size, float GetNearPoint(NULL, x, y, z, size, distance2d, GetOrientation() + angle); } -void WorldObject::GetNearPosition(Position &pos, float dist, float angle) +Position WorldObject::GetNearPosition(float dist, float angle) { - GetPosition(&pos); + Position pos = GetPosition(); MovePosition(pos, dist, angle); + return pos; } -void WorldObject::GetFirstCollisionPosition(Position &pos, float dist, float angle) +Position WorldObject::GetFirstCollisionPosition(float dist, float angle) { - GetPosition(&pos); + Position pos = GetPosition(); MovePositionToFirstCollision(pos, dist, angle); + return pos; } -void WorldObject::GetRandomNearPosition(Position &pos, float radius) +Position WorldObject::GetRandomNearPosition(float radius) { - GetPosition(&pos); + Position pos = GetPosition(); MovePosition(pos, radius * (float)rand_norm(), (float)rand_norm() * static_cast<float>(2 * M_PI)); + return pos; } void WorldObject::GetContactPoint(const WorldObject* obj, float &x, float &y, float &z, float distance2d /*= CONTACT_DISTANCE*/) const diff --git a/src/server/game/Entities/Object/Object.h b/src/server/game/Entities/Object/Object.h index 208077e51cb..3d308ee88c1 100644 --- a/src/server/game/Entities/Object/Object.h +++ b/src/server/game/Entities/Object/Object.h @@ -331,10 +331,10 @@ struct Position { x = m_positionX; y = m_positionY; z = m_positionZ; } void GetPosition(float &x, float &y, float &z, float &o) const { x = m_positionX; y = m_positionY; z = m_positionZ; o = m_orientation; } - void GetPosition(Position* pos) const + + Position GetPosition() const { - if (pos) - pos->Relocate(m_positionX, m_positionY, m_positionZ, m_orientation); + return *this; } Position::PositionXYZStreamer PositionXYZStream() @@ -489,6 +489,12 @@ class WorldLocation : public Position void WorldRelocate(const WorldLocation &loc) { m_mapId = loc.GetMapId(); Relocate(loc); } + + WorldLocation GetWorldLocation() const + { + return *this; + } + uint32 GetMapId() const { return m_mapId; } uint32 m_mapId; @@ -579,10 +585,10 @@ class WorldObject : public Object, public WorldLocation void GetNearPoint(WorldObject const* searcher, float &x, float &y, float &z, float searcher_size, float distance2d, float absAngle) const; void GetClosePoint(float &x, float &y, float &z, float size, float distance2d = 0, float angle = 0) const; void MovePosition(Position &pos, float dist, float angle); - void GetNearPosition(Position &pos, float dist, float angle); + Position GetNearPosition(float dist, float angle); void MovePositionToFirstCollision(Position &pos, float dist, float angle); - void GetFirstCollisionPosition(Position &pos, float dist, float angle); - void GetRandomNearPosition(Position &pos, float radius); + Position GetFirstCollisionPosition(float dist, float angle); + Position GetRandomNearPosition(float radius); void GetContactPoint(WorldObject const* obj, float &x, float &y, float &z, float distance2d = CONTACT_DISTANCE) const; float GetObjectSize() const; @@ -590,7 +596,7 @@ class WorldObject : public Object, public WorldLocation void UpdateAllowedPositionZ(float x, float y, float &z) const; void GetRandomPoint(Position const &srcPos, float distance, float &rand_x, float &rand_y, float &rand_z) const; - void GetRandomPoint(Position const &srcPos, float distance, Position &pos) const; + Position GetRandomPoint(Position const &srcPos, float distance) const; uint32 GetInstanceId() const { return m_InstanceId; } diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 94f212e6051..2c5bf220896 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -2209,8 +2209,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati // near teleport, triggering send MSG_MOVE_TELEPORT_ACK from client at landing if (!GetSession()->PlayerLogout()) { - Position oldPos; - GetPosition(&oldPos); + Position oldPos = GetPosition(); if (HasUnitMovementFlag(MOVEMENTFLAG_HOVER)) z += GetFloatValue(UNIT_FIELD_HOVERHEIGHT); Relocate(x, y, z, orientation); diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 979edcdafc7..a6871cd9906 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -16907,7 +16907,7 @@ void Unit::_ExitVehicle(Position const* exitPosition) Position pos; if (!exitPosition) // Exit position not specified - vehicle->GetBase()->GetPosition(&pos); // This should use passenger's current position, leaving it as it is now + pos = vehicle->GetBase()->GetPosition(); // This should use passenger's current position, leaving it as it is now // because we calculate positions incorrect (sometimes under map) else pos = *exitPosition; diff --git a/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp index a34d09c3721..95320865d0b 100644 --- a/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp @@ -45,8 +45,7 @@ void FleeingMovementGenerator<T>::_setTargetLocation(T* owner) _getPoint(owner, x, y, z); // Add LOS check for target point - Position mypos; - owner->GetPosition(&mypos); + Position mypos = owner->GetPosition(); bool isInLOS = VMAP::VMapFactory::createOrGetVMapManager()->isInLineOfSight(owner->GetMapId(), mypos.m_positionX, mypos.m_positionY, @@ -109,8 +108,7 @@ void FleeingMovementGenerator<T>::_getPoint(T* owner, float &x, float &y, float angle = frand(0, 2*static_cast<float>(M_PI)); } - Position pos; - owner->GetFirstCollisionPosition(pos, dist, angle); + Position pos = owner->GetFirstCollisionPosition(dist, angle); x = pos.m_positionX; y = pos.m_positionY; z = pos.m_positionZ; diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 124c1c21332..d9ad62ebf71 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -5012,9 +5012,8 @@ SpellCastResult Spell::CheckCast(bool strict) if (!target) return SPELL_FAILED_DONT_REPORT; - Position pos; - target->GetContactPoint(m_caster, pos.m_positionX, pos.m_positionY, pos.m_positionZ); - target->GetFirstCollisionPosition(pos, CONTACT_DISTANCE, target->GetRelativeAngle(m_caster)); + //target->GetContactPoint(m_caster, pos.m_positionX, pos.m_positionY, pos.m_positionZ); + Position pos = target->GetFirstCollisionPosition(CONTACT_DISTANCE, target->GetRelativeAngle(m_caster)); m_preGeneratedPath.SetPathLengthLimit(m_spellInfo->GetMaxRange(true) * 1.5f); bool result = m_preGeneratedPath.CalculatePath(pos.m_positionX, pos.m_positionY, pos.m_positionZ + target->GetObjectSize(), false, true); diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 35930906307..775f6540944 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -2292,7 +2292,7 @@ void Spell::EffectSummonType(SpellEffIndex effIndex) pos = *destTarget; else // randomize position for multiple summons - m_caster->GetRandomPoint(*destTarget, radius, pos); + pos = m_caster->GetRandomPoint(*destTarget, radius); summon = m_originalCaster->SummonCreature(entry, pos, summonType, duration); if (!summon) @@ -4593,9 +4593,8 @@ void Spell::EffectLeap(SpellEffIndex /*effIndex*/) if (!m_targets.HasDst()) return; - Position pos; - destTarget->GetPosition(&pos); - unitTarget->GetFirstCollisionPosition(pos, unitTarget->GetDistance(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ() + 2.0f), 0.0f); + Position pos = destTarget->GetPosition(); + pos = unitTarget->GetFirstCollisionPosition(unitTarget->GetDistance(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ() + 2.0f), 0.0f); unitTarget->NearTeleportTo(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation(), unitTarget == m_caster); } @@ -4732,9 +4731,8 @@ void Spell::EffectCharge(SpellEffIndex /*effIndex*/) // Spell is not using explicit target - no generated path if (m_preGeneratedPath.GetPathType() == PATHFIND_BLANK) { - Position pos; - unitTarget->GetContactPoint(m_caster, pos.m_positionX, pos.m_positionY, pos.m_positionZ); - unitTarget->GetFirstCollisionPosition(pos, unitTarget->GetObjectSize(), unitTarget->GetRelativeAngle(m_caster)); + //unitTarget->GetContactPoint(m_caster, pos.m_positionX, pos.m_positionY, pos.m_positionZ); + Position pos = unitTarget->GetFirstCollisionPosition(unitTarget->GetObjectSize(), unitTarget->GetRelativeAngle(m_caster)); m_caster->GetMotionMaster()->MoveCharge(pos.m_positionX, pos.m_positionY, pos.m_positionZ); } else @@ -4756,11 +4754,10 @@ void Spell::EffectChargeDest(SpellEffIndex /*effIndex*/) if (m_targets.HasDst()) { - Position pos; - destTarget->GetPosition(&pos); + Position pos = destTarget->GetPosition(); float angle = m_caster->GetRelativeAngle(pos.GetPositionX(), pos.GetPositionY()); float dist = m_caster->GetDistance(pos); - m_caster->GetFirstCollisionPosition(pos, dist, angle); + pos = m_caster->GetFirstCollisionPosition(dist, angle); m_caster->GetMotionMaster()->MoveCharge(pos.m_positionX, pos.m_positionY, pos.m_positionZ); } @@ -5688,7 +5685,7 @@ void Spell::SummonGuardian(uint32 i, uint32 entry, SummonPropertiesEntry const* pos = *destTarget; else // randomize position for multiple summons - m_caster->GetRandomPoint(*destTarget, radius, pos); + pos = m_caster->GetRandomPoint(*destTarget, radius); TempSummon* summon = map->SummonCreature(entry, pos, properties, duration, caster, m_spellInfo->Id); if (!summon) @@ -5909,10 +5906,7 @@ void Spell::EffectBind(SpellEffIndex effIndex) if (m_targets.HasDst()) homeLoc.WorldRelocate(*destTarget); else - { - player->GetPosition(&homeLoc); - homeLoc.m_mapId = player->GetMapId(); - } + homeLoc = player->GetWorldLocation(); player->SetHomebind(homeLoc, areaId); diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp index 597823abc13..ba4b189b9f7 100644 --- a/src/server/scripts/Commands/cs_debug.cpp +++ b/src/server/scripts/Commands/cs_debug.cpp @@ -1382,8 +1382,7 @@ public: } else { - Position pos; - transport->GetPosition(&pos); + Position pos = transport->GetPosition(); handler->PSendSysMessage("Transport %s is %s", transport->GetName().c_str(), transport->GetGoState() == GO_STATE_READY ? "stopped" : "moving"); handler->PSendSysMessage("Transport position: %s", pos.ToString().c_str()); return true; diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp index 92cdb40dc7b..4caeafb681e 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp @@ -353,7 +353,7 @@ public: InfernalPoint *point = NULL; Position pos; if ((me->GetMapId() != 532) || positions.empty()) - me->GetRandomNearPosition(pos, 60); + pos = me->GetRandomNearPosition(60); else { point = Trinity::Containers::SelectRandomContainerElement(positions); diff --git a/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp b/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp index 108aceebb90..f0ca568f0fd 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp @@ -740,8 +740,7 @@ public: if (MoveTimer <= diff) { - Position pos; - me->GetRandomNearPosition(pos, 10); + Position pos = me->GetRandomNearPosition(10); me->GetMotionMaster()->MovePoint(0, pos); MoveTimer = urand(5000, 8000); } else MoveTimer -= diff; diff --git a/src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp b/src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp index 9ceaf8cb85b..fb9f71a51bc 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp @@ -235,8 +235,7 @@ class instance_stratholme : public InstanceMapScript EncounterState[0] = data; if (Creature* ysidaTrigger = instance->GetCreature(ysidaTriggerGUID)) { - Position ysidaPos; - ysidaTrigger->GetPosition(&ysidaPos); + Position ysidaPos = ysidaTrigger->GetPosition(); ysidaTrigger->SummonCreature(NPC_YSIDA, ysidaPos, TEMPSUMMON_TIMED_DESPAWN, 1800000); } events.CancelEvent(EVENT_BARON_RUN); diff --git a/src/server/scripts/EasternKingdoms/zone_hinterlands.cpp b/src/server/scripts/EasternKingdoms/zone_hinterlands.cpp index 9db6a6b4d19..76452fd2ed0 100644 --- a/src/server/scripts/EasternKingdoms/zone_hinterlands.cpp +++ b/src/server/scripts/EasternKingdoms/zone_hinterlands.cpp @@ -112,8 +112,7 @@ public: for (uint8 i = 0; i < 3; ++i) { const Position src = {147.927444f, -3851.513428f, 130.893f, 0}; - Position dst; - me->GetRandomPoint(src, 7.0f, dst); + Position dst = me->GetRandomPoint(src, 7.0f); DoSummon(NPC_MARAUDING_OWL, dst, 25000, TEMPSUMMON_CORPSE_TIMED_DESPAWN); } break; @@ -121,8 +120,7 @@ public: for (uint8 i = 0; i < 3; ++i) { const Position src = {-141.151581f, -4291.213867f, 120.130f, 0}; - Position dst; - me->GetRandomPoint(src, 7.0f, dst); + Position dst = me->GetRandomPoint(src, 7.0f); me->SummonCreature(NPC_VILE_AMBUSHER, dst, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 25000); } break; diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp index 4fa9af466b1..840cdf8cd20 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp @@ -212,8 +212,7 @@ public: } else { - Position pos; - me->GetRandomNearPosition(pos, 40); + Position pos = me->GetRandomNearPosition(40); me->GetMotionMaster()->MovePoint(0, pos.m_positionX, pos.m_positionY, pos.m_positionZ); } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/instance_the_black_morass.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/instance_the_black_morass.cpp index e5920084033..2246ec13726 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/instance_the_black_morass.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/instance_the_black_morass.cpp @@ -269,8 +269,7 @@ public: TC_LOG_DEBUG("scripts", "Instance The Black Morass: Summoning rift boss entry %u.", entry); - Position pos; - me->GetRandomNearPosition(pos, 10.0f); + Position pos = me->GetRandomNearPosition(10.0f); //normalize Z-level if we can, if rift is not at ground level. pos.m_positionZ = std::max(me->GetMap()->GetHeight(pos.m_positionX, pos.m_positionY, MAX_HEIGHT), me->GetMap()->GetWaterLevel(pos.m_positionX, pos.m_positionY)); diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/the_black_morass.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/the_black_morass.cpp index 58bda23fb36..48401674442 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/the_black_morass.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/the_black_morass.cpp @@ -304,8 +304,7 @@ public: return; } - Position pos; - me->GetRandomNearPosition(pos, 10.0f); + Position pos = me->GetRandomNearPosition(10.0f); //normalize Z-level if we can, if rift is not at ground level. pos.m_positionZ = std::max(me->GetMap()->GetHeight(pos.m_positionX, pos.m_positionY, MAX_HEIGHT), me->GetMap()->GetWaterLevel(pos.m_positionX, pos.m_positionY)); diff --git a/src/server/scripts/Kalimdor/OnyxiasLair/instance_onyxias_lair.cpp b/src/server/scripts/Kalimdor/OnyxiasLair/instance_onyxias_lair.cpp index 678a79c51ad..9f04997dda7 100644 --- a/src/server/scripts/Kalimdor/OnyxiasLair/instance_onyxias_lair.cpp +++ b/src/server/scripts/Kalimdor/OnyxiasLair/instance_onyxias_lair.cpp @@ -82,8 +82,7 @@ public: switch (go->GetEntry()) { case GO_WHELP_SPAWNER: - Position goPos; - go->GetPosition(&goPos); + Position goPos = go->GetPosition(); if (Creature* temp = go->SummonCreature(NPC_WHELP, goPos, TEMPSUMMON_CORPSE_DESPAWN)) { temp->SetInCombatWithZone(); diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ayamiss.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ayamiss.cpp index 04e5f031589..c2450d87739 100644 --- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ayamiss.cpp +++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ayamiss.cpp @@ -158,8 +158,7 @@ class boss_ayamiss : public CreatureScript me->SetCanFly(false); if (me->GetVictim()) { - Position VictimPos; - me->EnsureVictim()->GetPosition(&VictimPos); + Position VictimPos = me->EnsureVictim()->GetPosition(); me->GetMotionMaster()->MovePoint(POINT_GROUND, VictimPos); } DoResetThreat(); @@ -212,8 +211,7 @@ class boss_ayamiss : public CreatureScript break; case EVENT_SUMMON_SWARMER: { - Position Pos; - me->GetRandomPoint(SwarmerPos, 80.0f, Pos); + Position Pos = me->GetRandomPoint(SwarmerPos, 80.0f); me->SummonCreature(NPC_SWARMER, Pos); events.ScheduleEvent(EVENT_SUMMON_SWARMER, 5000); break; diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ossirian.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ossirian.cpp index 3852802f43d..d3744935f2e 100644 --- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ossirian.cpp +++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ossirian.cpp @@ -146,8 +146,7 @@ class boss_ossirian : public CreatureScript for (uint8 i = 0; i < NUM_TORNADOS; ++i) { - Position Point; - me->GetRandomPoint(RoomCenter, RoomRadius, Point); + Position Point = me->GetRandomPoint(RoomCenter, RoomRadius); if (Creature* Tornado = me->GetMap()->SummonCreature(NPC_SAND_VORTEX, Point)) Tornado->CastSpell(Tornado, SPELL_SAND_STORM, true); } diff --git a/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp b/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp index 38bc321d2af..d0c246eb0a3 100644 --- a/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp +++ b/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp @@ -669,8 +669,7 @@ class npc_stillpine_capitive : public CreatureScript Talk(CAPITIVE_SAY, owner); _player = owner; } - Position pos; - me->GetNearPosition(pos, 3.0f, 0.0f); + Position pos = me->GetNearPosition(3.0f, 0.0f); me->GetMotionMaster()->MovePoint(POINT_INIT, pos); } diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_amanitar.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_amanitar.cpp index 8f71ae47bcb..9b1f833f51b 100644 --- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_amanitar.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_amanitar.cpp @@ -87,9 +87,7 @@ class boss_amanitar : public CreatureScript for (uint8 i = 0; i < 30; ++i) { - Position pos; - me->GetPosition(&pos); - me->GetRandomNearPosition(pos, 30.0f); + Position pos = me->GetRandomNearPosition(30.0f); pos.m_positionZ = me->GetMap()->GetHeight(pos.GetPositionX(), pos.GetPositionY(), MAX_HEIGHT) + 2.0f; if (Creature* trigger = me->SummonCreature(NPC_TRIGGER, pos)) diff --git a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp index 8a9fc2993a8..57549cd2d41 100644 --- a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp @@ -136,8 +136,7 @@ public: Creature* DoSummonImpaleTarget(Unit* target) { - Position targetPos; - target->GetPosition(&targetPos); + Position targetPos = target->GetPosition(); if (TempSummon* impaleTarget = me->SummonCreature(CREATURE_IMPALE_TARGET, targetPos, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 6*IN_MILLISECONDS)) { diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp index 966436a65df..37ee665e43e 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp @@ -418,7 +418,7 @@ class boss_halion : public CreatureScript { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true, -SPELL_TWILIGHT_REALM)) { - target->GetPosition(&_meteorStrikePos); + _meteorStrikePos = target->GetPosition(); me->CastSpell(_meteorStrikePos.GetPositionX(), _meteorStrikePos.GetPositionY(), _meteorStrikePos.GetPositionZ(), SPELL_METEOR_STRIKE, true, NULL, NULL, me->GetGUID()); Talk(SAY_METEOR_STRIKE); } @@ -1013,7 +1013,6 @@ class npc_meteor_strike_initial : public CreatureScript if (HalionAI* halionAI = CAST_AI(HalionAI, owner->AI())) { Position const* ownerPos = halionAI->GetMeteorStrikePosition(); - Position newPos; float angle[4]; angle[0] = me->GetAngle(ownerPos); angle[1] = me->GetAngle(ownerPos) - static_cast<float>(M_PI/2); @@ -1025,7 +1024,7 @@ class npc_meteor_strike_initial : public CreatureScript { angle[i] = Position::NormalizeOrientation(angle[i]); me->SetOrientation(angle[i]); - me->GetNearPosition(newPos, 10.0f, 0.0f); // Exact distance + Position newPos = me->GetNearPosition(10.0f, 0.0f); // Exact distance if (Creature* meteor = me->SummonCreature(NPC_METEOR_STRIKE_NORTH + i, newPos, TEMPSUMMON_TIMED_DESPAWN, 30000)) _meteorList.push_back(meteor); } @@ -1087,8 +1086,7 @@ class npc_meteor_strike : public CreatureScript if (_events.ExecuteEvent() == EVENT_SPAWN_METEOR_FLAME) { - Position pos; - me->GetNearPosition(pos, _range, 0.0f); + Position pos = me->GetNearPosition( _range, 0.0f); if (Creature* flame = me->SummonCreature(NPC_METEOR_STRIKE_FLAME, pos, TEMPSUMMON_TIMED_DESPAWN, 25000)) { @@ -1503,8 +1501,7 @@ class spell_halion_damage_aoe_summon : public SpellScriptLoader SummonPropertiesEntry const* properties = sSummonPropertiesStore.LookupEntry(uint32(GetSpellInfo()->Effects[effIndex].MiscValueB)); uint32 duration = uint32(GetSpellInfo()->GetDuration()); - Position pos; - caster->GetPosition(&pos); + Position pos = caster->GetPosition(); if (Creature* summon = caster->GetMap()->SummonCreature(entry, pos, properties, duration, caster, GetSpellInfo()->Id)) if (summon->IsAIEnabled) summon->AI()->SetData(DATA_STACKS_DISPELLED, GetSpellValue()->EffectBasePoints[EFFECT_1]); diff --git a/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp b/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp index 46912eeb898..f35d70e84b1 100644 --- a/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp +++ b/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp @@ -442,11 +442,9 @@ public: // we do this checks to see if the creature is one of the creatures that sorround the boss if (Creature* colossus = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_DRAKKARI_COLOSSUS))) { - Position homePosition; - me->GetHomePosition().GetPosition(&homePosition); + Position homePosition = me->GetHomePosition(); - Position colossusHomePosition; - colossus->GetHomePosition().GetPosition(&colossusHomePosition); + Position colossusHomePosition = colossus->GetHomePosition(); float distance = homePosition.GetExactDist(colossusHomePosition.GetPositionX(), colossusHomePosition.GetPositionY(), colossusHomePosition.GetPositionZ()); diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp index b053f0a0258..2299bd4012d 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp @@ -444,8 +444,7 @@ class boss_prince_keleseth_icc : public CreatureScript void JustSummoned(Creature* summon) OVERRIDE { summons.Summon(summon); - Position pos; - me->GetPosition(&pos); + Position pos = me->GetPosition(); float maxRange = me->GetDistance2d(summon); float angle = me->GetAngle(summon); me->MovePositionToFirstCollision(pos, maxRange, angle); diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp index f80afd055e9..f5f93292aac 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp @@ -576,8 +576,7 @@ class boss_lady_deathwhisper : public CreatureScript { if (spell->Id == SPELL_DARK_MARTYRDOM_T) { - Position pos; - target->GetPosition(&pos); + Position pos = target->GetPosition(); if (target->GetEntry() == NPC_CULT_FANATIC) me->SummonCreature(NPC_REANIMATED_FANATIC, pos, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000); else diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp index 162382e91b0..3acb7a704a9 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp @@ -401,8 +401,7 @@ class npc_coldflame : public CreatureScript if (_events.ExecuteEvent() == EVENT_COLDFLAME_TRIGGER) { - Position newPos; - me->GetNearPosition(newPos, 5.0f, 0.0f); + Position newPos = me->GetNearPosition(5.0f, 0.0f); me->NearTeleportTo(newPos.GetPositionX(), newPos.GetPositionY(), me->GetPositionZ(), me->GetOrientation()); DoCast(SPELL_COLDFLAME_SUMMON); _events.ScheduleEvent(EVENT_COLDFLAME_TRIGGER, 500); diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp index ac4d18adb8b..2e210b722ce 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp @@ -1436,8 +1436,7 @@ class spell_putricide_mutated_transformation : public SpellScriptLoader SummonPropertiesEntry const* properties = sSummonPropertiesStore.LookupEntry(uint32(GetSpellInfo()->Effects[effIndex].MiscValueB)); uint32 duration = uint32(GetSpellInfo()->GetDuration()); - Position pos; - caster->GetPosition(&pos); + Position pos = caster->GetPosition(); TempSummon* summon = caster->GetMap()->SummonCreature(entry, pos, properties, duration, caster, GetSpellInfo()->Id); if (!summon || !summon->IsVehicle()) return; diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp index b1141e31d39..32d8aaa3ba7 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp @@ -1266,8 +1266,7 @@ class spell_sindragosa_ice_tomb : public SpellScriptLoader void SummonTomb() { - Position pos; - GetHitUnit()->GetPosition(&pos); + Position pos = GetHitUnit()->GetPosition(); if (TempSummon* summon = GetCaster()->SummonCreature(NPC_ICE_TOMB, pos)) { summon->AI()->SetGUID(GetHitUnit()->GetGUID(), DATA_TRAPPED_PLAYER); diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp index 0d262110b5f..7317f45aaaf 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp @@ -1646,8 +1646,7 @@ class npc_strangulate_vehicle : public CreatureScript { if (me->GetExactDist(lichKing) > 10.0f) { - Position pos; - lichKing->GetNearPosition(pos, float(rand_norm()) * 5.0f + 7.5f, lichKing->GetAngle(me)); + Position pos = lichKing->GetNearPosition(float(rand_norm()) * 5.0f + 7.5f, lichKing->GetAngle(me)); me->GetMotionMaster()->MovePoint(0, pos); } } diff --git a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp index ca2c75e502c..3a334f4d59c 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp @@ -1980,9 +1980,7 @@ class spell_svalna_revive_champion : public SpellScriptLoader if (!caster) return; - Position pos; - caster->GetPosition(&pos); - caster->GetNearPosition(pos, 5.0f, 0.0f); + Position pos = caster->GetNearPosition(5.0f, 0.0f); //pos.m_positionZ = caster->GetBaseMap()->GetHeight(caster->GetPhaseMask(), pos.GetPositionX(), pos.GetPositionY(), caster->GetPositionZ(), true, 50.0f); //pos.m_positionZ += 0.05f; caster->SetHomePosition(pos); diff --git a/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp index fd2734f55ba..c0728765ee9 100644 --- a/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp +++ b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp @@ -470,8 +470,7 @@ public: break; case ACTION_LIFT_IN_AIR: { - Position _zToLift; - me->GetPosition(&_zToLift); + Position _zToLift = me->GetPosition(); if (_phase == PHASE_ONE) { _zToLift.m_positionZ += 20.0f; @@ -1596,8 +1595,7 @@ public: me->DespawnOrUnsummon(2050); me->SetOrientation(2.5f); me->SetSpeed(MOVE_FLIGHT, 1.0f, true); - Position pos; - me->GetPosition(&pos); + Position pos = me->GetPosition(); pos.m_positionX += 10.0f; pos.m_positionY += 10.0f; pos.m_positionZ += 12.0f; diff --git a/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp b/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp index e79f8d0764f..2f85bc5d046 100644 --- a/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp +++ b/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp @@ -105,19 +105,19 @@ public: if (instance->GetDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL) { irisGUID = go->GetGUID(); - go->GetPosition(&focusingIrisPosition); + focusingIrisPosition = go->GetPosition(); } break; case GO_FOCUSING_IRIS_25: if (instance->GetDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL) { irisGUID = go->GetGUID(); - go->GetPosition(&focusingIrisPosition); + focusingIrisPosition = go->GetPosition(); } break; case GO_EXIT_PORTAL: exitPortalGUID = go->GetGUID(); - go->GetPosition(&exitPortalPosition); + exitPortalPosition = go->GetPosition(); break; case GO_HEART_OF_MAGIC_10: if (instance->GetDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL) diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_drakos.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_drakos.cpp index 949b26d3d3b..eac3e1f0b9f 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/boss_drakos.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_drakos.cpp @@ -92,12 +92,9 @@ class boss_drakos : public CreatureScript { case EVENT_BOMB_SUMMON: { - Position position; - me->GetPosition(&position); - for (uint8 i = 0; i <= (postPull ? 3 : 0); i++) { - me->GetRandomNearPosition(position, frand(0.0f, 10.0f)); + Position position = me->GetRandomNearPosition(frand(0.0f, 10.0f)); me->SummonCreature(NPC_UNSTABLE_SPHERE, position); } } diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp index 0a2ebb549f8..7161f133e7c 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp @@ -232,8 +232,7 @@ class boss_urom : public CreatureScript { if (me->GetVictim()) { - Position pos; - me->EnsureVictim()->GetPosition(&pos); + Position pos = me->EnsureVictim()->GetPosition(); me->NearTeleportTo(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation()); me->GetMotionMaster()->MoveChase(me->GetVictim()); diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp index f6cf17c5b88..a96b8ec2f8e 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp @@ -314,8 +314,7 @@ class spell_varos_energize_core_area_enemy : public SpellScriptLoader for (std::list<WorldObject*>::iterator itr = targets.begin(); itr != targets.end();) { - Position pos; - (*itr)->GetPosition(&pos); + Position pos = (*itr)->GetPosition(); float angle = varos->GetAngle((*itr)->GetPositionX(), (*itr)->GetPositionY()); float diff = fabs(orientation - angle); @@ -361,8 +360,7 @@ class spell_varos_energize_core_area_entry : public SpellScriptLoader for (std::list<WorldObject*>::iterator itr = targets.begin(); itr != targets.end();) { - Position pos; - (*itr)->GetPosition(&pos); + Position pos = (*itr)->GetPosition(); float angle = varos->GetAngle((*itr)->GetPositionX(), (*itr)->GetPositionY()); float diff = fabs(orientation - angle); diff --git a/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp b/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp index 506e16741fb..9d48298d07e 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp @@ -264,8 +264,7 @@ class npc_ruby_emerald_amber_drake : public CreatureScript return; } - Position pos; - summoner->GetPosition(&pos); + Position pos = summoner->GetPosition(); me->GetMotionMaster()->MovePoint(POINT_LAND, pos); } @@ -337,8 +336,7 @@ class npc_ruby_emerald_amber_drake : public CreatureScript me->SetOrientation(2.5f); me->SetSpeed(MOVE_FLIGHT, 1.0f, true); Talk(SAY_DRAKES_TAKEOFF); - Position pos; - me->GetPosition(&pos); + Position pos = me->GetPosition(); Position offset = { 10.0f, 10.0f, 12.0f, 0.0f }; pos.RelocateOffset(offset); me->SetDisableGravity(true); diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_ionar.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_ionar.cpp index 1788ecacd35..83ea202a03a 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_ionar.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_ionar.cpp @@ -163,8 +163,7 @@ public: if (lSparkList.empty()) return; - Position pos; - me->GetPosition(&pos); + Position pos = me->GetPosition(); for (std::list<uint64>::const_iterator itr = lSparkList.begin(); itr != lSparkList.end(); ++itr) { @@ -345,8 +344,7 @@ public: { if (me->GetDistance(ionar) > DATA_MAX_SPARK_DISTANCE) { - Position pos; - ionar->GetPosition(&pos); + Position pos = ionar->GetPosition(); me->SetSpeed(MOVE_RUN, 2.0f); me->GetMotionMaster()->Clear(); diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp index 7f3e6485eaf..ca16df4a51e 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp @@ -1587,8 +1587,7 @@ class spell_freya_iron_roots : public SpellScriptLoader PreventHitDefaultEffect(effIndex); uint32 entry = uint32(GetSpellInfo()->Effects[effIndex].MiscValue); - Position pos; - GetCaster()->GetPosition(&pos); + Position pos = GetCaster()->GetPosition(); // Not good at all, but this prevents having roots in a different position then player if (Creature* Roots = GetCaster()->SummonCreature(entry, pos)) GetCaster()->NearTeleportTo(Roots->GetPositionX(), Roots->GetPositionY(), Roots->GetPositionZ(), GetCaster()->GetOrientation()); diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp index 26886719ec8..6e4dace58f2 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp @@ -587,8 +587,7 @@ class spell_ulduar_stone_grip : public SpellScriptLoader // Temporarily relocate player to vehicle exit dest serverside to send proper fall movement // beats me why blizzard sends these 2 spline packets one after another instantly - Position oldPos; - caster->GetPosition(&oldPos); + Position oldPos = caster->GetPosition(); caster->Relocate(exitPosition); caster->GetMotionMaster()->MoveFall(); caster->Relocate(oldPos); diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp index ee87e3e9732..2c6a747d7aa 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp @@ -562,8 +562,7 @@ class npc_pummeller : public CreatureScript if (Creature* xt002 = me->GetCreature(*me, _instance->GetData64(BOSS_XT002))) { - Position pos; - xt002->GetPosition(&pos); + Position pos = xt002->GetPosition(); me->GetMotionMaster()->MovePoint(0, pos); } } diff --git a/src/server/scripts/Northrend/zone_borean_tundra.cpp b/src/server/scripts/Northrend/zone_borean_tundra.cpp index 6ea4490c79d..ea9ebbdc15c 100644 --- a/src/server/scripts/Northrend/zone_borean_tundra.cpp +++ b/src/server/scripts/Northrend/zone_borean_tundra.cpp @@ -2027,8 +2027,7 @@ public: { if (uiTimer <= diff) { - Position pos; - me->GetRandomNearPosition(pos, 10.0f); + Position pos = me->GetRandomNearPosition(10.0f); me->GetMotionMaster()->MovePoint(0, pos); bStarted = false; } diff --git a/src/server/scripts/Northrend/zone_wintergrasp.cpp b/src/server/scripts/Northrend/zone_wintergrasp.cpp index e218741649d..813ec8c368d 100644 --- a/src/server/scripts/Northrend/zone_wintergrasp.cpp +++ b/src/server/scripts/Northrend/zone_wintergrasp.cpp @@ -611,8 +611,7 @@ public: { if (Unit* target = GetHitUnit()) { - WorldLocation loc; - target->GetPosition(&loc); + WorldLocation loc = target->GetWorldLocation(); SetExplTargetDest(loc); } } diff --git a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_mechano_lord_capacitus.cpp b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_mechano_lord_capacitus.cpp index 1135a95e92b..649544e452f 100644 --- a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_mechano_lord_capacitus.cpp +++ b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_mechano_lord_capacitus.cpp @@ -133,8 +133,7 @@ class boss_mechano_lord_capacitus : public CreatureScript break; case EVENT_SUMMON_NETHER_CHARGE: { - Position pos; - me->GetRandomNearPosition(pos, 5.0f); + Position pos = me->GetRandomNearPosition(5.0f); me->SummonCreature(NPC_NETHER_CHARGE, pos, TEMPSUMMON_TIMED_DESPAWN, 18000); events.ScheduleEvent(EVENT_SUMMON_NETHER_CHARGE, 10 * IN_MILLISECONDS); break; diff --git a/src/server/scripts/Outland/zone_shadowmoon_valley.cpp b/src/server/scripts/Outland/zone_shadowmoon_valley.cpp index f0defe88083..867eb542dcb 100644 --- a/src/server/scripts/Outland/zone_shadowmoon_valley.cpp +++ b/src/server/scripts/Outland/zone_shadowmoon_valley.cpp @@ -311,10 +311,10 @@ public: Position pos; if (Unit* EscapeDummy = me->FindNearestCreature(NPC_ESCAPE_DUMMY, 30)) - EscapeDummy->GetPosition(&pos); + pos = EscapeDummy->GetPosition(); else { - me->GetRandomNearPosition(pos, 20); + pos = me->GetRandomNearPosition(20); pos.m_positionZ += 25; } diff --git a/src/server/scripts/Spells/spell_quest.cpp b/src/server/scripts/Spells/spell_quest.cpp index b9fd07293cd..0c3d64dcf48 100644 --- a/src/server/scripts/Spells/spell_quest.cpp +++ b/src/server/scripts/Spells/spell_quest.cpp @@ -2011,8 +2011,7 @@ class spell_q12308_escape_from_silverbrook_summon_worgen : public SpellScriptLoa float dist = GetSpellInfo()->Effects[EFFECT_0].CalcRadius(GetCaster()); float angle = frand(0.75f, 1.25f) * M_PI; - Position pos; - GetCaster()->GetNearPosition(pos, dist, angle); + Position pos = GetCaster()->GetNearPosition(dist, angle); dest.Relocate(pos); } diff --git a/src/server/scripts/World/boss_emerald_dragons.cpp b/src/server/scripts/World/boss_emerald_dragons.cpp index c74405628b5..0ea9e50f56b 100644 --- a/src/server/scripts/World/boss_emerald_dragons.cpp +++ b/src/server/scripts/World/boss_emerald_dragons.cpp @@ -364,8 +364,7 @@ class boss_lethon : public CreatureScript { if (spell->Id == SPELL_DRAW_SPIRIT && target->GetTypeId() == TYPEID_PLAYER) { - Position targetPos; - target->GetPosition(&targetPos); + Position targetPos = target->GetPosition(); me->SummonCreature(NPC_SPIRIT_SHADE, targetPos, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 50000); } } |