diff --git a/src/java/com/threerings/puzzle/client/PuzzlePanel.java b/src/java/com/threerings/puzzle/client/PuzzlePanel.java index 91a3a0660..7f795c31a 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.5 2004/08/27 02:20:27 mdb Exp $ +// $Id: PuzzlePanel.java,v 1.6 2004/10/28 18:37:49 mdb Exp $ // // Narya library - tools for developing networked games // Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved @@ -27,6 +27,7 @@ import javax.swing.JPanel; import com.samskivert.swing.Controller; import com.samskivert.swing.ControllerProvider; import com.samskivert.swing.util.SwingUtil; +import com.samskivert.util.RuntimeAdjust; import com.threerings.util.KeyTranslator; import com.threerings.util.RobotPlayer; @@ -180,7 +181,8 @@ public abstract class PuzzlePanel extends JPanel public void startAction () { // make the first player a robot player - if (ROBOT_TEST && _controller.getPlayerIndex() == 0) { + + if (_robotTest.getValue() && _controller.getPlayerIndex() == 0) { setRobotPlayer(true); } } @@ -191,7 +193,7 @@ public abstract class PuzzlePanel extends JPanel public void clearAction () { // deactivate the robot player - if (ROBOT_TEST && _controller.getPlayerIndex() == 0) { + if (_robotTest.getValue() && _controller.getPlayerIndex() == 0) { setRobotPlayer(false); } } @@ -268,4 +270,11 @@ public abstract class PuzzlePanel extends JPanel /** The puzzle game controller. */ protected PuzzleController _controller; + + /** A debug hook that toggles activation of the robot test player. */ + protected static RuntimeAdjust.BooleanAdjust _robotTest = + new RuntimeAdjust.BooleanAdjust( + "Activates the robot test player which will make random moves " + + "in any activated puzzle.", "narya.puzzle.robot_tester", + PuzzlePrefs.config, false); } diff --git a/src/java/com/threerings/puzzle/client/PuzzlePrefs.java b/src/java/com/threerings/puzzle/client/PuzzlePrefs.java new file mode 100644 index 000000000..7d05450ea --- /dev/null +++ b/src/java/com/threerings/puzzle/client/PuzzlePrefs.java @@ -0,0 +1,35 @@ +// +// $Id: PuzzlePrefs.java,v 1.1 2004/10/28 18:37:49 mdb Exp $ +// +// Narya library - tools for developing networked games +// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved +// http://www.threerings.net/code/narya/ +// +// This library is free software; you can redistribute it and/or modify it +// under the terms of the GNU Lesser General Public License as published +// by the Free Software Foundation; either version 2.1 of the License, or +// (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +package com.threerings.puzzle.client; + +import com.samskivert.util.Config; + +/** + * Provides access to runtime configuration parameters for this package + * and its subpackages. + */ +public class PuzzlePrefs +{ + /** Used to load our preferences from a properties file and map them + * to the persistent Java preferences repository. */ + public static Config config = new Config("rsrc/config/puzzle"); +} diff --git a/src/java/com/threerings/puzzle/data/PuzzleGameCodes.java b/src/java/com/threerings/puzzle/data/PuzzleGameCodes.java index 88958bfa1..2cd1150d2 100644 --- a/src/java/com/threerings/puzzle/data/PuzzleGameCodes.java +++ b/src/java/com/threerings/puzzle/data/PuzzleGameCodes.java @@ -1,5 +1,5 @@ // -// $Id: PuzzleGameCodes.java,v 1.2 2004/08/27 02:20:28 mdb Exp $ +// $Id: PuzzleGameCodes.java,v 1.3 2004/10/28 18:37:49 mdb Exp $ // // Narya library - tools for developing networked games // Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved @@ -28,6 +28,5 @@ package com.threerings.puzzle.data; */ public interface PuzzleGameCodes { - /** Enable this flag to test the game with a robot player. */ - public static final boolean ROBOT_TEST = false; + // Nothing at the moment. }