From cf99e657e772ad4ab37204dd47abd02cdc1b2f49 Mon Sep 17 00:00:00 2001 From: Ray Greenwell Date: Fri, 16 May 2003 02:22:19 +0000 Subject: [PATCH] Allow a LinePath to be constructed with only one point, and the source point will be the position of the pathable at initialization time. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2584 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../com/threerings/media/util/LinePath.java | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/java/com/threerings/media/util/LinePath.java b/src/java/com/threerings/media/util/LinePath.java index a18ad8c3f..7d2f39c38 100644 --- a/src/java/com/threerings/media/util/LinePath.java +++ b/src/java/com/threerings/media/util/LinePath.java @@ -1,5 +1,5 @@ // -// $Id: LinePath.java,v 1.11 2002/12/04 02:45:09 shaper Exp $ +// $Id: LinePath.java,v 1.12 2003/05/16 02:22:19 ray Exp $ package com.threerings.media.util; @@ -38,6 +38,27 @@ public class LinePath extends TimedPath _dest = dest; } + /** + * Constructs a line path that moves a pathable from + * whatever its location is at init time to the dest point over + * the specified number of milliseconds. + */ + public LinePath (Point dest, long duration) + { + this(null, dest, duration); + } + + // documentation inherited + public void init (Pathable pable, long timestamp) + { + super.init(pable, timestamp); + + // fill in the source if necessary. + if (_source == null) { + _source = new Point(pable.getX(), pable.getY()); + } + } + // documentation inherited public boolean tick (Pathable pable, long timestamp) {