From 6c2f113604dee1324031eb1aef2fbdac7715a2cd Mon Sep 17 00:00:00 2001 From: David Markowitz Date: Wed, 3 Apr 2024 04:04:02 -0700 Subject: [PATCH] simplify if checks --- dGame/dUtilities/SlashCommandHandler.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/dGame/dUtilities/SlashCommandHandler.cpp b/dGame/dUtilities/SlashCommandHandler.cpp index da1d7e18..00d668e1 100644 --- a/dGame/dUtilities/SlashCommandHandler.cpp +++ b/dGame/dUtilities/SlashCommandHandler.cpp @@ -123,17 +123,13 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& chat, Entity* if (entity->GetGMLevel() >= commandHandle.requiredLevel) { if (commandHandle.requiredLevel > eGameMasterLevel::CIVILIAN) Database::Get()->InsertSlashCommandUsage(entity->GetObjectID(), input); commandHandle.handle(entity, sysAddr, args); - } else { + } else if (entity->GetGMLevel() != eGameMasterLevel::CIVILIAN) { // We don't need to tell civilians they aren't high enough level - if (entity->GetGMLevel() != eGameMasterLevel::CIVILIAN) { - error = "You are not high enough GM level to use \"" + command + "\""; - } + error = "You are not high enough GM level to use \"" + command + "\""; } - } else { + } else if (entity->GetGMLevel() == eGameMasterLevel::CIVILIAN) { // We don't need to tell civilians commands don't exist - if (entity->GetGMLevel() == eGameMasterLevel::CIVILIAN) { - error = "Command " + command + " does not exist!"; - } + error = "Command " + command + " does not exist!"; } if (!error.empty()) {