diff options
Diffstat (limited to 'src/game_tab/Game.cpp')
| -rw-r--r-- | src/game_tab/Game.cpp | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/src/game_tab/Game.cpp b/src/game_tab/Game.cpp index b831f0f..fdc754a 100644 --- a/src/game_tab/Game.cpp +++ b/src/game_tab/Game.cpp @@ -1,13 +1,13 @@ #include "Game.hpp" -Game::Game() : current(NULL), moves(NULL), result("*") { +Game::Game() : current(nullptr), moves(nullptr), result("*") { tags["White"] = ""; tags["Black"] = ""; initial_fen = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"; board = "rnbqkbnrpppppppp PPPPPPPPRNBQKBNR"; } -Game::Game(std::string fen) : current(NULL), moves(NULL), result("*") { +Game::Game(std::string fen) : current(nullptr), moves(nullptr), result("*") { tags["White"] = ""; tags["Black"] = ""; tags["FEN"] = fen; @@ -30,13 +30,13 @@ Game::Game(const Game* g){ tags=g->tags; current=nullptr; moves=nullptr; - if(g->moves != NULL){ + if(g->moves != nullptr){ moves=new HalfMove(g->moves); } } Game::~Game() { - if (moves != NULL) { + if (moves != nullptr) { delete moves; } } @@ -50,7 +50,7 @@ void Game::SetTag(std::string tagname, std::string value) { } bool Game::IsBlackToPlay() { - if (current == NULL) { + if (current == nullptr) { return (false); } return (!current->IsBlack); @@ -60,13 +60,13 @@ void Game::DeleteTag(std::string tagname) { tags.erase(tagname); } void Game::DeleteMove(HalfMove *m) { if (moves == m) { - current = NULL; - moves = NULL; + current = nullptr; + moves = nullptr; delete m; } else { - if (m != NULL) { + if (m != nullptr) { current = m->GetParent(); - if (current != NULL) { + if (current != nullptr) { current->RemoveChild(m); } delete m; @@ -79,14 +79,14 @@ HalfMove *Game::GetCurrentMove() { return (current); } HalfMove *Game::GetMoves() { return (moves); } void Game::PromoteMove(HalfMove *m) { - if (m != NULL) { + if (m != nullptr) { current = m; m->Promote(); } } void Game::SetMoveAsMainline(HalfMove *m) { - if (m != NULL) { + if (m != nullptr) { current = m; m->SetAsMainline(); } @@ -103,13 +103,13 @@ bool Game::Play(std::string move) { wxLogDebug("%c", capture); m->SetCapture(capture); } - if (current != NULL) { + if (current != nullptr) { current->AddMove(m); - } else if (moves != NULL) { + } else if (moves != nullptr) { moves->AddVariation(m); } current = m; - if (moves == NULL) { + if (moves == nullptr) { moves = m; } return (true); @@ -118,7 +118,7 @@ bool Game::Play(std::string move) { } void Game::Previous() { - if (current != NULL) { + if (current != nullptr) { current = current->GetParent(); } } @@ -132,9 +132,9 @@ std::vector<std::string> Game::ListTags() { } void Game::Next() { - if (current != NULL) { + if (current != nullptr) { HalfMove *m = current->GetMainline(); - if (m != NULL) { + if (m != nullptr) { current = m; } } else { @@ -145,7 +145,7 @@ void Game::Next() { void Game::SetCurrent(HalfMove *m) { current = m; } std::string Game::GetFen() { - if (current == NULL) { + if (current == nullptr) { return (initial_fen); } return (current->GetFen()); @@ -156,7 +156,7 @@ std::string Game::GetResult() { return (result); } void Game::SetResult(std::string result) { this->result = result; } void Game::BuildAndVerify() { - if (moves != NULL) { + if (moves != nullptr) { moves->BuildAndVerify(GetFen()); } } |
