From a8f8de068998f9766e391125ff7ab0e4832a27a8 Mon Sep 17 00:00:00 2001 From: EmosewaMC <39972741+EmosewaMC@users.noreply.github.com> Date: Mon, 5 Dec 2022 21:35:34 -0800 Subject: [PATCH] Use string_view instead of strcmp --- dGame/dUtilities/SlashCommandHandler.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dGame/dUtilities/SlashCommandHandler.cpp b/dGame/dUtilities/SlashCommandHandler.cpp index d36ddc78..ecc65a14 100644 --- a/dGame/dUtilities/SlashCommandHandler.cpp +++ b/dGame/dUtilities/SlashCommandHandler.cpp @@ -1826,7 +1826,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit std::transform(args[0].begin(), args[0].end(),args[0].begin(), ::toupper); Game::logger->Log("SlashCommandHandler", "looking for inventory %s", args[0].c_str()); for (uint32_t index = 0; index < NUMBER_OF_INVENTORIES; index++) { - if (strcmp(args[0].c_str(), InventoryType::InventoryTypeToString(static_cast(index))) == 0) inventoryType = static_cast(index); + if (std::string_view(args[0]) == std::string_view(InventoryType::InventoryTypeToString(static_cast(index)))) inventoryType = static_cast(index); } } @@ -1842,6 +1842,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit if (!inventoryToDelete) return; inventoryToDelete->DeleteAllItems(); + Game::logger->Log("SlashCommandHandler", "Deleted inventory %s for user %llu", args[0].c_str(), entity->GetObjectID()); ChatPackets::SendSystemMessage(sysAddr, u"Deleted inventory " + GeneralUtils::UTF8ToUTF16(args[0])); }