From 14c3a0515abe4771c37652ff890ec7eb3b13ae31 Mon Sep 17 00:00:00 2001 From: Eric Lundberg Date: Fri, 29 Oct 2004 00:48:37 +0000 Subject: [PATCH] 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 --- .../com/threerings/puzzle/client/PuzzlePanel.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/java/com/threerings/puzzle/client/PuzzlePanel.java b/src/java/com/threerings/puzzle/client/PuzzlePanel.java index 71d290565..08c1cc9f4 100644 --- a/src/java/com/threerings/puzzle/client/PuzzlePanel.java +++ b/src/java/com/threerings/puzzle/client/PuzzlePanel.java @@ -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 // 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 if (_robot == null) { - _robot = new RobotPlayer(this, _xlate); + _robot = createRobotPlayer(); } setPuzzleGrabsKeys(!isrobot); _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 * puzzle interface. This is called when the puzzle panel is