Change player access from sessions to players

This commit is contained in:
Rochet2
2015-02-13 22:27:06 +02:00
parent bdba6bd9bd
commit 849651d4c0
3 changed files with 27 additions and 21 deletions

View File

@@ -149,10 +149,12 @@ 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<Player>::ReadGuard g(HashMapHolder<Player>::GetLock());
HashMapHolder<Player>::MapType& m = eObjectAccessor->GetPlayers();
for (HashMapHolder<Player>::MapType::iterator it = m.begin(); it != m.end(); ++it)
{
if (Player* player = it->second)
{
#ifndef TRINITY
if ((team == TEAM_NEUTRAL || player->GetTeamId() == team) && (!onlyGM || player->isGameMaster()))
@@ -167,6 +169,7 @@ namespace LuaGlobalFunctions
}
}
}
}
lua_settop(L, tbl); // push table to top of stack
return 1;

View File

@@ -21,10 +21,12 @@ 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<Player>::ReadGuard g(HashMapHolder<Player>::GetLock());
HashMapHolder<Player>::MapType& m = eObjectAccessor->GetPlayers();
for (HashMapHolder<Player>::MapType::iterator it = m.begin(); it != m.end(); ++it)
{
if (Player* player = it->second)
{
if (player->GetSession() && (player->GetGuildId() == guild->GetId()))
{
@@ -35,6 +37,7 @@ namespace LuaGuild
}
}
}
}
lua_settop(L, tbl); // push table to top of stack
return 1;

View File

@@ -259,7 +259,7 @@ namespace LuaMap
uint32 weatherType = Eluna::CHECKVAL<uint32>(L, 3);
float grade = Eluna::CHECKVAL<float>(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