diff --git a/src/server/game/AI/CreatureAI.cpp b/src/server/game/AI/CreatureAI.cpp index 689927f29..7868fff6a 100644 --- a/src/server/game/AI/CreatureAI.cpp +++ b/src/server/game/AI/CreatureAI.cpp @@ -355,15 +355,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/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index 86e423fce..0dd6ad6d4 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -1484,9 +1484,9 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u for (uint32 i = 0; i < e.target.randomPoint.amount; i++) { if (e.target.randomPoint.self > 0) - me->GetRandomPoint(me->GetPosition(), range, randomPoint); + randomPoint = me->GetRandomPoint(me->GetPosition(), range); else - me->GetRandomPoint(srcPos, range, randomPoint); + randomPoint = me->GetRandomPoint(srcPos, range); if (Creature* summon = summoner->SummonCreature(e.action.summonCreature.creature, randomPoint, (TempSummonType)e.action.summonCreature.type, e.action.summonCreature.duration)) { if (unit && e.action.summonCreature.attackInvoker) @@ -1854,9 +1854,8 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (me) { float range = (float)e.target.randomPoint.range; - Position randomPoint; Position srcPos = { e.target.x, e.target.y, e.target.z, e.target.o }; - me->GetRandomPoint(srcPos, range, randomPoint); + Position randomPoint = me->GetRandomPoint(srcPos, range); me->GetMotionMaster()->MovePoint( e.action.MoveToPos.pointId, randomPoint.m_positionX, @@ -2438,9 +2437,8 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (me) { float range = (float)e.target.randomPoint.range; - Position randomPoint; Position srcPos = { e.target.x, e.target.y, e.target.z, e.target.o }; - me->GetRandomPoint(srcPos, range, randomPoint); + Position randomPoint = me->GetRandomPoint(srcPos, range); me->GetMotionMaster()->MoveJump(randomPoint, (float)e.action.jump.speedxy, (float)e.action.jump.speedz); } diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp index b4f680887..73e16bf93 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp @@ -155,8 +155,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 61a13aaca..550e4133a 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.h +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.h @@ -1338,8 +1338,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()); @@ -1350,8 +1349,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, TEAM_ALLIANCE)) { m_TurretTopList.insert(turret->GetGUID()); diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp index 088cf91cf..7f1415d8c 100644 --- a/src/server/game/Battlegrounds/Battleground.cpp +++ b/src/server/game/Battlegrounds/Battleground.cpp @@ -310,11 +310,10 @@ 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) { - itr->second->GetPosition(&pos); + Position pos = itr->second->GetPosition(); GetTeamStartLoc(itr->second->GetBgTeamId(), 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 137c9d53a..e62842d0a 100644 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -1684,11 +1684,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 @@ -2797,22 +2797,18 @@ bool WorldObject::GetClosePoint(float& x, float& y, float& z, float size, float return true; } -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::GetRandomNearPosition(float radius) { - GetPosition(&pos); - MovePositionToFirstCollision(pos, dist, angle); -} - -void WorldObject::GetRandomNearPosition(Position& pos, float radius) -{ - GetPosition(&pos); + Position pos = GetPosition(); MovePosition(pos, radius * (float) rand_norm(), (float) rand_norm() * static_cast(2 * M_PI)); + return pos; } void WorldObject::GetContactPoint(const WorldObject* obj, float& x, float& y, float& z, float distance2d) const @@ -2926,7 +2922,7 @@ Position WorldObject::GetFirstCollisionPosition(float destX, float destY, float Position WorldObject::GetFirstCollisionPosition(float dist, float angle) { Position pos = GetPosition(); - GetFirstCollisionPosition(pos, dist, angle); + MovePositionToFirstCollision(pos, dist, angle); return pos; } diff --git a/src/server/game/Entities/Object/Object.h b/src/server/game/Entities/Object/Object.h index efc830abb..28a07a4ad 100644 --- a/src/server/game/Entities/Object/Object.h +++ b/src/server/game/Entities/Object/Object.h @@ -354,11 +354,6 @@ struct Position z = m_positionZ; o = m_orientation; } - void GetPosition(Position* pos) const - { - if (pos) - pos->Relocate(m_positionX, m_positionY, m_positionZ, m_orientation); - } [[nodiscard]] Position GetPosition() const { return *this; } @@ -697,13 +692,12 @@ public: void GetVoidClosePoint(float& x, float& y, float& z, float size, float distance2d = 0, float relAngle = 0, float controlZ = 0) const; bool GetClosePoint(float& x, float& y, float& z, float size, float distance2d = 0, float angle = 0, const WorldObject* forWho = nullptr, bool force = false) 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); Position GetFirstCollisionPosition(float startX, float startY, float startZ, float destX, float destY); Position GetFirstCollisionPosition(float destX, float destY, float destZ); Position GetFirstCollisionPosition(float dist, float angle); - void GetFirstCollisionPosition(Position& pos, float dist, float angle); - void GetRandomNearPosition(Position& pos, float radius); + Position GetRandomNearPosition(float radius); void GetContactPoint(const WorldObject* obj, float& x, float& y, float& z, float distance2d = CONTACT_DISTANCE) const; void GetChargeContactPoint(const WorldObject* obj, float& x, float& y, float& z, float distance2d = CONTACT_DISTANCE) const; @@ -715,7 +709,7 @@ public: void UpdateAllowedPositionZ(float x, float y, float& z, float* groundZ = nullptr) const; void GetRandomPoint(const Position& srcPos, float distance, float& rand_x, float& rand_y, float& rand_z) const; - void GetRandomPoint(const Position& srcPos, float distance, Position& pos) const; + Position GetRandomPoint(const Position& srcPos, float distance) const; [[nodiscard]] 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 2bd05b131..330ae61ad 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -1439,8 +1439,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(); Relocate(x, y, z, orientation); SendTeleportAckPacket(); SendTeleportPacket(oldPos); // this automatically relocates to oldPos in order to broadcast the packet in the right place diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index b788e7cac..8b6105d70 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -18833,7 +18833,7 @@ void Unit::_ExitVehicle(Position const* exitPosition) Position pos; if (!exitPosition) // Exit position not specified - vehicleBase->GetPosition(&pos); // This should use passenger's current position, leaving it as it is now + pos = vehicleBase->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/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 964d7a9e3..a96d5c08d 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -2491,7 +2491,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) @@ -4883,8 +4883,7 @@ void Spell::EffectLeap(SpellEffIndex /*effIndex*/) if (!m_targets.HasDst()) return; - Position dstpos; - destTarget->GetPosition(&dstpos); + Position dstpos = destTarget->GetPosition(); unitTarget->NearTeleportTo(dstpos.GetPositionX(), dstpos.GetPositionY(), dstpos.GetPositionZ(), dstpos.GetOrientation(), unitTarget == m_caster); } @@ -5118,15 +5117,7 @@ void Spell::EffectCharge(SpellEffIndex /*effIndex*/) } else { - Position pos; - unitTarget->GetContactPoint(m_caster, pos.m_positionX, pos.m_positionY, pos.m_positionZ); - // assume that target is not in water - else should be always in los - if (!m_caster->IsWithinLOS(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ())) - { - float angle = m_caster->GetRelativeAngle(&pos); - float dist = m_caster->GetDistance(pos); - m_caster->GetFirstCollisionPosition(pos, dist, angle); - } + Position pos = unitTarget->GetFirstCollisionPosition(unitTarget->GetObjectSize(), unitTarget->GetRelativeAngle(m_caster)); m_caster->GetMotionMaster()->MoveCharge(pos.m_positionX, pos.m_positionY, pos.m_positionZ + Z_OFFSET_FIND_HEIGHT, SPEED_CHARGE, EVENT_CHARGE, nullptr, false, 0.f, targetGUID); @@ -5156,14 +5147,13 @@ void Spell::EffectChargeDest(SpellEffIndex /*effIndex*/) if (m_targets.HasDst()) { - Position pos; - destTarget->GetPosition(&pos); + Position pos = destTarget->GetPosition(); if (!m_caster->IsWithinLOS(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ())) { 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); @@ -6206,7 +6196,7 @@ void Spell::SummonGuardian(uint32 i, uint32 entry, SummonPropertiesEntry const* else { // randomize position - m_caster->GetRandomPoint(*destTarget, radius, pos); + pos = m_caster->GetRandomPoint(*destTarget, radius); } summon = map->SummonCreature(entry, pos, properties, duration, caster, m_spellInfo->Id); @@ -6470,8 +6460,7 @@ void Spell::EffectBind(SpellEffIndex effIndex) 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/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_the_beast.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_the_beast.cpp index 4a3e6c9cd..1f9f80763 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_the_beast.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_the_beast.cpp @@ -62,8 +62,7 @@ public: bool Execute(uint64 /*time*/, uint32 /*diff*/) override { _me->SetReactState(REACT_PASSIVE); - Position movePos; - _me->GetRandomPoint(OrcsRunawayPosition, 10.0f, movePos); + Position movePos = _me->GetRandomPoint(OrcsRunawayPosition, 10.0f); _me->GetMotionMaster()->MovePoint(1, movePos); return true; } diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp index 1fc6b6f37..17390e894 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp @@ -272,8 +272,7 @@ public: PreventHitDefaultEffect(effIndex); if (Unit* target = GetHitUnit()) { - Position pos; - target->GetFirstCollisionPosition(pos, 5.0f, M_PI); + Position pos = target->GetFirstCollisionPosition(5.0f, M_PI); GetCaster()->CastSpell(target, SPELL_GARROTE_DUMMY, true); GetCaster()->RemoveAurasDueToSpell(SPELL_VANISH); GetCaster()->NearTeleportTo(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), target->GetOrientation()); diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp index f4f16dfb1..5d5532148 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp @@ -299,7 +299,7 @@ public: if ((me->GetMapId() == 532)) { - me->GetRandomNearPosition(pos, 40.0); + pos = me->GetRandomNearPosition(40.0); } else { diff --git a/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp b/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp index aa2900ebd..02d9c0a6e 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp @@ -778,8 +778,7 @@ public: if (MoveTimer <= diff) { - Position pos; - me->GetRandomNearPosition(pos, 10); + Position pos = me->GetRandomNearPosition(10); me->GetMotionMaster()->MovePoint(0, pos); MoveTimer = urand(3000, 5000); } diff --git a/src/server/scripts/EasternKingdoms/zone_isle_of_queldanas.cpp b/src/server/scripts/EasternKingdoms/zone_isle_of_queldanas.cpp index bad0a288c..9619c18af 100644 --- a/src/server/scripts/EasternKingdoms/zone_isle_of_queldanas.cpp +++ b/src/server/scripts/EasternKingdoms/zone_isle_of_queldanas.cpp @@ -318,8 +318,7 @@ public: // emerge cast tr false 66947 case EVENT_SPAWN_WAVE_1: { - Position spawnPos; - c->GetPosition(&spawnPos); + Position spawnPos = c->GetPosition(); spawnPos.m_orientation = 5.80f; spawnPos.m_positionX += 5.0f * cos(4.5f); spawnPos.m_positionY += 5.0f * sin(4.5f); @@ -333,8 +332,7 @@ public: break; case EVENT_SPAWN_WAVE_2: { - Position spawnPos; - c->GetPosition(&spawnPos); + Position spawnPos = c->GetPosition(); spawnPos.m_orientation = 5.80f; spawnPos.m_positionX += 7.0f * cos(4.0f); spawnPos.m_positionY += 7.0f * sin(4.0f); @@ -349,8 +347,7 @@ public: break; case EVENT_SPAWN_WAVE_3: { - Position spawnPos; - c->GetPosition(&spawnPos); + Position spawnPos = c->GetPosition(); spawnPos.m_orientation = 5.80f; spawnPos.m_positionX += 8.0f * cos(4.0f); spawnPos.m_positionY += 8.0f * sin(4.0f); diff --git a/src/server/scripts/Events/hallows_end.cpp b/src/server/scripts/Events/hallows_end.cpp index 973dde2ea..a68a9b527 100644 --- a/src/server/scripts/Events/hallows_end.cpp +++ b/src/server/scripts/Events/hallows_end.cpp @@ -1199,8 +1199,7 @@ public: events.CancelEvent(EVENT_HORSEMAN_CLEAVE); // Summon Head - Position pos; - me->GetNearPosition(pos, 15.0f, rand_norm() * 2 * M_PI); + Position pos = me->GetNearPosition(15.0f, rand_norm() * 2 * M_PI); if (Creature* cr = me->SummonCreature(NPC_HORSEMAN_HEAD, pos)) { if (health) diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp index 068d7c688..ec8d77c27 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp @@ -233,8 +233,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/CullingOfStratholme/instance_culling_of_stratholme.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/instance_culling_of_stratholme.cpp index 403849db9..abfa09ff4 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/instance_culling_of_stratholme.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/instance_culling_of_stratholme.cpp @@ -301,8 +301,7 @@ public: if (!instance->GetPlayers().isEmpty()) if (Player* player = instance->GetPlayers().getFirst()->GetSource()) { - Position pos; - player->GetPosition(&pos); + Position pos = player->GetPosition(); if (Creature* cr = instance->SummonCreature(NPC_CHROMIE_MIDDLE, pos)) { cr->SetVisible(false); 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 2776dc025..dce168d4b 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 @@ -268,8 +268,7 @@ public: break; } - Position pos; - rift->GetNearPosition(pos, 10.0f, 2 * M_PI * rand_norm()); + Position pos = rift->GetNearPosition(10.0f, 2 * M_PI * rand_norm()); if (TempSummon* summon = instance->SummonCreature(abs(entry), pos)) { 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 04e153c54..71c1314c8 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/the_black_morass.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/the_black_morass.cpp @@ -323,8 +323,7 @@ public: void DoSummonAtRift(uint32 entry) { - Position pos; - me->GetNearPosition(pos, 10.0f, 2 * M_PI * rand_norm()); + Position pos = me->GetNearPosition(10.0f, 2 * M_PI * rand_norm()); if (Creature* summon = me->SummonCreature(entry, pos, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 150000)) if (instance) diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ayamiss.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ayamiss.cpp index e90ea69e8..825ecd3e0 100644 --- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ayamiss.cpp +++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ayamiss.cpp @@ -155,8 +155,7 @@ public: _phase = PHASE_GROUND; SetCombatMovement(true); me->SetCanFly(false); - Position VictimPos; - me->GetVictim()->GetPosition(&VictimPos); + Position VictimPos = me->GetVictim()->GetPosition(); me->GetMotionMaster()->MovePoint(POINT_GROUND, VictimPos); DoResetThreat(); events.ScheduleEvent(EVENT_LASH, urand(5000, 8000)); @@ -208,8 +207,7 @@ public: 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 338f9e78a..22049f67a 100644 --- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ossirian.cpp +++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ossirian.cpp @@ -146,8 +146,7 @@ public: 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 764d88645..0c9ca1171 100644 --- a/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp +++ b/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp @@ -462,8 +462,7 @@ public: Talk(CAPITIVE_SAY, owner); _playerGUID = owner->GetGUID(); } - 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/ChamberOfAspects/RubySanctum/boss_halion.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp index a19cc1dd0..fac4f4473 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp @@ -1045,8 +1045,7 @@ public: 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)) { bool heroic = summon->GetMap()->IsHeroic(); diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp index 7144046c4..7a756ce1a 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp @@ -2428,8 +2428,7 @@ public: if (!si) return; SpellCastTargets targets; - Position dest; - GetExplTargetDest()->GetPosition(&dest); + Position dest = GetExplTargetDest()->GetPosition(); targets.SetDst(dest); CustomSpellValues values; int32 damage = si->Effects[0].CalcValue() + _energyLeft * _energyLeft * 8; diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp index 31c4243a8..d89ca38a6 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp @@ -1538,8 +1538,7 @@ public: 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 21ba32fc2..9283d0f35 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp @@ -215,8 +215,7 @@ public: if (!sindragosa->IsAlive()) return true; - Position pos; - _owner->GetPosition(&pos); + Position pos = _owner->GetPosition(); _owner->UpdateGroundPositionZ(pos.m_positionX, pos.m_positionY, pos.m_positionZ); if (TempSummon* summon = sindragosa->SummonCreature(NPC_ICE_TOMB, pos)) diff --git a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp index 7aa2c5f46..2e4a9bea4 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp @@ -1770,8 +1770,7 @@ public: { if (spell->Id == 71306 && c->GetTypeId() == TYPEID_UNIT) // Twisted Winds { - Position myPos; - me->GetPosition(&myPos); + Position myPos = me->GetPosition(); me->NearTeleportTo(c->GetPositionX(), c->GetPositionY(), c->GetPositionZ(), c->GetOrientation()); c->NearTeleportTo(myPos.GetPositionX(), myPos.GetPositionY(), myPos.GetPositionZ(), myPos.GetOrientation()); const ThreatContainer::StorageType me_tl = me->getThreatMgr().getThreatList(); @@ -2181,9 +2180,7 @@ public: 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->GetMap()->GetHeight(caster->GetPhaseMask(), pos.GetPositionX(), pos.GetPositionY(), caster->GetPositionZ(), true, 50.0f); pos.m_positionZ += 0.1f; caster->SendMeleeAttackStop(caster->GetVictim()); @@ -3214,8 +3211,7 @@ public: if (currPipeWP != VENGEFUL_WP_COUNT) { - Position pos; - who->GetPosition(&pos); + Position pos = who->GetPosition(); float angle = who->GetAngle(me); float dist = 3.0f; pos.m_positionX += cos(angle) * dist; diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp index 9e2e8936f..98dd3649b 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp @@ -778,8 +778,7 @@ public: ACU->DespawnOrUnsummon(7000); ACU->SetReactState(REACT_PASSIVE); - Position exitPos; - me->GetPosition(&exitPos); + Position exitPos = me->GetPosition(); me->_ExitVehicle(&exitPos); me->AttackStop(); me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_TALK); @@ -1453,8 +1452,7 @@ public: { if( Creature* trigger = me->SummonCreature(NPC_ROCKET_STRIKE_N, temp->GetPositionX(), temp->GetPositionY(), temp->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN, 6000) ) trigger->CastSpell(trigger, SPELL_ROCKET_STRIKE_AURA, true); - Position exitPos; - r->GetPosition(&exitPos); + Position exitPos = r->GetPosition(); exitPos.m_positionX += cos(me->GetOrientation()) * 2.35f; exitPos.m_positionY += sin(me->GetOrientation()) * 2.35f; exitPos.m_positionZ += 2.0f * Phase; diff --git a/src/server/scripts/Northrend/zone_dalaran.cpp b/src/server/scripts/Northrend/zone_dalaran.cpp index 878fec6d8..560309a73 100644 --- a/src/server/scripts/Northrend/zone_dalaran.cpp +++ b/src/server/scripts/Northrend/zone_dalaran.cpp @@ -585,8 +585,7 @@ public: case EVENT_BLINK: { DoCast(me, SPELL_IMPROVED_BLINK); - Position pos; - me->GetRandomNearPosition(pos, (urand(15, 40))); + Position pos = me->GetRandomNearPosition((urand(15, 40))); me->GetMotionMaster()->MovePoint(0, pos.m_positionX, pos.m_positionY, pos.m_positionZ); events.ScheduleEvent(EVENT_DESPAWN, 3 * IN_MILLISECONDS); events.ScheduleEvent(EVENT_DESPAWN_VISUAL, 2.5 * IN_MILLISECONDS); 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 acd11fca1..c4ed5ac5d 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 @@ -118,8 +118,7 @@ public: break; case EVENT_SUMMON_NETHER_CHARGE: { - Position pos; - me->GetRandomNearPosition(pos, 8.0f); + Position pos = me->GetRandomNearPosition(8.0f); me->SummonCreature(NPC_NETHER_CHARGE, pos, TEMPSUMMON_TIMED_DESPAWN, 18000); events.ScheduleEvent(EVENT_SUMMON_NETHER_CHARGE, 5000); break; diff --git a/src/server/scripts/Outland/zone_shadowmoon_valley.cpp b/src/server/scripts/Outland/zone_shadowmoon_valley.cpp index 79b3c7ed1..728882211 100644 --- a/src/server/scripts/Outland/zone_shadowmoon_valley.cpp +++ b/src/server/scripts/Outland/zone_shadowmoon_valley.cpp @@ -535,10 +535,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_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 3d6a2e675..092745e1a 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -1389,8 +1389,7 @@ public: float dist = GetSpellInfo()->Effects[EFFECT_0].CalcRadius(GetCaster()); float angle = frand(0.0f, 2 * M_PI); - Position pos; - GetCaster()->GetNearPosition(pos, dist, angle); + Position pos = GetCaster()->GetNearPosition(dist, angle); dest.Relocate(pos); } @@ -1562,8 +1561,7 @@ public: { if (Unit* caster = GetCaster()) { - Position pos; - caster->GetRandomNearPosition(pos, 5.0f); + Position pos = caster->GetRandomNearPosition(5.0f); if (Creature* haunt = caster->SummonCreature(NPC_SCOURGE_HAUNT, pos, TEMPSUMMON_TIMED_DESPAWN, urand(10, 20) * IN_MILLISECONDS)) { haunt->SetSpeed(MOVE_RUN, 0.5, true); @@ -1602,8 +1600,7 @@ public: if (Unit* caster = GetCaster()) { - Position pos; - caster->GetRandomNearPosition(pos, 5.0f); + Position pos = caster->GetRandomNearPosition(5.0f); if (Creature* haunt = caster->SummonCreature(NPC_SCOURGE_HAUNT, pos, TEMPSUMMON_TIMED_DESPAWN, urand(10, 20) * IN_MILLISECONDS)) { haunt->SetSpeed(MOVE_RUN, 0.5, true); diff --git a/src/server/scripts/Spells/spell_quest.cpp b/src/server/scripts/Spells/spell_quest.cpp index 75a1347a9..263551e7e 100644 --- a/src/server/scripts/Spells/spell_quest.cpp +++ b/src/server/scripts/Spells/spell_quest.cpp @@ -2171,8 +2171,7 @@ class spell_q12308_escape_from_silverbrook_summon_worgen : public SpellScript 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 1fb9055af..e5245ea7e 100644 --- a/src/server/scripts/World/boss_emerald_dragons.cpp +++ b/src/server/scripts/World/boss_emerald_dragons.cpp @@ -364,8 +364,7 @@ public: { 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); } } diff --git a/src/server/scripts/World/npc_stave_of_ancients.cpp b/src/server/scripts/World/npc_stave_of_ancients.cpp index 4e5ca456f..dc269228c 100644 --- a/src/server/scripts/World/npc_stave_of_ancients.cpp +++ b/src/server/scripts/World/npc_stave_of_ancients.cpp @@ -140,8 +140,7 @@ bool NPCStaveQuestAI::ValidThreatlist() void NPCStaveQuestAI::SetHomePosition() { - Position homePosition; - me->GetPosition(&homePosition); + Position homePosition = me->GetPosition(); if (homePosition.IsPositionValid()) { @@ -564,8 +563,7 @@ public: void RespawnPet() { - Position current; - me->GetNearPosition(current, -5.0f, 0.0f); + Position current = me->GetNearPosition(-5.0f, 0.0f); Precious()->RemoveCorpse(false, false); Precious()->SetPosition(current); Precious()->SetHomePosition(current); @@ -609,8 +607,7 @@ public: return; } - Position petResetPos; - me->GetNearPosition(petResetPos, -5.0f, 0.0f); + Position petResetPos = me->GetNearPosition(-5.0f, 0.0f); if (petResetPos.IsPositionValid()) {