Have board summaries always update before being broadcast. Don't

generate a summary for every change to a player's board.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3777 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Mark Johnson
2005-12-07 19:19:11 +00:00
parent 23087de145
commit 8381da7cab
2 changed files with 18 additions and 4 deletions
@@ -147,8 +147,6 @@ public abstract class DropManagerDelegate extends PuzzleManagerDelegate
*/
protected void placedBlock (int pidx)
{
// update the player's board levels
_puzmgr.updateBoardSummary(pidx);
}
/** The drop game board for each player. */
@@ -122,6 +122,21 @@ public abstract class PuzzleManager extends GameManager
}
}
/**
* Applies updateBoardSummary on all the players' boards. AI board
* summaries should be updated by the AI logic.
*/
public void updateBoardSummaries ()
{
if (_puzobj.summaries != null) {
for (int ii = 0; ii < _puzobj.summaries.length; ii++) {
if (!isAI(ii)) {
updateBoardSummary(ii);
}
}
}
}
// documentation inherited
protected void playerGameDidEnd (int pidx)
{
@@ -286,8 +301,9 @@ public abstract class PuzzleManager extends GameManager
{
// if we're a board summary updating kind of puzzle, do that
if (needsBoardSummaries()) {
// they're already modified in-situ, so we just rebroadcast
// the latest versions
// generate the latest summaries
updateBoardSummaries();
// then broadcast them to the clients
_puzobj.setSummaries(_puzobj.summaries);
}
}