aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormegamage <none@none>2009-06-03 00:24:07 -0500
committermegamage <none@none>2009-06-03 00:24:07 -0500
commit297ce013a841731e83fd8169ba1de65f4419eef0 (patch)
tree808a32d9c0eebcd43c6f793ef30b05bce2c18161 /src
parent7e3bb5c2d43faac7ee8d32892840b070f8beaf92 (diff)
*Disable vehicle/creature driver movement when entering vehicle.
--HG-- branch : trunk
Diffstat (limited to 'src')
-rw-r--r--src/game/NullCreatureAI.h1
-rw-r--r--src/game/Unit.cpp7
-rw-r--r--src/game/Vehicle.cpp6
3 files changed, 12 insertions, 2 deletions
diff --git a/src/game/NullCreatureAI.h b/src/game/NullCreatureAI.h
index 347f52228b4..2f481c0a758 100644
--- a/src/game/NullCreatureAI.h
+++ b/src/game/NullCreatureAI.h
@@ -61,6 +61,7 @@ class TRINITY_DLL_DECL NullCreatureAI : public CreatureAI
void AttackStart(Unit *) {}
void UpdateAI(const uint32) {}
void EnterEvadeMode() {}
+ void OnCharmed(bool apply) {}
static int Permissible(const Creature *) { return PERMIT_BASE_IDLE; }
};
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 9bef10368d8..dd589023c47 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -11655,7 +11655,10 @@ void Unit::RemoveFromWorld()
ExitVehicle();
if(GetCharmerGUID())
+ {
sLog.outCrash("Unit %u has charmer guid when removed from world", GetEntry());
+ assert(false);
+ }
WorldObject::RemoveFromWorld();
}
@@ -11701,7 +11704,7 @@ void Unit::UpdateCharmAI()
if(isCharmed())
{
i_disabledAI = i_AI;
- if(isPossessed())
+ if(isPossessed() || ((Creature*)this)->isVehicle())
i_AI = new PossessedAI((Creature*)this);
else
i_AI = new PetAI((Creature*)this);
@@ -14000,7 +14003,7 @@ void Unit::SetPhaseMask(uint32 newPhaseMask, bool update)
return;
for(ControlList::const_iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); ++itr)
- if((*itr)->GetOwnerGUID() == GetGUID())
+ if((*itr)->GetTypeId() == TYPEID_UNIT)
(*itr)->SetPhaseMask(newPhaseMask,true);
for(int8 i = 0; i < MAX_SUMMON_SLOT; ++i)
diff --git a/src/game/Vehicle.cpp b/src/game/Vehicle.cpp
index aaf97b3e413..f915c828c1d 100644
--- a/src/game/Vehicle.cpp
+++ b/src/game/Vehicle.cpp
@@ -25,6 +25,7 @@
#include "WorldPacket.h"
#include "Chat.h"
+#include "CreatureAI.h"
Vehicle::Vehicle() : Creature(), m_vehicleInfo(NULL), m_usableSeatNum(0)
{
@@ -238,6 +239,8 @@ bool Vehicle::AddPassenger(Unit *unit, int8 seatId)
GetPositionZ() + unit->m_movementInfo.t_z,
GetOrientation());
+ unit->GetMotionMaster()->MoveIdle(MOTION_SLOT_IDLE);
+
WorldPacket data;
if(unit->GetTypeId() == TYPEID_PLAYER)
{
@@ -246,6 +249,8 @@ bool Vehicle::AddPassenger(Unit *unit, int8 seatId)
if(seat->first == 0 && seat->second.seatInfo->IsUsable()) // not right
{
setFaction(unit->getFaction());
+ AI()->OnCharmed(true);
+ GetMotionMaster()->MoveIdle();
((Player*)unit)->SetCharm(this, true);
((Player*)unit)->SetViewpoint(this, true);
((Player*)unit)->VehicleSpellInitialize();
@@ -291,6 +296,7 @@ void Vehicle::RemovePassenger(Unit *unit)
if(unit->GetTypeId() == TYPEID_PLAYER && seat->first == 0 && seat->second.seatInfo->IsUsable())
{
RestoreFaction();
+ AI()->OnCharmed(false);
((Player*)unit)->SetCharm(this, false);
((Player*)unit)->SetViewpoint(this, false);
((Player*)unit)->SendRemoveControlBar();