// Returns a function used for alerting users that another user, within visible range, has changed position func movedFun(tId uint, usr *user.U) func(mNS, mEW float64, e interface{}) { return func(mNS, mEW float64, e interface{}) { oUsr := e.(*user.U) if !usr.Equiv(oUsr) { broadcastSend(tId, msgdef.SMovedOp, usr, oUsr) } } }
// Deletes usr from tree at the given coords func deleteUsr(mNS, mEW float64, usr *user.U, tree quadtree.T) { v := quadtree.PointViewP(mNS, mEW) pred := func(_, _ float64, e interface{}) bool { oUsr := e.(*user.U) return usr.Equiv(oUsr) } tree.Del(v, pred) }
// Returns a function used for alerting users that another user has been added to the system func initLocFun(tId uint, usr *user.U) func(mNS, mEW float64, e interface{}) { return func(mNS, mEW float64, e interface{}) { oUsr := e.(*user.U) if !usr.Equiv(oUsr) { broadcastSend(tId, msgdef.SVisibleOp, usr, oUsr) broadcastSend(tId, msgdef.SVisibleOp, oUsr, usr) } } }