Pulled draw logic into its own method.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3112 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Ray Greenwell
2004-09-01 20:35:06 +00:00
parent c314d304ec
commit 23a843d79b
@@ -1,5 +1,5 @@
// //
// $Id: PuzzleManager.java,v 1.13 2004/08/27 02:20:32 mdb Exp $ // $Id: PuzzleManager.java,v 1.14 2004/09/01 20:35:06 ray Exp $
// //
// Narya library - tools for developing networked games // Narya library - tools for developing networked games
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved // Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
@@ -447,15 +447,22 @@ public abstract class PuzzleManager extends GameManager
sendStatusUpdate(); sendStatusUpdate();
// report the winners and losers if appropriate // report the winners and losers if appropriate
int winnerCount = _puzobj.getWinnerCount(); if (shouldConcludeGame() && !isDraw()) {
boolean draw = (winnerCount == _puzobj.getPlayerCount());
if (shouldConcludeGame() && winnerCount > 0 && !draw) {
reportWinnersAndLosers(); reportWinnersAndLosers();
} }
super.gameDidEnd(); super.gameDidEnd();
} }
/**
* Is the game a draw?
*/
protected boolean isDraw ()
{
int winnerCount = _puzobj.getWinnerCount();
return winnerCount > 0 && (winnerCount == _puzobj.getPlayerCount());
}
/** /**
* Report winner and loser oids to each room that any of the * Report winner and loser oids to each room that any of the
* winners/losers is in. * winners/losers is in.