mirror of
https://gitlab.com/manzerbredes/chess-move-interface.git
synced 2025-06-07 14:57:39 +00:00
Improve NAG parsing
This commit is contained in:
parent
2ac42558f2
commit
da88575493
5 changed files with 30 additions and 27 deletions
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace pgnp {
|
||||
|
||||
HalfMove::HalfMove() : count(-1), isBlack(false), MainLine(NULL) {}
|
||||
HalfMove::HalfMove() : count(-1), isBlack(false), MainLine(NULL), NAG(0) {}
|
||||
|
||||
HalfMove::~HalfMove() {
|
||||
delete MainLine;
|
||||
|
|
|
@ -24,7 +24,7 @@ public:
|
|||
std::string move;
|
||||
/// @brief Comment associated to the move
|
||||
std::string comment;
|
||||
std::string NAG;
|
||||
std::uint8_t NAG;
|
||||
/// @brief Next HalfMove link to this line
|
||||
HalfMove *MainLine;
|
||||
/// @brief Next HalfMove links to variation of this line
|
||||
|
|
|
@ -260,16 +260,19 @@ loctype PGN::ParseHalfMove(loctype loc, HalfMove *hm) {
|
|||
EOF_CHECK(loc);
|
||||
c = pgn_content[loc];
|
||||
if (c == '$') {
|
||||
hm->NAG += c;
|
||||
//hm->NAG += c;
|
||||
std::string NAG;
|
||||
loc++;
|
||||
EOF_CHECK(loc);
|
||||
c = pgn_content[loc];
|
||||
while (IS_DIGIT(c)) {
|
||||
hm->NAG += c;
|
||||
NAG += c;
|
||||
loc++;
|
||||
EOF_CHECK(loc);
|
||||
c = pgn_content[loc];
|
||||
}
|
||||
if(NAG.size()>0)
|
||||
hm->NAG=std::stoi(NAG);
|
||||
}
|
||||
} else if (c == '(') {
|
||||
// Check for variations
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue