[9454] Fixed some time existed multi-map taxi problem.

Interrupt taxi movegen at far teleport time with remove related state.
Far teleport triggered code not expect this state set.
This commit is contained in:
VladimirMangos 2010-02-26 00:43:07 +03:00
parent ac99fa4d6f
commit 73eeac234f
7 changed files with 30 additions and 24 deletions

View file

@ -117,7 +117,7 @@ void WorldSession::HandleMoveWorldportAckOpcode()
{ {
// short preparations to continue flight // short preparations to continue flight
FlightPathMovementGenerator* flight = (FlightPathMovementGenerator*)(GetPlayer()->GetMotionMaster()->top()); FlightPathMovementGenerator* flight = (FlightPathMovementGenerator*)(GetPlayer()->GetMotionMaster()->top());
flight->Initialize(*GetPlayer()); flight->Reset(*GetPlayer());
return; return;
} }

View file

@ -213,6 +213,8 @@ void WorldSession::HandleMoveSplineDoneOpcode(WorldPacket& recv_data)
// short preparations to continue flight // short preparations to continue flight
FlightPathMovementGenerator* flight = (FlightPathMovementGenerator*)(GetPlayer()->GetMotionMaster()->top()); FlightPathMovementGenerator* flight = (FlightPathMovementGenerator*)(GetPlayer()->GetMotionMaster()->top());
flight->Interrupt(*GetPlayer()); // will reset at map landing
flight->SetCurrentNodeAfterTeleport(); flight->SetCurrentNodeAfterTeleport();
Path::PathNode const& node = flight->GetPath()[flight->GetCurrentNode()]; Path::PathNode const& node = flight->GetPath()[flight->GetCurrentNode()];
flight->SkipCurrentNode(); flight->SkipCurrentNode();

View file

@ -424,7 +424,7 @@ void Unit::SendMonsterMoveByPath(Path const& path, uint32 start, uint32 end, Spl
data << GetPositionY(); data << GetPositionY();
data << GetPositionZ(); data << GetPositionZ();
data << uint32(getMSTime()); data << uint32(getMSTime());
data << uint8(0); data << uint8(SPLINETYPE_NORMAL);
data << uint32(flags); data << uint32(flags);
data << uint32(traveltime); data << uint32(traveltime);
data << uint32(pathSize); data << uint32(pathSize);

View file

@ -417,7 +417,7 @@ enum UnitState
UNIT_STAT_ISOLATED = 0x00000020, // area auras do not affect other players, Aura::HandleAuraModSchoolImmunity UNIT_STAT_ISOLATED = 0x00000020, // area auras do not affect other players, Aura::HandleAuraModSchoolImmunity
// persistent movement generator state (all time while movement generator applied to unit (independent from top state of movegen) // persistent movement generator state (all time while movement generator applied to unit (independent from top state of movegen)
UNIT_STAT_IN_FLIGHT = 0x00000040, // player is in flight mode UNIT_STAT_IN_FLIGHT = 0x00000040, // player is in flight mode (in fact interrupted at far teleport until next map telport landing)
UNIT_STAT_DISTRACTED = 0x00000080, // DistractedMovementGenerator active UNIT_STAT_DISTRACTED = 0x00000080, // DistractedMovementGenerator active
// persistent movement generator state with non-persistent mirror states for stop support // persistent movement generator state with non-persistent mirror states for stop support

View file

@ -69,11 +69,6 @@ void WaypointMovementGenerator<Creature>::LoadPath(Creature &c)
i_hasDone[node_count - 1] = true; i_hasDone[node_count - 1] = true;
} }
void WaypointMovementGenerator<Creature>::ClearWaypoints()
{
i_path = NULL;
}
void WaypointMovementGenerator<Creature>::Initialize( Creature &u ) void WaypointMovementGenerator<Creature>::Initialize( Creature &u )
{ {
i_nextMoveTime.Reset(0); // TODO: check the lower bound (0 is probably too small) i_nextMoveTime.Reset(0); // TODO: check the lower bound (0 is probably too small)
@ -302,15 +297,8 @@ uint32 FlightPathMovementGenerator::GetPathAtMapEnd() const
void FlightPathMovementGenerator::Initialize(Player &player) void FlightPathMovementGenerator::Initialize(Player &player)
{ {
player.getHostileRefManager().setOnlineOfflineState(false);
player.addUnitState(UNIT_STAT_IN_FLIGHT);
player.SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_TAXI_FLIGHT);
LoadPath(player); LoadPath(player);
Traveller<Player> traveller(player); Reset(player);
// do not send movement, it was sent already
i_destinationHolder.SetDestination(traveller, i_path[i_currentNode].x, i_path[i_currentNode].y, i_path[i_currentNode].z, false);
player.SendMonsterMoveByPath(GetPath(),GetCurrentNode(),GetPathAtMapEnd(), SplineFlags(SPLINEFLAG_WALKMODE|SPLINEFLAG_FLYING));
} }
void FlightPathMovementGenerator::Finalize(Player & player) void FlightPathMovementGenerator::Finalize(Player & player)
@ -338,6 +326,23 @@ void FlightPathMovementGenerator::Finalize(Player & player)
} }
} }
void FlightPathMovementGenerator::Interrupt(Player & player)
{
player.clearUnitState(UNIT_STAT_IN_FLIGHT);
}
void FlightPathMovementGenerator::Reset(Player & player)
{
player.getHostileRefManager().setOnlineOfflineState(false);
player.addUnitState(UNIT_STAT_IN_FLIGHT);
player.SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_TAXI_FLIGHT);
Traveller<Player> traveller(player);
// do not send movement, it was sent already
i_destinationHolder.SetDestination(traveller, i_path[i_currentNode].x, i_path[i_currentNode].y, i_path[i_currentNode].z, false);
player.SendMonsterMoveByPath(GetPath(),GetCurrentNode(),GetPathAtMapEnd(), SplineFlags(SPLINEFLAG_WALKMODE|SPLINEFLAG_FLYING));
}
bool FlightPathMovementGenerator::Update(Player &player, const uint32 &diff) bool FlightPathMovementGenerator::Update(Player &player, const uint32 &diff)
{ {
if( MovementInProgress() ) if( MovementInProgress() )
@ -345,6 +350,9 @@ bool FlightPathMovementGenerator::Update(Player &player, const uint32 &diff)
Traveller<Player> traveller(player); Traveller<Player> traveller(player);
if( i_destinationHolder.UpdateTraveller(traveller, diff, false) ) if( i_destinationHolder.UpdateTraveller(traveller, diff, false) )
{ {
if (!IsActive(player)) // force stop processing (movement can move out active zone with cleanup movegens list)
return true; // not expire now, but already lost
i_destinationHolder.ResetUpdate(FLIGHT_TRAVEL_UPDATE); i_destinationHolder.ResetUpdate(FLIGHT_TRAVEL_UPDATE);
if( i_destinationHolder.HasArrived() ) if( i_destinationHolder.HasArrived() )
{ {

View file

@ -50,7 +50,6 @@ class MANGOS_DLL_SPEC PathMovementBase
// template pattern, not defined .. override required // template pattern, not defined .. override required
void LoadPath(T &); void LoadPath(T &);
void ReloadPath(T &);
uint32 GetCurrentNode() const { return i_currentNode; } uint32 GetCurrentNode() const { return i_currentNode; }
bool GetDestination(float& x, float& y, float& z) const { i_destinationHolder.GetDestination(x,y,z); return true; } bool GetDestination(float& x, float& y, float& z) const { i_destinationHolder.GetDestination(x,y,z); return true; }
@ -76,7 +75,7 @@ public PathMovementBase<Creature, WaypointPath const*>
{ {
public: public:
WaypointMovementGenerator(Creature &) : i_nextMoveTime(0), b_StoppedByPlayer(false) {} WaypointMovementGenerator(Creature &) : i_nextMoveTime(0), b_StoppedByPlayer(false) {}
~WaypointMovementGenerator() { ClearWaypoints(); } ~WaypointMovementGenerator() { i_path = NULL; }
void Initialize(Creature &u); void Initialize(Creature &u);
void Interrupt(Creature &); void Interrupt(Creature &);
void Finalize(Creature &); void Finalize(Creature &);
@ -89,7 +88,6 @@ public PathMovementBase<Creature, WaypointPath const*>
// now path movement implmementation // now path movement implmementation
void LoadPath(Creature &c); void LoadPath(Creature &c);
void ReloadPath(Creature &c) { ClearWaypoints(); LoadPath(c); }
// Player stoping creature // Player stoping creature
bool IsStoppedByPlayer() { return b_StoppedByPlayer; } bool IsStoppedByPlayer() { return b_StoppedByPlayer; }
@ -101,7 +99,6 @@ public PathMovementBase<Creature, WaypointPath const*>
bool GetResetPosition(Creature&, float& x, float& y, float& z); bool GetResetPosition(Creature&, float& x, float& y, float& z);
private: private:
void ClearWaypoints();
TimeTrackerSmall i_nextMoveTime; TimeTrackerSmall i_nextMoveTime;
std::vector<bool> i_hasDone; std::vector<bool> i_hasDone;
@ -121,13 +118,12 @@ public PathMovementBase<Player>
explicit FlightPathMovementGenerator(uint32 id, uint32 startNode = 0) : i_pathId(id) { i_currentNode = startNode; } explicit FlightPathMovementGenerator(uint32 id, uint32 startNode = 0) : i_pathId(id) { i_currentNode = startNode; }
void Initialize(Player &); void Initialize(Player &);
void Finalize(Player &); void Finalize(Player &);
void Interrupt(Player &) {} void Interrupt(Player &);
void Reset(Player &) {} void Reset(Player &);
bool Update(Player &, const uint32 &); bool Update(Player &, const uint32 &);
MovementGeneratorType GetMovementGeneratorType() { return FLIGHT_MOTION_TYPE; } MovementGeneratorType GetMovementGeneratorType() { return FLIGHT_MOTION_TYPE; }
void LoadPath(Player &); void LoadPath(Player &);
void ReloadPath(Player &) { /* don't reload flight path */ }
Path& GetPath() { return i_path; } Path& GetPath() { return i_path; }
uint32 GetPathAtMapEnd() const; uint32 GetPathAtMapEnd() const;

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "9453" #define REVISION_NR "9454"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__