aboutsummaryrefslogtreecommitdiff
path: root/src/game_tab/HalfMove.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game_tab/HalfMove.cpp')
-rw-r--r--src/game_tab/HalfMove.cpp28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/game_tab/HalfMove.cpp b/src/game_tab/HalfMove.cpp
index 735f17c..7f19480 100644
--- a/src/game_tab/HalfMove.cpp
+++ b/src/game_tab/HalfMove.cpp
@@ -12,7 +12,7 @@ HalfMove::HalfMove(std::string move_absolute, std::string move_san, std::string
}
HalfMove::~HalfMove() {
- if (mainline != NULL) {
+ if (mainline != nullptr) {
delete mainline;
}
for (HalfMove *m : variations) {
@@ -29,7 +29,7 @@ HalfMove::HalfMove(HalfMove *m){
Number = m->Number;
nag = m->nag;
comment=m->comment;
- if(m->mainline != NULL){
+ if(m->mainline != nullptr){
SetMainline(new HalfMove(m->mainline));
}
for (int i=0; i < m->variations.size(); i++) {
@@ -56,17 +56,17 @@ std::map<char, std::uint8_t> HalfMove::GetLineCaptures() {
captures[c] = 1;
}
m = m->parent;
- } while (m != NULL);
+ } while (m != nullptr);
return (captures);
}
void HalfMove::SetCapture(char c) { capture = c; }
void HalfMove::AddMove(HalfMove *m) {
- if (this->mainline == NULL) {
+ if (this->mainline == nullptr) {
SetMainline(m);
} else {
- if (mainline != NULL) {
+ if (mainline != nullptr) {
mainline->AddVariation(m);
}
}
@@ -82,7 +82,7 @@ void HalfMove::SetMainline(HalfMove *m) {
}
HalfMove::mainline = m;
cgeditor::CGEHalfMove::MainLine = m;
- if (m != NULL) {
+ if (m != nullptr) {
m->SetParent(this);
}
}
@@ -105,7 +105,7 @@ void HalfMove::RemoveChild(HalfMove *m) {
HalfMove::variations.erase(HalfMove::variations.begin() + i);
}
if (HalfMove::mainline == m) {
- HalfMove::mainline = NULL;
+ HalfMove::mainline = nullptr;
}
cgeditor::CGEHalfMove::RemoveChild((CGEHalfMove *)m);
}
@@ -115,7 +115,7 @@ HalfMove *HalfMove::GetParent() { return (parent); }
HalfMove *HalfMove::GetRoot() {
HalfMove *m = this;
HalfMove *p = HalfMove::parent;
- while (p != NULL) {
+ while (p != nullptr) {
if (p->mainline != m) {
return (m);
}
@@ -143,7 +143,7 @@ HalfMove::HalfMove(pgnp::HalfMove *m) : capture(' ') {
this->IsBlack = m->isBlack;
this->comment=m->comment;
this->Number = m->count;
- if (m->MainLine != NULL) {
+ if (m->MainLine != nullptr) {
this->SetMainline(new HalfMove(m->MainLine));
}
for (pgnp::HalfMove *v : m->variations) {
@@ -155,10 +155,10 @@ void HalfMove::SetFen(std::string fen) { this->fen = fen; }
void HalfMove::Promote() {
HalfMove *root = GetRoot();
- if (root->parent != NULL) {
+ if (root->parent != nullptr) {
HalfMove *p = root->parent;
if (p->HalfMove::mainline != root) {
- if (root->parent->HalfMove::parent != NULL) {
+ if (root->parent->HalfMove::parent != nullptr) {
HalfMove *pp = root->parent->HalfMove::parent;
if (pp->HalfMove::mainline == p) {
pp->HalfMove::SetMainline(root);
@@ -168,7 +168,7 @@ void HalfMove::Promote() {
}
}
if (p->HalfMove::mainline == root) {
- p->HalfMove::SetMainline(NULL);
+ p->HalfMove::SetMainline(nullptr);
} else {
p->HalfMove::RemoveChild(root);
}
@@ -180,7 +180,7 @@ void HalfMove::Promote() {
bool HalfMove::IsVariation() {
HalfMove *m = this;
HalfMove *p = HalfMove::parent;
- while (p != NULL) {
+ while (p != nullptr) {
if (p->mainline != m) {
return (true);
}
@@ -208,7 +208,7 @@ void HalfMove::BuildAndVerify(HalfMove *m, std::string fen) {
m->capture = capture;
}
m->fen = arbiter.GetFEN();
- if (m->mainline != NULL) {
+ if (m->mainline != nullptr) {
BuildAndVerify(m->mainline, arbiter.GetFEN());
}
for (HalfMove *v : m->variations) {