Fix a typo in 327fe7c than changed the logic of a function and simplify IsXXXAccount functions

This commit is contained in:
Spp
2011-09-08 18:32:52 +02:00
parent 15d220639b
commit d46ef045a6
2 changed files with 6 additions and 45 deletions
+5 -44
View File
@@ -222,66 +222,27 @@ std::string CalculateShaPassHash(std::string& name, std::string& password)
bool IsPlayerAccount(uint32 gmlevel) bool IsPlayerAccount(uint32 gmlevel)
{ {
switch (gmlevel) return gmlevel = SEC_PLAYER;
{
case SEC_CONSOLE:
case SEC_ADMINISTRATOR:
case SEC_GAMEMASTER:
case SEC_MODERATOR:
return false;
default:
return true;
}
} }
bool IsModeratorAccount(uint32 gmlevel) bool IsModeratorAccount(uint32 gmlevel)
{ {
switch (gmlevel) return gmlevel >= SEC_MODERATOR && gmlevel <= SEC_CONSOLE;
{
case SEC_CONSOLE:
case SEC_ADMINISTRATOR:
case SEC_GAMEMASTER:
case SEC_MODERATOR:
return true;
default:
return false;
}
} }
bool IsGMAccount(uint32 gmlevel) bool IsGMAccount(uint32 gmlevel)
{ {
switch (gmlevel) return gmlevel >= SEC_GAMEMASTER && gmlevel <= SEC_CONSOLE;
{
case SEC_CONSOLE:
case SEC_ADMINISTRATOR:
case SEC_GAMEMASTER:
return true;
default:
return false;
}
} }
bool IsAdminAccount(uint32 gmlevel) bool IsAdminAccount(uint32 gmlevel)
{ {
switch (gmlevel) return gmlevel >= SEC_ADMINISTRATOR && gmlevel <= SEC_CONSOLE;
{
case SEC_CONSOLE:
case SEC_ADMINISTRATOR:
return true;
default:
return false;
}
} }
bool IsConsoleAccount(uint32 gmlevel) bool IsConsoleAccount(uint32 gmlevel)
{ {
switch (gmlevel) return gmlevel = SEC_CONSOLE;
{
case SEC_CONSOLE:
return true;
default:
return false;
}
} }
} // Namespace AccountMgr } // Namespace AccountMgr
+1 -1
View File
@@ -122,7 +122,7 @@ public:
for (HashMapHolder<Player>::MapType::const_iterator itr = m.begin(); itr != m.end(); ++itr) for (HashMapHolder<Player>::MapType::const_iterator itr = m.begin(); itr != m.end(); ++itr)
{ {
AccountTypes itr_sec = itr->second->GetSession()->GetSecurity(); 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()))) (!handler->GetSession() || itr->second->IsVisibleGloballyFor(handler->GetSession()->GetPlayer())))
{ {
if (first) if (first)