Core/Entities: Add new functions: Unit::GetReactionTo and Unit::GetFactionReactionTo for more direct reaction checks than Unit::IsFriendly/HostileTo (those functions have many duplicated code and have many checks unrelated to unit reaction).

This commit is contained in:
QAston
2011-09-15 17:44:03 +02:00
parent af05915b9e
commit e07535c3e3
6 changed files with 166 additions and 5 deletions
+1
View File
@@ -307,6 +307,7 @@ enum FactionTemplateFlags
{
FACTION_TEMPLATE_FLAG_PVP = 0x00000800, // flagged for PvP
FACTION_TEMPLATE_FLAG_CONTESTED_GUARD = 0x00001000, // faction will attack players that were involved in PvP combats
FACTION_TEMPLATE_FLAG_HOSTILE_BY_DEFAULT= 0x00002000,
};
enum FactionMasks
+6 -4
View File
@@ -870,6 +870,12 @@ struct FactionEntry
// 39 string flags
//char* description[16]; // 40-55 m_description_lang
// 56 string flags
// helpers
bool CanHaveReputation() const
{
return reputationListID >=0;
}
};
#define MAX_FACTION_RELATIONS 4
@@ -889,8 +895,6 @@ struct FactionTemplateEntry
// helpers
bool IsFriendlyTo(FactionTemplateEntry const& entry) const
{
if (ID == entry.ID)
return true;
if (entry.faction)
{
for (int i = 0; i < MAX_FACTION_RELATIONS; ++i)
@@ -904,8 +908,6 @@ struct FactionTemplateEntry
}
bool IsHostileTo(FactionTemplateEntry const& entry) const
{
if (ID == entry.ID)
return false;
if (entry.faction)
{
for (int i = 0; i < MAX_FACTION_RELATIONS; ++i)