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:
Ray Greenwell
2005-04-30 21:37:59 +00:00
parent 357ed12b9f
commit bc07aa1afd
@@ -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,8 +287,10 @@ 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 {
// play the card by removing it from the hand and adding it
// to the end of the cards played array
_hands[pidx].remove(card); _hands[pidx].remove(card);
PlayerCard[] cards = (PlayerCard[])ArrayUtil.append( PlayerCard[] cards = (PlayerCard[])ArrayUtil.append(
_trickCardGame.getCardsPlayed(), new PlayerCard(pidx, card)); _trickCardGame.getCardsPlayed(), new PlayerCard(pidx, card));
@@ -305,6 +308,9 @@ public class TrickCardGameManagerDelegate extends TurnGameManagerDelegate
_endTrickInterval.schedule(_endTrickDelay); _endTrickInterval.schedule(_endTrickDelay);
} }
} }
} finally {
((DObject) _trickCardGame).commitTransaction();
}
} }
// Documentation inherited. // Documentation inherited.