Have the TableDirector place a party game creator in the game, rather
than forcing them from the server. git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@175 c613c5cb-e716-0410-b11b-feb51c14d237
This commit is contained in:
@@ -96,11 +96,12 @@ public class TableDirector extends BasicDirector
|
||||
*/
|
||||
public function willEnterPlace (place :PlaceObject) :void
|
||||
{
|
||||
// the place should be a TableLobbyObject
|
||||
_tlobj = TableLobbyObject(place);
|
||||
_lobby = place;
|
||||
|
||||
// add ourselves as a listener to the place object
|
||||
place.addListener(this);
|
||||
|
||||
// and remember this for later
|
||||
_lobby = place;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -114,6 +115,7 @@ public class TableDirector extends BasicDirector
|
||||
|
||||
// clear out our lobby reference
|
||||
_lobby = null;
|
||||
_tlobj = null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -298,8 +300,22 @@ public class TableDirector extends BasicDirector
|
||||
// documentation inherited from interface
|
||||
public function tableCreated (tableId :int) :void
|
||||
{
|
||||
// nothing much to do here
|
||||
log.info("Table creation succeeded [tableId=" + tableId + "].");
|
||||
if (_lobby == null) {
|
||||
// we've left, it's none of our concern anymore
|
||||
log.info("Table created, but no lobby. [tableId=" + tableId + "].");
|
||||
return;
|
||||
}
|
||||
|
||||
// All this to check to see if we created a party game (and should now enter).
|
||||
var table :Table = (_tlobj.getTables().get(tableId) as Table);
|
||||
if (table == null) {
|
||||
log.warning("Table created, but where is it? [tableId=" + tableId + "]");
|
||||
return;
|
||||
}
|
||||
if (table.gameOid != 0 && table.isPartyGame()) {
|
||||
// let's boogie!
|
||||
_pctx.getParlorDirector().gameIsReady(table.gameOid);
|
||||
}
|
||||
}
|
||||
|
||||
// documentation inherited from interface
|
||||
@@ -358,6 +374,9 @@ public class TableDirector extends BasicDirector
|
||||
/** The place object in which we're currently managing tables. */
|
||||
protected var _lobby :PlaceObject;
|
||||
|
||||
/** The place object, cast as a TableLobbyObject. */
|
||||
protected var _tlobj :TableLobbyObject;
|
||||
|
||||
/** The field name of the distributed set that contains our tables. */
|
||||
protected var _tableField :String;
|
||||
|
||||
|
||||
@@ -94,11 +94,12 @@ public class TableDirector extends BasicDirector
|
||||
*/
|
||||
public void willEnterPlace (PlaceObject place)
|
||||
{
|
||||
// the place should be a TableLobbyObject
|
||||
_tlobj = (TableLobbyObject) place;
|
||||
_lobby = place;
|
||||
|
||||
// add ourselves as a listener to the place object
|
||||
place.addListener(this);
|
||||
|
||||
// and remember this for later
|
||||
_lobby = place;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -112,6 +113,7 @@ public class TableDirector extends BasicDirector
|
||||
|
||||
// clear out our lobby reference
|
||||
_lobby = null;
|
||||
_tlobj = null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -294,8 +296,22 @@ public class TableDirector extends BasicDirector
|
||||
// documentation inherited from interface
|
||||
public void tableCreated (int tableId)
|
||||
{
|
||||
// nothing much to do here
|
||||
Log.info("Table creation succeeded [tableId=" + tableId + "].");
|
||||
if (_lobby == null) {
|
||||
// we've left, it's none of our concern anymore
|
||||
Log.info("Table created, but no lobby. [tableId=" + tableId + "].");
|
||||
return;
|
||||
}
|
||||
|
||||
// All this to check to see if we created a party game (and should now enter).
|
||||
Table table = (Table) _tlobj.getTables().get(tableId);
|
||||
if (table == null) {
|
||||
Log.warning("Table created, but where is it? [tableId=" + tableId + "]");
|
||||
return;
|
||||
}
|
||||
if (table.gameOid != 0 && table.isPartyGame()) {
|
||||
// let's boogie!
|
||||
_ctx.getParlorDirector().gameIsReady(table.gameOid);
|
||||
}
|
||||
}
|
||||
|
||||
// documentation inherited from interface
|
||||
@@ -357,6 +373,9 @@ public class TableDirector extends BasicDirector
|
||||
/** The place object in which we're currently managing tables. */
|
||||
protected PlaceObject _lobby;
|
||||
|
||||
/** The place object, cast as a TableLobbyObject. */
|
||||
protected TableLobbyObject _tlobj;
|
||||
|
||||
/** The field name of the distributed set that contains our tables. */
|
||||
protected String _tableField;
|
||||
|
||||
|
||||
@@ -154,11 +154,6 @@ public class TableManager
|
||||
// if the table has only one seat, start the game immediately
|
||||
if (table.shouldBeStarted()) {
|
||||
int oid = createGame(table);
|
||||
|
||||
// the creator will not be moved automatically, so we do it for them
|
||||
if (isParty) {
|
||||
CrowdServer.plreg.locprov.moveBody(creator, oid);
|
||||
}
|
||||
}
|
||||
|
||||
// finally let the caller know what the new table id is
|
||||
|
||||
Reference in New Issue
Block a user