]> git.sesse.net Git - stockfish/commitdiff
Rename promotion_piece_type() to promotion_type()
authorMarco Costalba <mcostalba@gmail.com>
Sun, 26 Feb 2012 17:31:02 +0000 (18:31 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Sun, 26 Feb 2012 17:39:53 +0000 (18:39 +0100)
Shorter and equally clear to understand.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
src/move.cpp
src/movepick.cpp
src/position.cpp
src/types.h

index f589889b444ca2bc081f69465a59520a2405d44d..fdc6946b7dd9aaf2e53a5e286785c492a0c327eb 100644 (file)
@@ -46,7 +46,7 @@ const string move_to_uci(Move m, bool chess960) {
       to = from + (file_of(to) == FILE_H ? Square(2) : -Square(2));
 
   if (is_promotion(m))
       to = from + (file_of(to) == FILE_H ? Square(2) : -Square(2));
 
   if (is_promotion(m))
-      promotion = char(tolower(piece_type_to_char(promotion_piece_type(m))));
+      promotion = char(tolower(piece_type_to_char(promotion_type(m))));
 
   return square_to_string(from) + square_to_string(to) + promotion;
 }
 
   return square_to_string(from) + square_to_string(to) + promotion;
 }
@@ -142,7 +142,7 @@ const string move_to_san(Position& pos, Move m) {
       if (is_promotion(m))
       {
           san += '=';
       if (is_promotion(m))
       {
           san += '=';
-          san += piece_type_to_char(promotion_piece_type(m));
+          san += piece_type_to_char(promotion_type(m));
       }
   }
 
       }
   }
 
index 1eb6d54ec35b5d826a8ea5a6d31b5e5dd52627cc..0be426ab659b969b8073b0bb5c8c528f911a2451 100644 (file)
@@ -167,7 +167,7 @@ void MovePicker::score_captures() {
                   - type_of(pos.piece_moved(m));
 
       if (is_promotion(m))
                   - type_of(pos.piece_moved(m));
 
       if (is_promotion(m))
-          cur->score += PieceValueMidgame[promotion_piece_type(m)];
+          cur->score += PieceValueMidgame[promotion_type(m)];
   }
 }
 
   }
 }
 
index 2cc384a31e8267a525250e9f69738314c38f0e82..bf415b34d22ac48485e9b6cc24dd1d5928fb8fdc 100644 (file)
@@ -518,7 +518,7 @@ bool Position::is_pseudo_legal(const Move m) const {
       return move_is_legal(m);
 
   // Is not a promotion, so promotion piece must be empty
       return move_is_legal(m);
 
   // Is not a promotion, so promotion piece must be empty
-  if (promotion_piece_type(m) - 2 != NO_PIECE_TYPE)
+  if (promotion_type(m) - 2 != NO_PIECE_TYPE)
       return false;
 
   // If the from square is not occupied by a piece belonging to the side to
       return false;
 
   // If the from square is not occupied by a piece belonging to the side to
@@ -656,7 +656,7 @@ bool Position::move_gives_check(Move m, const CheckInfo& ci) const {
 
   // Promotion with check ?
   if (is_promotion(m))
 
   // Promotion with check ?
   if (is_promotion(m))
-      return attacks_from(Piece(promotion_piece_type(m)), to, occupied_squares() ^ from) & ksq;
+      return attacks_from(Piece(promotion_type(m)), to, occupied_squares() ^ from) & ksq;
 
   // En passant capture with check ? We have already handled the case
   // of direct checks and ordinary discovered check, the only case we
 
   // En passant capture with check ? We have already handled the case
   // of direct checks and ordinary discovered check, the only case we
@@ -850,7 +850,7 @@ void Position::do_move(Move m, StateInfo& newSt, const CheckInfo& ci, bool moveI
 
       if (is_promotion(m))
       {
 
       if (is_promotion(m))
       {
-          PieceType promotion = promotion_piece_type(m);
+          PieceType promotion = promotion_type(m);
 
           assert(relative_rank(us, to) == RANK_8);
           assert(promotion >= KNIGHT && promotion <= QUEEN);
 
           assert(relative_rank(us, to) == RANK_8);
           assert(promotion >= KNIGHT && promotion <= QUEEN);
@@ -965,7 +965,7 @@ void Position::undo_move(Move m) {
 
   if (is_promotion(m))
   {
 
   if (is_promotion(m))
   {
-      PieceType promotion = promotion_piece_type(m);
+      PieceType promotion = promotion_type(m);
 
       assert(promotion == pt);
       assert(relative_rank(us, to) == RANK_8);
 
       assert(promotion == pt);
       assert(relative_rank(us, to) == RANK_8);
index 10642ad39f240e5e04198a61884069c16e7af1a3..6c9c425ea743659fd591a5d32c207276d8f2835a 100644 (file)
@@ -452,7 +452,7 @@ inline int is_castle(Move m) {
   return (m & (3 << 14)) == (3 << 14);
 }
 
   return (m & (3 << 14)) == (3 << 14);
 }
 
-inline PieceType promotion_piece_type(Move m) {
+inline PieceType promotion_type(Move m) {
   return PieceType(((m >> 12) & 3) + 2);
 }
 
   return PieceType(((m >> 12) & 3) + 2);
 }