aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts/World
diff options
context:
space:
mode:
authorjoschiwald <joschiwald.trinity@gmail.com>2014-10-26 01:46:28 +0200
committerjoschiwald <joschiwald.trinity@gmail.com>2014-10-26 01:56:06 +0200
commit747350a0bcffaa4ef2b5d3317bb75fac78c64472 (patch)
treebc70e5a82c432dbb208ea74dfb1574bc467b8f3b /src/server/scripts/World
parent10fb948c409e2e4a68b77b7cfc41c068fcbd0bf4 (diff)
Scripts: replaced various Location struct defines with proper Position or G3D::Vector3
Diffstat (limited to 'src/server/scripts/World')
-rw-r--r--src/server/scripts/World/npcs_special.cpp39
1 files changed, 17 insertions, 22 deletions
diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp
index f7c09fa21b9..6df02b7b20d 100644
--- a/src/server/scripts/World/npcs_special.cpp
+++ b/src/server/scripts/World/npcs_special.cpp
@@ -524,12 +524,7 @@ enum Doctor
HORDE_COORDS = 6
};
-struct Location
-{
- float x, y, z, o;
-};
-
-static Location AllianceCoords[]=
+Position const AllianceCoords[]=
{
{-3757.38f, -4533.05f, 14.16f, 3.62f}, // Top-far-right bunk as seen from entrance
{-3754.36f, -4539.13f, 14.16f, 5.13f}, // Top-far-left bunk
@@ -545,7 +540,7 @@ static Location AllianceCoords[]=
#define A_RUNTOY -4531.52f
#define A_RUNTOZ 11.91f
-static Location HordeCoords[]=
+Position const HordeCoords[]=
{
{-1013.75f, -3492.59f, 62.62f, 4.34f}, // Left, Behind
{-1017.72f, -3490.92f, 62.62f, 4.34f}, // Right, Behind
@@ -614,7 +609,7 @@ public:
bool Event;
GuidList Patients;
- std::vector<Location*> Coordinates;
+ std::vector<Position const*> Coordinates;
void Reset() override
{
@@ -647,7 +642,7 @@ public:
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
}
- void PatientDied(Location* point)
+ void PatientDied(Position const* point)
{
Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID);
if (player && ((player->GetQuestStatus(6624) == QUEST_STATUS_INCOMPLETE) || (player->GetQuestStatus(6622) == QUEST_STATUS_INCOMPLETE)))
@@ -672,7 +667,7 @@ public:
Reset();
}
- void PatientSaved(Creature* /*soldier*/, Player* player, Location* point)
+ void PatientSaved(Creature* /*soldier*/, Player* player, Position const* point)
{
if (player && PlayerGUID == player->GetGUID())
{
@@ -747,7 +742,7 @@ public:
}
ObjectGuid DoctorGUID;
- Location* Coord;
+ Position const* Coord;
void Reset() override
{
@@ -864,7 +859,6 @@ void npc_doctor::npc_doctorAI::UpdateAI(uint32 diff)
if (Coordinates.empty())
return;
- std::vector<Location*>::iterator itr = Coordinates.begin() + rand32() % Coordinates.size();
uint32 patientEntry = 0;
switch (me->GetEntry())
@@ -880,20 +874,21 @@ void npc_doctor::npc_doctorAI::UpdateAI(uint32 diff)
return;
}
- if (Location* point = *itr)
+ std::vector<Position const*>::iterator point = Coordinates.begin();
+ std::advance(point, urand(0, Coordinates.size() - 1));
+
+ if (Creature* Patient = me->SummonCreature(patientEntry, **point, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000))
{
- if (Creature* Patient = me->SummonCreature(patientEntry, point->x, point->y, point->z, point->o, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000))
- {
- //303, this flag appear to be required for client side item->spell to work (TARGET_SINGLE_FRIEND)
- Patient->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE);
+ //303, this flag appear to be required for client side item->spell to work (TARGET_SINGLE_FRIEND)
+ Patient->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE);
- Patients.push_back(Patient->GetGUID());
- ENSURE_AI(npc_injured_patient::npc_injured_patientAI, Patient->AI())->DoctorGUID = me->GetGUID();
- ENSURE_AI(npc_injured_patient::npc_injured_patientAI, Patient->AI())->Coord = point;
+ Patients.push_back(Patient->GetGUID());
+ ENSURE_AI(npc_injured_patient::npc_injured_patientAI, Patient->AI())->DoctorGUID = me->GetGUID();
+ ENSURE_AI(npc_injured_patient::npc_injured_patientAI, Patient->AI())->Coord = *point;
- Coordinates.erase(itr);
- }
+ Coordinates.erase(point);
}
+
SummonPatientTimer = 10000;
++SummonPatientCount;
}