mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-21 09:44:45 +01:00
Core/Transports: Fixed crashes when instance with transports unloads
Closes #11056
This commit is contained in:
@@ -58,8 +58,17 @@ BattlegroundIC::BattlegroundIC()
|
||||
|
||||
BattlegroundIC::~BattlegroundIC()
|
||||
{
|
||||
delete gunshipHorde;
|
||||
delete gunshipAlliance;
|
||||
if (gunshipHorde)
|
||||
{
|
||||
gunshipHorde->RemoveFromWorld();
|
||||
delete gunshipHorde;
|
||||
}
|
||||
|
||||
if (gunshipAlliance)
|
||||
{
|
||||
gunshipAlliance->RemoveFromWorld();
|
||||
delete gunshipAlliance;
|
||||
}
|
||||
}
|
||||
|
||||
void BattlegroundIC::HandlePlayerResurrect(Player* player)
|
||||
|
||||
@@ -39,6 +39,7 @@ Transport::Transport() : GameObject(),
|
||||
|
||||
Transport::~Transport()
|
||||
{
|
||||
UnloadStaticPassengers();
|
||||
}
|
||||
|
||||
bool Transport::Create(uint32 guidlow, uint32 entry, uint32 mapid, float x, float y, float z, float ang, uint32 animprogress)
|
||||
|
||||
@@ -67,6 +67,8 @@ class Transport : public GameObject, public TransportBase
|
||||
|
||||
void EnableMovement(bool enabled);
|
||||
|
||||
TransportTemplate const* GetTransportTemplate() const { return _transportInfo; }
|
||||
|
||||
private:
|
||||
void MoveToNextWaypoint();
|
||||
float CalculateSegmentPos(float perc);
|
||||
|
||||
@@ -63,6 +63,17 @@ Map::~Map()
|
||||
obj->ResetMap();
|
||||
}
|
||||
|
||||
for (TransportsContainer::iterator itr = _transports.begin(); itr != _transports.end(); ++itr)
|
||||
{
|
||||
Transport* transport = *itr;
|
||||
// Destroy local transports
|
||||
if (transport->GetTransportTemplate()->inInstance)
|
||||
{
|
||||
transport->RemoveFromWorld();
|
||||
delete transport;
|
||||
}
|
||||
}
|
||||
|
||||
if (!m_scriptSchedule.empty())
|
||||
sScriptMgr->DecreaseScheduledScriptCount(m_scriptSchedule.size());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user