AZEROTHCORE compatibility (#271)

* Done Compatible AZEROTHCORE.

* Fix TC build

* Try fix whitespace (trailing and tabs2spaces)

* Remove undefs and TC_LOG defines

* Revert indentation change

* Indentation and style change

* Add more possible SQL types to query

* change bg hooks OnBGEnd parameter type.
This commit is contained in:
ayase
2018-06-06 23:42:46 +08:00
committed by Rochet2
parent 2cedb8c5af
commit 9b5499db9c
31 changed files with 869 additions and 510 deletions

View File

@@ -38,6 +38,8 @@ namespace LuaGuild
{
#ifdef TRINITY
boost::shared_lock<boost::shared_mutex> lock(*HashMapHolder<Player>::GetLock());
#elif AZEROTHCORE
TRINITY_READ_GUARD(HashMapHolder<Player>::LockType, *HashMapHolder<Player>::GetLock());
#else
HashMapHolder<Player>::ReadGuard g(HashMapHolder<Player>::GetLock());
#endif
@@ -66,7 +68,7 @@ namespace LuaGuild
*/
int GetMemberCount(lua_State* L, Guild* guild)
{
#ifdef TRINITY
#if defined TRINITY || AZEROTHCORE
Eluna::Push(L, guild->GetMemberCount());
#else
Eluna::Push(L, guild->GetMemberSize());
@@ -81,10 +83,10 @@ namespace LuaGuild
*/
int GetLeader(lua_State* L, Guild* guild)
{
#ifndef TRINITY
Eluna::Push(L, eObjectAccessor()FindPlayer(guild->GetLeaderGuid()));
#else
#if defined TRINITY || AZEROTHCORE
Eluna::Push(L, eObjectAccessor()FindPlayer(guild->GetLeaderGUID()));
#else
Eluna::Push(L, eObjectAccessor()FindPlayer(guild->GetLeaderGuid()));
#endif
return 1;
}
@@ -96,10 +98,10 @@ namespace LuaGuild
*/
int GetLeaderGUID(lua_State* L, Guild* guild)
{
#ifndef TRINITY
Eluna::Push(L, guild->GetLeaderGuid());
#else
#if defined TRINITY || AZEROTHCORE
Eluna::Push(L, guild->GetLeaderGUID());
#else
Eluna::Push(L, guild->GetLeaderGuid());
#endif
return 1;
}
@@ -144,10 +146,10 @@ namespace LuaGuild
*/
int GetInfo(lua_State* L, Guild* guild)
{
#ifndef TRINITY
Eluna::Push(L, guild->GetGINFO());
#else
#if defined TRINITY || AZEROTHCORE
Eluna::Push(L, guild->GetInfo());
#else
Eluna::Push(L, guild->GetGINFO());
#endif
return 1;
}
@@ -162,10 +164,10 @@ namespace LuaGuild
{
Player* player = Eluna::CHECKOBJ<Player>(L, 2);
#ifndef TRINITY
guild->SetLeader(player->GET_GUID());
#else
#if defined TRINITY || AZEROTHCORE
guild->HandleSetLeader(player->GetSession(), player->GetName());
#else
guild->SetLeader(player->GET_GUID());
#endif
return 0;
}
@@ -182,10 +184,10 @@ namespace LuaGuild
{
uint8 tabId = Eluna::CHECKVAL<uint8>(L, 2);
const char* text = Eluna::CHECKVAL<const char*>(L, 3);
#ifndef TRINITY
guild->SetGuildBankTabText(tabId, text);
#else
#if defined TRINITY || AZEROTHCORE
guild->SetBankTabText(tabId, text);
#else
guild->SetGuildBankTabText(tabId, text);
#endif
return 0;
}
@@ -271,7 +273,7 @@ namespace LuaGuild
Player* player = Eluna::CHECKOBJ<Player>(L, 2);
bool isDisbanding = Eluna::CHECKVAL<bool>(L, 3, false);
#ifdef TRINITY
#if defined TRINITY || AZEROTHCORE
SQLTransaction trans(nullptr);
guild->DeleteMember(trans, player->GET_GUID(), isDisbanding);
#else