Core/Misc: Fix various crashes, also related to multithreading (#19012)

* When iterating groups we have to either do it not in multithreaded context (map updates) or start with checking maps (they are guaranteed to change in single thread update).
* Properly clear ComboPoint references on player remove 
* remove some possible references item may have when it is deleted during save. 
* Also clear all hostile references when unit is removed from map.
This commit is contained in:
xinef1 authored and Aokromes committed 2017-02-05 01:58:11 +01:00
1 parent a76da51e7f
commit 2c05a59815
20 files changed
+175 -126

No files matched your search

@@ -613,7 +613,7 @@ void GameObject::Update(uint32 diff)
{
Group* group = sGroupMgr->GetGroupByGUID(lootingGroupLowGUID);
if (group)
group->EndRoll(&loot);
group->EndRoll(&loot, GetMap());
m_groupLootTimer = 0;
lootingGroupLowGUID = 0;
}
@@ -1331,7 +1331,7 @@ void GameObject::Use(Unit* user)
if (itr->second)
{
if (Player* ChairUser = ObjectAccessor::FindPlayer(itr->second))
if (Player* ChairUser = ObjectAccessor::GetPlayer(*this, itr->second))
{
if (ChairUser->IsSitState() && ChairUser->GetStandState() != UNIT_STAND_STATE_SIT && ChairUser->GetExactDist2d(x_i, y_i) < 0.1f)
continue; // This seat is already occupied by ChairUser. NOTE: Not sure if the ChairUser->GetStandState() != UNIT_STAND_STATE_SIT check is required.