No more SYNC_BOARD_STATE either. Now that too can be activated at runtime.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3183 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: PuzzleController.java,v 1.17 2004/10/28 18:59:35 mdb Exp $
|
// $Id: PuzzleController.java,v 1.18 2004/10/28 19:20:04 mdb 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
|
||||||
@@ -739,7 +739,7 @@ public abstract class PuzzleController extends GameController
|
|||||||
}
|
}
|
||||||
|
|
||||||
_events.add(new Integer(event));
|
_events.add(new Integer(event));
|
||||||
if (_puzconfig.syncBoardState()) {
|
if (PuzzlePanel.isSyncingBoards()) {
|
||||||
_states.add((board == null) ? null : board.clone());
|
_states.add((board == null) ? null : board.clone());
|
||||||
if (board == null) {
|
if (board == null) {
|
||||||
Log.warning("Added progress event with no associated board " +
|
Log.warning("Added progress event with no associated board " +
|
||||||
@@ -751,7 +751,7 @@ public abstract class PuzzleController extends GameController
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sends the server a game progress update with the list of events, as
|
* Sends the server a game progress update with the list of events, as
|
||||||
* well as board states if {@link #SYNC_BOARD_STATE} is true.
|
* well as board states if {@link PuzzlePanel#isSyncingBoards} is true.
|
||||||
*/
|
*/
|
||||||
public void sendProgressUpdate ()
|
public void sendProgressUpdate ()
|
||||||
{
|
{
|
||||||
@@ -770,7 +770,7 @@ public abstract class PuzzleController extends GameController
|
|||||||
|
|
||||||
// create an array of the board states that correspond with those
|
// create an array of the board states that correspond with those
|
||||||
// events (if state syncing is enabled)
|
// events (if state syncing is enabled)
|
||||||
if (_puzconfig.syncBoardState()) {
|
if (PuzzlePanel.isSyncingBoards()) {
|
||||||
int scount = _states.size();
|
int scount = _states.size();
|
||||||
Board[] states = new Board[scount];
|
Board[] states = new Board[scount];
|
||||||
for (int ii = 0; ii < scount; ii++) {
|
for (int ii = 0; ii < scount; ii++) {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: PuzzleGameService.java,v 1.2 2004/08/27 02:20:27 mdb Exp $
|
// $Id: PuzzleGameService.java,v 1.3 2004/10/28 19:20:04 mdb 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
|
||||||
@@ -41,8 +41,8 @@ public interface PuzzleGameService extends InvocationService, PuzzleCodes
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Debug variant of {@link #updateProgress} that is only used when
|
* Debug variant of {@link #updateProgress} that is only used when
|
||||||
* {@link #SYNC_BOARD_STATE} is true and which includes the board
|
* {@link PuzzlePanel#isSyncingBoards} is true and which includes the
|
||||||
* states associated with each event.
|
* board states associated with each event.
|
||||||
*/
|
*/
|
||||||
public void updateProgressSync (
|
public void updateProgressSync (
|
||||||
Client client, int roundId, int[] events, Board[] states);
|
Client client, int roundId, int[] events, Board[] states);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: PuzzlePanel.java,v 1.7 2004/10/28 18:53:26 mdb Exp $
|
// $Id: PuzzlePanel.java,v 1.8 2004/10/28 19:20:04 mdb 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
|
||||||
@@ -253,6 +253,12 @@ public abstract class PuzzlePanel extends JPanel
|
|||||||
return _robotTest.getValue();
|
return _robotTest.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Returns true if board syncing is activated. */
|
||||||
|
public static boolean isSyncingBoards ()
|
||||||
|
{
|
||||||
|
return _syncBoardState.getValue();
|
||||||
|
}
|
||||||
|
|
||||||
/** Our puzzle context. */
|
/** Our puzzle context. */
|
||||||
protected PuzzleContext _ctx;
|
protected PuzzleContext _ctx;
|
||||||
|
|
||||||
@@ -283,4 +289,11 @@ public abstract class PuzzlePanel extends JPanel
|
|||||||
"Activates the robot test player which will make random moves " +
|
"Activates the robot test player which will make random moves " +
|
||||||
"in any activated puzzle.", "narya.puzzle.robot_tester",
|
"in any activated puzzle.", "narya.puzzle.robot_tester",
|
||||||
PuzzlePrefs.config, false);
|
PuzzlePrefs.config, false);
|
||||||
|
|
||||||
|
/** A debug hook that toggles activation of board syncing. */
|
||||||
|
protected static RuntimeAdjust.BooleanAdjust _syncBoardState =
|
||||||
|
new RuntimeAdjust.BooleanAdjust(
|
||||||
|
"Sends a snapshot of the puzzle board with every event to aid " +
|
||||||
|
"in debugging.", "narya.puzzle.sync_board_state",
|
||||||
|
PuzzlePrefs.config, false);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user