1 /***************************************************************************
2 						pathfinder.h  -  description
3 							-------------------
4 	begin                : may 17th, 2004
5 	copyright            : (C) 2004-2007 by Duong Khang NGUYEN
6 	email                : neoneurone @ gmail com
7 
8 	$Id: pathfinder.h 375 2008-10-28 14:47:15Z neoneurone $
9  ***************************************************************************/
10 
11 /***************************************************************************
12  *                                                                         *
13  *   This program is free software; you can redistribute it and/or modify  *
14  *   it under the terms of the GNU General Public License as published by  *
15  *   the Free Software Foundation; either version 2 of the License, or     *
16  *   any later version.                                                    *
17  *                                                                         *
18  ***************************************************************************/
19 
20 #ifndef _OPENCITY_PATHFINDER_H_
21 #define _OPENCITY_PATHFINDER_H_ 1
22 
23 #define PATHFINDER_NDEBUG 1			// Debugging off
24 
25 #include "main.h"
26 
27 #ifndef PATHFINDER_NDEBUG
28 	#define PATHFINDER_DEBUG( msg ) OPENCITY_DEBUG( msg )
29 #else
30 	#define PATHFINDER_DEBUG( msg )
31 #endif
32 
33 #include <vector>
34 
35 
36 class BuildingLayer;
37 class Map;
38 class Destination;
39 
40 
41 //========================================================================
42 /** This class implements few famous algorithms in path finding problems
43 */
44 class PathFinder {
45 public:
46 	enum PATH_TYPE {
47 		OC_DISTANCE,
48 		OC_TRAFFIC
49 	};
50 
51 
52 	PathFinder(
53 		SDL_mutex* const mutex,
54 		BuildingLayer* const pblayer,
55 		Map* const map,
56 		const uint & rcuiCityWidth,
57 		const uint & rcuiCityHeight );
58 
59 	~PathFinder();
60 
61 
62 	const bool
63 	findShortestPath(
64 		const uint & rcuiW1, const uint & rcuiH1,
65 		const uint & rcuiW2, const uint & rcuiH2,
66 		std::vector<Destination> & rvdest,
67 		const PATH_TYPE & enumType,
68 		uint uiMaxLength = 0xFFFFFFFF );
69 
70 
71 private:
72 	SDL_mutex* pmutex;
73 	BuildingLayer* pbuildlayer;
74 	Map* pmap;
75 	uint uiWidth;				///< The city's width
76 	uint uiHeight;				///< The city's height
77 };
78 
79 
80 #endif
81 
82 
83 
84 
85 
86 
87 
88 
89 
90 
91 
92 
93 
94 
95 
96 
97 
98 
99 
100 
101 
102 
103 
104 
105 
106 
107 
108 
109 
110 
111