diff options
author | Spp <spp@jorge.gr> | 2011-09-08 18:32:52 +0200 |
---|---|---|
committer | Spp <spp@jorge.gr> | 2011-09-08 18:32:52 +0200 |
commit | d46ef045a638903e8c388da0237763105ab761cc (patch) | |
tree | 480999ec80f92f10d1de3831f0aa1ce936e4356f /src | |
parent | 15d220639b93a58aae76d62047185259d8d3e24a (diff) |
Fix a typo in 327fe7c than changed the logic of a function and simplify IsXXXAccount functions
Diffstat (limited to 'src')
-rwxr-xr-x | src/server/game/Accounts/AccountMgr.cpp | 49 | ||||
-rw-r--r-- | src/server/scripts/Commands/cs_gm.cpp | 2 |
2 files changed, 6 insertions, 45 deletions
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<Player>::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) |