Fix TC build, remove GetCombatTime

This commit is contained in:
Rochet2
2018-01-06 00:28:30 +02:00
parent d9415332bb
commit 5b9743025b
4 changed files with 27 additions and 16 deletions

View File

@@ -692,8 +692,12 @@ namespace LuaCreature
#ifdef CMANGOS #ifdef CMANGOS
ThreatList const& threatlist = creature->getThreatManager().getThreatList(); ThreatList const& threatlist = creature->getThreatManager().getThreatList();
#else #endif
#ifdef MANGOS
ThreatList const& threatlist = creature->GetThreatManager().getThreatList(); ThreatList const& threatlist = creature->GetThreatManager().getThreatList();
#endif
#ifdef TRINITY
auto const& threatlist = creature->GetThreatManager().GetThreatenedByMeList();
#endif #endif
if (threatlist.empty()) if (threatlist.empty())
return 1; return 1;
@@ -701,9 +705,13 @@ namespace LuaCreature
return 1; return 1;
std::list<Unit*> targetList; std::list<Unit*> targetList;
for (ThreatList::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr) for (auto itr = threatlist.begin(); itr != threatlist.end(); ++itr)
{ {
#ifdef TRINITY
Unit* target = itr->second->GetOwner();
#else
Unit* target = (*itr)->getTarget(); Unit* target = (*itr)->getTarget();
#endif
if (!target) if (!target)
continue; continue;
if (playerOnly && target->GetTypeId() != TYPEID_PLAYER) if (playerOnly && target->GetTypeId() != TYPEID_PLAYER)
@@ -772,13 +780,21 @@ namespace LuaCreature
*/ */
int GetAITargets(lua_State* L, Creature* creature) int GetAITargets(lua_State* L, Creature* creature)
{ {
#ifdef TRINITY
auto const& threatlist = creature->GetThreatManager().GetThreatenedByMeList();
#else
ThreatList const& threatlist = creature->GetThreatManager().getThreatList(); ThreatList const& threatlist = creature->GetThreatManager().getThreatList();
#endif
lua_createtable(L, threatlist.size(), 0); lua_createtable(L, threatlist.size(), 0);
int tbl = lua_gettop(L); int tbl = lua_gettop(L);
uint32 i = 0; uint32 i = 0;
for (ThreatList::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr) for (auto itr = threatlist.begin(); itr != threatlist.end(); ++itr)
{ {
#ifdef TRINITY
Unit* target = itr->second->GetOwner();
#else
Unit* target = (*itr)->getTarget(); Unit* target = (*itr)->getTarget();
#endif
if (!target) if (!target)
continue; continue;
Eluna::Push(L, target); Eluna::Push(L, target);
@@ -796,7 +812,11 @@ namespace LuaCreature
*/ */
int GetAITargetsCount(lua_State* L, Creature* creature) int GetAITargetsCount(lua_State* L, Creature* creature)
{ {
#ifdef TRINITY
Eluna::Push(L, creature->GetThreatManager().GetThreatenedByMeList().size());
#else
Eluna::Push(L, creature->GetThreatManager().getThreatList().size()); Eluna::Push(L, creature->GetThreatManager().getThreatList().size());
#endif
return 1; return 1;
} }

View File

@@ -103,7 +103,6 @@ typedef Opcodes OpcodesList;
#define eAuctionMgr (sAuctionMgr) #define eAuctionMgr (sAuctionMgr)
#define eObjectAccessor() ObjectAccessor:: #define eObjectAccessor() ObjectAccessor::
#define REGEN_TIME_FULL #define REGEN_TIME_FULL
typedef ThreatContainer::StorageType ThreatList;
#ifdef CATA #ifdef CATA
#define NUM_MSG_TYPES NUM_OPCODE_HANDLERS #define NUM_MSG_TYPES NUM_OPCODE_HANDLERS

View File

@@ -270,7 +270,6 @@ ElunaRegister<Unit> UnitMethods[] =
{ "GetRaceAsString", &LuaUnit::GetRaceAsString }, { "GetRaceAsString", &LuaUnit::GetRaceAsString },
{ "GetClassAsString", &LuaUnit::GetClassAsString }, { "GetClassAsString", &LuaUnit::GetClassAsString },
{ "GetAura", &LuaUnit::GetAura }, { "GetAura", &LuaUnit::GetAura },
{ "GetCombatTime", &LuaUnit::GetCombatTime },
{ "GetFaction", &LuaUnit::GetFaction }, { "GetFaction", &LuaUnit::GetFaction },
{ "GetCurrentSpell", &LuaUnit::GetCurrentSpell }, { "GetCurrentSpell", &LuaUnit::GetCurrentSpell },
{ "GetCreatureType", &LuaUnit::GetCreatureType }, { "GetCreatureType", &LuaUnit::GetCreatureType },

View File

@@ -1177,17 +1177,6 @@ namespace LuaUnit
return 1; return 1;
} }
/**
* Returns the [Unit]'s combat timer
*
* @return uint32 combatTimer
*/
int GetCombatTime(lua_State* L, Unit* unit)
{
Eluna::Push(L, unit->GetCombatTimer());
return 1;
}
/** /**
* Returns a table containing friendly [Unit]'s within given range of the [Unit]. * Returns a table containing friendly [Unit]'s within given range of the [Unit].
* *
@@ -1928,7 +1917,11 @@ namespace LuaUnit
*/ */
int ClearThreatList(lua_State* /*L*/, Unit* unit) int ClearThreatList(lua_State* /*L*/, Unit* unit)
{ {
#ifdef TRINITY
unit->GetThreatManager().ClearAllThreat();
#else
unit->GetThreatManager().clearReferences(); unit->GetThreatManager().clearReferences();
#endif
return 0; return 0;
} }