From 7c2933962686eeb73dfe71158108c5f598508487 Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Wed, 22 Aug 2007 23:54:01 +0000 Subject: [PATCH] Extract that handy method. git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@413 c613c5cb-e716-0410-b11b-feb51c14d237 --- .../ezgame/client/GameControlBackend.as | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/as/com/threerings/ezgame/client/GameControlBackend.as b/src/as/com/threerings/ezgame/client/GameControlBackend.as index e63f9637..30fc823a 100644 --- a/src/as/com/threerings/ezgame/client/GameControlBackend.as +++ b/src/as/com/threerings/ezgame/client/GameControlBackend.as @@ -758,12 +758,8 @@ public class GameControlBackend protected function endGame_v2 (... winnerIds) :void { validateConnected(); - var winners :TypedArray = TypedArray.create(int); - while (winnerIds.length > 0) { - winners.push(int(winnerIds.shift())); - } _ezObj.ezGameService.endGame( - _ctx.getClient(), winners, createLoggingConfirmListener("endGame")); + _ctx.getClient(), toTypedIntArray(winnerIds), createLoggingConfirmListener("endGame")); } protected function getDictionaryLetterSet_v1 ( @@ -901,6 +897,18 @@ public class GameControlBackend _ezObj.commitTransaction(); } + /** + * Converts a Flash array of ints to a TypedArray for delivery over the wire to the server. + */ + protected function toTypedIntArray (array :Array) :TypedArray + { + var tarray :TypedArray = TypedArray.create(int); + while (array.length > 0) { + tarray.push(int(array.shift())); + } + return tarray; + } + protected var _ctx :CrowdContext; protected var _userListener :MessageAdapter =