Core/Movement: 7fff83d675 followup

remove home position set from creature PauseMovement, and use it when necessary
change log level on DelayedDelete

(cherry picked from commit cd4775420a)
This commit is contained in:
ccrs
2017-08-12 17:35:46 +02:00
committed by Shauren
parent 7586daad62
commit 0a133e77d6
9 changed files with 9 additions and 11 deletions

View File

@@ -144,6 +144,7 @@ void SmartAI::PausePath(uint32 delay, bool forced)
_waypointPauseForced = forced;
SetRun(mRun);
me->PauseMovement();
me->SetHomePosition(me->GetPosition());
}
else
_waypointReached = false;
@@ -407,6 +408,7 @@ void SmartAI::WaypointReached(uint32 nodeId, uint32 pathId)
{
_waypointReached = true;
me->PauseMovement();
me->SetHomePosition(me->GetPosition());
}
else if (HasEscortState(SMART_ESCORT_ESCORTING) && me->GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE)
{

View File

@@ -356,13 +356,6 @@ void Creature::DisappearAndDie()
ForcedDespawn(0);
}
void Creature::PauseMovement(uint32 timer/* = 0*/, uint8 slot/* = 0*/)
{
Unit::PauseMovement(timer, slot);
SetHomePosition(GetPosition());
}
bool Creature::IsReturningHome() const
{
if (GetMotionMaster()->GetMotionSlotType(MOTION_SLOT_ACTIVE) == HOME_MOTION_TYPE)

View File

@@ -296,7 +296,6 @@ class TC_GAME_API Creature : public Unit, public GridObject<Creature>, public Ma
uint32 GetCurrentWaypointID() const { return m_waypointID; }
void UpdateWaypointID(uint32 wpID) { m_waypointID = wpID; }
void PauseMovement(uint32 timer = 0, uint8 slot = 0) override; // timer in ms
bool IsReturningHome() const;
void SearchFormation();

View File

@@ -1909,8 +1909,8 @@ class TC_GAME_API Unit : public WorldObject
bool IsStopped() const { return !(HasUnitState(UNIT_STATE_MOVING)); }
void StopMoving();
virtual void PauseMovement(uint32 timer = 0, uint8 slot = 0); // timer in ms
void ResumeMovement(uint32 timer = 0, uint8 slot = 0);
void PauseMovement(uint32 timer = 0, uint8 slot = 0); // timer in ms
void ResumeMovement(uint32 timer = 0, uint8 slot = 0); // timer in ms
void AddUnitMovementFlag(uint32 f) { m_movementInfo.AddMovementFlag(f); }
void RemoveUnitMovementFlag(uint32 f) { m_movementInfo.RemoveMovementFlag(f); }

View File

@@ -48,6 +48,7 @@ void WorldSession::HandleBattlemasterHelloOpcode(WorldPackets::NPC::Hello& hello
// Stop the npc if moving
unit->PauseMovement(sWorld->getIntConfig(CONFIG_CREATURE_STOP_FOR_PLAYER));
unit->SetHomePosition(unit->GetPosition());
BattlegroundTypeId bgTypeId = sBattlegroundMgr->GetBattleMasterBG(unit->GetEntry());

View File

@@ -601,6 +601,7 @@ void WorldSession::SendListInventory(ObjectGuid vendorGuid)
// Stop the npc if moving
vendor->PauseMovement(sWorld->getIntConfig(CONFIG_CREATURE_STOP_FOR_PLAYER));
vendor->SetHomePosition(vendor->GetPosition());
VendorItemData const* vendorItems = vendor->GetVendorItems();
uint32 rawItemCount = vendorItems ? vendorItems->GetItemCount() : 0;

View File

@@ -170,6 +170,7 @@ void WorldSession::HandleGossipHelloOpcode(WorldPackets::NPC::Hello& packet)
// Stop the npc if moving
unit->PauseMovement(sWorld->getIntConfig(CONFIG_CREATURE_STOP_FOR_PLAYER));
unit->SetHomePosition(unit->GetPosition());
// If spiritguide, no need for gossip menu, just put player into resurrect queue
if (unit->IsSpiritGuide())

View File

@@ -90,6 +90,7 @@ void WorldSession::HandleQuestgiverHelloOpcode(WorldPackets::Quest::QuestGiverHe
// Stop the npc if moving
creature->PauseMovement(sWorld->getIntConfig(CONFIG_CREATURE_STOP_FOR_PLAYER));
creature->SetHomePosition(creature->GetPosition());
_player->PlayerTalkClass->ClearMenus();
if (creature->GetAI()->GossipHello(_player))

View File

@@ -878,7 +878,7 @@ void MotionMaster::DirectDelete(MovementGenerator* curr)
void MotionMaster::DelayedDelete(MovementGenerator* curr)
{
TC_LOG_FATAL("misc", "Unit (Entry %u) is trying to delete its updating Movement Generator (Type %u)!", _owner->GetEntry(), curr->GetMovementGeneratorType());
TC_LOG_DEBUG("misc", "MotionMaster::DelayedDelete: unit (%u) delayed deleting movement generator (type %u)", _owner->GetEntry(), curr->GetMovementGeneratorType());
if (IsStatic(curr))
return;