diff options
author | ccrs <ccrs@users.noreply.github.com> | 2017-05-02 14:18:42 +0200 |
---|---|---|
committer | funjoker <funjoker109@gmail.com> | 2020-06-14 20:04:17 +0200 |
commit | 55576d20d837a9b4575c11a73940c29c0e8e605b (patch) | |
tree | 8b4db4405e3664aac4a779fd6a75257ca88a70e9 /src | |
parent | a90f60f7d3b482072d0ae3dbfd49580a3ef9ce88 (diff) |
Core/Creature: drop method SetPosition
eeeevil, use UpdatePosition. It was there just for old scripts compatibility.
(cherry picked from commit 17579f8d91e0dcc6990fe581de9ca51ed444b754)
Diffstat (limited to 'src')
19 files changed, 22 insertions, 39 deletions
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index 44a6ae2b3a4..1d17e161b47 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -2943,20 +2943,6 @@ float Creature::GetPetChaseDistance() const return range; } -void Creature::SetPosition(float x, float y, float z, float o) -{ - // prevent crash when a bad coord is sent by the client - if (!Trinity::IsValidMapCoord(x, y, z, o)) - { - TC_LOG_DEBUG("entities.unit", "Creature::SetPosition(%f, %f, %f) .. bad coordinates!", x, y, z); - return; - } - - GetMap()->CreatureRelocation(this, x, y, z, o); - if (IsVehicle()) - GetVehicleKit()->RelocatePassengers(); -} - float Creature::GetAggroRange(Unit const* target) const { // Determines the aggro range for creatures (usually pets), used mainly for aggressive pet target selection. diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h index cc5608bfc3d..4d7171b4c0d 100644 --- a/src/server/game/Entities/Creature/Creature.h +++ b/src/server/game/Entities/Creature/Creature.h @@ -282,9 +282,6 @@ class TC_GAME_API Creature : public Unit, public GridObject<Creature>, public Ma void SetCannotReachTarget(bool cannotReach) { if (cannotReach == m_cannotReachTarget) return; m_cannotReachTarget = cannotReach; m_cannotReachTimer = 0; } bool CanNotReachTarget() const { return m_cannotReachTarget; } - void SetPosition(float x, float y, float z, float o); - void SetPosition(const Position &pos) { SetPosition(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation()); } - void SetHomePosition(float x, float y, float z, float o) { m_homePosition.Relocate(x, y, z, o); } void SetHomePosition(const Position &pos) { m_homePosition.Relocate(pos); } void GetHomePosition(float& x, float& y, float& z, float& ori) const { m_homePosition.GetPosition(x, y, z, ori); } diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp index 595af9223bc..4d818db8f9d 100644 --- a/src/server/scripts/Commands/cs_npc.cpp +++ b/src/server/scripts/Commands/cs_npc.cpp @@ -891,7 +891,7 @@ public: const_cast<CreatureData*>(data)->posZ = z; const_cast<CreatureData*>(data)->orientation = o; } - creature->SetPosition(x, y, z, o); + creature->UpdatePosition(x, y, z, o); creature->GetMotionMaster()->Initialize(); if (creature->IsAlive()) // dead creature will reset movement generator at respawn { diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp index 9fa6e43ae5d..45fe5e7c0cc 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp @@ -217,7 +217,7 @@ public: { float x = KaelLocations[0][0]; float y = KaelLocations[0][1]; - me->SetPosition(x, y, LOCATION_Z, 0.0f); + me->UpdatePosition(x, y, LOCATION_Z, 0.0f); ThreatContainer::StorageType threatlist = me->getThreatManager().getThreatList(); ThreatContainer::StorageType::const_iterator i = threatlist.begin(); for (i = threatlist.begin(); i != threatlist.end(); ++i) diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/zone_the_scarlet_enclave.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/zone_the_scarlet_enclave.cpp index fea8c330b9c..e97f8a8454d 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/zone_the_scarlet_enclave.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/zone_the_scarlet_enclave.cpp @@ -78,7 +78,7 @@ public: x -= 3.5f; y -= 5.0f; me->GetMotionMaster()->Clear(false); - me->SetPosition(x, y, z, 0.0f); + me->UpdatePosition(x, y, z, 0.0f); } void UpdateAI(uint32 diff) override diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp index d27c334a0de..75ff54ac3eb 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp @@ -805,7 +805,7 @@ public: { float x, y, z; me->GetPosition(x, y, z); //this visual aura some under ground - me->SetPosition(x, y, z + 0.35f, 0.0f); + me->UpdatePosition(x, y, z + 0.35f, 0.0f); debuffGUID.Clear(); Despawn(); Creature* debuff = DoSpawnCreature(HELPER, 0, 0, 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 14500); diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp index e7ee54390ed..ca4ef08a0d1 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp @@ -676,7 +676,7 @@ public: void JustDied(Unit* /*killer*/) override { Talk(SAY_SATH_DEATH); - me->SetPosition(me->GetPositionX(), me->GetPositionY(), DRAGON_REALM_Z, me->GetOrientation()); + me->UpdatePosition(me->GetPositionX(), me->GetPositionY(), DRAGON_REALM_Z, me->GetOrientation()); TeleportAllPlayersBack(); if (Creature* Kalecgos = ObjectAccessor::GetCreature(*me, KalecgosGUID)) { diff --git a/src/server/scripts/EasternKingdoms/zone_undercity.cpp b/src/server/scripts/EasternKingdoms/zone_undercity.cpp index 56cc8d49c25..f28570dc5d5 100644 --- a/src/server/scripts/EasternKingdoms/zone_undercity.cpp +++ b/src/server/scripts/EasternKingdoms/zone_undercity.cpp @@ -150,7 +150,7 @@ public: if (Creature* target = ObjectAccessor::GetCreature(*summoned, targetGUID)) { target->GetMotionMaster()->MoveJump(target->GetPositionX(), target->GetPositionY(), me->GetPositionZ() + 15.0f, me->GetOrientation(), 0); - target->SetPosition(target->GetPositionX(), target->GetPositionY(), me->GetPositionZ()+15.0f, 0.0f); + target->UpdatePosition(target->GetPositionX(), target->GetPositionY(), me->GetPositionZ()+15.0f, 0.0f); summoned->CastSpell(target, SPELL_RIBBON_OF_SOULS, false); } @@ -298,7 +298,7 @@ public: { me->SetDisableGravity(true); me->MonsterMoveWithSpeed(me->GetPositionX(), me->GetPositionY(), HIGHBORNE_LOC_Y_NEW, me->GetDistance(me->GetPositionX(), me->GetPositionY(), HIGHBORNE_LOC_Y_NEW) / (5000 * 0.001f)); - me->SetPosition(me->GetPositionX(), me->GetPositionY(), HIGHBORNE_LOC_Y_NEW, me->GetOrientation()); + me->UpdatePosition(me->GetPositionX(), me->GetPositionY(), HIGHBORNE_LOC_Y_NEW, me->GetOrientation()); EventMove = false; } else EventMoveTimer -= diff; } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp index 00ff25951df..4e280a1ca18 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp @@ -1175,7 +1175,7 @@ public: me->GetPosition(x, y, z); me->UpdateGroundPositionZ(x, y, z); me->GetMotionMaster()->MovePoint(0, x, y, z); - me->SetPosition(x, y, z, 0); + me->UpdatePosition(x, y, z, 0); } void EnterCombat(Unit* /*who*/) override { } @@ -1293,7 +1293,7 @@ public: me->GetPosition(x, y, z); me->UpdateGroundPositionZ(x, y, z); me->GetMotionMaster()->MovePoint(0, x, y, z); - me->SetPosition(x, y, z, 0); + me->UpdatePosition(x, y, z, 0); hyjal_trashAI::JustDied(killer); } diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp index 340ae314f92..59d33f235f4 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp @@ -1042,7 +1042,7 @@ public: if (!target->HasAura(SPELL_DIGESTIVE_ACID)) { - me->SetPosition(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0); + me->UpdatePosition(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0); if (Creature* pPortal = me->SummonCreature(NPC_SMALL_PORTAL, *me, TEMPSUMMON_CORPSE_DESPAWN)) { pPortal->SetReactState(REACT_PASSIVE); @@ -1159,7 +1159,7 @@ public: if (!target->HasAura(SPELL_DIGESTIVE_ACID)) { - me->SetPosition(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0); + me->UpdatePosition(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0); if (Creature* pPortal = me->SummonCreature(NPC_GIANT_PORTAL, *me, TEMPSUMMON_CORPSE_DESPAWN)) { pPortal->SetReactState(REACT_PASSIVE); diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp index 4dd49bb1c66..39a0034747f 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp @@ -227,8 +227,8 @@ struct boss_twinemperorsAI : public ScriptedAI thisPos.Relocate(me); Position otherPos; otherPos.Relocate(pOtherBoss); - pOtherBoss->SetPosition(thisPos); - me->SetPosition(otherPos); + pOtherBoss->UpdatePosition(thisPos); + me->UpdatePosition(otherPos); SetAfterTeleport(); ENSURE_AI(boss_twinemperorsAI, pOtherBoss->AI())->SetAfterTeleport(); diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp index 0a7857225ad..97ba864358a 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp @@ -264,7 +264,7 @@ class ValithriaDespawner : public BasicEvent creature->SetRespawnDelay(10); if (CreatureData const* data = creature->GetCreatureData()) - creature->SetPosition(data->posX, data->posY, data->posZ, data->orientation); + creature->UpdatePosition(data->posX, data->posY, data->posZ, data->orientation); creature->DespawnOrUnsummon(); creature->SetCorpseDelay(corpseDelay); diff --git a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp index 1e857d6164c..1462ebc1df1 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp @@ -358,7 +358,7 @@ class FrostwingGauntletRespawner creature->SetRespawnDelay(2); if (CreatureData const* data = creature->GetCreatureData()) - creature->SetPosition(data->posX, data->posY, data->posZ, data->orientation); + creature->UpdatePosition(data->posX, data->posY, data->posZ, data->orientation); creature->DespawnOrUnsummon(); creature->SetCorpseDelay(corpseDelay); diff --git a/src/server/scripts/Northrend/Nexus/Nexus/boss_magus_telestra.cpp b/src/server/scripts/Northrend/Nexus/Nexus/boss_magus_telestra.cpp index a75650dd6ba..48b1772ea95 100644 --- a/src/server/scripts/Northrend/Nexus/Nexus/boss_magus_telestra.cpp +++ b/src/server/scripts/Northrend/Nexus/Nexus/boss_magus_telestra.cpp @@ -261,7 +261,7 @@ public: for (uint8 n = 0; n < 3; ++n) time[n] = 0; me->GetMotionMaster()->Clear(); - me->SetPosition(CenterOfRoom.GetPositionX(), CenterOfRoom.GetPositionY(), CenterOfRoom.GetPositionZ(), CenterOfRoom.GetOrientation()); + me->UpdatePosition(CenterOfRoom.GetPositionX(), CenterOfRoom.GetPositionY(), CenterOfRoom.GetPositionZ(), CenterOfRoom.GetOrientation()); DoCast(me, SPELL_TELESTRA_BACK); me->SetVisible(true); if (Phase == 1) diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp index 09240de5649..004760c07ee 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp @@ -780,7 +780,7 @@ class boss_flame_leviathan_safety_container : public CreatureScript me->GetPosition(x, y, z); z = me->GetMap()->GetHeight(me->GetPhaseShift(), x, y, z); me->GetMotionMaster()->MovePoint(0, x, y, z); - me->SetPosition(x, y, z, 0); + me->UpdatePosition(x, y, z, 0); } void UpdateAI(uint32 /*diff*/) override diff --git a/src/server/scripts/Northrend/VaultOfArchavon/boss_toravon.cpp b/src/server/scripts/Northrend/VaultOfArchavon/boss_toravon.cpp index 5b9ab19fb86..ae9d06e9e5d 100644 --- a/src/server/scripts/Northrend/VaultOfArchavon/boss_toravon.cpp +++ b/src/server/scripts/Northrend/VaultOfArchavon/boss_toravon.cpp @@ -277,7 +277,7 @@ class npc_frozen_orb_stalker : public CreatureScript { Position pos; me->GetNearPoint(toravon, pos.m_positionX, pos.m_positionY, pos.m_positionZ, 0.0f, 10.0f, 0.0f); - me->SetPosition(pos); + me->UpdatePosition(pos); DoCast(me, SPELL_FROZEN_ORB_SUMMON); } } diff --git a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp index 56b21a7465f..416eec05c45 100644 --- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp +++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp @@ -192,7 +192,7 @@ class boss_grandmaster_vorpil : public CreatureScript if (i_pl->IsAlive() && !i_pl->HasAura(SPELL_BANISH)) i_pl->TeleportTo(me->GetMapId(), VorpilPosition.GetPositionX(), VorpilPosition.GetPositionY(), VorpilPosition.GetPositionZ(), VorpilPosition.GetOrientation(), TELE_TO_NOT_LEAVE_COMBAT); - me->SetPosition(VorpilPosition); + me->UpdatePosition(VorpilPosition); DoCast(me, SPELL_DRAW_SHADOWS, true); DoCast(me, SPELL_RAIN_OF_FIRE); events.ScheduleEvent(EVENT_SHADOWBOLT_VOLLEY, 6000); diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp index 6fba85f3580..59e48cb078b 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp @@ -289,7 +289,7 @@ class boss_alar : public CreatureScript if (me->IsWithinDist3d(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 5.0f)) dist = 5.0f; WaitTimer = 1000 + uint32(floor(dist / 80 * 1000.0f)); - me->SetPosition(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0.0f); + me->UpdatePosition(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0.0f); me->StopMoving(); WaitEvent = WE_LAND; return; diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp index ee7c9396764..f1a4e6e2d8f 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp @@ -291,7 +291,7 @@ class boss_high_astromancer_solarian : public CreatureScript Phase1_Timer = 50000; //After these 50 seconds she portals to the middle of the room and disappears, leaving 3 light portals behind. me->GetMotionMaster()->Clear(); - me->SetPosition(CENTER_X, CENTER_Y, CENTER_Z, CENTER_O); + me->UpdatePosition(CENTER_X, CENTER_Y, CENTER_Z, CENTER_O); for (uint8 i=0; i <= 2; ++i) { if (!i) @@ -357,7 +357,7 @@ class boss_high_astromancer_solarian : public CreatureScript //15 seconds later Solarian reappears out of one of the 3 portals. Simultaneously, 2 healers appear in the two other portals. int i = rand32() % 3; me->GetMotionMaster()->Clear(); - me->SetPosition(Portals[i][0], Portals[i][1], Portals[i][2], CENTER_O); + me->UpdatePosition(Portals[i][0], Portals[i][1], Portals[i][2], CENTER_O); for (int j=0; j <= 2; j++) if (j != i) |