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
ThreatList const& threatlist = creature->getThreatManager().getThreatList();
#else
#endif
#ifdef MANGOS
ThreatList const& threatlist = creature->GetThreatManager().getThreatList();
#endif
#ifdef TRINITY
auto const& threatlist = creature->GetThreatManager().GetThreatenedByMeList();
#endif
if (threatlist.empty())
return 1;
@@ -701,9 +705,13 @@ namespace LuaCreature
return 1;
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();
#endif
if (!target)
continue;
if (playerOnly && target->GetTypeId() != TYPEID_PLAYER)
@@ -772,13 +780,21 @@ namespace LuaCreature
*/
int GetAITargets(lua_State* L, Creature* creature)
{
#ifdef TRINITY
auto const& threatlist = creature->GetThreatManager().GetThreatenedByMeList();
#else
ThreatList const& threatlist = creature->GetThreatManager().getThreatList();
#endif
lua_createtable(L, threatlist.size(), 0);
int tbl = lua_gettop(L);
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();
#endif
if (!target)
continue;
Eluna::Push(L, target);
@@ -796,7 +812,11 @@ namespace LuaCreature
*/
int GetAITargetsCount(lua_State* L, Creature* creature)
{
#ifdef TRINITY
Eluna::Push(L, creature->GetThreatManager().GetThreatenedByMeList().size());
#else
Eluna::Push(L, creature->GetThreatManager().getThreatList().size());
#endif
return 1;
}

View File

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

View File

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

View File

@@ -1177,17 +1177,6 @@ namespace LuaUnit
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].
*
@@ -1928,7 +1917,11 @@ namespace LuaUnit
*/
int ClearThreatList(lua_State* /*L*/, Unit* unit)
{
#ifdef TRINITY
unit->GetThreatManager().ClearAllThreat();
#else
unit->GetThreatManager().clearReferences();
#endif
return 0;
}