diff options
author | Peter Keresztes Schmidt <carbenium@outlook.com> | 2020-07-15 10:22:29 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2022-01-23 18:05:59 +0100 |
commit | 770fbcca0cae18faac981a326d73996afc20b9ba (patch) | |
tree | 2e173ff2e397e56975cb37a10ec11119ec3af41f /src/server/scripts/Commands | |
parent | cd86a015c46f8da581f86857e313d9c596dba7fa (diff) |
Core/Misc: Replace boost::optional with std::optional (#25047)
C++17 is already mandatory, so it's a safe thing to do
(cherry picked from commit 202fd41389973322f63186fd8e5a368fce3e1b04)
Diffstat (limited to 'src/server/scripts/Commands')
-rw-r--r-- | src/server/scripts/Commands/cs_account.cpp | 8 | ||||
-rw-r--r-- | src/server/scripts/Commands/cs_debug.cpp | 4 | ||||
-rw-r--r-- | src/server/scripts/Commands/cs_go.cpp | 8 |
3 files changed, 10 insertions, 10 deletions
diff --git a/src/server/scripts/Commands/cs_account.cpp b/src/server/scripts/Commands/cs_account.cpp index 2a3cbf577a3..29cc59266d6 100644 --- a/src/server/scripts/Commands/cs_account.cpp +++ b/src/server/scripts/Commands/cs_account.cpp @@ -256,7 +256,7 @@ public: return false; } - switch (sAccountMgr->CreateAccount(accountName, password, email.get_value_or(""))) + switch (sAccountMgr->CreateAccount(accountName, password, email.value_or(""))) { case AccountOpResult::AOR_OK: handler->PSendSysMessage(LANG_ACCOUNT_CREATED, accountName); @@ -265,7 +265,7 @@ public: TC_LOG_INFO("entities.player.character", "Account: %d (IP: %s) Character:[%s] %s) created Account %s (Email: '%s')", handler->GetSession()->GetAccountId(), handler->GetSession()->GetRemoteAddress().c_str(), handler->GetSession()->GetPlayer()->GetName().c_str(), handler->GetSession()->GetPlayer()->GetGUID().ToString().c_str(), - accountName.c_str(), email.get_value_or("").c_str()); + accountName.c_str(), email.value_or("").c_str()); } break; case AccountOpResult::AOR_NAME_TOO_LONG: @@ -527,7 +527,7 @@ public: // This compares the old, current email to the entered email - however, only... if ((pwConfig == PW_EMAIL || (pwConfig == PW_RBAC && handler->HasPermission(rbac::RBAC_PERM_EMAIL_CONFIRM_FOR_PASS_CHANGE))) // ...if either PW_EMAIL or PW_RBAC with the Permission is active... - && !AccountMgr::CheckEmail(handler->GetSession()->GetAccountId(), confirmEmail.get_value_or(""))) // ... and returns false if the comparison fails. + && !AccountMgr::CheckEmail(handler->GetSession()->GetAccountId(), confirmEmail.value_or(""))) // ... and returns false if the comparison fails. { handler->SendSysMessage(LANG_COMMAND_WRONGEMAIL); sScriptMgr->OnFailedPasswordChange(handler->GetSession()->GetAccountId()); @@ -535,7 +535,7 @@ public: TC_LOG_INFO("entities.player.character", "Account: %u (IP: %s) Character:[%s] %s Tried to change password, but the entered email [%s] is wrong.", handler->GetSession()->GetAccountId(), handler->GetSession()->GetRemoteAddress().c_str(), handler->GetSession()->GetPlayer()->GetName().c_str(), handler->GetSession()->GetPlayer()->GetGUID().ToString().c_str(), - confirmEmail.get_value_or("").c_str()); + confirmEmail.value_or("").c_str()); return false; } diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp index aac8b3379e5..5f5a0caf3e1 100644 --- a/src/server/scripts/Commands/cs_debug.cpp +++ b/src/server/scripts/Commands/cs_debug.cpp @@ -1814,7 +1814,7 @@ public: auto mapId = args->TryConsume<uint32>(); if (mapId) { - sMapMgr->DoForAllMapsWithMapId(mapId.get(), + sMapMgr->DoForAllMapsWithMapId(mapId.value(), [handler](Map* map) -> void { HandleDebugGuidLimitsMap(handler, map); @@ -1847,7 +1847,7 @@ public: auto mapId = args->TryConsume<uint32>(); if (mapId) { - sMapMgr->DoForAllMapsWithMapId(mapId.get(), + sMapMgr->DoForAllMapsWithMapId(mapId.value(), [handler](Map* map) -> void { HandleDebugObjectCountMap(handler, map); diff --git a/src/server/scripts/Commands/cs_go.cpp b/src/server/scripts/Commands/cs_go.cpp index 47e1c737849..ddcbfbba710 100644 --- a/src/server/scripts/Commands/cs_go.cpp +++ b/src/server/scripts/Commands/cs_go.cpp @@ -220,7 +220,7 @@ public: static bool HandleGoGridCommand(ChatHandler* handler, float gridX, float gridY, Optional<uint32> oMapId) { Player* player = handler->GetSession()->GetPlayer(); - uint32 mapId = oMapId.get_value_or(player->GetMapId()); + uint32 mapId = oMapId.value_or(player->GetMapId()); // center of grid float x = (gridX - CENTER_GRID_ID + 0.5f) * SIZE_OF_GRIDS; @@ -408,7 +408,7 @@ public: static bool HandleGoXYZCommand(ChatHandler* handler, float x, float y, Optional<float> z, Optional<uint32> id, Optional<float> o) { Player* player = handler->GetSession()->GetPlayer(); - uint32 mapId = id.get_value_or(player->GetMapId()); + uint32 mapId = id.value_or(player->GetMapId()); if (z) { if (!MapManager::IsValidMapCoord(mapId, x, y, *z)) @@ -430,7 +430,7 @@ public: z = std::max(map->GetStaticHeight(PhasingHandler::GetEmptyPhaseShift(), x, y, MAX_HEIGHT), map->GetWaterLevel(PhasingHandler::GetEmptyPhaseShift(), x, y)); } - return DoTeleport(handler, { x, y, *z, o.get_value_or(0.0f) }, mapId); + return DoTeleport(handler, { x, y, *z, o.value_or(0.0f) }, mapId); } template<typename T> @@ -458,7 +458,7 @@ public: static bool HandleGoOffsetCommand(ChatHandler* handler, float dX, Optional<float> dY, Optional<float> dZ, Optional<float> dO) { Position loc = handler->GetSession()->GetPlayer()->GetPosition(); - loc.RelocateOffset({ dX, dY.get_value_or(0.0f), dZ.get_value_or(0.0f), dO.get_value_or(0.0f) }); + loc.RelocateOffset({ dX, dY.value_or(0.0f), dZ.value_or(0.0f), dO.value_or(0.0f) }); return DoTeleport(handler, loc); } |