changeset 70:236117ab8a49

Decent sketch of what the communication system might look like
author John@Yosemite-PC
date Thu, 29 Mar 2012 23:24:51 -0400
parents b7352f007028
children d5e2dfe0c269
files Core.lua Gui.lua Lists.lua breuesk.toc
diffstat 4 files changed, 13 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/Core.lua	Thu Mar 29 20:17:59 2012 -0400
+++ b/Core.lua	Thu Mar 29 23:24:51 2012 -0400
@@ -8,15 +8,15 @@
 -- (*) lists store number slots rather than flat indexing
 -- ( ) database and comm versioning
 -- ( ) limited communication - everyone trusts the loot master
--- ( ) single user + admin gui (manual suicides)
+-- (_) single user + admin gui (manual suicides)
 -- ( ) single user + admin gui (master loot)
 -- ( ) communication and list merging/trimming
 -- ( ) admins
--- ( ) players gui
+-- (_) players gui
 -- ( ) undo
 -- ( ) crypto / protection against tampering
 -- ( ) alt tracking
--- (_) reserves
+-- (*) reserves
 
 local _G=_G
 local strsplit=strsplit
@@ -51,6 +51,7 @@
     local HandlePassThrough = function(...) HandleCommand(...) end
     bsk:RegisterChatCommand("bsk", HandlePassThrough)
     bsk:OnInitializeSetStaticData()
+    InitializeComm()
 end
 
 function OnEnable()
--- a/Gui.lua	Thu Mar 29 20:17:59 2012 -0400
+++ b/Gui.lua	Thu Mar 29 23:24:51 2012 -0400
@@ -61,7 +61,6 @@
     ["Hide"] = function(self) if f then AceGUI:Release(f); self.shown=false end end
 }
 
-
 SelectorListEventDispatcher =
 {
     listeners = nil,
@@ -362,6 +361,7 @@
                     biddingZone:ReleaseChildren()
                     widget:SetText("Open Bids")
                     RListEventDispatch:Release()
+                    RListPopulator:Release() 
                 else
                     widget:SetText("Close bids")
                     local spacer = AceGUI:Create("Label")
@@ -389,7 +389,7 @@
                     local bidRetractButton = AceGUI:Create("Button")
                     bidRetractButton:SetText("Place Bid")
                     bidRetractButton:SetWidth(100)
-                    bidRetractButton:SetCallback("OnClick", function(widget) RListPopulator:Force(SListPopulator:GetMe()) end)
+                    bidRetractButton:SetCallback("OnClick", function(widget) RListPopulator:Force(SListPopulator:GetMe()) end) -- todo: Force is not the desired thing here.
                     local rollButton = AceGUI:Create("Button")
                     rollButton:SetText("Offset Roll")
                     rollButton:SetWidth(100)
--- a/Lists.lua	Thu Mar 29 20:17:59 2012 -0400
+++ b/Lists.lua	Thu Mar 29 23:24:51 2012 -0400
@@ -84,7 +84,7 @@
 local setmetatable=setmetatable
 setfenv(1,bsk)
 
-local changeListener = nil -- todo: really should not be scoped like this
+changeListener = nil -- todo: really should not be scoped like this
 
 ListEntry = 
 {
@@ -531,8 +531,8 @@
     if le then
         -- todo: check that they're not already reserved
         self.active.reserve[le:GetId()] = true
+        return true
     end
-    changeListener:DataEvent() -- todo: revisit
 end
 -- todo: remove reserve
 function PersonList:IsActive(id) -- todo: support LE as input - saves IsActive(le:GetId())
@@ -630,6 +630,7 @@
             changeListener:DataEvent(change)
         end
         -- TODO: broadcast
+        Comm:SendChange(change)
         return arg
     else
         return nil
@@ -818,7 +819,9 @@
 end
 function ReservePerson(person)
     print("Reserving " .. person)
-    PersonList:AddReserve(person)
+    if PersonList:AddReserve(person) then -- todo: would be better if this were an ID ...
+        Comm:AddReserve(person)
+    end
 end
 --}}}
 -- Higher order actions (ie calls other standard actions){{{
--- a/breuesk.toc	Thu Mar 29 20:17:59 2012 -0400
+++ b/breuesk.toc	Thu Mar 29 23:24:51 2012 -0400
@@ -32,3 +32,4 @@
 Options.lua
 Utility.lua
 SelectorList.lua
+Comm.lua