Allow more 'advanced' robots to be created by derived classes if they like.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3188 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Eric Lundberg
2004-10-29 00:48:37 +00:00
parent 18611da53d
commit 14c3a0515a
@@ -1,5 +1,5 @@
// //
// $Id: PuzzlePanel.java,v 1.8 2004/10/28 19:20:04 mdb Exp $ // $Id: PuzzlePanel.java,v 1.9 2004/10/29 00:48:37 eric 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
@@ -155,7 +155,7 @@ public abstract class PuzzlePanel extends JPanel
{ {
// create a robot player if necessary // create a robot player if necessary
if (_robot == null) { if (_robot == null) {
_robot = new RobotPlayer(this, _xlate); _robot = createRobotPlayer();
} }
setPuzzleGrabsKeys(!isrobot); setPuzzleGrabsKeys(!isrobot);
_robot.setRobotDelay(200L); _robot.setRobotDelay(200L);
@@ -198,6 +198,16 @@ public abstract class PuzzlePanel extends JPanel
} }
} }
/**
* Creates a robot player using the default RobotPlayer. Derived
* classes can override to make use of more advanced robots adapted to
* specific puzzles.
*/
protected RobotPlayer createRobotPlayer ()
{
return new RobotPlayer(this, _xlate);
}
/** /**
* Creates the puzzle board view that will be used to display the main * Creates the puzzle board view that will be used to display the main
* puzzle interface. This is called when the puzzle panel is * puzzle interface. This is called when the puzzle panel is