Quantcast

In Player:IsCorrectFaction(): Replaced raw bit.band() use with recipe:IsFlagged()

James D. Callahan III [04-09-10 - 04:01]
In Player:IsCorrectFaction(): Replaced raw bit.band() use with recipe:IsFlagged()
Filename
Player.lua
diff --git a/Player.lua b/Player.lua
index c0b088f..6eeb0a8 100644
--- a/Player.lua
+++ b/Player.lua
@@ -120,12 +120,12 @@ function Player:HasProperRepLevel(rep_data)
 end

 function Player:IsCorrectFaction(recipe)
-	local flags = recipe.flags.common1
-	local C1 = private.common_flags_word1
+	local flagged_horde = recipe:IsFlagged("common1", "HORDE")
+	local flagged_alliance = recipe:IsFlagged("common1", "ALLIANCE")

-	if self.faction == BFAC["Alliance"] and bit.band(flags, C1.HORDE) == C1.HORDE and bit.band(flags, C1.ALLIANCE) ~= C1.ALLIANCE then
+	if self.faction == BFAC["Alliance"] and flagged_horde and not flagged_alliance then
 		return false
-	elseif self.faction == BFAC["Horde"] and bit.band(flags, C1.ALLIANCE) == C1.ALLIANCE and bit.band(flags, C1.HORDE) ~= C1.HORDE then
+	elseif self.faction == BFAC["Horde"] and flagged_alliance and not flagged_horde then
 		return false
 	end
 	return true