Quantcast

Removed a bunch of debug code

Kevin Lyles [06-18-11 - 14:44]
Removed a bunch of debug code
Filename
IntervalTree.lua
Upgrade.lua
WeightsWatcher.lua
diff --git a/IntervalTree.lua b/IntervalTree.lua
index 763ab33..f542958 100644
--- a/IntervalTree.lua
+++ b/IntervalTree.lua
@@ -3,7 +3,7 @@
 -- Root is black
 -- All leaves (nils) are black
 -- If a node is red, both its children are black
--- For each node, all paths to descendant leaves containthe same number of black nodes
+-- For each node, all paths to descendant leaves contain the same number of black nodes

 IntervalTree = {}

@@ -215,113 +215,5 @@ function IntervalTree.create()
 		end
 	end

-	local function printNode(node)
-		if node == sentinel or node == nil then
-			io.write("nil")
-			return
-		end
-		io.write("( ")
-		printNode(node.left)
-		io.write(", ")
-		if node.color == RED then
-			io.write("RED")
-		else
-			io.write("BLACK")
-		end
-		io.write(": " .. node.start .. "-" .. node.stop .. " = " .. tostring(node.value))
-		io.write(", max = " .. node.max)
-		io.write(", ")
-		printNode(node.right)
-		io.write(" )")
-	end
-
-	function tree.print()
-		printNode(tree.root)
-		print()
-	end
-
-	local function quotedString(str)
-		return string.gsub(string.format("%q", str), "\n", "n")
-	end
-
-	local function varName(name)
-		if type(name) == "number" then
-			return string.format("[%d]", name)
-		elseif type(name) == "string" then
-			if string.find(name, "^[a-zA-Z][a-zA-Z0-9_]+$") then
-				return name
-			else
-				return string.format("[%s]", quotedString(name))
-			end
-		elseif type(name) == "boolean" then
-			return string.format("[%s]", tostring(name))
-		else
-			print("Unhandled name type: %q", type(name))
-		end
-	end
-
-	local function fullPrintNode(node, name, indent)
-		local indentStr
-		if indent then
-			indentStr = string.rep("\t", indent)
-		else
-			indent = 0
-			indentStr = ""
-		end
-
-		print(string.format("%s%s = {", indentStr, varName(name)))
-
-		local indexTable = {}
-		for index, value in pairs(node) do
-			if index ~= "parent" and value ~= sentinel and type(value) ~= "function" then
-				table.insert(indexTable, index)
-			end
-		end
-		table.sort(indexTable)
-
-		for _, index in ipairs(indexTable) do
-			local value = node[index]
-			if type(value) == "string" then
-				print(string.format("%s\t%s = %s,", indentStr, varName(index), quotedString(value)))
-			elseif type(value) == "number" then
-				value = string.gsub(string.format("%f", value), "%.?0+$", "")
-				print(string.format("%s\t%s = %s,", indentStr, varName(index), value))
-			elseif type(value) == "table" then
-				if type(value.fullPrint) == "function" then
-					value.fullPrint(index, indent + 1)
-				elseif type(value.parent) == "table" then
-					fullPrintNode(value, index, indent + 1)
-				else
-					sort(value, index, indent + 1)
-				end
-			elseif type(value) == "boolean" then
-				print(string.format("%s\t%s = %s,", indentStr, varName(index), quotedString(value and "RED" or "BLACK")))
-			else
-				print(string.format("%s\tUnhandled value type: %q", indentStr, type(value)))
-			end
-		end
-		if indent > 0 then
-			print(string.format("%s},", indentStr))
-		else
-			print("}")
-		end
-	end
-
-	function tree.fullPrint(name, indent)
-		fullPrintNode(tree.root, name, indent)
-	end
-
-	function tree.check()
-		if sentinel.color ~= BLACK then
-			print("Sentinel's color is not black!")
-			return false
-		end
-		if tree.root.color ~= BLACK then
-			print("Root's color is not black!")
-			return false
-		end
-		return true
-	end
-
 	return tree
 end
diff --git a/Upgrade.lua b/Upgrade.lua
index 9f9ac36..c5a0f31 100644
--- a/Upgrade.lua
+++ b/Upgrade.lua
@@ -837,10 +837,6 @@ local function upgradeAccountToConfig(vars)
 	for key, value in pairs(table) do
 		if keys[key] then
 			if conversion[value] == nil then
-				if type(value) ~= "string" then
-					value = "type: " .. type(value)
-				end
-				print("WeightsWatcher: error: invalid value in tooltip options: " .. value)
 				return nil
 			end
 			table[key] = conversion[value]
@@ -877,10 +873,6 @@ local downgradeAccountFromConfig = [[
 		for key, value in pairs(table) do
 			if keys[key] then
 				if conversion[value] == nil then
-					if type(value) ~= "string" then
-						value = "type: " .. type(value)
-					end
-					print("WeightsWatcher: error: invalid value in tooltip options: " .. value)
 					return nil
 				end
 				table[key] = conversion[value]
@@ -937,7 +929,6 @@ local function upgradeAccountToOrderedLists(vars)

 	for class, weights in pairs(vars.weightsList) do
 		if type(class) ~= "string" then
-			print("WeightsWatcher: Error: class name has type " .. type(class) .. ", expecting string.")
 			return nil
 		end
 		weightsListCopy[i] = class
@@ -945,7 +936,6 @@ local function upgradeAccountToOrderedLists(vars)
 		j = 1
 		for weight, stats in pairs(weights) do
 			if type(weight) ~= "string" then
-				print("WeightsWatcher: Error: weight name for class " .. class .. " has type " .. type(weight) .. ", expecting string.")
 				return nil
 			end
 			weightsListCopy[class][j] = weight
@@ -983,14 +973,12 @@ local function upgradeCharToOrderedLists(vars)

 	for class, weights in pairs(vars.activeWeights) do
 		if type(class) ~= "string" then
-			print("WeightsWatcher: Error: class name has type " .. type(class) .. ", expecting string.")
 			return nil
 		end
 		activeWeightsCopy[i] = class
 		activeWeightsCopy[class] = {}
 		for j, weight in pairs(weights) do
 			if type(weight) ~= "string" then
-				print("WeightsWatcher: Error: weight name has type " .. type(weight) .. ", expecting string.")
 				return nil
 			end
 			activeWeightsCopy[class][j] = weight
diff --git a/WeightsWatcher.lua b/WeightsWatcher.lua
index 7d30ecd..5050e36 100644
--- a/WeightsWatcher.lua
+++ b/WeightsWatcher.lua
@@ -334,7 +334,6 @@ function WeightsWatcher:eventHandler(event, message, ...)
 				WeightsWatcher.ResetEnchantCache()
 			end
 		else
-			print("WeightsWatcher: warning: unhandled profession event \"" .. message .. "\"")
 			populateProfessions()
 		end
 	elseif event == "CHAT_MSG_COMBAT_FACTION_CHANGE" then
@@ -378,13 +377,10 @@ function WeightsWatcher:eventHandler(event, message, ...)
 				end
 			end
 		else
-			print("WeightsWatcher: warning: unhandled reputation event \"" .. message .. "\"")
 			populateReputations()
 		end
 	elseif event == "SKILL_LINES_CHANGED" then
 		populateProfessions()
-	else
-		print("WeightsWatcher: warning: unhandled event \"" .. tostring(event) .. "\"")
 	end
 end

@@ -1248,8 +1244,6 @@ function WeightsWatcher.matchesSocket(gemId, socketColor)
 		if gemInfo then
 			gemColor = gemInfo.info[1]
 		else
-			print(string.format(L["WARN_UNREC_GEMID"], gemId))
-			-- TODO: use the getgeminfo api to parse the gem?
 			return false
 		end
 	elseif type(gemId) == "string" then
@@ -1257,7 +1251,6 @@ function WeightsWatcher.matchesSocket(gemId, socketColor)
 	end

 	if not socketColors[socketColor] then
-		print(string.format(L["WARN_UNREC_SOCKET_COLOR"], socketColor))
 		return false
 	end

@@ -1340,10 +1333,6 @@ function WeightsWatcher.getGemStats(...)
 			if gemInfo then
 				table.insert(innerStatTable, gemInfo.info)
 			else
-				if gemId ~= "0" then
-					print(string.format(L["WARN_UNHAND_GEMID"], gemId))
-					-- TODO: use getgeminfo to parse the gem itself?
-				end
 				-- Ensures gems line up with their sockets
 				table.insert(innerStatTable, {"N/A", "None", {}})
 			end