source: golgotha/src/golg/solvegraph_breadth.hh @ 80

Last change on this file since 80 was 80, checked in by Sam Hocevar, 11 years ago
  • Adding the Golgotha source code. Not sure what's going to be interesting in there, but since it's all public domain, there's certainly stuff to pick up.
File size: 2.0 KB
RevLine 
[80]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
14class g1_breadth_first_graph_solver_class : public g1_graph_solver_class
15{
16public:
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
28protected:
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  //}}}
49public:
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//}}}
Note: See TracBrowser for help on using the repository browser.