File indexing completed on 2021-12-21 12:50:22

0001 /*
0002  *  ksokoban - a Sokoban game by KDE
0003  *  Copyright (C) 1998  Anders Widell  <d95-awi@nada.kth.se>
0004  *
0005  *  This program is free software; you can redistribute it and/or modify
0006  *  it under the terms of the GNU General Public License as published by
0007  *  the Free Software Foundation; either version 2 of the License, or
0008  *  (at your option) any later version.
0009  *
0010  *  This program is distributed in the hope that it will be useful,
0011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
0012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0013  *  GNU General Public License for more details.
0014  *
0015  *  You should have received a copy of the GNU General Public License
0016  *  along with this program; if not, write to the Free Software
0017  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
0018  */
0019 
0020 #ifndef PATHFINDER_H
0021 #define PATHFINDER_H
0022 
0023 #include "Map.h"
0024 class Move;
0025 
0026 #define PATH_WALL 32767
0027 
0028 class PathFinder {
0029 public:
0030   Move *search (Map *_map, int _x, int _y);
0031   Move* drag(int x1, int y1, int x2, int y2);
0032   bool canDrag(int x, int y) const;
0033   bool canWalkTo(int x, int y) const;
0034   bool canDragTo(int x, int y) const;
0035   void updatePossibleMoves();
0036   void updatePossibleDestinations(int x, int y);
0037 
0038 protected:
0039   //static const int PATH_WALL=32767;
0040 
0041   int dist[MAX_Y+1][MAX_X+1];
0042 
0043   void BFS (int _x, int _y);
0044 
0045 
0046 };
0047 
0048 #endif  /* PATHFINDER_H */