Don't report ready if not actually a player.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3258 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Andrzej Kapolka
2004-12-03 03:27:37 +00:00
parent e95f1e8914
commit f4bb453f83
@@ -28,6 +28,7 @@ import com.threerings.presents.dobj.AttributeChangedEvent;
import com.threerings.crowd.client.PlaceController; import com.threerings.crowd.client.PlaceController;
import com.threerings.crowd.client.PlaceControllerDelegate; import com.threerings.crowd.client.PlaceControllerDelegate;
import com.threerings.crowd.data.BodyObject;
import com.threerings.crowd.data.PlaceConfig; import com.threerings.crowd.data.PlaceConfig;
import com.threerings.crowd.data.PlaceObject; import com.threerings.crowd.data.PlaceObject;
import com.threerings.crowd.util.CrowdContext; import com.threerings.crowd.util.CrowdContext;
@@ -35,6 +36,8 @@ import com.threerings.crowd.util.CrowdContext;
import com.threerings.parlor.Log; import com.threerings.parlor.Log;
import com.threerings.parlor.util.ParlorContext; import com.threerings.parlor.util.ParlorContext;
import com.threerings.util.Name;
/** /**
* The game controller manages the flow and control of a game on the * The game controller manages the flow and control of a game on the
* client side. This class serves as the root of a hierarchy of controller * client side. This class serves as the root of a hierarchy of controller
@@ -93,14 +96,19 @@ public abstract class GameController extends PlaceController
// runnable here that will let the game manager know that we're // runnable here that will let the game manager know that we're
// ready on the next pass through the distributed event loop // ready on the next pass through the distributed event loop
Log.info("Entering game " + _gobj.which() + "."); Log.info("Entering game " + _gobj.which() + ".");
Name username =
((BodyObject)_ctx.getClient().getClientObject()).username;
if (_gobj.getPlayerIndex(username) != -1) {
_ctx.getClient().getInvoker().invokeLater(new Runnable() { _ctx.getClient().getInvoker().invokeLater(new Runnable() {
public void run () { public void run () {
// finally let the game manager know that we're ready to roll // finally let the game manager know that we're ready
// to roll
Log.info("Reporting ready " + _gobj.which() + "."); Log.info("Reporting ready " + _gobj.which() + ".");
_gobj.gameService.playerReady(_ctx.getClient()); _gobj.gameService.playerReady(_ctx.getClient());
} }
}); });
} }
}
/** /**
* Removes our listener registration from the game object and cleans * Removes our listener registration from the game object and cleans