feat(Core/Misc): change how Position struct is retrieved (#9017)

Update Position::GetPosition() and similar methods signatures to reflect 2a4c9bc changes by return a Position object instead of accepting a Position parameter by reference.

Cherry pick of 2585e799f9
This commit is contained in:
sschepens
2021-11-10 19:43:00 -03:00
committed by GitHub
parent d31d8279ca
commit b7f8083915
36 changed files with 68 additions and 133 deletions

View File

@@ -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;
}

View File

@@ -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());

View File

@@ -299,7 +299,7 @@ public:
if ((me->GetMapId() == 532))
{
me->GetRandomNearPosition(pos, 40.0);
pos = me->GetRandomNearPosition(40.0);
}
else
{

View File

@@ -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);
}

View File

@@ -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);

View File

@@ -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)

View File

@@ -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);
}

View File

@@ -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);

View File

@@ -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))
{

View File

@@ -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)

View File

@@ -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;

View File

@@ -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);
}

View File

@@ -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);
}

View File

@@ -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();

View File

@@ -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;

View File

@@ -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;

View File

@@ -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))

View File

@@ -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;

View File

@@ -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;

View File

@@ -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);

View File

@@ -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;

View File

@@ -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;
}

View File

@@ -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);

View File

@@ -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);
}

View File

@@ -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);
}
}

View File

@@ -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())
{