aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/server/game/Entities/Totem/Totem.cpp24
-rw-r--r--src/server/game/Entities/Transport/Transport.cpp15
-rw-r--r--src/server/game/Entities/Transport/Transport.h6
-rwxr-xr-xsrc/server/game/Entities/Vehicle/Vehicle.cpp12
-rw-r--r--src/server/game/Entities/Vehicle/Vehicle.h4
-rw-r--r--src/server/game/Entities/Vehicle/VehicleDefines.h14
6 files changed, 36 insertions, 39 deletions
diff --git a/src/server/game/Entities/Totem/Totem.cpp b/src/server/game/Entities/Totem/Totem.cpp
index 07aa28ecee0..9526d8755a5 100644
--- a/src/server/game/Entities/Totem/Totem.cpp
+++ b/src/server/game/Entities/Totem/Totem.cpp
@@ -35,7 +35,7 @@ Totem::Totem(SummonPropertiesEntry const* properties, Unit* owner) : Minion(prop
void Totem::Update(uint32 time)
{
- if (!m_owner->isAlive() || !isAlive())
+ if (!GetOwner()->isAlive() || !isAlive())
{
UnSummon(); // remove self
return;
@@ -55,19 +55,19 @@ void Totem::Update(uint32 time)
void Totem::InitStats(uint32 duration)
{
// client requires SMSG_TOTEM_CREATED to be sent before adding to world and before removing old totem
- if (m_owner->GetTypeId() == TYPEID_PLAYER
- && m_Properties->Slot >= SUMMON_SLOT_TOTEM
- && m_Properties->Slot < MAX_TOTEM_SLOT)
+ if (GetOwner()->GetTypeId() == TYPEID_PLAYER
+ && m_Properties->Slot >= SUMMON_SLOT_TOTEM
+ && m_Properties->Slot < MAX_TOTEM_SLOT)
{
WorldPacket data(SMSG_TOTEM_CREATED, 1 + 8 + 4 + 4);
data << uint8(m_Properties->Slot - 1);
data << uint64(GetGUID());
data << uint32(duration);
data << uint32(GetUInt32Value(UNIT_CREATED_BY_SPELL));
- m_owner->ToPlayer()->SendDirectMessage(&data);
+ GetOwner()->ToPlayer()->SendDirectMessage(&data);
// set display id depending on caster's race
- SetDisplayId(m_owner->GetModelForTotem(PlayerTotemType(m_Properties->Id)));
+ SetDisplayId(GetOwner()->GetModelForTotem(PlayerTotemType(m_Properties->Id)));
}
Minion::InitStats(duration);
@@ -82,7 +82,7 @@ void Totem::InitStats(uint32 duration)
m_duration = duration;
- SetLevel(m_owner->getLevel());
+ SetLevel(GetOwner()->getLevel());
}
void Totem::InitSummon()
@@ -111,21 +111,21 @@ void Totem::UnSummon(uint32 msTime)
// clear owner's totem slot
for (int i = SUMMON_SLOT_TOTEM; i < MAX_TOTEM_SLOT; ++i)
{
- if (m_owner->m_SummonSlot[i] == GetGUID())
+ if (GetOwner()->m_SummonSlot[i] == GetGUID())
{
- m_owner->m_SummonSlot[i] = 0;
+ GetOwner()->m_SummonSlot[i] = 0;
break;
}
}
- m_owner->RemoveAurasDueToSpell(GetSpell(), GetGUID());
+ GetOwner()->RemoveAurasDueToSpell(GetSpell(), GetGUID());
// Remove Sentry Totem Aura
if (GetEntry() == SENTRY_TOTEM_ENTRY)
- m_owner->RemoveAurasDueToSpell(SENTRY_TOTEM_SPELLID);
+ GetOwner()->RemoveAurasDueToSpell(SENTRY_TOTEM_SPELLID);
//remove aura all party members too
- if (Player* owner = m_owner->ToPlayer())
+ if (Player* owner = GetOwner()->ToPlayer())
{
owner->SendAutoRepeatCancel(this);
diff --git a/src/server/game/Entities/Transport/Transport.cpp b/src/server/game/Entities/Transport/Transport.cpp
index c2c01331b4d..76c69a3a4dd 100644
--- a/src/server/game/Entities/Transport/Transport.cpp
+++ b/src/server/game/Entities/Transport/Transport.cpp
@@ -180,11 +180,6 @@ Transport::~Transport()
(*itr)->SetTransport(NULL);
GetMap()->AddObjectToRemoveList(*itr);
}
-
- m_NPCPassengerSet.clear();
-
- m_WayPoints.clear();
- m_passengers.clear();
}
bool Transport::Create(uint32 guidlow, uint32 entry, uint32 mapid, float x, float y, float z, float ang, uint32 animprogress, uint32 dynflags)
@@ -553,7 +548,7 @@ void Transport::Update(uint32 p_diff)
else
{
Relocate(m_curr->second.x, m_curr->second.y, m_curr->second.z, GetAngle(m_next->second.x, m_next->second.y) + float(M_PI));
- UpdateNPCPositions(); // COME BACK MARKER
+ UpdatePassengerPositions(); // COME BACK MARKER
}
sScriptMgr->OnRelocate(this, m_curr->first, m_curr->second.mapid, m_curr->second.x, m_curr->second.y, m_curr->second.z);
@@ -686,10 +681,10 @@ void Transport::UpdatePosition(MovementInfo* mi)
float transport_z = mi->pos.m_positionZ - mi->t_pos.m_positionZ;
Relocate(transport_x, transport_y, transport_z, transport_o);
- UpdateNPCPositions();
+ UpdatePassengerPositions();
}
-void Transport::UpdateNPCPositions()
+void Transport::UpdatePassengerPositions()
{
for (CreatureSet::iterator itr = m_NPCPassengerSet.begin(); itr != m_NPCPassengerSet.end(); ++itr)
{
@@ -705,7 +700,7 @@ void Transport::UpdateNPCPositions()
}
}
-void Transport::CalculatePassengerPosition(float& x, float& y, float& z, float& o)
+void Transport::CalculatePassengerPosition(float& x, float& y, float& z, float& o) const
{
float inx = x, iny = y, inz = z, ino = o;
o = GetOrientation() + ino;
@@ -714,7 +709,7 @@ void Transport::CalculatePassengerPosition(float& x, float& y, float& z, float&
z = GetPositionZ() + inz;
}
-void Transport::CalculatePassengerOffset(float& x, float& y, float& z, float& o)
+void Transport::CalculatePassengerOffset(float& x, float& y, float& z, float& o) const
{
o -= GetOrientation();
z -= GetPositionZ();
diff --git a/src/server/game/Entities/Transport/Transport.h b/src/server/game/Entities/Transport/Transport.h
index d3bc3732b08..bae09335f62 100644
--- a/src/server/game/Entities/Transport/Transport.h
+++ b/src/server/game/Entities/Transport/Transport.h
@@ -47,13 +47,13 @@ class Transport : public GameObject, public TransportBase
CreatureSet m_NPCPassengerSet;
uint32 AddNPCPassenger(uint32 tguid, uint32 entry, float x, float y, float z, float o, uint32 anim=0);
void UpdatePosition(MovementInfo* mi);
- void UpdateNPCPositions();
+ void UpdatePassengerPositions();
/// This method transforms supplied transport offsets into global coordinates
- void CalculatePassengerPosition(float& x, float& y, float& z, float& o);
+ void CalculatePassengerPosition(float& x, float& y, float& z, float& o) const;
/// This method transforms supplied global coordinates into local offsets
- void CalculatePassengerOffset(float& x, float& y, float& z, float& o);
+ void CalculatePassengerOffset(float& x, float& y, float& z, float& o) const;
void BuildStartMovePacket(Map const* targetMap);
void BuildStopMovePacket(Map const* targetMap);
diff --git a/src/server/game/Entities/Vehicle/Vehicle.cpp b/src/server/game/Entities/Vehicle/Vehicle.cpp
index fad9115ee3d..83509c1b2b0 100755
--- a/src/server/game/Entities/Vehicle/Vehicle.cpp
+++ b/src/server/game/Entities/Vehicle/Vehicle.cpp
@@ -674,7 +674,7 @@ uint8 Vehicle::GetAvailableSeatCount() const
return ret;
}
-void Vehicle::CalculatePassengerPosition(float& x, float& y, float& z, float& o)
+void Vehicle::CalculatePassengerPosition(float& x, float& y, float& z, float& o) const
{
float inx = x, iny = y, inz = z, ino = o;
o = GetBase()->GetOrientation() + ino;
@@ -683,7 +683,7 @@ void Vehicle::CalculatePassengerPosition(float& x, float& y, float& z, float& o)
z = GetBase()->GetPositionZ() + inz;
}
-void Vehicle::CalculatePassengerOffset(float& x, float& y, float& z, float& o)
+void Vehicle::CalculatePassengerOffset(float& x, float& y, float& z, float& o) const
{
o -= GetBase()->GetOrientation();
z -= GetBase()->GetPositionZ();
@@ -841,7 +841,7 @@ bool VehicleJoinEvent::Execute(uint64, uint32)
if (Target->GetBase()->GetTypeId() == TYPEID_UNIT && Passenger->GetTypeId() == TYPEID_PLAYER &&
Seat->second.SeatInfo->m_flags & VEHICLE_SEAT_FLAG_CAN_CONTROL)
- ASSERT(Target->GetBase()->SetCharmedBy(Passenger, CHARM_TYPE_VEHICLE)) // SMSG_CLIENT_CONTROL
+ ASSERT(Target->GetBase()->SetCharmedBy(Passenger, CHARM_TYPE_VEHICLE)); // SMSG_CLIENT_CONTROL
Passenger->SendClearTarget(); // SMSG_BREAK_TARGET
Passenger->SetControlled(true, UNIT_STATE_ROOT); // SMSG_FORCE_ROOT - In some cases we send SMSG_SPLINE_MOVE_ROOT here (for creatures)
@@ -854,10 +854,10 @@ bool VehicleJoinEvent::Execute(uint64, uint32)
init.SetTransportEnter();
init.Launch();
- if (Target->GetBase()->GetTypeId() == TYPEID_UNIT)
+ if (Creature* creature = Target->GetBase()->ToCreature())
{
- if (Target->GetBase()->ToCreature()->IsAIEnabled)
- Target->GetBase()->ToCreature()->AI()->PassengerBoarded(Passenger, Seat->first, true);
+ if (creature->IsAIEnabled)
+ creature->AI()->PassengerBoarded(Passenger, Seat->first, true);
sScriptMgr->OnAddPassenger(Target, Passenger, Seat->first);
diff --git a/src/server/game/Entities/Vehicle/Vehicle.h b/src/server/game/Entities/Vehicle/Vehicle.h
index 67975490ecc..3e4a2fd3a78 100644
--- a/src/server/game/Entities/Vehicle/Vehicle.h
+++ b/src/server/game/Entities/Vehicle/Vehicle.h
@@ -89,10 +89,10 @@ class Vehicle : public TransportBase
void InitMovementInfoForBase();
/// This method transforms supplied transport offsets into global coordinates
- void CalculatePassengerPosition(float& x, float& y, float& z, float& o);
+ void CalculatePassengerPosition(float& x, float& y, float& z, float& o) const;
/// This method transforms supplied global coordinates into local offsets
- void CalculatePassengerOffset(float& x, float& y, float& z, float& o);
+ void CalculatePassengerOffset(float& x, float& y, float& z, float& o) const;
void RemovePendingEvent(VehicleJoinEvent* e);
void RemovePendingEventsForSeat(int8 seatId);
diff --git a/src/server/game/Entities/Vehicle/VehicleDefines.h b/src/server/game/Entities/Vehicle/VehicleDefines.h
index 4210a663aab..b02448b2d96 100644
--- a/src/server/game/Entities/Vehicle/VehicleDefines.h
+++ b/src/server/game/Entities/Vehicle/VehicleDefines.h
@@ -77,14 +77,16 @@ typedef std::map<int8, VehicleSeat> SeatMap;
class TransportBase
{
- public:
- virtual ~TransportBase() { }
+protected:
+ TransportBase() { }
+ virtual ~TransportBase() { }
- /// This method transforms supplied transport offsets into global coordinates
- virtual void CalculatePassengerPosition(float& x, float& y, float& z, float& o) = 0;
+public:
+ /// This method transforms supplied transport offsets into global coordinates
+ virtual void CalculatePassengerPosition(float& x, float& y, float& z, float& o) const = 0;
- /// This method transforms supplied global coordinates into local offsets
- virtual void CalculatePassengerOffset(float& x, float& y, float& z, float& o) = 0;
+ /// This method transforms supplied global coordinates into local offsets
+ virtual void CalculatePassengerOffset(float& x, float& y, float& z, float& o) const = 0;
};
#endif