fixed issue with misaligned group deaths

This commit is contained in:
2024-11-26 00:15:04 -05:00
parent 91d3f91dfc
commit ccf222ec4f
2 changed files with 9 additions and 3 deletions

View File

@@ -303,7 +303,13 @@ private:
_instanceCreatureData->reserve(500);
};
inline ~MpDataStore() {}
inline ~MpDataStore() {
for (auto& [guid, playerData] : *_playerData) {
delete playerData;
}
_playerData->clear();
}
std::unique_ptr<std::unordered_map<ObjectGuid, MpPlayerData*>> _playerData;

View File

@@ -107,8 +107,8 @@ public:
// get the player data or set it up
MpPlayerData* playerData = sMpDataStore->GetPlayerData(player->GetGUID());
if(!playerData) {
auto newPlayerData = MpPlayerData(player, data->difficulty, group->GetGUID().GetCounter());
sMpDataStore->AddPlayerData(player->GetGUID(), &newPlayerData);
playerData = new MpPlayerData(player, data->difficulty, group->GetGUID().GetCounter());
sMpDataStore->AddPlayerData(player->GetGUID(), playerData);
}
// Add this players data to the group data