File indexing completed on 2025-02-16 03:51:05

0001 /*
0002     SPDX-FileCopyrightText: 1998 Anders Widell <d95-awi@nada.kth.se>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #ifndef PATHFINDER_H
0008 #define PATHFINDER_H
0009 
0010 #include "Map.h"
0011 
0012 class Move;
0013 
0014 class PathFinder
0015 {
0016 public:
0017     Move *search(const Map *_map, int _x, int _y);
0018     Move *drag(int x1, int y1, int x2, int y2);
0019     bool canDrag(int x, int y) const;
0020     bool canWalkTo(int x, int y) const;
0021     bool canDragTo(int x, int y) const;
0022     void updatePossibleMoves();
0023     void updatePossibleDestinations(int x, int y);
0024 
0025 private:
0026     int dist[Map::MAX_Y + 1][Map::MAX_X + 1];
0027 
0028     void BFS(int _x, int _y);
0029 };
0030 
0031 #endif /* PATHFINDER_H */