From 67ff7dc171526e1db347e0dbca1fed3bfe16b399 Mon Sep 17 00:00:00 2001
From: Rtch90 <ritchie.cunningham@protonmail.com>
Date: Sat, 4 Feb 2012 20:34:43 +0000
Subject: [PATCH] [Add] Nothing interesting just methods to grab specific
 nodes..

---
 src/libUnuk/Engine/Pathfinding.h | 45 +++++++++++++++++++++++++++++---
 1 file changed, 41 insertions(+), 4 deletions(-)

diff --git a/src/libUnuk/Engine/Pathfinding.h b/src/libUnuk/Engine/Pathfinding.h
index 45986d4..6887825 100644
--- a/src/libUnuk/Engine/Pathfinding.h
+++ b/src/libUnuk/Engine/Pathfinding.h
@@ -281,16 +281,53 @@ public:
 	// -- Some methods for travelling through the solution. --
 
 	// Get the start node.
-	UserState* GetSolutionStart(void);
+	UserState* GetSolutionStart(void) {
+		_currentSolutionNode = _start;
+		if(_start) {
+			return &_start->_userState;
+		} else {
+			return NULL;
+		}
+	}
 
 	// Get the next node.
-	UserState* GetSolutionNext(void);
+	UserState* GetSolutionNext(void) {
+		if(_currentSolutionNode) {
+			if(_currentSolutionNode->child) {
+				Node* child = _currentSolutionNode->child;
+				_currentSolutionNode = _currentSolutionNode->child;
+
+				return &child->_userState;
+			}
+		}
+
+		return NULL;
+	}
 
 	// Get the end node.
-	UserState* GetSolutionEnd(void);
+	UserState* GetSolutionEnd(void) {
+		_currentSolutionNode = _goal;
+		if(goal) {
+			return &goal->_userState;
+		} else {
+			return NULL;
+		}
+	}
 
 	// Step through the solution backwards.
-	UserState* GetSolutionPrev(void);
+	UserState* GetSolutionPrev(void) {
+		if(_currentSolutionNode) {
+			if(_currentSolutionNode->parent) {
+				Node* parent = _currentSolutionNode->parent;
+
+				_currentSolutionNode = _currentSolutionNode->parent;
+
+				return &parent->_userState;
+			}
+		}
+
+		return NULL;
+	}
 
 	// It will be useful to be able to view the open
 	// and closed lists at each step for debugging.