More updates.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2882 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2003-11-26 17:46:06 +00:00
parent c5a422f7a2
commit fa1c7af17a
2 changed files with 32 additions and 19 deletions
@@ -1,5 +1,5 @@
//
// $Id: PuzzleManager.java,v 1.2 2003/11/26 02:07:45 mdb Exp $
// $Id: PuzzleManager.java,v 1.3 2003/11/26 17:46:06 mdb Exp $
package com.threerings.puzzle.server;
@@ -165,6 +165,17 @@ public abstract class PuzzleManager extends GameManager
}
}
/**
* Returns whether game conclusion antics such as rating updates
* should be performed when an in-play game is ended. Derived classes
* may wish to override this method to customize the conditions under
* which the game is concluded.
*/
public boolean shouldConcludeGame ()
{
return (_puzobj.state == PuzzleObject.GAME_OVER);
}
/**
* Called when a player has been marked as knocked out but before the
* knock-out status update has been sent to the players. Any status
@@ -407,6 +418,13 @@ public abstract class PuzzleManager extends GameManager
// send along one final status update
sendStatusUpdate();
// report the winners and losers if appropriate
int winnerCount = _puzobj.getWinnerCount();
boolean draw = (winnerCount == getPlayerCount());
if (shouldConcludeGame() && winnerCount > 0 && !draw) {
reportWinnersAndLosers();
}
super.gameDidEnd();
}
@@ -470,17 +488,6 @@ public abstract class PuzzleManager extends GameManager
_invmgr.clearDispatcher(_puzobj.puzzleGameService);
}
/**
* Returns whether game conclusion antics such as rating updates
* should be performed when an in-play game is ended. Derived classes
* may wish to override this method to customize the conditions under
* which the game is concluded.
*/
protected boolean shouldConcludeGame ()
{
return (_puzobj.state == PuzzleObject.GAME_OVER);
}
/**
* Applies progress updates received from the client. If puzzle
* debugging is enabled, this also compares the client board dumps