mirror of
https://gitlab.com/manzerbredes/ochess.git
synced 2025-04-07 02:26:29 +02:00
Update Game tab
This commit is contained in:
parent
bbf3282839
commit
dcf6c01e54
2 changed files with 17 additions and 0 deletions
|
@ -177,6 +177,21 @@ void HalfMove::Promote() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool HalfMove::HasParent(HalfMove*m){
|
||||||
|
return m==parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool HalfMove::HasChild(HalfMove*m){
|
||||||
|
if(mainline==m){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
for(auto var: variations){
|
||||||
|
if(var == m)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool HalfMove::IsVariation() {
|
bool HalfMove::IsVariation() {
|
||||||
HalfMove *m = this;
|
HalfMove *m = this;
|
||||||
HalfMove *p = HalfMove::parent;
|
HalfMove *p = HalfMove::parent;
|
||||||
|
|
|
@ -46,6 +46,8 @@ public:
|
||||||
/// @brief Check if current half move is within a variation
|
/// @brief Check if current half move is within a variation
|
||||||
bool IsVariation();
|
bool IsVariation();
|
||||||
/// @brief Get the root of a variation
|
/// @brief Get the root of a variation
|
||||||
|
bool HasParent(HalfMove*m);
|
||||||
|
bool HasChild(HalfMove*m);
|
||||||
HalfMove *GetRoot();
|
HalfMove *GetRoot();
|
||||||
/// @brief Get parent of the current move
|
/// @brief Get parent of the current move
|
||||||
HalfMove *GetParent();
|
HalfMove *GetParent();
|
||||||
|
|
Loading…
Add table
Reference in a new issue