Skip to content

Commit

Permalink
Refactor some naming to restore FactionGroup meaning
Browse files Browse the repository at this point in the history
Directly point towards original FactionGroups in naming
  • Loading branch information
Warlockbugs committed Jun 18, 2017
1 parent 8111a6c commit f1ea89b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions src/game/AuctionHouse/AuctionHouseMgr.cpp
Expand Up @@ -531,9 +531,9 @@ AuctionHouseEntry const* AuctionHouseMgr::GetAuctionHouseEntry(Unit* unit)
FactionTemplateEntry const* u_entry = sFactionTemplateStore.LookupEntry(factionTemplateId);
if (!u_entry)
houseid = 7; // goblin auction house
else if (u_entry->ourMask & FACTION_MASK_ALLIANCE)
else if (u_entry->factionGroupMask & FACTION_GROUP_MASK_ALLIANCE)
houseid = 1; // human auction house
else if (u_entry->ourMask & FACTION_MASK_HORDE)
else if (u_entry->factionGroupMask & FACTION_GROUP_MASK_HORDE)
houseid = 6; // orc auction house
else
houseid = 7; // goblin auction house
Expand Down
12 changes: 6 additions & 6 deletions src/game/Server/DBCEnums.h
Expand Up @@ -289,13 +289,13 @@ enum FactionTemplateFlags
FACTION_TEMPLATE_FLAG_CONTESTED_GUARD = 0x00001000, // faction will attack players that were involved in PvP combats
};

enum FactionMasks
enum FactionGroupMask
{
FACTION_MASK_PLAYER = 1, // any player
FACTION_MASK_ALLIANCE = 2, // player or creature from alliance team
FACTION_MASK_HORDE = 4, // player or creature from horde team
FACTION_MASK_MONSTER = 8 // aggressive creature from monster team
// if none flags set then non-aggressive creature
FACTION_GROUP_MASK_PLAYER = 1, // any player
FACTION_GROUP_MASK_ALLIANCE = 2, // player or creature from alliance team
FACTION_GROUP_MASK_HORDE = 4, // player or creature from horde team
FACTION_GROUP_MASK_MONSTER = 8 // aggressive creature from monster team
// if none flags set then non-aggressive creature
};

enum MapTypes // Lua_IsInInstance
Expand Down
16 changes: 8 additions & 8 deletions src/game/Server/DBCStructure.h
Expand Up @@ -918,7 +918,7 @@ struct FactionEntry
};

/*
// NOTE: FactionGroup.dbc - currently unused, please refer to related hardcoded enum FactionMasks
// NOTE: FactionGroup.dbc - currently unused, please refer to related hardcoded enum FactionGroupMask
struct FactionGroupEntry
{
uint32 ID; // 0 m_ID
Expand All @@ -934,9 +934,9 @@ struct FactionTemplateEntry
uint32 ID; // 0 m_ID
uint32 faction; // 1 m_faction
uint32 factionFlags; // 2 m_flags
uint32 ourMask; // 3 m_factionGroup
uint32 friendlyMask; // 4 m_friendGroup
uint32 hostileMask; // 5 m_enemyGroup
uint32 factionGroupMask; // 3 m_factionGroup
uint32 friendGroupMask; // 4 m_friendGroup
uint32 enemyGroupMask; // 5 m_enemyGroup
uint32 enemyFaction[4]; // 6 m_enemies[4]
uint32 friendFaction[4]; // 10 m_friend[4]
//------------------------------------------------------- end structure
Expand All @@ -953,7 +953,7 @@ struct FactionTemplateEntry
if (friendFaction[i] == entry.faction)
return true;
}
return (friendlyMask & entry.ourMask) || (ourMask & entry.friendlyMask);
return (friendGroupMask & entry.factionGroupMask) || (factionGroupMask & entry.friendGroupMask);
}
bool IsHostileTo(FactionTemplateEntry const& entry) const
{
Expand All @@ -966,15 +966,15 @@ struct FactionTemplateEntry
if (friendFaction[i] == entry.faction)
return false;
}
return (hostileMask & entry.ourMask) != 0;
return (enemyGroupMask & entry.factionGroupMask) != 0;
}
bool IsHostileToPlayers() const { return (hostileMask & FACTION_MASK_PLAYER) != 0; }
bool IsHostileToPlayers() const { return (enemyGroupMask & FACTION_GROUP_MASK_PLAYER) != 0; }
bool IsNeutralToAll() const
{
for (int i = 0; i < 4; ++i)
if (enemyFaction[i] != 0)
return false;
return hostileMask == 0 && friendlyMask == 0;
return enemyGroupMask == 0 && friendGroupMask == 0;
}
bool IsContestedGuardFaction() const { return (factionFlags & FACTION_TEMPLATE_FLAG_CONTESTED_GUARD) != 0; }
};
Expand Down

0 comments on commit f1ea89b

Please sign in to comment.