From 73eeac234f24afb3f81234bcbffa583884c0de29 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Fri, 26 Feb 2010 00:43:07 +0300 Subject: [PATCH] [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. --- src/game/MovementHandler.cpp | 2 +- src/game/TaxiHandler.cpp | 2 ++ src/game/Unit.cpp | 2 +- src/game/Unit.h | 2 +- src/game/WaypointMovementGenerator.cpp | 34 ++++++++++++++++---------- src/game/WaypointMovementGenerator.h | 10 +++----- src/shared/revision_nr.h | 2 +- 7 files changed, 30 insertions(+), 24 deletions(-) diff --git a/src/game/MovementHandler.cpp b/src/game/MovementHandler.cpp index 6150a30ec..df93dde3c 100644 --- a/src/game/MovementHandler.cpp +++ b/src/game/MovementHandler.cpp @@ -117,7 +117,7 @@ void WorldSession::HandleMoveWorldportAckOpcode() { // short preparations to continue flight FlightPathMovementGenerator* flight = (FlightPathMovementGenerator*)(GetPlayer()->GetMotionMaster()->top()); - flight->Initialize(*GetPlayer()); + flight->Reset(*GetPlayer()); return; } diff --git a/src/game/TaxiHandler.cpp b/src/game/TaxiHandler.cpp index 2731af276..a50903f32 100644 --- a/src/game/TaxiHandler.cpp +++ b/src/game/TaxiHandler.cpp @@ -213,6 +213,8 @@ void WorldSession::HandleMoveSplineDoneOpcode(WorldPacket& recv_data) // short preparations to continue flight FlightPathMovementGenerator* flight = (FlightPathMovementGenerator*)(GetPlayer()->GetMotionMaster()->top()); + flight->Interrupt(*GetPlayer()); // will reset at map landing + flight->SetCurrentNodeAfterTeleport(); Path::PathNode const& node = flight->GetPath()[flight->GetCurrentNode()]; flight->SkipCurrentNode(); diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index cbe69fd7b..3a912a4f1 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -424,7 +424,7 @@ void Unit::SendMonsterMoveByPath(Path const& path, uint32 start, uint32 end, Spl data << GetPositionY(); data << GetPositionZ(); data << uint32(getMSTime()); - data << uint8(0); + data << uint8(SPLINETYPE_NORMAL); data << uint32(flags); data << uint32(traveltime); data << uint32(pathSize); diff --git a/src/game/Unit.h b/src/game/Unit.h index fac7911e7..00ccca9b5 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -417,7 +417,7 @@ enum UnitState 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) - 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 // persistent movement generator state with non-persistent mirror states for stop support diff --git a/src/game/WaypointMovementGenerator.cpp b/src/game/WaypointMovementGenerator.cpp index 755fb1e46..0a5d43492 100644 --- a/src/game/WaypointMovementGenerator.cpp +++ b/src/game/WaypointMovementGenerator.cpp @@ -69,11 +69,6 @@ void WaypointMovementGenerator::LoadPath(Creature &c) i_hasDone[node_count - 1] = true; } -void WaypointMovementGenerator::ClearWaypoints() -{ - i_path = NULL; -} - void WaypointMovementGenerator::Initialize( Creature &u ) { 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) { - 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); - Traveller 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)); + Reset(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 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) { if( MovementInProgress() ) @@ -345,6 +350,9 @@ bool FlightPathMovementGenerator::Update(Player &player, const uint32 &diff) Traveller traveller(player); 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); if( i_destinationHolder.HasArrived() ) { diff --git a/src/game/WaypointMovementGenerator.h b/src/game/WaypointMovementGenerator.h index 4b41b78b2..366c7f83a 100644 --- a/src/game/WaypointMovementGenerator.h +++ b/src/game/WaypointMovementGenerator.h @@ -50,7 +50,6 @@ class MANGOS_DLL_SPEC PathMovementBase // template pattern, not defined .. override required void LoadPath(T &); - void ReloadPath(T &); uint32 GetCurrentNode() const { return i_currentNode; } bool GetDestination(float& x, float& y, float& z) const { i_destinationHolder.GetDestination(x,y,z); return true; } @@ -76,7 +75,7 @@ public PathMovementBase { public: WaypointMovementGenerator(Creature &) : i_nextMoveTime(0), b_StoppedByPlayer(false) {} - ~WaypointMovementGenerator() { ClearWaypoints(); } + ~WaypointMovementGenerator() { i_path = NULL; } void Initialize(Creature &u); void Interrupt(Creature &); void Finalize(Creature &); @@ -89,7 +88,6 @@ public PathMovementBase // now path movement implmementation void LoadPath(Creature &c); - void ReloadPath(Creature &c) { ClearWaypoints(); LoadPath(c); } // Player stoping creature bool IsStoppedByPlayer() { return b_StoppedByPlayer; } @@ -101,7 +99,6 @@ public PathMovementBase bool GetResetPosition(Creature&, float& x, float& y, float& z); private: - void ClearWaypoints(); TimeTrackerSmall i_nextMoveTime; std::vector i_hasDone; @@ -121,13 +118,12 @@ public PathMovementBase explicit FlightPathMovementGenerator(uint32 id, uint32 startNode = 0) : i_pathId(id) { i_currentNode = startNode; } void Initialize(Player &); void Finalize(Player &); - void Interrupt(Player &) {} - void Reset(Player &) {} + void Interrupt(Player &); + void Reset(Player &); bool Update(Player &, const uint32 &); MovementGeneratorType GetMovementGeneratorType() { return FLIGHT_MOTION_TYPE; } void LoadPath(Player &); - void ReloadPath(Player &) { /* don't reload flight path */ } Path& GetPath() { return i_path; } uint32 GetPathAtMapEnd() const; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index fe28e11eb..3323dde8c 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9453" + #define REVISION_NR "9454" #endif // __REVISION_NR_H__