Fix TC build, analysis warnings and triggering addon message hooks

This commit is contained in:
Rochet2
2015-01-06 12:43:53 +02:00
parent 6371728547
commit 5e7b0ee0f7
6 changed files with 28 additions and 28 deletions

View File

@@ -17,7 +17,7 @@ extern "C"
#include "lauxlib.h"
};
class ElunaBind
class ElunaBind : public ElunaUtil::RWLockable
{
public:
struct Binding
@@ -61,7 +61,7 @@ public:
};
template<typename T>
class EventBind : public ElunaBind, public ElunaUtil::RWLockable
class EventBind : public ElunaBind
{
public:
EventBind(const char* bindGroupName, Eluna& _E) : ElunaBind(bindGroupName, _E)
@@ -141,7 +141,7 @@ public:
};
template<typename T>
class EntryBind : public ElunaBind, public ElunaUtil::RWLockable
class EntryBind : public ElunaBind
{
public:
typedef UNORDERED_MAP<uint32, EventToFunctionsMap> EntryToEventsMap;

View File

@@ -45,7 +45,7 @@ ElunaEventProcessor::ElunaEventProcessor(Eluna** _E, WorldObject* _obj) : m_time
{
if (obj)
{
EventMgr::WriteGuard lock((*E)->eventMgr->GetLock());
EventMgr::WriteGuard guard((*E)->eventMgr->GetLock());
(*E)->eventMgr->processors.insert(this);
}
}
@@ -56,7 +56,7 @@ ElunaEventProcessor::~ElunaEventProcessor()
if (obj && Eluna::initialized)
{
EventMgr::WriteGuard lock((*E)->eventMgr->GetLock());
EventMgr::WriteGuard guard((*E)->eventMgr->GetLock());
(*E)->eventMgr->processors.erase(this);
}
}
@@ -133,7 +133,7 @@ EventMgr::EventMgr(Eluna** _E) : globalProcessor(new ElunaEventProcessor(_E, NUL
EventMgr::~EventMgr()
{
{
ReadGuard lock(GetLock());
ReadGuard guard(GetLock());
if (!processors.empty())
for (ProcessorSet::const_iterator it = processors.begin(); it != processors.end(); ++it) // loop processors
(*it)->RemoveEvents_internal();
@@ -145,7 +145,7 @@ EventMgr::~EventMgr()
void EventMgr::RemoveEvents()
{
ReadGuard lock(GetLock());
ReadGuard guard(GetLock());
if (!processors.empty())
for (ProcessorSet::const_iterator it = processors.begin(); it != processors.end(); ++it) // loop processors
(*it)->RemoveEvents();
@@ -154,7 +154,7 @@ void EventMgr::RemoveEvents()
void EventMgr::RemoveEvent(int eventId)
{
ReadGuard lock(GetLock());
ReadGuard guard(GetLock());
if (!processors.empty())
for (ProcessorSet::const_iterator it = processors.begin(); it != processors.end(); ++it) // loop processors
(*it)->RemoveEvent(eventId);

View File

@@ -119,9 +119,9 @@ namespace ElunaUtil
/*
* Usage:
* Inherit this class, then when needing lock, use
* ReadGuard lock(_lock);
* ReadGuard guard(GetLock());
* or
* WriteGuard lock(_lock);
* WriteGuard guard(GetLock());
*
* The lock is automatically released at end of scope
*/

View File

@@ -1190,12 +1190,12 @@ void Eluna::OnMapChanged(Player* player)
bool Eluna::OnChat(Player* pPlayer, uint32 type, uint32 lang, std::string& msg)
{
if (!PlayerEventBindings->HasEvents(PLAYER_EVENT_ON_CHAT))
return true;
if (lang == LANG_ADDON)
return OnAddonMessage(pPlayer, type, msg, NULL, NULL, NULL, NULL);
if (!PlayerEventBindings->HasEvents(PLAYER_EVENT_ON_CHAT))
return true;
LOCK_ELUNA;
bool result = true;
Push(pPlayer);
@@ -1223,12 +1223,12 @@ bool Eluna::OnChat(Player* pPlayer, uint32 type, uint32 lang, std::string& msg)
bool Eluna::OnChat(Player* pPlayer, uint32 type, uint32 lang, std::string& msg, Group* pGroup)
{
if (!PlayerEventBindings->HasEvents(PLAYER_EVENT_ON_GROUP_CHAT))
return true;
if (lang == LANG_ADDON)
return OnAddonMessage(pPlayer, type, msg, NULL, NULL, pGroup, NULL);
if (!PlayerEventBindings->HasEvents(PLAYER_EVENT_ON_GROUP_CHAT))
return true;
LOCK_ELUNA;
bool result = true;
Push(pPlayer);
@@ -1257,12 +1257,12 @@ bool Eluna::OnChat(Player* pPlayer, uint32 type, uint32 lang, std::string& msg,
bool Eluna::OnChat(Player* pPlayer, uint32 type, uint32 lang, std::string& msg, Guild* pGuild)
{
if (!PlayerEventBindings->HasEvents(PLAYER_EVENT_ON_GUILD_CHAT))
return true;
if (lang == LANG_ADDON)
return OnAddonMessage(pPlayer, type, msg, NULL, pGuild, NULL, NULL);
if (!PlayerEventBindings->HasEvents(PLAYER_EVENT_ON_GUILD_CHAT))
return true;
LOCK_ELUNA;
bool result = true;
Push(pPlayer);
@@ -1291,12 +1291,12 @@ bool Eluna::OnChat(Player* pPlayer, uint32 type, uint32 lang, std::string& msg,
bool Eluna::OnChat(Player* pPlayer, uint32 type, uint32 lang, std::string& msg, Channel* pChannel)
{
if (!PlayerEventBindings->HasEvents(PLAYER_EVENT_ON_CHANNEL_CHAT))
return true;
if (lang == LANG_ADDON)
return OnAddonMessage(pPlayer, type, msg, NULL, NULL, NULL, pChannel);
if (!PlayerEventBindings->HasEvents(PLAYER_EVENT_ON_CHANNEL_CHAT))
return true;
LOCK_ELUNA;
bool result = true;
Push(pPlayer);
@@ -1325,12 +1325,12 @@ bool Eluna::OnChat(Player* pPlayer, uint32 type, uint32 lang, std::string& msg,
bool Eluna::OnChat(Player* pPlayer, uint32 type, uint32 lang, std::string& msg, Player* pReceiver)
{
if (!PlayerEventBindings->HasEvents(PLAYER_EVENT_ON_WHISPER))
return true;
if (lang == LANG_ADDON)
return OnAddonMessage(pPlayer, type, msg, pReceiver, NULL, NULL, NULL);
if (!PlayerEventBindings->HasEvents(PLAYER_EVENT_ON_WHISPER))
return true;
LOCK_ELUNA;
bool result = true;
Push(pPlayer);

View File

@@ -89,13 +89,13 @@ void Eluna::ReloadEluna()
EventMgr::ProcessorSet oldProcessors;
{
EventMgr::ReadGuard lock(sEluna->eventMgr->GetLock());
EventMgr::ReadGuard guard(sEluna->eventMgr->GetLock());
oldProcessors = sEluna->eventMgr->processors;
}
Uninitialize();
Initialize();
{
EventMgr::WriteGuard lock(sEluna->eventMgr->GetLock());
EventMgr::WriteGuard guard(sEluna->eventMgr->GetLock());
sEluna->eventMgr->processors.insert(oldProcessors.begin(), oldProcessors.end());
}

View File

@@ -156,7 +156,7 @@ public:
#ifdef TRINITY
typedef std::recursive_mutex LockType;
typedef std::lock_guard<LockType> ElunaGuard;
typedef std::lock_guard<LockType> Guard;
#else
typedef ACE_Recursive_Thread_Mutex LockType;
typedef ACE_Guard<LockType> Guard;