]> git.sesse.net Git - stockfish/blobdiff - src/bitbase.cpp
Allow Bitbases::init() to be called more than once
[stockfish] / src / bitbase.cpp
index ebf3c59a02355d780e31d79b48d8e70c36ee7d6c..b3ae5c5fb5498b737ad4b0ba206268b5f3e9485d 100644 (file)
@@ -85,9 +85,10 @@ bool Bitbases::probe(Square wksq, Square wpsq, Square bksq, Color us) {
 void Bitbases::init() {
 
   std::vector<KPKPosition> db(MAX_INDEX);
+  unsigned id = 0;
 
   // Initialize db with known win / draw positions
-  std::generate(db.begin(), db.end(), [](){ static unsigned id; return KPKPosition(id++); });
+  std::generate(db.begin(), db.end(), [&id](){ return KPKPosition(id++); });
 
   // Iterate through the positions until none of the unknown positions can be
   // changed to either wins or draws (15 cycles needed).