Use a dobj transaction to bundle up the events that get dispatched during
each card play. More could be done, I just added this quickly. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3530 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
+23
-17
@@ -31,6 +31,7 @@ import com.threerings.util.Name;
|
|||||||
import com.threerings.util.RandomUtil;
|
import com.threerings.util.RandomUtil;
|
||||||
|
|
||||||
import com.threerings.presents.data.ClientObject;
|
import com.threerings.presents.data.ClientObject;
|
||||||
|
import com.threerings.presents.dobj.DObject;
|
||||||
import com.threerings.presents.server.InvocationException;
|
import com.threerings.presents.server.InvocationException;
|
||||||
import com.threerings.presents.server.PresentsServer;
|
import com.threerings.presents.server.PresentsServer;
|
||||||
|
|
||||||
@@ -286,24 +287,29 @@ public class TrickCardGameManagerDelegate extends TurnGameManagerDelegate
|
|||||||
*/
|
*/
|
||||||
protected void playCard (int pidx, Card card)
|
protected void playCard (int pidx, Card card)
|
||||||
{
|
{
|
||||||
// play the card by removing it from the hand and adding it to the end
|
((DObject) _trickCardGame).startTransaction();
|
||||||
// of the cards played array
|
try {
|
||||||
_hands[pidx].remove(card);
|
// play the card by removing it from the hand and adding it
|
||||||
PlayerCard[] cards = (PlayerCard[])ArrayUtil.append(
|
// to the end of the cards played array
|
||||||
_trickCardGame.getCardsPlayed(), new PlayerCard(pidx, card));
|
_hands[pidx].remove(card);
|
||||||
_trickCardGame.setCardsPlayed(cards);
|
PlayerCard[] cards = (PlayerCard[])ArrayUtil.append(
|
||||||
|
_trickCardGame.getCardsPlayed(), new PlayerCard(pidx, card));
|
||||||
// end the user's turn
|
_trickCardGame.setCardsPlayed(cards);
|
||||||
endTurn();
|
|
||||||
|
// end the user's turn
|
||||||
// end the trick if everyone has played a card
|
endTurn();
|
||||||
if (_turnIdx == -1) {
|
|
||||||
if (_endTrickDelay == 0) {
|
// end the trick if everyone has played a card
|
||||||
endTrick();
|
if (_turnIdx == -1) {
|
||||||
|
if (_endTrickDelay == 0) {
|
||||||
} else {
|
endTrick();
|
||||||
_endTrickInterval.schedule(_endTrickDelay);
|
|
||||||
|
} else {
|
||||||
|
_endTrickInterval.schedule(_endTrickDelay);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} finally {
|
||||||
|
((DObject) _trickCardGame).commitTransaction();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user