Fix defSiege resetting

Scott Yeskie [06-05-14 - 02:25]
Fix defSiege resetting
Add battle restart option
Filename
classes/Battle.lua
diff --git a/classes/Battle.lua b/classes/Battle.lua
index b8342f8..2ceff71 100644
--- a/classes/Battle.lua
+++ b/classes/Battle.lua
@@ -28,6 +28,7 @@ CyrHUD.Battle.new = function(keepID)
     self.keepID = keepID
     self.keepName = GetKeepName(keepID)
     self.keepType = GetKeepType(keepID)
+    self.siege = {}
     self:update()
     return self
 end
@@ -36,7 +37,6 @@ function CyrHUD.Battle:update()
     local _, bc = GetKeepKeysByIndex(10)
     self.defender = GetKeepAlliance(self.keepID, bc)
     self.keepUA = GetKeepUnderAttack(self.keepID, bc)
-    self.siege = {}
     self.siege[ALLIANCE_ALDMERI_DOMINION] = GetNumSieges(self.keepID, bc, ALLIANCE_ALDMERI_DOMINION)
     self.siege[ALLIANCE_DAGGERFALL_COVENANT] = GetNumSieges(self.keepID, bc, ALLIANCE_DAGGERFALL_COVENANT)
     self.siege[ALLIANCE_EBONHEART_PACT] = GetNumSieges(self.keepID, bc, ALLIANCE_EBONHEART_PACT)
@@ -53,6 +53,10 @@ function CyrHUD.Battle:update()
     end
 end

+function CyrHUD.Battle:restart()
+    self.endBattle = nil
+end
+
 ----------------------------------------------
 -- Getters
 ----------------------------------------------
@@ -95,7 +99,6 @@ end
 ]]
 function CyrHUD.Battle:getDefSiege()
     local siege = self.siege[self.defender]
-    --d(self.keepName .. ":" ..  siege .. " (" .. self.defender .. ")")
     if siege == 0 then siege = "" end
     return siege, CyrHUD.info[self.defender].color
 end
@@ -107,12 +110,10 @@ end
     @note If two attacking factions, will sum the siege and show white for color
 ]]
 function CyrHUD.Battle:getAttSiege()
-    local siege = self.siege
-    siege[self.defender] = nil
     local count, faction = 0, nil
-    for f,c in pairs(siege) do
-        count = count + c
-        if c > 0 then
+    for f,c in pairs(self.siege) do
+        if f ~= self.defender and c > 0 then
+            count = count + c
             if faction == nil then
                 faction = f
             else