Core/Misc: Change how Position struct is retrieved

Update Position::GetPosition() and similar methods signatures to reflect 2a4c9bcaf9 changes by return a Position object instead of accepting a Position parameter by reference.
This commit is contained in:
jackpoz committed 2014-04-25 21:19:30 +02:00
1 parent dc8a7a6fa5
commit 2585e799f9
51 files changed
+102 -158

No files matched your search

+1 -2
View File
@@ -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;
@@ -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);
@@ -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;
@@ -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);
@@ -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;
@@ -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);
}
@@ -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));
@@ -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));
@@ -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();
@@ -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;
@@ -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);
}
@@ -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);
}
@@ -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))
@@ -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))
{
@@ -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]);
@@ -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());
@@ -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);
@@ -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
@@ -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);
@@ -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;
@@ -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);
@@ -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);
}
}
@@ -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);
@@ -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;
@@ -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)
@@ -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);
}
}
@@ -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());
@@ -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);
@@ -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);
@@ -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();
@@ -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());
@@ -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);
@@ -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);
}
}
@@ -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;
}
@@ -611,8 +611,7 @@ public:
{
if (Unit* target = GetHitUnit())
{
WorldLocation loc;
target->GetPosition(&loc);
WorldLocation loc = target->GetWorldLocation();
SetExplTargetDest(loc);
}
}
@@ -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;
@@ -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;
}
+1 -2
View File
@@ -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);
}
@@ -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);
}
}