Changes to match alterations to abjectscript's StreamableArrayList.

git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@149 c613c5cb-e716-0410-b11b-feb51c14d237
This commit is contained in:
Ray Greenwell
2007-01-22 19:59:06 +00:00
parent f347723abe
commit 054c4469f3
2 changed files with 11 additions and 15 deletions
+8 -10
View File
@@ -21,9 +21,7 @@
package com.threerings.parlor.card.data {
import mx.collections.ArrayCollection;
import com.threerings.util.Collections;
import com.threerings.util.ArrayUtil;
import com.threerings.util.StreamableArrayList;
/**
@@ -58,7 +56,7 @@ public class Deck extends StreamableArrayList
var hand :Hand = new Hand();
var offset :int = length - size;
for (var ii :int = 0; ii < size; ii++) {
hand.addItem(removeItemAt(offset));
hand.add(removeAt(offset));
}
return hand;
}
@@ -72,7 +70,7 @@ public class Deck extends StreamableArrayList
public function returnHand (hand :Hand) :void
{
addAll(hand);
hand.removeAll();
hand.clear();
}
/**
@@ -84,17 +82,17 @@ public class Deck extends StreamableArrayList
*/
public function reset (includeJokers :Boolean) :void
{
removeAll();
clear();
for (var i :int = CardCodes.SPADES; i <= CardCodes.DIAMONDS; i++) {
for (var j :int = 2; j <= CardCodes.ACE; j++) {
addItem(new Card(j, i));
add(new Card(j, i));
}
}
if (includeJokers) {
addItem(new Card(CardCodes.RED_JOKER, 3));
addItem(new Card(CardCodes.BLACK_JOKER, 3));
add(new Card(CardCodes.RED_JOKER, 3));
add(new Card(CardCodes.BLACK_JOKER, 3));
}
}
@@ -103,7 +101,7 @@ public class Deck extends StreamableArrayList
*/
public function shuffle () :void
{
Collections.shuffle(this);
ArrayUtil.shuffle(_array);
}
}
}
@@ -43,7 +43,7 @@ public class Hand extends StreamableArrayList
{
var members :int = 0;
for (var i :int = 0; i < length; i++) {
if ((getItemAt(i) as Card).getSuit() == suit) {
if ((get(i) as Card).getSuit() == suit) {
members++;
}
}
@@ -63,9 +63,7 @@ public class Hand extends StreamableArrayList
*/
public function addAllCards (cards :Array) :void
{
for (var i :int = 0; i < cards.length; i++) {
addItem(cards[i]);
}
addAll(cards);
}
/**
@@ -74,7 +72,7 @@ public class Hand extends StreamableArrayList
public function containsAllCards (cards :Array) :Boolean
{
for (var i :int = 0; i < cards.length; i++) {
if (indexOf(cards[i]) == -1) {
if (!contains(cards[i])) {
return false;
}
}