From 444acb7c709cfbfd38c1489b268128b5a951ea8b Mon Sep 17 00:00:00 2001 From: Uleat Date: Sun, 27 Jan 2019 21:49:21 -0500 Subject: [PATCH] Fix for bot npctype memory leak (thanks mackal!) --- zone/bot.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/zone/bot.cpp b/zone/bot.cpp index b6496fd80..f7575c030 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -30,6 +30,8 @@ extern volatile bool is_zone_loaded; // This constructor is used during the bot create command Bot::Bot(NPCType *npcTypeData, Client* botOwner) : NPC(npcTypeData, nullptr, glm::vec4(), Ground, false), rest_timer(1), ping_timer(1) { + GiveNPCTypeData(npcTypeData); + if(botOwner) { this->SetBotOwner(botOwner); this->_botOwnerCharacterID = botOwner->CharacterID(); @@ -108,6 +110,8 @@ Bot::Bot(NPCType *npcTypeData, Client* botOwner) : NPC(npcTypeData, nullptr, glm Bot::Bot(uint32 botID, uint32 botOwnerCharacterID, uint32 botSpellsID, double totalPlayTime, uint32 lastZoneId, NPCType *npcTypeData) : NPC(npcTypeData, nullptr, glm::vec4(), Ground, false), rest_timer(1), ping_timer(1) { + GiveNPCTypeData(npcTypeData); + this->_botOwnerCharacterID = botOwnerCharacterID; if(this->_botOwnerCharacterID > 0) this->SetBotOwner(entity_list.GetClientByCharID(this->_botOwnerCharacterID));