Eluna fix merge

This commit is contained in:
Rochet2
2015-02-15 03:00:24 +02:00
3 changed files with 34 additions and 20 deletions

View File

@@ -149,21 +149,28 @@ 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())
{
#ifndef TRINITY
if ((team == TEAM_NEUTRAL || player->GetTeamId() == team) && (!onlyGM || player->isGameMaster()))
#ifdef TRINITY
boost::shared_lock<boost::shared_mutex> lock(*HashMapHolder<Player>::GetLock());
#else
if ((team == TEAM_NEUTRAL || player->GetTeamId() == team) && (!onlyGM || player->IsGameMaster()))
HashMapHolder<Player>::ReadGuard g(HashMapHolder<Player>::GetLock());
#endif
const HashMapHolder<Player>::MapType& m = eObjectAccessor->GetPlayers();
for (HashMapHolder<Player>::MapType::const_iterator it = m.begin(); it != m.end(); ++it)
{
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);
}
}
}
}

View File

@@ -21,17 +21,24 @@ 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())
#ifdef TRINITY
boost::shared_lock<boost::shared_mutex> lock(*HashMapHolder<Player>::GetLock());
#else
HashMapHolder<Player>::ReadGuard g(HashMapHolder<Player>::GetLock());
#endif
const HashMapHolder<Player>::MapType& m = eObjectAccessor->GetPlayers();
for (HashMapHolder<Player>::MapType::const_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);
}
}
}
}

View File

@@ -259,7 +259,7 @@ namespace LuaMap
uint32 weatherType = Eluna::CHECKVAL<uint32>(L, 3);
float grade = Eluna::CHECKVAL<float>(L, 4);
#if ((defined(MANGOS) || defined(CMANGOS)) && defined(WOTLK))
#if ((defined(CMANGOS) || defined(MANGOS)) && defined(WOTLK))
if (Weather::IsValidWeatherType(weatherType))
map->SetWeather(zoneId, (WeatherType)weatherType, grade, false);
#else