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_SOLVEGRAPH_BREADTH_HH
|
---|
10 | #define G1_SOLVEGRAPH_BREADTH_HH
|
---|
11 |
|
---|
12 | #include "solvegraph.hh"
|
---|
13 |
|
---|
14 | class g1_breadth_first_graph_solver_class : public g1_graph_solver_class
|
---|
15 | {
|
---|
16 | public:
|
---|
17 | class solve_node
|
---|
18 | {
|
---|
19 | public:
|
---|
20 | g1_graph_node ref;
|
---|
21 | i4_float length;
|
---|
22 |
|
---|
23 | solve_node() {}
|
---|
24 | solve_node(g1_graph_node node, i4_float length) : ref(node), length(length) {}
|
---|
25 | solve_node& operator=(const solve_node &a) { ref=a.ref; length=a.length; return *this; }
|
---|
26 | };
|
---|
27 |
|
---|
28 | protected:
|
---|
29 | g1_critical_graph_class *graph;
|
---|
30 |
|
---|
31 |
|
---|
32 | solve_node *solve_graph;
|
---|
33 | w32 nodes;
|
---|
34 |
|
---|
35 | // Breadth first heap
|
---|
36 | i4_array<solve_node> heap;
|
---|
37 |
|
---|
38 | void clear_heap() { heap.clear(); }
|
---|
39 |
|
---|
40 | i4_bool add_node(g1_graph_node node, g1_graph_node from, i4_float len);
|
---|
41 | i4_bool get_next_node(g1_graph_node &node, i4_float &len);
|
---|
42 |
|
---|
43 | void clear_solve()
|
---|
44 | //{{{
|
---|
45 | {
|
---|
46 | memset(solve_graph, 0, nodes*sizeof(solve_node));
|
---|
47 | }
|
---|
48 | //}}}
|
---|
49 | public:
|
---|
50 |
|
---|
51 | g1_breadth_first_graph_solver_class() : heap(100,20), solve_graph(0) {}
|
---|
52 | g1_breadth_first_graph_solver_class(g1_critical_graph_class *_graph)
|
---|
53 | : heap(100,20), solve_graph(0) { set_graph(_graph); }
|
---|
54 | ~g1_breadth_first_graph_solver_class();
|
---|
55 |
|
---|
56 | virtual void set_graph(g1_critical_graph_class *_graph);
|
---|
57 | virtual i4_bool path_solve(g1_graph_node start_node, g1_graph_node end_node,
|
---|
58 | w8 group_size, w8 grade,
|
---|
59 | i4_float *point, w16 &points);
|
---|
60 | };
|
---|
61 |
|
---|
62 | #endif
|
---|
63 |
|
---|
64 | //{{{ Emacs Locals
|
---|
65 | // Local Variables:
|
---|
66 | // folded-file: t
|
---|
67 | // End:
|
---|
68 | //}}}
|
---|