refactor: _selectPiece 改名为 select_piece

This commit is contained in:
Calcitem 2020-07-05 22:17:37 +08:00
parent c9703a9aff
commit ca6bbb491a
3 changed files with 5 additions and 5 deletions

View File

@ -337,7 +337,7 @@ ExtMove *generateMoves(/* TODO: const */ Position *position, ExtMove *moveList)
for (int i = Board::MOVE_PRIORITY_TABLE_SIZE - 1; i >= 0; i--) { for (int i = Board::MOVE_PRIORITY_TABLE_SIZE - 1; i >= 0; i--) {
oldSquare = static_cast<Square>(MoveList::movePriorityTable[i]); oldSquare = static_cast<Square>(MoveList::movePriorityTable[i]);
if (!position->_selectPiece(oldSquare)) { if (!position->select_piece(oldSquare)) {
continue; continue;
} }

View File

@ -472,7 +472,7 @@ out:
return true; return true;
} }
bool Position::_selectPiece(Square square) bool Position::select_piece(Square square)
{ {
if (phase != PHASE_MOVING) if (phase != PHASE_MOVING)
return false; return false;
@ -492,7 +492,7 @@ bool Position::_selectPiece(Square square)
bool Position::_selectPiece(File file, Rank rank) bool Position::_selectPiece(File file, Rank rank)
{ {
return _selectPiece(Board::polarToSquare(file, rank)); return select_piece(Board::polarToSquare(file, rank));
} }
bool Position::giveup(Color loser) bool Position::giveup(Color loser)
@ -602,7 +602,7 @@ bool Position::do_move(Move m)
case MOVETYPE_REMOVE: case MOVETYPE_REMOVE:
return remove_piece(static_cast<Square>(-m)); return remove_piece(static_cast<Square>(-m));
case MOVETYPE_MOVE: case MOVETYPE_MOVE:
if (_selectPiece(from_sq(m))) { if (select_piece(from_sq(m))) {
return place_piece(to_sq(m)); return place_piece(to_sq(m));
} }
break; break;

View File

@ -73,7 +73,7 @@ public:
Position &operator=(const Position &) = delete; Position &operator=(const Position &) = delete;
// Properties of moves // Properties of moves
bool _selectPiece(Square s); bool select_piece(Square s);
bool place_piece(Square s, bool updateCmdlist = false); bool place_piece(Square s, bool updateCmdlist = false);
bool remove_piece(Square s, bool updateCmdlist = false); bool remove_piece(Square s, bool updateCmdlist = false);