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;
|
if (config is PartyGameConfig) {
|
||||||
for (var ii :int = 0; ii < occupants.length; ii++) {
|
return (config as PartyGameConfig).getPartyGameType();
|
||||||
if (occupants[ii] != null) {
|
|
||||||
count++;
|
} else {
|
||||||
}
|
return PartyGameCodes.NOT_PARTY_GAME;
|
||||||
}
|
}
|
||||||
return count;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -116,6 +116,20 @@ public class Table
|
|||||||
return players;
|
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
|
* For a team game, get the team member indices of the compressed
|
||||||
* players array returned by getPlayers().
|
* players array returned by getPlayers().
|
||||||
@@ -154,20 +168,6 @@ public class Table
|
|||||||
return (PartyGameCodes.NOT_PARTY_GAME != getPartyGameType());
|
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
|
* Requests to seat the specified user at the specified position in
|
||||||
* this table.
|
* this table.
|
||||||
|
|||||||
@@ -5,13 +5,12 @@ package com.threerings.parlor.game.data {
|
|||||||
|
|
||||||
import com.threerings.io.ObjectInputStream;
|
import com.threerings.io.ObjectInputStream;
|
||||||
import com.threerings.io.ObjectOutputStream;
|
import com.threerings.io.ObjectOutputStream;
|
||||||
import com.threerings.io.Streamable;
|
import com.threerings.io.SimpleStreamableObject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents attributes of an AI player.
|
* Represents attributes of an AI player.
|
||||||
*/
|
*/
|
||||||
public class GameAI
|
public class GameAI extends SimpleStreamableObject
|
||||||
implements Streamable
|
|
||||||
{
|
{
|
||||||
/** The "personality" of the AI, which can be interpreted by
|
/** The "personality" of the AI, which can be interpreted by
|
||||||
* each puzzle. */
|
* each puzzle. */
|
||||||
@@ -31,17 +30,17 @@ public class GameAI
|
|||||||
}
|
}
|
||||||
|
|
||||||
// from Streamable
|
// from Streamable
|
||||||
public function writeObject (out :ObjectOutputStream) :void
|
override public function readObject (ins :ObjectInputStream) :void
|
||||||
{
|
|
||||||
out.writeInt(personality);
|
|
||||||
out.writeInt(skill);
|
|
||||||
}
|
|
||||||
|
|
||||||
// from Streamable
|
|
||||||
public function readObject (ins :ObjectInputStream) :void
|
|
||||||
{
|
{
|
||||||
personality = ins.readInt();
|
personality = ins.readInt();
|
||||||
skill = 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. */
|
* at all. */
|
||||||
public var ais :TypedArray = TypedArray.create(GameAI);
|
public var ais :TypedArray = TypedArray.create(GameAI);
|
||||||
|
|
||||||
|
public function GameConfig ()
|
||||||
|
{
|
||||||
|
// nothing needed
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the message bundle identifier for the bundle that should be
|
* Returns the message bundle identifier for the bundle that should be
|
||||||
* used to translate the translatable strings used to describe the
|
* used to translate the translatable strings used to describe the
|
||||||
@@ -116,32 +121,6 @@ public /*abstract*/ class GameConfig extends PlaceConfig
|
|||||||
return -1;
|
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
|
* Computes a hashcode for this game config object that supports our
|
||||||
* {@link #equals} implementation. Objects that are equal should have
|
* {@link #equals} implementation. Objects that are equal should have
|
||||||
@@ -165,15 +144,33 @@ public /*abstract*/ class GameConfig extends PlaceConfig
|
|||||||
return copy;
|
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);
|
} else {
|
||||||
out.writeBoolean(rated);
|
return false;
|
||||||
out.writeObject(ais);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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
|
override public function readObject (ins :ObjectInputStream) :void
|
||||||
{
|
{
|
||||||
super.readObject(ins);
|
super.readObject(ins);
|
||||||
@@ -182,5 +179,15 @@ public /*abstract*/ class GameConfig extends PlaceConfig
|
|||||||
rated = ins.readBoolean();
|
rated = ins.readBoolean();
|
||||||
ais = (ins.readObject() as TypedArray);
|
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