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:
@@ -21,9 +21,7 @@
|
|||||||
|
|
||||||
package com.threerings.parlor.card.data {
|
package com.threerings.parlor.card.data {
|
||||||
|
|
||||||
import mx.collections.ArrayCollection;
|
import com.threerings.util.ArrayUtil;
|
||||||
|
|
||||||
import com.threerings.util.Collections;
|
|
||||||
import com.threerings.util.StreamableArrayList;
|
import com.threerings.util.StreamableArrayList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -58,7 +56,7 @@ public class Deck extends StreamableArrayList
|
|||||||
var hand :Hand = new Hand();
|
var hand :Hand = new Hand();
|
||||||
var offset :int = length - size;
|
var offset :int = length - size;
|
||||||
for (var ii :int = 0; ii < size; ii++) {
|
for (var ii :int = 0; ii < size; ii++) {
|
||||||
hand.addItem(removeItemAt(offset));
|
hand.add(removeAt(offset));
|
||||||
}
|
}
|
||||||
return hand;
|
return hand;
|
||||||
}
|
}
|
||||||
@@ -72,7 +70,7 @@ public class Deck extends StreamableArrayList
|
|||||||
public function returnHand (hand :Hand) :void
|
public function returnHand (hand :Hand) :void
|
||||||
{
|
{
|
||||||
addAll(hand);
|
addAll(hand);
|
||||||
hand.removeAll();
|
hand.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -84,17 +82,17 @@ public class Deck extends StreamableArrayList
|
|||||||
*/
|
*/
|
||||||
public function reset (includeJokers :Boolean) :void
|
public function reset (includeJokers :Boolean) :void
|
||||||
{
|
{
|
||||||
removeAll();
|
clear();
|
||||||
|
|
||||||
for (var i :int = CardCodes.SPADES; i <= CardCodes.DIAMONDS; i++) {
|
for (var i :int = CardCodes.SPADES; i <= CardCodes.DIAMONDS; i++) {
|
||||||
for (var j :int = 2; j <= CardCodes.ACE; j++) {
|
for (var j :int = 2; j <= CardCodes.ACE; j++) {
|
||||||
addItem(new Card(j, i));
|
add(new Card(j, i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (includeJokers) {
|
if (includeJokers) {
|
||||||
addItem(new Card(CardCodes.RED_JOKER, 3));
|
add(new Card(CardCodes.RED_JOKER, 3));
|
||||||
addItem(new Card(CardCodes.BLACK_JOKER, 3));
|
add(new Card(CardCodes.BLACK_JOKER, 3));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -103,7 +101,7 @@ public class Deck extends StreamableArrayList
|
|||||||
*/
|
*/
|
||||||
public function shuffle () :void
|
public function shuffle () :void
|
||||||
{
|
{
|
||||||
Collections.shuffle(this);
|
ArrayUtil.shuffle(_array);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ public class Hand extends StreamableArrayList
|
|||||||
{
|
{
|
||||||
var members :int = 0;
|
var members :int = 0;
|
||||||
for (var i :int = 0; i < length; i++) {
|
for (var i :int = 0; i < length; i++) {
|
||||||
if ((getItemAt(i) as Card).getSuit() == suit) {
|
if ((get(i) as Card).getSuit() == suit) {
|
||||||
members++;
|
members++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -63,9 +63,7 @@ public class Hand extends StreamableArrayList
|
|||||||
*/
|
*/
|
||||||
public function addAllCards (cards :Array) :void
|
public function addAllCards (cards :Array) :void
|
||||||
{
|
{
|
||||||
for (var i :int = 0; i < cards.length; i++) {
|
addAll(cards);
|
||||||
addItem(cards[i]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -74,7 +72,7 @@ public class Hand extends StreamableArrayList
|
|||||||
public function containsAllCards (cards :Array) :Boolean
|
public function containsAllCards (cards :Array) :Boolean
|
||||||
{
|
{
|
||||||
for (var i :int = 0; i < cards.length; i++) {
|
for (var i :int = 0; i < cards.length; i++) {
|
||||||
if (indexOf(cards[i]) == -1) {
|
if (!contains(cards[i])) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user