diff --git a/src/as/com/threerings/crowd/client/LocationDirector.as b/src/as/com/threerings/crowd/client/LocationDirector.as index ce6f7d9fc..d0c08d082 100644 --- a/src/as/com/threerings/crowd/client/LocationDirector.as +++ b/src/as/com/threerings/crowd/client/LocationDirector.as @@ -232,10 +232,9 @@ public class LocationDirector extends BasicDirector public function mayMoveTo (placeId :int, rl :ResultListener) :Boolean { var vetoed :Boolean = false; - _observers.apply(function (obs :Object) :Boolean { + _observers.apply(function (obs :Object) :void { var lobs :LocationObserver = (obs as LocationObserver); vetoed = vetoed || !lobs.locationMayChange(placeId); - return true; }); // if we're actually going somewhere, let the controller know that @@ -536,9 +535,8 @@ public class LocationDirector extends BasicDirector protected function notifyFailure (placeId :int, reason :String) :void { - _observers.apply(function (obs :Object) :Boolean { + _observers.apply(function (obs :Object) :void { (obs as LocationObserver).locationChangeFailed(placeId, reason); - return true; }); } @@ -582,10 +580,9 @@ public class LocationDirector extends BasicDirector protected var _moveListener :ResultListener; /** The operation used to inform observers that the location changed. */ - protected var _didChangeOp :Function = function (obs :Object) :Boolean + protected var _didChangeOp :Function = function (obs :Object) :void { (obs as LocationObserver).locationDidChange(_plobj); - return true; }; /** We require that a moveTo request be outstanding for one minute diff --git a/src/as/com/threerings/presents/client/Client.as b/src/as/com/threerings/presents/client/Client.as index 94533e029..e0d4c1d9e 100644 --- a/src/as/com/threerings/presents/client/Client.as +++ b/src/as/com/threerings/presents/client/Client.as @@ -400,8 +400,8 @@ public class Client extends EventDispatcher protected var _comm :Communicator; /** Our list of client observers. */ - protected var _observers :ObserverList = - new ObserverList(ObserverList.SAFE_IN_ORDER_NOTIFY); +// protected var _observers :ObserverList = +// new ObserverList(ObserverList.SAFE_IN_ORDER_NOTIFY); /** General startup information provided by the server. */ protected var _bstrap :BootstrapData; diff --git a/src/as/com/threerings/util/ObserverList.as b/src/as/com/threerings/util/ObserverList.as index a882762e9..f89f44313 100644 --- a/src/as/com/threerings/util/ObserverList.as +++ b/src/as/com/threerings/util/ObserverList.as @@ -28,7 +28,7 @@ public class ObserverList */ public function add (observer :Object) :void { - if (_list.indexOf(observer) == -1) { + if (!ArrayUtil.contains(_list, observer)) { _list.push(observer); } } @@ -43,11 +43,9 @@ public class ObserverList /** * Apply some operation to all observers. - * The function to be passed in should expect one argument and return a - * Boolean. - * function (observer :Object) :Boolean. - * The function should return false if the observer should be removed - * from the list. + * The function to be passed in should expect one argument and either + * return void or a Boolean. If returning a Boolean, returning false + * indicates that the observer should be removed from the list. */ public function apply (func :Function) :void { @@ -58,8 +56,8 @@ public class ObserverList } for (var ii :int = list.length-1; ii >= 0; ii--) { try { - var result :Boolean = func(list[ii]); - if (!result) { + var result :* = func(list[ii]); + if (result !== undefined && !Boolean(result)) { // remove it if directed to do so remove(list[ii]); }