From d46ef045a638903e8c388da0237763105ab761cc Mon Sep 17 00:00:00 2001 From: Spp Date: Thu, 8 Sep 2011 18:32:52 +0200 Subject: Fix a typo in 327fe7c than changed the logic of a function and simplify IsXXXAccount functions --- src/server/game/Accounts/AccountMgr.cpp | 49 ++++----------------------------- src/server/scripts/Commands/cs_gm.cpp | 2 +- 2 files changed, 6 insertions(+), 45 deletions(-) (limited to 'src') diff --git a/src/server/game/Accounts/AccountMgr.cpp b/src/server/game/Accounts/AccountMgr.cpp index c8870a82966..f2478ae4a6c 100755 --- a/src/server/game/Accounts/AccountMgr.cpp +++ b/src/server/game/Accounts/AccountMgr.cpp @@ -222,66 +222,27 @@ std::string CalculateShaPassHash(std::string& name, std::string& password) bool IsPlayerAccount(uint32 gmlevel) { - switch (gmlevel) - { - case SEC_CONSOLE: - case SEC_ADMINISTRATOR: - case SEC_GAMEMASTER: - case SEC_MODERATOR: - return false; - default: - return true; - } + return gmlevel = SEC_PLAYER; } bool IsModeratorAccount(uint32 gmlevel) { - switch (gmlevel) - { - case SEC_CONSOLE: - case SEC_ADMINISTRATOR: - case SEC_GAMEMASTER: - case SEC_MODERATOR: - return true; - default: - return false; - } + return gmlevel >= SEC_MODERATOR && gmlevel <= SEC_CONSOLE; } bool IsGMAccount(uint32 gmlevel) { - switch (gmlevel) - { - case SEC_CONSOLE: - case SEC_ADMINISTRATOR: - case SEC_GAMEMASTER: - return true; - default: - return false; - } + return gmlevel >= SEC_GAMEMASTER && gmlevel <= SEC_CONSOLE; } bool IsAdminAccount(uint32 gmlevel) { - switch (gmlevel) - { - case SEC_CONSOLE: - case SEC_ADMINISTRATOR: - return true; - default: - return false; - } + return gmlevel >= SEC_ADMINISTRATOR && gmlevel <= SEC_CONSOLE; } bool IsConsoleAccount(uint32 gmlevel) { - switch (gmlevel) - { - case SEC_CONSOLE: - return true; - default: - return false; - } + return gmlevel = SEC_CONSOLE; } } // Namespace AccountMgr diff --git a/src/server/scripts/Commands/cs_gm.cpp b/src/server/scripts/Commands/cs_gm.cpp index 45e8dcd5eb5..780b4e549a9 100644 --- a/src/server/scripts/Commands/cs_gm.cpp +++ b/src/server/scripts/Commands/cs_gm.cpp @@ -122,7 +122,7 @@ public: for (HashMapHolder::MapType::const_iterator itr = m.begin(); itr != m.end(); ++itr) { AccountTypes itr_sec = itr->second->GetSession()->GetSecurity(); - if ((itr->second->isGameMaster() || !AccountMgr::IsPlayerAccount((itr_sec) && itr_sec <= AccountTypes(sWorld->getIntConfig(CONFIG_GM_LEVEL_IN_GM_LIST)))) && + if ((itr->second->isGameMaster() || (!AccountMgr::IsPlayerAccount(itr_sec) && itr_sec <= AccountTypes(sWorld->getIntConfig(CONFIG_GM_LEVEL_IN_GM_LIST)))) && (!handler->GetSession() || itr->second->IsVisibleGloballyFor(handler->GetSession()->GetPlayer()))) { if (first) -- cgit v1.2.3