RootMoves[i].prevScore = RootMoves[i].score;
// MultiPV loop. We perform a full root search for each PV line
- for (PVIdx = 0; PVIdx < PVSize; ++PVIdx)
+ for (PVIdx = 0; PVIdx < PVSize && !Signals.stop; ++PVIdx)
{
// Reset aspiration window starting size
if (depth >= 5)
for (size_t i = 0; i <= PVIdx; ++i)
RootMoves[i].insert_pv_in_tt(pos);
- // If search has been stopped return immediately. Sorting and
+ // If search has been stopped break immediately. Sorting and
// writing PV back to TT is safe becuase RootMoves is still
// valid, although refers to previous iteration.
if (Signals.stop)
- return;
+ break;
// When failing high/low give some update (without cluttering
// the UI) before to research.
Signals.stop = true;
// Do we have time for the next iteration? Can we stop searching now?
- if (Limits.use_time_management() && !Signals.stopOnPonderhit)
+ if (Limits.use_time_management() && !Signals.stop && !Signals.stopOnPonderhit)
{
bool stop = false; // Local variable, not the volatile Signals.stop
// We exclude the trivial case where a sliding piece does in two moves what
// it could do in one move: eg. Ra1a2, Ra2a3.
if ( m2to == m1from
- || (m1to == m2from && !squares_aligned(m1from, m2from, m2to)))
+ || (m1to == m2from && !aligned(m1from, m2from, m2to)))
return true;
// Second one moves through the square vacated by first one