Ensure we've registered our receiver before we call our superclass's function, since this queues up a playerReady and it's important that our addToReceivers event is queued up before that so the game doesn't start before we're ready to go.

git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@319 c613c5cb-e716-0410-b11b-feb51c14d237
This commit is contained in:
Mike Thomas
2007-06-21 00:10:25 +00:00
parent 3e56079a1a
commit a22a6e5551
@@ -42,19 +42,19 @@ public abstract class CardGameController extends GameController
// Documentation inherited. // Documentation inherited.
public void willEnterPlace (PlaceObject plobj) public void willEnterPlace (PlaceObject plobj)
{ {
super.willEnterPlace(plobj);
if (_ctx.getClient().getClientObject().receivers.containsKey( if (_ctx.getClient().getClientObject().receivers.containsKey(
CardGameDecoder.RECEIVER_CODE)) { CardGameDecoder.RECEIVER_CODE)) {
Log.warning("Yuh oh, we already have a card game receiver " + Log.warning("Yuh oh, we already have a card game receiver " +
"registered and are trying for another...!"); "registered and are trying for another...!");
Thread.dumpStack(); Thread.dumpStack();
} }
_ctx.getClient().getInvocationDirector().registerReceiver( _ctx.getClient().getInvocationDirector().registerReceiver(
new CardGameDecoder(this)); new CardGameDecoder(this));
super.willEnterPlace(plobj);
} }
// Documentation inherited. // Documentation inherited.
public void didLeavePlace (PlaceObject plobj) public void didLeavePlace (PlaceObject plobj)
{ {
@@ -63,7 +63,7 @@ public abstract class CardGameController extends GameController
_ctx.getClient().getInvocationDirector().unregisterReceiver( _ctx.getClient().getInvocationDirector().unregisterReceiver(
CardGameDecoder.RECEIVER_CODE); CardGameDecoder.RECEIVER_CODE);
} }
// Documentation inherited. // Documentation inherited.
public void turnDidChange (Name turnHolder) public void turnDidChange (Name turnHolder)
{} {}
@@ -77,7 +77,7 @@ public abstract class CardGameController extends GameController
receivedHand(hand); receivedHand(hand);
} }
} }
/** /**
* Called when the server deals the client a new hand of cards. Default * Called when the server deals the client a new hand of cards. Default
* implementation does nothing. * implementation does nothing.
@@ -86,7 +86,7 @@ public abstract class CardGameController extends GameController
*/ */
public void receivedHand (Hand hand) public void receivedHand (Hand hand)
{} {}
/** /**
* Dispatched to the client when it has received a set of cards * Dispatched to the client when it has received a set of cards
* from another player. Default implementation does nothing. * from another player. Default implementation does nothing.
@@ -96,7 +96,7 @@ public abstract class CardGameController extends GameController
*/ */
public void receivedCardsFromPlayer (int plidx, Card[] cards) public void receivedCardsFromPlayer (int plidx, Card[] cards)
{} {}
/** /**
* Dispatched to the client when the server has forced it to send * Dispatched to the client when the server has forced it to send
* a set of cards to another player. Default implementation does * a set of cards to another player. Default implementation does
@@ -107,7 +107,7 @@ public abstract class CardGameController extends GameController
*/ */
public void sentCardsToPlayer (int plidx, Card[] cards) public void sentCardsToPlayer (int plidx, Card[] cards)
{} {}
/** /**
* Dispatched to the client when a set of cards is transferred between * Dispatched to the client when a set of cards is transferred between
* two other players in the game. Default implementation does nothing. * two other players in the game. Default implementation does nothing.