Removed waiter mechanism which has become vestigal and was booching things
by being incorrectly used by the duty report system. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3142 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: PuzzleController.java,v 1.12 2004/08/27 02:20:27 mdb Exp $
|
||||
// $Id: PuzzleController.java,v 1.13 2004/10/15 23:33:51 mdb Exp $
|
||||
//
|
||||
// Narya library - tools for developing networked games
|
||||
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
|
||||
@@ -231,12 +231,7 @@ public abstract class PuzzleController extends GameController
|
||||
*/
|
||||
protected boolean canStartChatting ()
|
||||
{
|
||||
// if we're waiting, we can't pause
|
||||
if (isWaiting()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// otherwise, check with the delegates
|
||||
// check with the delegates
|
||||
final boolean[] canChatNow = new boolean[] { true };
|
||||
applyToDelegates(PuzzleControllerDelegate.class, new DelegateOp() {
|
||||
public void apply (PlaceControllerDelegate delegate) {
|
||||
@@ -302,9 +297,6 @@ public abstract class PuzzleController extends GameController
|
||||
// clean up and clear out
|
||||
clearAction();
|
||||
|
||||
// we're certainly no longer waiting
|
||||
_waitstamp = -1;
|
||||
|
||||
// unregister the puzzle object's chat
|
||||
_pctx.getChatDirector().removeAuxiliarySource(plobj);
|
||||
|
||||
@@ -591,6 +583,9 @@ public abstract class PuzzleController extends GameController
|
||||
{
|
||||
if (_astate == CLEAR_PENDING && canClearAction()) {
|
||||
actuallyClearAction();
|
||||
} else {
|
||||
Log.info("Not clearing action [astate=" + _astate +
|
||||
", canClear=" + canClearAction() + "].");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -718,97 +713,6 @@ public abstract class PuzzleController extends GameController
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a waiting entity to the list of entities awaiting the receipt
|
||||
* of data from the server, and without whose happiness the show must
|
||||
* not go on.
|
||||
*/
|
||||
public void addWaiter (Object waiter)
|
||||
{
|
||||
if (!_waiters.contains(waiter)) {
|
||||
_waiters.add(waiter);
|
||||
String state = (_waitstamp == -1) ? "(suspending)" : "(suspended)";
|
||||
Log.info("Adding waiter " + state + " [waiter=" + waiter + "].");
|
||||
// suspend things if we weren't already suspended
|
||||
if (_waitstamp == -1) {
|
||||
_waitstamp = _pview.getTimeStamp();
|
||||
didSuspend();
|
||||
}
|
||||
|
||||
} else {
|
||||
Log.warning("Already-waiting waiter attempted to wait again " +
|
||||
"[waiter=" + waiter + "].");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a waiting entity from the list of entities awaiting the
|
||||
* receipt of data from the server, and without whose happiness the
|
||||
* show must not go on.
|
||||
*/
|
||||
public void removeWaiter (Object waiter)
|
||||
{
|
||||
if (_waiters.remove(waiter)) {
|
||||
// resume things once we've no longer got any waiters
|
||||
if (_waiters.size() == 0 && _waitstamp != -1) {
|
||||
long delta = _pview.getTimeStamp() - _waitstamp;
|
||||
_waitstamp = -1;
|
||||
didResume(delta);
|
||||
}
|
||||
String state = (_waitstamp == -1) ? "(resumed)" : "(suspended)";
|
||||
Log.info("Removed waiter " + state + " [waiter=" + waiter + "].");
|
||||
|
||||
} else {
|
||||
Log.warning("Requested to remove a waiter that's not waiting " +
|
||||
"[waiter=" + waiter + "].");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether things are paused while we wait for a new piece
|
||||
* packet from the server.
|
||||
*/
|
||||
public boolean isWaiting ()
|
||||
{
|
||||
return (_waitstamp != -1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the game is suspended while we wait for a new piece
|
||||
* packet from the server.
|
||||
*/
|
||||
public void didSuspend ()
|
||||
{
|
||||
// we've somehow whipped through all of our pieces, so send a
|
||||
// progress update to the server straightaway which will in turn
|
||||
// prompt it to send us more pieces
|
||||
sendProgressUpdate();
|
||||
|
||||
// let our delegates do their business
|
||||
applyToDelegates(PuzzleControllerDelegate.class, new DelegateOp() {
|
||||
public void apply (PlaceControllerDelegate delegate) {
|
||||
((PuzzleControllerDelegate)delegate).didSuspend();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the game is resumed once a new piece packet arrives
|
||||
* from the server while we were suspended awaiting its arrival.
|
||||
*
|
||||
* @param delta the time elapsed in milliseconds while we were
|
||||
* suspended.
|
||||
*/
|
||||
public void didResume (final long delta)
|
||||
{
|
||||
// let our delegates do their business
|
||||
applyToDelegates(PuzzleControllerDelegate.class, new DelegateOp() {
|
||||
public void apply (PlaceControllerDelegate delegate) {
|
||||
((PuzzleControllerDelegate)delegate).didResume(delta);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of progress events currently queued up for
|
||||
* sending to the server with the next progress update.
|
||||
@@ -1015,13 +919,6 @@ public abstract class PuzzleController extends GameController
|
||||
* our events has been applied. */
|
||||
protected ArrayList _states = new ArrayList();
|
||||
|
||||
/** The entities waiting on some action before the puzzle can proceed
|
||||
* apace, and accordingly for whom the puzzle is paused. */
|
||||
protected ArrayList _waiters = new ArrayList();
|
||||
|
||||
/** The time at which we paused waiting for pieces. */
|
||||
protected long _waitstamp = -1;
|
||||
|
||||
/** A flag indicating that we're in chatting mode. */
|
||||
protected boolean _chatting = false;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: PuzzleControllerDelegate.java,v 1.4 2004/08/27 02:20:27 mdb Exp $
|
||||
// $Id: PuzzleControllerDelegate.java,v 1.5 2004/10/15 23:33:51 mdb Exp $
|
||||
//
|
||||
// Narya library - tools for developing networked games
|
||||
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
|
||||
@@ -145,25 +145,6 @@ public class PuzzleControllerDelegate extends GameControllerDelegate
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the game is suspended while we wait for a new piece
|
||||
* packet from the server.
|
||||
*/
|
||||
public void didSuspend ()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the game is resumed once a new piece packet arrives
|
||||
* from the server while we were suspended awaiting its arrival.
|
||||
*
|
||||
* @param delta the time elapsed in milliseconds while we were
|
||||
* suspended.
|
||||
*/
|
||||
public void didResume (long delta)
|
||||
{
|
||||
}
|
||||
|
||||
/** Our puzzle controller. */
|
||||
protected PuzzleController _ctrl;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user