Index: source/simulation2/components/CCmpUnitMotion.cpp
===================================================================
--- source/simulation2/components/CCmpUnitMotion.cpp	(revision 16832)
+++ source/simulation2/components/CCmpUnitMotion.cpp	(working copy)
@@ -733,29 +733,10 @@
 		m_PathState = PATHSTATE_FOLLOWING;
 		StartSucceeded();
 	}
-	else if (m_PathState == PATHSTATE_WAITING_REQUESTING_SHORT)
+	else if (m_PathState == PATHSTATE_WAITING_REQUESTING_SHORT || m_PathState == PATHSTATE_FOLLOWING_REQUESTING_SHORT)
 	{
 		m_ShortPath = path;
-
-		// If there's no waypoints then we couldn't get near the target
-		if (m_ShortPath.m_Waypoints.empty())
-		{
-			// If we're globally following a long path, try to remove the next waypoint, it might be obstructed
-			if (m_LongPath.m_Waypoints.size() > 1)
-				m_LongPath.m_Waypoints.pop_back();
-			else if (!IsFormationMember())
-			{
-				StartFailed();
-				return;
-			}
-			else
-			{
-				m_Moving = false;
-				CMessageMotionChanged msg(true, true);
-				GetSimContext().GetComponentManager().PostMessage(GetEntityId(), msg);
-			}
-		}
-
+				
 		CmpPtr<ICmpPosition> cmpPosition(GetEntityHandle());
 		if (!cmpPosition || !cmpPosition->IsInWorld())
 		{
@@ -762,11 +743,52 @@
 			StartFailed();
 			return;
 		}
-
+		
+		
 		// Now we've got a short path that we can follow
-		m_PathState = PATHSTATE_FOLLOWING;
+		
+		if (!m_ShortPath.m_Waypoints.empty())
+		{
+			m_PathState = PATHSTATE_FOLLOWING;
+			StartSucceeded();
+		}
+		else
+		{
+			CMessageMotionChanged msg(false, true);
+			GetSimContext().GetComponentManager().PostMessage(GetEntityId(), msg);
+			m_ExpectedPathTicket = 0;
+			m_ShortPath.m_Waypoints.clear();
+			
+			CmpPtr<ICmpObstruction> cmpObstruction(GetEntityHandle());
+			if (cmpObstruction)
+				cmpObstruction->SetMovingFlag(false);
 
-		StartSucceeded();
+			m_PathState = PATHSTATE_FOLLOWING_REQUESTING_SHORT;
+			
+			// With the new long pathfinder, the short pathfinder is used to get around units
+			// as those are not considered. This means we can effectively get stuck because of some units
+			// (sometimes the short pathfinder would have to go beyond its box to find a path and fails)
+			// While we wait for a better solution, we'll do two things:
+			// -Retry on the next turn: it might have been a moving unit so we'll be good to go
+			// -Tell idle units to go away. Hopefully that will clear a path.
+			
+			CmpPtr<ICmpRangeManager> cmpRangeManager(GetSystemEntity());
+			CmpPtr<ICmpOwnership> cmpOwnership(GetEntityHandle());
+			if (cmpRangeManager && cmpOwnership)
+			{
+				std::vector<int> Owners;
+				Owners.push_back(cmpOwnership->GetOwner());
+				std::vector<entity_id_t> idleUnits = cmpRangeManager->ExecuteQueryAroundPos(cmpPosition->GetPosition2D(), entity_pos_t::Zero(), entity_pos_t::FromInt(10), Owners, IID_UnitMotion);
+				for (entity_id_t ent : idleUnits)
+				{
+					if (ent == GetEntityId())
+						continue;
+					CmpPtr<ICmpUnitMotion> cmpUnitMotion(GetSimContext(), ent);
+					if (cmpUnitMotion && !cmpUnitMotion->IsMoving())
+						cmpUnitMotion->MoveToPointRange(cmpPosition->GetPosition2D().X, cmpPosition->GetPosition2D().Y, entity_pos_t::FromInt(10), entity_pos_t::FromInt(16));
+				}
+			}
+		}
 	}
 	else if (m_PathState == PATHSTATE_FOLLOWING_REQUESTING_LONG)
 	{
@@ -794,31 +816,6 @@
 		// old path while this request is active, so it'll be slightly incorrect
 		// by the time the request has completed)
 	}
-	else if (m_PathState == PATHSTATE_FOLLOWING_REQUESTING_SHORT)
-	{
-		// Replace the current path with the new one
-		m_ShortPath = path;
-
-		// If there's no waypoints then we couldn't get near the target
-		if (m_ShortPath.m_Waypoints.empty())
-		{
-			// We should stop moving (unless we're in a formation, in which
-			// case we should continue following it)
-			if (!IsFormationMember())
-			{
-				MoveFailed();
-				return;
-			}
-			else
-			{
-				m_Moving = false;
-				CMessageMotionChanged msg(false, true);
-				GetSimContext().GetComponentManager().PostMessage(GetEntityId(), msg);
-			}
-		}
-
-		m_PathState = PATHSTATE_FOLLOWING;
-	}
 	else
 	{
 		LOGWARNING("unexpected PathResult (%u %d %d)", GetEntityId(), m_State, m_PathState);
