diff Lists.lua @ 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 a177b863ed6c
children d5e2dfe0c269
line wrap: on
line diff
--- 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){{{