mirror of
https://gitlab.com/manzerbredes/ochess.git
synced 2025-07-03 10:47:39 +00:00
Enable PGN save (slow for now so do not use it).
This commit is contained in:
parent
6f866f55ee
commit
64dec753e7
11 changed files with 109 additions and 30 deletions
|
@ -139,5 +139,8 @@ std::string Game::GetPGN() {
|
|||
}
|
||||
pgn += moves->GetPGN();
|
||||
}
|
||||
pgn += " " + result;
|
||||
return (pgn);
|
||||
}
|
||||
}
|
||||
|
||||
void Game::SetResult(std::string result) { this->result = result; }
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
class Game {
|
||||
std::string board;
|
||||
std::string initial_fen;
|
||||
std::string result;
|
||||
std::unordered_map<std::string, std::string> tags;
|
||||
HalfMove *moves;
|
||||
HalfMove *current;
|
||||
|
@ -35,4 +36,5 @@ public:
|
|||
void SetCurrent(HalfMove *m);
|
||||
std::vector<std::string> ListTags();
|
||||
std::string GetPGN();
|
||||
void SetResult(std::string result);
|
||||
};
|
|
@ -115,16 +115,16 @@ void HalfMove::SetAsMainline() {
|
|||
|
||||
HalfMove *HalfMove::GetMainline() { return (mainline); }
|
||||
|
||||
HalfMove::HalfMove(pgnp::HalfMove *m, std::string initial_fen): capture(' ') {
|
||||
HalfMove::HalfMove(pgnp::HalfMove *m, std::string initial_fen) : capture(' ') {
|
||||
chessarbiter::ChessArbiter arbiter;
|
||||
arbiter.Setup(initial_fen);
|
||||
bool work=arbiter.Play(arbiter.ParseSAN(m->move));
|
||||
if(!work){
|
||||
wxLogDebug("Bug! %s",m->move);
|
||||
bool work = arbiter.Play(arbiter.ParseSAN(m->move));
|
||||
if (!work) {
|
||||
wxLogDebug("Bug! %s", m->move);
|
||||
}
|
||||
char capture=arbiter.GetCapture();
|
||||
if(capture != ' '){
|
||||
this->capture=capture;
|
||||
char capture = arbiter.GetCapture();
|
||||
if (capture != ' ') {
|
||||
this->capture = capture;
|
||||
}
|
||||
this->fen = arbiter.GetFEN();
|
||||
this->move = m->move;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue