From 9eedd5678c6930c928e14c5f6e1996f8278ee478 Mon Sep 17 00:00:00 2001 From: Ray Greenwell Date: Thu, 22 Feb 2007 03:53:44 +0000 Subject: [PATCH] Making callEZCode() 'internal' booched it for WorldGameControl. Made it protected, added a second function for 'friend' access. We could use a custom namespace for this, too. git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@206 c613c5cb-e716-0410-b11b-feb51c14d237 --- src/as/com/threerings/ezgame/CollectionsControl.as | 6 +++--- src/as/com/threerings/ezgame/EZGameControl.as | 12 +++++++++++- src/as/com/threerings/ezgame/SeatingControl.as | 4 ++-- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/as/com/threerings/ezgame/CollectionsControl.as b/src/as/com/threerings/ezgame/CollectionsControl.as index 3d41fc4f..e233e363 100644 --- a/src/as/com/threerings/ezgame/CollectionsControl.as +++ b/src/as/com/threerings/ezgame/CollectionsControl.as @@ -37,7 +37,7 @@ public class CollectionsControl extends SubControl */ public function merge (srcColl :String, intoColl :String) :void { - _ctrl.callEZCode("mergeCollection_v1", srcColl, intoColl); + _ctrl.callEZCodeFriend("mergeCollection_v1", srcColl, intoColl); } /** @@ -93,7 +93,7 @@ public class CollectionsControl extends SubControl protected function populate ( collName :String, values :Array, clearExisting :Boolean) :void { - _ctrl.callEZCode("populateCollection_v1", collName, values, clearExisting); + _ctrl.callEZCodeFriend("populateCollection_v1", collName, values, clearExisting); } /** @@ -103,7 +103,7 @@ public class CollectionsControl extends SubControl collName :String, count :int, msgOrPropName :String, playerId :int, consume :Boolean, callback :Function) :void { - _ctrl.callEZCode("getFromCollection_v2", collName, count, msgOrPropName, + _ctrl.callEZCodeFriend("getFromCollection_v2", collName, count, msgOrPropName, playerId, consume, callback); } } diff --git a/src/as/com/threerings/ezgame/EZGameControl.as b/src/as/com/threerings/ezgame/EZGameControl.as index dde86fc3..cc78b372 100644 --- a/src/as/com/threerings/ezgame/EZGameControl.as +++ b/src/as/com/threerings/ezgame/EZGameControl.as @@ -557,7 +557,7 @@ public class EZGameControl extends BaseControl /** * Call a method across the security boundary. */ - internal function callEZCode (name :String, ... args) :* + protected function callEZCode (name :String, ... args) :* { if (_funcs != null) { try { @@ -571,6 +571,16 @@ public class EZGameControl extends BaseControl } } + /** + * A "friend" version of callEZCode for subControls. + */ + internal function callEZCodeFriend (name :String, ... args) :* + { + // var args + args.unshift(name); + callEZCode.apply(this, args); + } + /** * Internal method that is called whenever the mouse clicks our root. */ diff --git a/src/as/com/threerings/ezgame/SeatingControl.as b/src/as/com/threerings/ezgame/SeatingControl.as index 93c791a6..ef26bb59 100644 --- a/src/as/com/threerings/ezgame/SeatingControl.as +++ b/src/as/com/threerings/ezgame/SeatingControl.as @@ -12,7 +12,7 @@ public class SeatingControl extends SubControl */ public function getPlayerPosition (playerId :int) :int { - return int(_ctrl.callEZCode("getPlayerPosition_v1", playerId)); + return int(_ctrl.callEZCodeFriend("getPlayerPosition_v1", playerId)); } /** @@ -21,7 +21,7 @@ public class SeatingControl extends SubControl */ public function getPlayerIds () :Array /* of playerId (int) */ { - return (_ctrl.callEZCode("getPlayers_v1") as Array); + return (_ctrl.callEZCodeFriend("getPlayers_v1") as Array); } // TODO: methods for allowing a player to pick a seat