Overwrote with generated versions (which are the same but in different orders).
git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@94 c613c5cb-e716-0410-b11b-feb51c14d237
This commit is contained in:
@@ -79,17 +79,17 @@ public class Table
|
||||
}
|
||||
|
||||
/**
|
||||
* Count the number of players currently occupying this table.
|
||||
* Get the type of party game being played at this table, or
|
||||
* PartyGameCodes.NOT_PARTY_GAME.
|
||||
*/
|
||||
public function getOccupiedCount () :int
|
||||
public function getPartyGameType () :int
|
||||
{
|
||||
var count :int = 0;
|
||||
for (var ii :int = 0; ii < occupants.length; ii++) {
|
||||
if (occupants[ii] != null) {
|
||||
count++;
|
||||
}
|
||||
if (config is PartyGameConfig) {
|
||||
return (config as PartyGameConfig).getPartyGameType();
|
||||
|
||||
} else {
|
||||
return PartyGameCodes.NOT_PARTY_GAME;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -116,6 +116,20 @@ public class Table
|
||||
return players;
|
||||
}
|
||||
|
||||
/**
|
||||
* Count the number of players currently occupying this table.
|
||||
*/
|
||||
public function getOccupiedCount () :int
|
||||
{
|
||||
var count :int = 0;
|
||||
for (var ii :int = 0; ii < occupants.length; ii++) {
|
||||
if (occupants[ii] != null) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
/**
|
||||
* For a team game, get the team member indices of the compressed
|
||||
* players array returned by getPlayers().
|
||||
@@ -154,20 +168,6 @@ public class Table
|
||||
return (PartyGameCodes.NOT_PARTY_GAME != getPartyGameType());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the type of party game being played at this table, or
|
||||
* PartyGameCodes.NOT_PARTY_GAME.
|
||||
*/
|
||||
public function getPartyGameType () :int
|
||||
{
|
||||
if (config is PartyGameConfig) {
|
||||
return (config as PartyGameConfig).getPartyGameType();
|
||||
|
||||
} else {
|
||||
return PartyGameCodes.NOT_PARTY_GAME;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Requests to seat the specified user at the specified position in
|
||||
* this table.
|
||||
|
||||
@@ -5,13 +5,12 @@ package com.threerings.parlor.game.data {
|
||||
|
||||
import com.threerings.io.ObjectInputStream;
|
||||
import com.threerings.io.ObjectOutputStream;
|
||||
import com.threerings.io.Streamable;
|
||||
import com.threerings.io.SimpleStreamableObject;
|
||||
|
||||
/**
|
||||
* Represents attributes of an AI player.
|
||||
*/
|
||||
public class GameAI
|
||||
implements Streamable
|
||||
public class GameAI extends SimpleStreamableObject
|
||||
{
|
||||
/** The "personality" of the AI, which can be interpreted by
|
||||
* each puzzle. */
|
||||
@@ -31,17 +30,17 @@ public class GameAI
|
||||
}
|
||||
|
||||
// from Streamable
|
||||
public function writeObject (out :ObjectOutputStream) :void
|
||||
{
|
||||
out.writeInt(personality);
|
||||
out.writeInt(skill);
|
||||
}
|
||||
|
||||
// from Streamable
|
||||
public function readObject (ins :ObjectInputStream) :void
|
||||
override public function readObject (ins :ObjectInputStream) :void
|
||||
{
|
||||
personality = ins.readInt();
|
||||
skill = ins.readInt();
|
||||
}
|
||||
|
||||
// from Streamable
|
||||
override public function writeObject (out :ObjectOutputStream) :void
|
||||
{
|
||||
out.writeInt(personality);
|
||||
out.writeInt(skill);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,6 +68,11 @@ public /*abstract*/ class GameConfig extends PlaceConfig
|
||||
* at all. */
|
||||
public var ais :TypedArray = TypedArray.create(GameAI);
|
||||
|
||||
public function GameConfig ()
|
||||
{
|
||||
// nothing needed
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the message bundle identifier for the bundle that should be
|
||||
* used to translate the translatable strings used to describe the
|
||||
@@ -116,32 +121,6 @@ public /*abstract*/ class GameConfig extends PlaceConfig
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an Array of strings that describe the configuration of this
|
||||
* game. Default implementation returns an empty array.
|
||||
*/
|
||||
public function getDescription () :Array
|
||||
{
|
||||
return new Array(); // nothing by default
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this game config object is equal to the supplied
|
||||
* object (meaning it is also a game config object and its
|
||||
* configuration settings are the same as ours).
|
||||
*/
|
||||
public function equals (other :Object) :Boolean
|
||||
{
|
||||
// make sure they're of the same class
|
||||
if (ClassUtil.isSameClass(other, this)) {
|
||||
var that :GameConfig = GameConfig(other);
|
||||
return this.rated == that.rated;
|
||||
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Computes a hashcode for this game config object that supports our
|
||||
* {@link #equals} implementation. Objects that are equal should have
|
||||
@@ -165,15 +144,33 @@ public /*abstract*/ class GameConfig extends PlaceConfig
|
||||
return copy;
|
||||
}
|
||||
|
||||
override public function writeObject (out :ObjectOutputStream) :void
|
||||
/**
|
||||
* Returns true if this game config object is equal to the supplied
|
||||
* object (meaning it is also a game config object and its
|
||||
* configuration settings are the same as ours).
|
||||
*/
|
||||
public function equals (other :Object) :Boolean
|
||||
{
|
||||
super.writeObject(out);
|
||||
// make sure they're of the same class
|
||||
if (ClassUtil.isSameClass(other, this)) {
|
||||
var that :GameConfig = GameConfig(other);
|
||||
return this.rated == that.rated;
|
||||
|
||||
out.writeObject(players);
|
||||
out.writeBoolean(rated);
|
||||
out.writeObject(ais);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an Array of strings that describe the configuration of this
|
||||
* game. Default implementation returns an empty array.
|
||||
*/
|
||||
public function getDescription () :Array
|
||||
{
|
||||
return new Array(); // nothing by default
|
||||
}
|
||||
|
||||
// from interface Streamable
|
||||
override public function readObject (ins :ObjectInputStream) :void
|
||||
{
|
||||
super.readObject(ins);
|
||||
@@ -182,5 +179,15 @@ public /*abstract*/ class GameConfig extends PlaceConfig
|
||||
rated = ins.readBoolean();
|
||||
ais = (ins.readObject() as TypedArray);
|
||||
}
|
||||
|
||||
// from interface Streamable
|
||||
override public function writeObject (out :ObjectOutputStream) :void
|
||||
{
|
||||
super.writeObject(out);
|
||||
|
||||
out.writeObject(players);
|
||||
out.writeBoolean(rated);
|
||||
out.writeObject(ais);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user