mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-21 21:17:25 +00:00
Merge remote-tracking branch 'upstream/main' into MSVCCompilerFlags
This commit is contained in:
commit
b96cfd71a4
@ -158,9 +158,7 @@ namespace GeneralUtils {
|
|||||||
template <Numeric T>
|
template <Numeric T>
|
||||||
[[nodiscard]] std::optional<T> TryParse(std::string_view str) {
|
[[nodiscard]] std::optional<T> TryParse(std::string_view str) {
|
||||||
numeric_parse_t<T> result;
|
numeric_parse_t<T> result;
|
||||||
if (!str.empty()) {
|
while (!str.empty() && std::isspace(str.front())) str.remove_prefix(1);
|
||||||
while (std::isspace(str.front())) str.remove_prefix(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
const char* const strEnd = str.data() + str.size();
|
const char* const strEnd = str.data() + str.size();
|
||||||
const auto [parseEnd, ec] = std::from_chars(str.data(), strEnd, result);
|
const auto [parseEnd, ec] = std::from_chars(str.data(), strEnd, result);
|
||||||
@ -186,9 +184,7 @@ namespace GeneralUtils {
|
|||||||
template <std::floating_point T>
|
template <std::floating_point T>
|
||||||
[[nodiscard]] std::optional<T> TryParse(std::string_view str) noexcept
|
[[nodiscard]] std::optional<T> TryParse(std::string_view str) noexcept
|
||||||
try {
|
try {
|
||||||
if (!str.empty()) {
|
while (!str.empty() && std::isspace(str.front())) str.remove_prefix(1);
|
||||||
while (std::isspace(str.front())) str.remove_prefix(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t parseNum;
|
size_t parseNum;
|
||||||
const T result = details::_parse<T>(str, parseNum);
|
const T result = details::_parse<T>(str, parseNum);
|
||||||
|
@ -4660,7 +4660,7 @@ void GameMessages::HandleBuyFromVendor(RakNet::BitStream& inStream, Entity* enti
|
|||||||
if (!user) return;
|
if (!user) return;
|
||||||
Entity* player = Game::entityManager->GetEntity(user->GetLoggedInChar());
|
Entity* player = Game::entityManager->GetEntity(user->GetLoggedInChar());
|
||||||
if (!player) return;
|
if (!player) return;
|
||||||
|
|
||||||
// handle buying normal items
|
// handle buying normal items
|
||||||
auto* vendorComponent = entity->GetComponent<VendorComponent>();
|
auto* vendorComponent = entity->GetComponent<VendorComponent>();
|
||||||
if (vendorComponent) {
|
if (vendorComponent) {
|
||||||
@ -5290,7 +5290,7 @@ void GameMessages::HandleRemoveItemFromInventory(RakNet::BitStream& inStream, En
|
|||||||
bool iLootTypeSourceIsDefault = false;
|
bool iLootTypeSourceIsDefault = false;
|
||||||
LWOOBJID iLootTypeSource = LWOOBJID_EMPTY;
|
LWOOBJID iLootTypeSource = LWOOBJID_EMPTY;
|
||||||
bool iObjIDIsDefault = false;
|
bool iObjIDIsDefault = false;
|
||||||
LWOOBJID iObjID;
|
LWOOBJID iObjID = LWOOBJID_EMPTY;
|
||||||
bool iObjTemplateIsDefault = false;
|
bool iObjTemplateIsDefault = false;
|
||||||
LOT iObjTemplate = LOT_NULL;
|
LOT iObjTemplate = LOT_NULL;
|
||||||
bool iRequestingObjIDIsDefault = false;
|
bool iRequestingObjIDIsDefault = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user