Advertisement
Guest User

Untitled

a guest
Nov 27th, 2012
109
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. contact: grasmanek94@live.nl
  10.  
  11. http://gpb.googlecode.com/
  12. */
  13.  
  14.  
  15. #include "Node.h"
  16.  
  17. Node::Node(void)
  18. {
  19. }
  20.  
  21. Node::Node(/*const std::string&*/int name, bool exists) : mGCost(0), mTotal(0), mClosed(false), mpParent(NULL), mName(name), mHeur(exists)
  22. {
  23. }
  24.  
  25. Node::~Node(void)
  26. {
  27. while(!mEdges.empty())
  28. {
  29. delete mEdges.back();
  30. mEdges.pop_back();
  31. }
  32. }
  33.  
  34. int Node::getName(void)
  35. {
  36. return mName;
  37. }
  38.  
  39. void Node::createEdge(Node* pTarget, int moveCost)
  40. {
  41. mEdges.push_back(new Edge(pTarget, moveCost));
  42. }
  43.  
  44. void Node::setClosed(bool closed)
  45. {
  46. mClosed = closed;
  47. }
  48.  
  49. bool Node::getClosed(void)
  50. {
  51. return mClosed;
  52. }
  53.  
  54. std::vector<Edge*>* Node::getEdges(void)
  55. {
  56. return &mEdges;
  57. }
  58.  
  59. int Node::getGCost(void)
  60. {
  61. return mGCost;
  62. }
  63.  
  64. void Node::setGCost(int cost)
  65. {
  66. mGCost = cost;
  67. }
  68.  
  69. void Node::calcFCost(void)
  70. {
  71. mTotal = mGCost;
  72. }
  73.  
  74. void Node::setParent(Node* pParent)
  75. {
  76. mpParent = pParent;
  77. }
  78.  
  79. int Node::getFCost(void)
  80. {
  81. return mTotal;
  82. }
  83.  
  84. bool Node::DoesExist(void)
  85. {
  86. return mHeur;
  87. }
  88.  
  89. bool Node::DoesExist_yes(void)
  90. {
  91. mHeur = true;
  92. return true;
  93. }
  94.  
  95. Node* Node::getParent(void)
  96. {
  97. return mpParent;
  98. }
  99.  
  100. void Node::reset(void)
  101. {
  102. mGCost = 0;
  103. mTotal = 0;
  104. mClosed = false;
  105. mpParent = NULL;
  106. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement