src/yapf/yapf_rail.cpp
branchcpp_gui
changeset 6308 646711c5feaa
parent 6268 4b5241e5dd10
equal deleted inserted replaced
6307:f40e88cff863 6308:646711c5feaa
    59 		bool bFound = Yapf().FindPath(v);
    59 		bool bFound = Yapf().FindPath(v);
    60 		if (!bFound) return false;
    60 		if (!bFound) return false;
    61 
    61 
    62 		// some path found
    62 		// some path found
    63 		// get found depot tile
    63 		// get found depot tile
    64 		Node& n = Yapf().GetBestNode();
    64 		Node *n = Yapf().GetBestNode();
    65 		*depot_tile = n.GetLastTile();
    65 		*depot_tile = n->GetLastTile();
    66 
    66 
    67 		// walk through the path back to the origin
    67 		// walk through the path back to the origin
    68 		Node* pNode = &n;
    68 		Node *pNode = n;
    69 		while (pNode->m_parent != NULL) {
    69 		while (pNode->m_parent != NULL) {
    70 			pNode = pNode->m_parent;
    70 			pNode = pNode->m_parent;
    71 		}
    71 		}
    72 
    72 
    73 		// if the origin node is our front vehicle tile/Trackdir then we didn't reverse
    73 		// if the origin node is our front vehicle tile/Trackdir then we didn't reverse
   126 			*path_not_found = !(path_found || Yapf().m_stopped_on_first_two_way_signal);
   126 			*path_not_found = !(path_found || Yapf().m_stopped_on_first_two_way_signal);
   127 		}
   127 		}
   128 
   128 
   129 		// if path not found - return INVALID_TRACKDIR
   129 		// if path not found - return INVALID_TRACKDIR
   130 		Trackdir next_trackdir = INVALID_TRACKDIR;
   130 		Trackdir next_trackdir = INVALID_TRACKDIR;
   131 		Node* pNode = &Yapf().GetBestNode();
   131 		Node *pNode = Yapf().GetBestNode();
   132 		if (pNode != NULL) {
   132 		if (pNode != NULL) {
   133 			// path was found or at least suggested
   133 			// path was found or at least suggested
   134 			// walk through the path back to the origin
   134 			// walk through the path back to the origin
   135 			Node* pPrev = NULL;
   135 			Node* pPrev = NULL;
   136 			while (pNode->m_parent != NULL) {
   136 			while (pNode->m_parent != NULL) {
   163 
   163 
   164 		if (!bFound) return false;
   164 		if (!bFound) return false;
   165 
   165 
   166 		// path was found
   166 		// path was found
   167 		// walk through the path back to the origin
   167 		// walk through the path back to the origin
   168 		Node* pNode = &Yapf().GetBestNode();
   168 		Node *pNode = Yapf().GetBestNode();
   169 		while (pNode->m_parent != NULL) {
   169 		while (pNode->m_parent != NULL) {
   170 			pNode = pNode->m_parent;
   170 			pNode = pNode->m_parent;
   171 		}
   171 		}
   172 
   172 
   173 		// check if it was reversed origin
   173 		// check if it was reversed origin