1 | /********************************************************************** <BR>
|
---|
2 | This file is part of Crack dot Com's free source code release of
|
---|
3 | Golgotha. <a href="http://www.crack.com/golgotha_release"> <BR> for
|
---|
4 | information about compiling & licensing issues visit this URL</a>
|
---|
5 | <PRE> If that doesn't help, contact Jonathan Clark at
|
---|
6 | golgotha_source@usa.net (Subject should have "GOLG" in it)
|
---|
7 | ***********************************************************************/
|
---|
8 |
|
---|
9 | #ifndef G1_SOLVEMAP_BREADTH_HH
|
---|
10 | #define G1_SOLVEMAP_BREADTH_HH
|
---|
11 |
|
---|
12 | #include "arch.hh"
|
---|
13 | #include "memory/array.hh"
|
---|
14 | #include "math/num_type.hh"
|
---|
15 | #include "map_cell.hh"
|
---|
16 | #include <string.h>
|
---|
17 |
|
---|
18 | class g1_block_map_class;
|
---|
19 | class g1_astar_map_solver_class
|
---|
20 | {
|
---|
21 | public:
|
---|
22 | class cell
|
---|
23 | {
|
---|
24 | public:
|
---|
25 | w16 x,y;
|
---|
26 | i4_float length;
|
---|
27 | i4_float hint;
|
---|
28 |
|
---|
29 | cell() {}
|
---|
30 | cell(w16 x, w16 y, i4_float length, i4_float hint) : x(x), y(y), length(length), hint(hint) {}
|
---|
31 | cell(const cell &a) : x(a.x), y(a.y), length(a.length), hint(a.hint) {}
|
---|
32 | };
|
---|
33 | protected:
|
---|
34 | w16 wx, wy;
|
---|
35 | w16 dest_x, dest_y;
|
---|
36 |
|
---|
37 | // Breadth first Queue
|
---|
38 | i4_array<cell> heap;
|
---|
39 |
|
---|
40 | void clear_heap() { heap.clear(); }
|
---|
41 |
|
---|
42 | i4_bool add_link(w16 from_x,w16 from_y, w16 x,w16 y, i4_float length);
|
---|
43 | i4_bool add_step_link(w16 from_x,w16 from_y, w16 x,w16 y, i4_float length);
|
---|
44 | i4_bool add_path_link(w16 from_x,w16 from_y, w16 x,w16 y, i4_float length);
|
---|
45 | i4_bool get_next_cell(w16 &x,w16 &y,i4_float &length);
|
---|
46 |
|
---|
47 | void clear_solve();
|
---|
48 | public:
|
---|
49 | enum { VISITED=g1_map_cell_class::SCRATCH1, OK=g1_map_cell_class::SCRATCH2 };
|
---|
50 |
|
---|
51 | g1_astar_map_solver_class() : heap(2048,1024) {}
|
---|
52 |
|
---|
53 | virtual i4_bool path_solve(i4_float startx, i4_float starty, i4_float destx, i4_float desty,
|
---|
54 | i4_float *point, w16 &points);
|
---|
55 | };
|
---|
56 |
|
---|
57 | #endif
|
---|
58 |
|
---|
59 | //{{{ Emacs Locals
|
---|
60 | // Local Variables:
|
---|
61 | // folded-file: t
|
---|
62 | // End:
|
---|
63 | //}}}
|
---|