diff --git a/src/functions.cpp b/src/functions.cpp index 13269cd..4049d8c 100644 --- a/src/functions.cpp +++ b/src/functions.cpp @@ -450,8 +450,6 @@ void _non_pawn_disambiguate(int from, int to, int piecetype, const std::vector& board){ - std::stringstream ss; - int to = get_to_sq(move); int from = get_from_sq(move); @@ -488,7 +486,7 @@ std::string to_notation(int move, const std::array& board){ std::string disambig = ""; // Blank if not a pawn promotion move. // Otherwise is equal to "=P/N/B/R/Q". - std::stringstream promotion; + std::string promotion; auto other_pieces = is_white(piecetype)?Pieces::BLACK:Pieces::WHITE; if (captured_piece != PieceType::NONE){ @@ -537,11 +535,13 @@ std::string to_notation(int move, const std::array& board){ } // If promoting, add an equals sign and the piece promoting to. if (promoting_to != PieceType::NONE){ - promotion << "=" << CHESS_CHARS_INSENSITIVE[promoting_to]; + promotion += "="; + promotion += CHESS_CHARS_INSENSITIVE[promoting_to]; } // end of checking for multiple pieces - ss << pawn_file << piece_character << disambig << capture_character << POSITION_STRING[to] << en_passant << promotion.str() << check; - return ss.str(); + std::string result = ""; + result += pawn_file + piece_character + disambig + capture_character + POSITION_STRING[to] + en_passant + promotion + check; + return result; } void get_all_moves_for_pieces(std::array pieces, const std::array& board, std::vector& moves, int en_passant, int castle_perms){