Extract that handy method.

git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@413 c613c5cb-e716-0410-b11b-feb51c14d237
This commit is contained in:
Michael Bayne
2007-08-22 23:54:01 +00:00
parent 1a272ef171
commit 7c29339626
@@ -758,12 +758,8 @@ public class GameControlBackend
protected function endGame_v2 (... winnerIds) :void protected function endGame_v2 (... winnerIds) :void
{ {
validateConnected(); validateConnected();
var winners :TypedArray = TypedArray.create(int);
while (winnerIds.length > 0) {
winners.push(int(winnerIds.shift()));
}
_ezObj.ezGameService.endGame( _ezObj.ezGameService.endGame(
_ctx.getClient(), winners, createLoggingConfirmListener("endGame")); _ctx.getClient(), toTypedIntArray(winnerIds), createLoggingConfirmListener("endGame"));
} }
protected function getDictionaryLetterSet_v1 ( protected function getDictionaryLetterSet_v1 (
@@ -901,6 +897,18 @@ public class GameControlBackend
_ezObj.commitTransaction(); _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 _ctx :CrowdContext;
protected var _userListener :MessageAdapter = protected var _userListener :MessageAdapter =