Core/Misc: Replace boost::optional with std::optional part 2

This commit is contained in:
Shauren
2022-01-23 20:31:52 +01:00
parent 770fbcca0c
commit 596bf2b772
77 changed files with 498 additions and 501 deletions

View File

@@ -530,7 +530,7 @@ void WorldSession::HandlePetRename(WorldPackets::Pet::PetRename& packet)
ObjectGuid petguid = packet.RenameData.PetGUID;
std::string name = packet.RenameData.NewName;
DeclinedName* declinedname = packet.RenameData.DeclinedNames.get_ptr();
Optional<DeclinedName> const& declinedname = packet.RenameData.DeclinedNames;
Pet* pet = ObjectAccessor::GetPet(*_player, petguid);
// check it!
@@ -542,13 +542,13 @@ void WorldSession::HandlePetRename(WorldPackets::Pet::PetRename& packet)
PetNameInvalidReason res = ObjectMgr::CheckPetName(name);
if (res != PET_NAME_SUCCESS)
{
SendPetNameInvalid(res, name, nullptr);
SendPetNameInvalid(res, name, {});
return;
}
if (sObjectMgr->IsReservedName(name))
{
SendPetNameInvalid(PET_NAME_RESERVED, name, nullptr);
SendPetNameInvalid(PET_NAME_RESERVED, name, {});
return;
}
@@ -751,13 +751,12 @@ void WorldSession::HandlePetCastSpellOpcode(WorldPackets::Spells::PetCastSpell&
}
}
void WorldSession::SendPetNameInvalid(uint32 error, const std::string& name, DeclinedName *declinedName)
void WorldSession::SendPetNameInvalid(uint32 error, const std::string& name, Optional<DeclinedName> const& declinedName)
{
WorldPackets::Pet::PetNameInvalid petNameInvalid;
petNameInvalid.Result = error;
petNameInvalid.RenameData.NewName = name;
if (declinedName)
petNameInvalid.RenameData.DeclinedNames = *declinedName;
petNameInvalid.RenameData.DeclinedNames = declinedName;
SendPacket(petNameInvalid.Write());
}