mirror of
https://gitlab.com/manzerbredes/ochess.git
synced 2025-05-02 09:47:45 +00:00
Improve Game and HalfMoves memory management
This commit is contained in:
parent
a8c59c41bc
commit
4c959fe12e
6 changed files with 19 additions and 3 deletions
src/game_tab
|
@ -15,13 +15,19 @@ Game::Game(std::string fen) : current(NULL), moves(NULL), result("*") {
|
|||
board = chessarbiter::FENParser::Parse(fen).board;
|
||||
}
|
||||
|
||||
Game::Game(HalfMove *m, std::string initial_fen): result("*") {
|
||||
Game::Game(HalfMove *m, std::string initial_fen) : result("*") {
|
||||
moves = m;
|
||||
current = m;
|
||||
this->initial_fen = initial_fen;
|
||||
board = chessarbiter::FENParser::Parse(initial_fen).board;
|
||||
}
|
||||
|
||||
Game::~Game() {
|
||||
if (moves != NULL) {
|
||||
delete moves;
|
||||
}
|
||||
}
|
||||
|
||||
std::string Game::GetBoard() { return (board); }
|
||||
|
||||
std::string Game::GetTag(std::string tagname) { return (tags[tagname]); }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue