Do some jiggery poker to make sure that if a path completes as a result of

our call to Path.init() we don't freak out. Also made a note that paths
will be ticked after being init()ed because that's the way it works.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2011 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2002-12-02 20:11:24 +00:00
parent 55f40108b8
commit 0f0631f318
3 changed files with 11 additions and 7 deletions
@@ -1,5 +1,5 @@
//
// $Id: Sprite.java,v 1.53 2002/11/20 05:33:20 mdb Exp $
// $Id: Sprite.java,v 1.54 2002/12/02 20:11:24 mdb Exp $
package com.threerings.media.sprite;
@@ -285,7 +285,10 @@ public abstract class Sprite extends AbstractMedia
_path.init(this, _pathStamp = tickStamp);
}
return _path.tick(this, tickStamp);
// it's possible that as a result of init() the path completed and
// removed itself with a call to pathCompleted(), so we have to be
// careful here
return (_path == null) ? true : _path.tick(this, tickStamp);
}
// documentation inherited
+3 -2
View File
@@ -1,5 +1,5 @@
//
// $Id: Path.java,v 1.8 2002/06/18 22:25:33 mdb Exp $
// $Id: Path.java,v 1.9 2002/12/02 20:11:24 mdb Exp $
package com.threerings.media.util;
@@ -21,7 +21,8 @@ public interface Path
{
/**
* Called once to let the path prepare itself for the process of
* animating the supplied pathable.
* animating the supplied pathable. Path users should also call {@link
* #tick} after {@link #init} with the same initialization timestamp.
*/
public void init (Pathable pable, long tickStamp);
@@ -1,5 +1,5 @@
//
// $Id: TimedPath.java,v 1.1 2002/09/17 03:59:05 mdb Exp $
// $Id: TimedPath.java,v 1.2 2002/12/02 20:11:24 mdb Exp $
package com.threerings.media.util;
@@ -34,8 +34,8 @@ public abstract class TimedPath implements Path
// make a note of when we started
_startStamp = timestamp;
// update our position to the start of the path
tick(pable, timestamp);
// we'll be ticked immediately following init() which will update
// our position to the start of our path
}
// documentation inherited