position: 删除自定义的重载 = 运算符
This commit is contained in:
parent
3a187ddbc6
commit
c2b6a3880c
|
@ -72,11 +72,6 @@ StateInfo::StateInfo(const StateInfo &state)
|
|||
*this = state;
|
||||
}
|
||||
|
||||
Position::Position(const Position &pos)
|
||||
{
|
||||
*this = pos;
|
||||
}
|
||||
|
||||
StateInfo::StateInfo(StateInfo &state)
|
||||
{
|
||||
if (position != nullptr) {
|
||||
|
@ -89,64 +84,18 @@ StateInfo::StateInfo(StateInfo &state)
|
|||
*this = state;
|
||||
}
|
||||
|
||||
Position::Position(Position &pos)
|
||||
{
|
||||
*this = pos;
|
||||
}
|
||||
|
||||
StateInfo &StateInfo::operator= (const StateInfo &state)
|
||||
{
|
||||
memcpy(position, state.position, sizeof(Position));
|
||||
return *this;
|
||||
}
|
||||
|
||||
Position &Position::operator= (const Position &pos)
|
||||
{
|
||||
currentStep = pos.currentStep;
|
||||
moveStep = pos.moveStep;
|
||||
memcpy(board.locations, pos.board.locations, sizeof(board.locations));
|
||||
memcpy(board.byTypeBB, pos.board.byTypeBB, sizeof(board.byTypeBB));
|
||||
currentSquare = pos.currentSquare;
|
||||
winner = pos.winner;
|
||||
startTime = pos.startTime;
|
||||
currentTime = pos.currentTime;
|
||||
elapsedSeconds[BLACK] = pos.elapsedSeconds[BLACK];
|
||||
elapsedSeconds[WHITE] = pos.elapsedSeconds[WHITE];
|
||||
move = pos.move;
|
||||
memcpy(cmdline, pos.cmdline, sizeof(cmdline));
|
||||
cmdlist = pos.cmdlist;
|
||||
//tips = pos.tips;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
StateInfo &StateInfo::operator= (StateInfo &state)
|
||||
{
|
||||
memcpy(position, state.position, sizeof(Position));
|
||||
return *this;
|
||||
}
|
||||
|
||||
Position &Position::operator= (Position &pos)
|
||||
{
|
||||
currentStep = pos.currentStep;
|
||||
moveStep = pos.moveStep;
|
||||
memcpy(board.locations, pos.board.locations, sizeof(board.locations));
|
||||
memcpy(board.byTypeBB, pos.board.byTypeBB, sizeof(board.byTypeBB));
|
||||
currentSquare = pos.currentSquare;
|
||||
winner = pos.winner;
|
||||
startTime = pos.startTime;
|
||||
currentTime = pos.currentTime;
|
||||
elapsedSeconds[BLACK] = pos.elapsedSeconds[BLACK];
|
||||
elapsedSeconds[WHITE] = pos.elapsedSeconds[WHITE];
|
||||
move = pos.move;
|
||||
memcpy(cmdline, pos.cmdline, sizeof(cmdline));
|
||||
cmdlist = pos.cmdlist;
|
||||
//tips = pos.tips;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
int Position::countPiecesOnBoard()
|
||||
{
|
||||
nPiecesOnBoard[BLACK] = nPiecesOnBoard[WHITE] = 0;
|
||||
|
|
|
@ -43,11 +43,8 @@ public:
|
|||
Position();
|
||||
virtual ~Position();
|
||||
|
||||
Position(Position &);
|
||||
Position(const Position &);
|
||||
|
||||
Position &operator=(const Position &);
|
||||
Position &operator=(Position &);
|
||||
Position(const Position &) = delete;
|
||||
Position &operator=(const Position &) = delete;
|
||||
|
||||
Board board;
|
||||
|
||||
|
|
Loading…
Reference in New Issue