Send the oid of the applicable game with the Hand.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3828 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -59,6 +59,16 @@ public abstract class CardGameController extends GameController
|
||||
// Documentation inherited.
|
||||
public void turnDidChange (Name turnHolder)
|
||||
{}
|
||||
|
||||
/**
|
||||
* Called by our sender to notify us of a received hand.
|
||||
*/
|
||||
public final void receivedHand (int oid, Hand hand)
|
||||
{
|
||||
if (oid == _gobj.getOid()) {
|
||||
receivedHand(hand);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the server deals the client a new hand of cards. Default
|
||||
|
||||
@@ -53,7 +53,7 @@ public class CardGameDecoder extends InvocationDecoder
|
||||
switch (methodId) {
|
||||
case RECEIVED_HAND:
|
||||
((CardGameReceiver)receiver).receivedHand(
|
||||
(Hand)args[0]
|
||||
((Integer)args[0]).intValue(), (Hand)args[1]
|
||||
);
|
||||
return;
|
||||
|
||||
|
||||
@@ -35,9 +35,10 @@ public interface CardGameReceiver extends InvocationReceiver
|
||||
/**
|
||||
* Dispatched to the client when it has received a hand of cards.
|
||||
*
|
||||
* @param oid the oid of the game for which this hand applies
|
||||
* @param hand the received hand
|
||||
*/
|
||||
public void receivedHand (Hand hand);
|
||||
public void receivedHand (int oid, Hand hand);
|
||||
|
||||
/**
|
||||
* Dispatched to the client when it has received a set of cards
|
||||
|
||||
@@ -108,9 +108,9 @@ public class CardGameManager extends GameManager
|
||||
} else {
|
||||
Hand hand = deck.dealHand(size);
|
||||
if (!isAI(playerIndex)) {
|
||||
CardGameSender.sendHand(
|
||||
(ClientObject)PresentsServer.omgr.getObject(
|
||||
_playerOids[playerIndex]), hand);
|
||||
ClientObject clobj = (ClientObject)
|
||||
PresentsServer.omgr.getObject(_playerOids[playerIndex]);
|
||||
CardGameSender.sendHand(clobj, _cardgameobj.getOid(), hand);
|
||||
}
|
||||
return hand;
|
||||
}
|
||||
@@ -130,8 +130,8 @@ public class CardGameManager extends GameManager
|
||||
{
|
||||
if (deck.size() < size * _playerCount) {
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
|
||||
} else {
|
||||
Hand[] hands = new Hand[_playerCount];
|
||||
|
||||
for (int i=0;i<_playerCount;i++) {
|
||||
|
||||
@@ -21,11 +21,11 @@ public class CardGameSender extends InvocationSender
|
||||
* CardGameReceiver#receivedHand} on a client.
|
||||
*/
|
||||
public static void sendHand (
|
||||
ClientObject target, Hand arg1)
|
||||
ClientObject target, int arg1, Hand arg2)
|
||||
{
|
||||
sendNotification(
|
||||
target, CardGameDecoder.RECEIVER_CODE, CardGameDecoder.RECEIVED_HAND,
|
||||
new Object[] { arg1 });
|
||||
new Object[] { new Integer(arg1), arg2 });
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user