00001 /* 00002 * Copyright (C) 2000-2001 The Exult Team 00003 * 00004 * This program is free software; you can redistribute it and/or modify 00005 * it under the terms of the GNU General Public License as published by 00006 * the Free Software Foundation; either version 2 of the License, or 00007 * (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software 00016 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00017 */ 00018 00019 #ifndef ASTAR_H 00020 #define ASTAR_H 00021 00022 #include "PathFinder.h" 00023 #include <vector> 00024 00025 00026 class Astar: public virtual PathFinder 00027 { 00028 std::vector<Tile_coord> path; // Coords. to goal. 00029 int pathlen; // Length of path. 00030 int dir; // 1 or -1. 00031 int stop; // Index to stop at. 00032 int next_index; // Index of next tile to return. 00033 public: 00034 Astar() : PathFinder(),path(), pathlen(0), dir(0),stop(0),next_index(0) 00035 { } 00036 // Find a path from sx,sy,sz to dx,dy,dz 00037 // Return 0 if no path can be traced. 00038 // Return !0 if path found 00039 virtual int NewPath(Tile_coord s, Tile_coord d, 00040 Pathfinder_client *client); 00041 00042 // Retrieve the coordinates of the next step on the path 00043 virtual int GetNextStep(Tile_coord& n, bool& done); 00044 // Set to retrieve in opposite order. 00045 virtual int set_backwards(); 00046 virtual int following_smart_path() // Astar? 00047 { return 1; } 00048 virtual int get_num_steps(); // # of steps left to take. 00049 virtual ~Astar(); 00050 }; 00051 00052 #endif