Advertisement
Guest User

Untitled

a guest
Nov 27th, 2012
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. /*
  2. ROUTER PLUGIN
  3. - GPS ADDITION TO SA-MP
  4. - Made By Gamer_Z a.k.a. grasmanek94 , Rafal Grasman
  5.  
  6. October-2011
  7.  
  8.  
  9.  
  10. http://gpb.googlecode.com/
  11. */
  12.  
  13.  
  14. #include "Node.h"
  15.  
  16. Node::Node(void)
  17. {
  18. }
  19.  
  20. Node::Node(/*const std::string&*/int name, bool exists) : mGCost(0), mTotal(0), mClosed(false), mpParent(NULL), mName(name), mHeur(exists)
  21. {
  22. }
  23.  
  24. Node::~Node(void)
  25. {
  26. while(!mEdges.empty())
  27. {
  28. delete mEdges.back();
  29. mEdges.pop_back();
  30. }
  31. }
  32.  
  33. int Node::getName(void)
  34. {
  35. return mName;
  36. }
  37.  
  38. void Node::createEdge(Node* pTarget, int moveCost)
  39. {
  40. mEdges.push_back(new Edge(pTarget, moveCost));
  41. }
  42.  
  43. void Node::setClosed(bool closed)
  44. {
  45. mClosed = closed;
  46. }
  47.  
  48. bool Node::getClosed(void)
  49. {
  50. return mClosed;
  51. }
  52.  
  53. std::vector<Edge*>* Node::getEdges(void)
  54. {
  55. return &mEdges;
  56. }
  57.  
  58. int Node::getGCost(void)
  59. {
  60. return mGCost;
  61. }
  62.  
  63. void Node::setGCost(int cost)
  64. {
  65. mGCost = cost;
  66. }
  67.  
  68. void Node::calcFCost(void)
  69. {
  70. mTotal = mGCost;
  71. }
  72.  
  73. void Node::setParent(Node* pParent)
  74. {
  75. mpParent = pParent;
  76. }
  77.  
  78. int Node::getFCost(void)
  79. {
  80. return mTotal;
  81. }
  82.  
  83. bool Node::DoesExist(void)
  84. {
  85. return mHeur;
  86. }
  87.  
  88. bool Node::DoesExist_yes(void)
  89. {
  90. mHeur = true;
  91. return true;
  92. }
  93.  
  94. Node* Node::getParent(void)
  95. {
  96. return mpParent;
  97. }
  98.  
  99. void Node::reset(void)
  100. {
  101. mGCost = 0;
  102. mTotal = 0;
  103. mClosed = false;
  104. mpParent = NULL;
  105. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement