1 package cz.cuni.amis.pogamut.ut2004.agent.navigation; 2 3 import cz.cuni.amis.pogamut.base.agent.navigation.IPathFuture; 4 import cz.cuni.amis.pogamut.base.agent.navigation.IPathPlanner; 5 import cz.cuni.amis.pogamut.base3d.worldview.object.ILocated; 6 import cz.cuni.amis.pogamut.ut2004.bot.impl.UT2004Bot; 7 8 /** 9 * Finds the shortest through internal A* algorithm in the UT2004. The path info is send through GB2004 messages. 10 * <p><p> 11 * Returns {@link UT2004AStarPathFuture} that contains the logic for obtaining the path from UT2004 (note that it takes 12 * some time then UT2004 sends you a path). 13 * <p><p> 14 * <b>IMPORTANT:</b> Due to restrictions of the UnrealScript path planner this implementation returns only paths of maximal length 16. 15 * Therefore returned path may end on the half way trough. Therefore, whenever the {@link IPathExecutor} reports that 16 * the bot has reached its target, you should compare bot's current position and the {@link UT2004AStarPathFuture#getPathTo()}. 17 * 18 * @author Ik 19 * @author Jimmy 20 */ 21 public class UT2004AStarPathPlanner implements IPathPlanner<ILocated> { 22 23 private UT2004Bot bot; 24 25 public UT2004AStarPathPlanner(UT2004Bot bot) { 26 this.bot = bot; 27 } 28 29 @Override 30 public IPathFuture<ILocated> computePath(ILocated from, ILocated to) { 31 return new UT2004AStarPathFuture(bot, from, to); 32 } 33 34 }