diff --git a/rts/Sim/Path/QTPFS/PathSearch.cpp b/rts/Sim/Path/QTPFS/PathSearch.cpp index 5dbce9b2b2..fccc4d7b96 100644 --- a/rts/Sim/Path/QTPFS/PathSearch.cpp +++ b/rts/Sim/Path/QTPFS/PathSearch.cpp @@ -214,6 +214,7 @@ void QTPFS::PathSearch::LoadPartialPath(IPath* path) { // explicitly doesn't capture the step index if it hits an early drop out. }); } + expectIncompletePartialSearch = (badNodeCount > 0); } // #pragma GCC pop_options @@ -454,6 +455,9 @@ bool QTPFS::PathSearch::ExecutePathSearch() { searchThreadData->ResetQueue(SearchThreadData::SEARCH_FORWARD); searchThreadData->ResetQueue(SearchThreadData::SEARCH_BACKWARD); } + // We're done with the forward path and we expect the reverse path to fail so stop it right there. + if ((*fwd.openNodes).empty() && expectIncompletePartialSearch) + searchThreadData->ResetQueue(SearchThreadData::SEARCH_BACKWARD); } if (!(*bwd.openNodes).empty()) { diff --git a/rts/Sim/Path/QTPFS/PathSearch.h b/rts/Sim/Path/QTPFS/PathSearch.h index ce3d55c74b..1c5281b88c 100644 --- a/rts/Sim/Path/QTPFS/PathSearch.h +++ b/rts/Sim/Path/QTPFS/PathSearch.h @@ -224,6 +224,7 @@ namespace QTPFS { bool doPartialSearch = false; bool rejectPartialSearch = false; bool allowPartialSearch = false; + bool expectIncompletePartialSearch = false; bool searchEarlyDrop = false; bool initialized = false; bool partialReverseTrace = false;