- for (auto& m : *this)
- m.value = PieceValue[MG][pos.piece_on(to_sq(m))]
- - Value(type_of(pos.moved_piece(m)))
- + (type_of(m) == ENPASSANT ? PieceValue[MG][PAWN] :
- type_of(m) == PROMOTION ? PieceValue[MG][promotion_type(m)] - PieceValue[MG][PAWN]
- : VALUE_ZERO);
+ Move m;
+
+ for (ExtMove* it = moves; it != end; ++it)
+ {
+ m = it->move;
+ it->value = PieceValue[MG][pos.piece_on(to_sq(m))]
+ - Value(type_of(pos.moved_piece(m)));
+
+ if (type_of(m) == ENPASSANT)
+ it->value += PieceValue[MG][PAWN];
+
+ else if (type_of(m) == PROMOTION)
+ it->value += PieceValue[MG][promotion_type(m)] - PieceValue[MG][PAWN];
+ }