mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
reduce memory leak
This commit is contained in:
@@ -203,15 +203,11 @@ void PlayerbotAI::UpdateAI(uint32 elapsed, bool minimal)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// cancel logout in combat
|
|
||||||
if (!bot->GetSession() || bot->GetSession()->isLogingOut())
|
if (!bot->GetSession() || bot->GetSession()->isLogingOut())
|
||||||
{
|
{
|
||||||
// if (bot->IsInCombat() || (master && master->IsInCombat() && sServerFacade->GetDistance2d(bot, master) < 30.0f))
|
return;
|
||||||
// {
|
}
|
||||||
// WorldPackets::Character::LogoutCancel data = WorldPacket(CMSG_LOGOUT_CANCEL);
|
if (bot->IsDuringRemoveFromWorld()) {
|
||||||
// bot->GetSession()->HandleLogoutCancelOpcode(data);
|
|
||||||
// TellMaster("Logout cancelled!");
|
|
||||||
// }
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// if (!GetMaster() || !GetMaster()->IsInWorld() || !GetMaster()->GetSession() || GetMaster()->GetSession()->isLogingOut()) {
|
// if (!GetMaster() || !GetMaster()->IsInWorld() || !GetMaster()->GetSession() || GetMaster()->GetSession()->isLogingOut()) {
|
||||||
|
|||||||
@@ -1371,13 +1371,13 @@ void PlayerbotsMgr::RemovePlayerBotData(ObjectGuid const& guid)
|
|||||||
|
|
||||||
PlayerbotAI* PlayerbotsMgr::GetPlayerbotAI(Player* player)
|
PlayerbotAI* PlayerbotsMgr::GetPlayerbotAI(Player* player)
|
||||||
{
|
{
|
||||||
if (!(sPlayerbotAIConfig->enabled) || !player || (!player->IsInWorld() && !player->IsBeingTeleported()))
|
if (!(sPlayerbotAIConfig->enabled) || !player)
|
||||||
{
|
{
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
if (player->GetSession()->isLogingOut() || player->IsDuringRemoveFromWorld()) {
|
// if (player->GetSession()->isLogingOut() || player->IsDuringRemoveFromWorld()) {
|
||||||
return nullptr;
|
// return nullptr;
|
||||||
}
|
// }
|
||||||
auto itr = _playerbotsMap.find(player->GetGUID());
|
auto itr = _playerbotsMap.find(player->GetGUID());
|
||||||
if (itr != _playerbotsMap.end())
|
if (itr != _playerbotsMap.end())
|
||||||
{
|
{
|
||||||
@@ -1390,7 +1390,7 @@ PlayerbotAI* PlayerbotsMgr::GetPlayerbotAI(Player* player)
|
|||||||
|
|
||||||
PlayerbotMgr* PlayerbotsMgr::GetPlayerbotMgr(Player* player)
|
PlayerbotMgr* PlayerbotsMgr::GetPlayerbotMgr(Player* player)
|
||||||
{
|
{
|
||||||
if (!(sPlayerbotAIConfig->enabled) || !player || (!player->IsInWorld() && !player->IsBeingTeleported()))
|
if (!(sPlayerbotAIConfig->enabled) || !player)
|
||||||
{
|
{
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user