diff --git a/GlobalMethods.h b/GlobalMethods.h index 6993669..a5db2eb 100644 --- a/GlobalMethods.h +++ b/GlobalMethods.h @@ -149,21 +149,24 @@ namespace LuaGlobalFunctions int tbl = lua_gettop(L); uint32 i = 0; - SessionMap const& sessions = eWorld->GetAllSessions(); - for (SessionMap::const_iterator it = sessions.begin(); it != sessions.end(); ++it) { - if (Player* player = it->second->GetPlayer()) + HashMapHolder::ReadGuard g(HashMapHolder::GetLock()); + HashMapHolder::MapType& m = eObjectAccessor->GetPlayers(); + for (HashMapHolder::MapType::iterator it = m.begin(); it != m.end(); ++it) { -#ifndef TRINITY - if ((team == TEAM_NEUTRAL || player->GetTeamId() == team) && (!onlyGM || player->isGameMaster())) -#else - if ((team == TEAM_NEUTRAL || player->GetTeamId() == team) && (!onlyGM || player->IsGameMaster())) -#endif + if (Player* player = it->second) { - ++i; - Eluna::Push(L, i); - Eluna::Push(L, player); - lua_settable(L, tbl); +#ifndef TRINITY + if ((team == TEAM_NEUTRAL || player->GetTeamId() == team) && (!onlyGM || player->isGameMaster())) +#else + if ((team == TEAM_NEUTRAL || player->GetTeamId() == team) && (!onlyGM || player->IsGameMaster())) +#endif + { + ++i; + Eluna::Push(L, i); + Eluna::Push(L, player); + lua_settable(L, tbl); + } } } } diff --git a/GuildMethods.h b/GuildMethods.h index c9305f7..e152d28 100644 --- a/GuildMethods.h +++ b/GuildMethods.h @@ -21,17 +21,20 @@ namespace LuaGuild int tbl = lua_gettop(L); uint32 i = 0; - SessionMap const& sessions = eWorld->GetAllSessions(); - for (SessionMap::const_iterator it = sessions.begin(); it != sessions.end(); ++it) { - if (Player* player = it->second->GetPlayer()) + HashMapHolder::ReadGuard g(HashMapHolder::GetLock()); + HashMapHolder::MapType& m = eObjectAccessor->GetPlayers(); + for (HashMapHolder::MapType::iterator it = m.begin(); it != m.end(); ++it) { - if (player->GetSession() && (player->GetGuildId() == guild->GetId())) + if (Player* player = it->second) { - ++i; - Eluna::Push(L, i); - Eluna::Push(L, player); - lua_settable(L, tbl); + if (player->GetSession() && (player->GetGuildId() == guild->GetId())) + { + ++i; + Eluna::Push(L, i); + Eluna::Push(L, player); + lua_settable(L, tbl); + } } } } diff --git a/MapMethods.h b/MapMethods.h index b0a1e83..b1d27e0 100644 --- a/MapMethods.h +++ b/MapMethods.h @@ -259,7 +259,7 @@ namespace LuaMap uint32 weatherType = Eluna::CHECKVAL(L, 3); float grade = Eluna::CHECKVAL(L, 4); -#if (defined(CMANGOS) && defined(WOTLK)) +#if ((defined(CMANGOS) || defined(MANGOS)) && defined(WOTLK)) if (Weather::IsValidWeatherType(weatherType)) map->SetWeather(zoneId, (WeatherType)weatherType, grade, false); #else