critical_graph.hh 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. #error
  9. #ifndef CRITICAL_GRAPH_HH
  10. #define CRITICAL_GRAPH_HH
  11. #include "g1_limits.hh"
  12. #include "math/num_type.hh"
  13. #include "saver.hh"
  14. typedef w8 g1_graph_node;
  15. class g1_critical_graph_class
  16. {
  17. friend class g1_critical_map_maker_class;
  18. public:
  19. enum { MAX_CRITICALS=256, MAX_CONNECTIONS=100 };
  20. class connection_class
  21. {
  22. public:
  23. g1_graph_node ref;
  24. i4_float dist;
  25. w8 size[G1_GRADE_LEVELS];
  26. };
  27. class critical_point_class
  28. {
  29. public:
  30. i4_float x,y;
  31. connection_class *connection;
  32. w8 connections;
  33. w8 selected;
  34. };
  35. protected:
  36. connection_class *pool;
  37. w32 pool_connections;
  38. public:
  39. critical_point_class critical[MAX_CRITICALS];
  40. // note critical point 0 is used to mark the null
  41. w16 criticals;
  42. g1_critical_graph_class() : criticals(1), pool(0) {}
  43. g1_critical_graph_class(g1_loader_class *f) : pool(0) { load_points(f); }
  44. ~g1_critical_graph_class();
  45. void clear_critical_graph();
  46. void compact_critical_graph();
  47. void expand_critical_graph();
  48. i4_bool add_critical_point(float x, float y);
  49. void save_points(g1_saver_class *f);
  50. void save_graph(g1_saver_class *f);
  51. void load_points(g1_loader_class *f);
  52. void load_graph(g1_loader_class *f);
  53. };
  54. #endif
  55. //{{{ Emacs Locals
  56. // Local Variables:
  57. // folded-file: t
  58. // End:
  59. //}}}