Did away with PartyGameConfig, added getGameType() to GameConfig.
Changed the names of the 3 standard game types, but I could be convinced
of better names:
SEATED_GAME: normal match-made game, a game with a set list of players that
does not change.
SEATED_CONTINUOUS: the game starts immediately, but people join the room
and then choose a place to sit to become a player.
PARTY: no seats, anyone that enters is a player.
Also, changed SEATED_CONTINUOUS to create an occupants array and auto-sit
the creator, since I'm pretty sure we'll want to show seating in the lobby
for those types of games (but it actually does neither right now, code
needs to be written either way, depending on UI decisions.)
git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@182 c613c5cb-e716-0410-b11b-feb51c14d237
This commit is contained in:
@@ -34,7 +34,6 @@ import com.threerings.crowd.data.BodyObject;
|
||||
|
||||
import com.threerings.parlor.data.ParlorCodes;
|
||||
import com.threerings.parlor.game.data.GameConfig;
|
||||
import com.threerings.parlor.game.data.PartyGameConfig;
|
||||
|
||||
/**
|
||||
* This class represents a table that is being used to matchmake a game by
|
||||
@@ -106,7 +105,7 @@ public class Table
|
||||
this.config = config;
|
||||
|
||||
// make room for the maximum number of players
|
||||
if (!isPartyGame()) {
|
||||
if (config.getGameType() != GameConfig.PARTY) {
|
||||
occupants = new Name[tconfig.desiredPlayerCount];
|
||||
bodyOids = new int[occupants.length];
|
||||
|
||||
@@ -158,7 +157,7 @@ public class Table
|
||||
public Name[] getPlayers ()
|
||||
{
|
||||
// seated party games need a spot for every seat
|
||||
if (PartyGameConfig.SEATED_PARTY_GAME == getPartyGameType()) {
|
||||
if (GameConfig.SEATED_CONTINUOUS == config.getGameType()) {
|
||||
return new Name[tconfig.desiredPlayerCount];
|
||||
}
|
||||
|
||||
@@ -205,28 +204,6 @@ public class Table
|
||||
return newTeams;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the game is a party game.
|
||||
*/
|
||||
public boolean isPartyGame ()
|
||||
{
|
||||
return (PartyGameConfig.NOT_PARTY_GAME != getPartyGameType());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the type of party game being played at this table, or
|
||||
* PartyGameConfig.NOT_PARTY_GAME.
|
||||
*/
|
||||
public byte getPartyGameType ()
|
||||
{
|
||||
if (config instanceof PartyGameConfig) {
|
||||
return ((PartyGameConfig) config).getPartyGameType();
|
||||
|
||||
} else {
|
||||
return PartyGameConfig.NOT_PARTY_GAME;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Requests to seat the specified user at the specified position in
|
||||
* this table.
|
||||
@@ -324,6 +301,12 @@ public class Table
|
||||
*/
|
||||
public boolean mayBeStarted ()
|
||||
{
|
||||
switch (config.getGameType()) {
|
||||
case GameConfig.SEATED_CONTINUOUS:
|
||||
case GameConfig.PARTY:
|
||||
return true;
|
||||
}
|
||||
|
||||
if (tconfig.teamMemberIndices == null) {
|
||||
// for a normal game, just check to see if we're past the minimum
|
||||
return tconfig.minimumPlayerCount <= getOccupiedCount();
|
||||
@@ -352,8 +335,14 @@ public class Table
|
||||
*/
|
||||
public boolean shouldBeStarted ()
|
||||
{
|
||||
return isPartyGame() ||
|
||||
(tconfig.desiredPlayerCount <= getOccupiedCount());
|
||||
switch (config.getGameType()) {
|
||||
case GameConfig.SEATED_CONTINUOUS:
|
||||
case GameConfig.PARTY:
|
||||
return true;
|
||||
|
||||
default:
|
||||
return (tconfig.desiredPlayerCount <= getOccupiedCount());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user