StartAction was never getting called for watchers, so the player index

was not set up correctly. Rather than trying to save the player index
somewhere or have a new method for retrieving it (and knowing if it changes),
just let the PuzzleController worry about all that and simply always
ask it for the index.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3592 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Ray Greenwell
2005-06-09 22:00:57 +00:00
parent 74b44bc21c
commit eae92d8d89
@@ -175,9 +175,6 @@ public abstract class DropControllerDelegate extends PuzzleControllerDelegate
// Log.info("Starting drop action"); // Log.info("Starting drop action");
// save off the player index
_pidx = _ctrl.getPlayerIndex();
// add ourselves as a frame participant // add ourselves as a frame participant
_ctx.getFrameManager().registerFrameParticipant(this); _ctx.getFrameManager().registerFrameParticipant(this);
@@ -455,8 +452,8 @@ public abstract class DropControllerDelegate extends PuzzleControllerDelegate
return; return;
} }
if (_pidx != -1 && !_ctrl.isGameOver() && int pidx = _ctrl.getPlayerIndex();
_puzobj.isActivePlayer(_pidx)) { if (pidx != -1 && !_ctrl.isGameOver() && _puzobj.isActivePlayer(pidx)) {
// create the next block // create the next block
_blocksprite = createNextBlock(); _blocksprite = createNextBlock();
if (_blocksprite != null) { if (_blocksprite != null) {
@@ -621,11 +618,12 @@ public abstract class DropControllerDelegate extends PuzzleControllerDelegate
*/ */
protected void updateSelfSummary () protected void updateSelfSummary ()
{ {
if (_pidx != -1 && _puzobj != null && _puzobj.summaries != null) { int pidx = _ctrl.getPlayerIndex();
BoardSummary bsum = _puzobj.summaries[_pidx]; if (pidx != -1 && _puzobj != null && _puzobj.summaries != null) {
BoardSummary bsum = _puzobj.summaries[pidx];
bsum.setBoard(_dboard); bsum.setBoard(_dboard);
bsum.summarize(); bsum.summarize();
_dpanel.setSummary(_pidx, bsum); _dpanel.setSummary(pidx, bsum);
} }
} }
@@ -1132,9 +1130,6 @@ public abstract class DropControllerDelegate extends PuzzleControllerDelegate
/** The board dimensions in pieces. */ /** The board dimensions in pieces. */
protected int _bwid, _bhei; protected int _bwid, _bhei;
/** Our player index in the game. */
protected int _pidx;
/** The distance the board row travels in pixels. */ /** The distance the board row travels in pixels. */
protected int _risedist; protected int _risedist;