]> git.sesse.net Git - stockfish/blobdiff - src/tt.cpp
Remove pointless tte->static_value() != VALUE_NONE checks
[stockfish] / src / tt.cpp
index bc26606721413eb90ecae8923c7d4238960892d2..d2f983c9f014cba76d250092a8f0e9f06c60dc04 100644 (file)
@@ -25,6 +25,7 @@
 #include <cassert>
 #include <cstring>
 
+#include "evaluate.h"
 #include "movegen.h"
 #include "tt.h"
 
@@ -164,13 +165,18 @@ void TranspositionTable::new_search() {
 void TranspositionTable::insert_pv(const Position& pos, Move pv[]) {
 
   StateInfo st;
+  EvalInfo ei;
+  Value v;
   Position p(pos, pos.thread());
 
   for (int i = 0; pv[i] != MOVE_NONE; i++)
   {
       TTEntry *tte = retrieve(p.get_key());
       if (!tte || tte->move() != pv[i])
-          store(p.get_key(), VALUE_NONE, VALUE_TYPE_NONE, Depth(-127*OnePly), pv[i], VALUE_NONE, VALUE_NONE);
+      {
+          v = (p.is_check() ? VALUE_NONE : evaluate(p, ei));
+          store(p.get_key(), VALUE_NONE, VALUE_TYPE_NONE, Depth(-127*OnePly), pv[i], v, ei.kingDanger[pos.side_to_move()]);
+      }
       p.do_move(pv[i], st);
   }
 }