From 1b9a2ae01868ebf619aa5103bbc6f71679f8aabd Mon Sep 17 00:00:00 2001 From: Rochet2 Date: Sat, 14 Feb 2015 00:31:08 +0200 Subject: [PATCH] MangosTwo change fixes --- GlobalMethods.h | 8 ++++++-- GuildMethods.h | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/GlobalMethods.h b/GlobalMethods.h index a5db2eb..d269c95 100644 --- a/GlobalMethods.h +++ b/GlobalMethods.h @@ -150,9 +150,13 @@ namespace LuaGlobalFunctions uint32 i = 0; { +#ifdef TRINITY + boost::shared_lock lock(*HashMapHolder::GetLock()); +#else HashMapHolder::ReadGuard g(HashMapHolder::GetLock()); - HashMapHolder::MapType& m = eObjectAccessor->GetPlayers(); - for (HashMapHolder::MapType::iterator it = m.begin(); it != m.end(); ++it) +#endif + const HashMapHolder::MapType& m = eObjectAccessor->GetPlayers(); + for (HashMapHolder::MapType::const_iterator it = m.begin(); it != m.end(); ++it) { if (Player* player = it->second) { diff --git a/GuildMethods.h b/GuildMethods.h index e152d28..5bc5fd6 100644 --- a/GuildMethods.h +++ b/GuildMethods.h @@ -22,9 +22,13 @@ namespace LuaGuild uint32 i = 0; { +#ifdef TRINITY + boost::shared_lock lock(*HashMapHolder::GetLock()); +#else HashMapHolder::ReadGuard g(HashMapHolder::GetLock()); - HashMapHolder::MapType& m = eObjectAccessor->GetPlayers(); - for (HashMapHolder::MapType::iterator it = m.begin(); it != m.end(); ++it) +#endif + const HashMapHolder::MapType& m = eObjectAccessor->GetPlayers(); + for (HashMapHolder::MapType::const_iterator it = m.begin(); it != m.end(); ++it) { if (Player* player = it->second) {