Signals.stopOnPonderhit = Signals.firstRootMove = false;
Signals.stop = Signals.failedLowAtRoot = false;
+ RootMoves.clear();
RootPos = pos;
Limits = limits;
- SetupStates = states; // Ownership transfer here
- RootMoves.clear();
+ if (states.get()) // If we don't set a new position, preserve current state
+ {
+ SetupStates = states; // Ownership transfer here
+ assert(!states.get());
+ }
- for (MoveList<LEGAL> ml(pos); !ml.end(); ++ml)
+ for (MoveList<LEGAL> it(pos); *it; ++it)
if ( searchMoves.empty()
- || std::count(searchMoves.begin(), searchMoves.end(), ml.move()))
- RootMoves.push_back(RootMove(ml.move()));
+ || std::count(searchMoves.begin(), searchMoves.end(), *it))
+ RootMoves.push_back(RootMove(*it));
main_thread()->thinking = true;
main_thread()->notify_one(); // Starts main thread