diff --git a/dChatServer/PlayerContainer.cpp b/dChatServer/PlayerContainer.cpp index b40e8386..c5da3a7f 100644 --- a/dChatServer/PlayerContainer.cpp +++ b/dChatServer/PlayerContainer.cpp @@ -49,25 +49,21 @@ void PlayerContainer::RemovePlayer(Packet* packet) { inStream.Read(playerID); //Before they get kicked, we need to also send a message to their friends saying that they disconnected. - auto player = this->GetPlayerData(playerID); + std::unique_ptr player(this->GetPlayerData(playerID)); if (player == nullptr) { return; } for (auto& fr : player->friends) { - //if (!fr.isOnline) continue; - auto fd = this->GetPlayerData(fr.friendID); - if (fd) ChatPacketHandler::SendFriendUpdate(fd, player, 0, fr.isBestFriend); + if (fd) ChatPacketHandler::SendFriendUpdate(fd, player.get(), 0, fr.isBestFriend); } auto* team = GetTeam(playerID); if (team != nullptr) { - //TeamStatusUpdate(team); - const auto memberName = GeneralUtils::ASCIIToUTF16(std::string(player->playerName.C_String())); for (const auto memberId : team->memberIDs) @@ -77,7 +73,6 @@ void PlayerContainer::RemovePlayer(Packet* packet) { if (otherMember == nullptr) continue; ChatPacketHandler::SendTeamSetOffWorldFlag(otherMember, playerID, {0, 0, 0}); - //ChatPacketHandler::SendTeamRemovePlayer(otherMember, false, false, true, false, team->leaderID, player->playerID, memberName); } } @@ -241,12 +236,6 @@ void PlayerContainer::AddMember(TeamData* team, LWOOBJID playerID) const auto memberName = GeneralUtils::ASCIIToUTF16(std::string(member->playerName.C_String())); ChatPacketHandler::SendTeamInviteConfirm(member, false, leader->playerID, leader->zoneID, team->lootFlag, 0, 0, leaderName); - - /* - ChatPacketHandler::SendTeamAddPlayer(member, false, false, false, leader->playerID, leaderName, leader->zoneID); - - Game::logger->Log("PlayerContainer", "Team invite successfully accepted, leader: %s, member: %s\n", leader->playerName.C_String(), member->playerName.C_String()); - */ if (!team->local) { @@ -383,10 +372,6 @@ void PlayerContainer::TeamStatusUpdate(TeamData* team) { ChatPacketHandler::SendTeamStatus(otherMember, team->leaderID, leader->zoneID, team->lootFlag, 0, leaderName); } - else - { - //ChatPacketHandler::SendTeamStatus(otherMember, LWOOBJID_EMPTY, LWOZONEID(0, 0, 0), 1, 0, u""); - } } UpdateTeamsOnWorld(team, false); diff --git a/dGame/dBehaviors/Behavior.cpp b/dGame/dBehaviors/Behavior.cpp index a2329f96..489bd1a7 100644 --- a/dGame/dBehaviors/Behavior.cpp +++ b/dGame/dBehaviors/Behavior.cpp @@ -409,7 +409,7 @@ Behavior::Behavior(const uint32_t behaviorId) { auto behaviorTemplateTable = CDClientManager::Instance()->GetTable("BehaviorTemplate"); - CDBehaviorTemplate templateInDatabase; + CDBehaviorTemplate templateInDatabase{}; if (behaviorTemplateTable) { auto templateEntry = behaviorTemplateTable->GetByBehaviorID(behaviorId);