Cleaning pointers related code

This commit is contained in:
Loic Guegan 2022-12-31 20:45:03 +01:00
parent 21a5b3df8a
commit 8a14abe007
14 changed files with 63 additions and 63 deletions

View file

@ -17,7 +17,7 @@ wxDEFINE_EVENT(CLOSE_LINKED_TAB, wxCommandEvent);
MainWindow::MainWindow() MainWindow::MainWindow()
: MainFrame(NULL, wxID_ANY, "OChess: The Open Chess software", : MainFrame(NULL, wxID_ANY, "OChess: The Open Chess software",
wxDefaultPosition, wxSize(1500, 1000)), wxDefaultPosition, wxSize(1500, 1000)),
prefsEditor(NULL) { prefsEditor(nullptr) {
SetStatusText("OChess"); SetStatusText("OChess");
/// File menu /// File menu
@ -196,7 +196,7 @@ void MainWindow::NewEngine() {
} }
void MainWindow::OpenSettings() { void MainWindow::OpenSettings() {
if (prefsEditor != NULL) { if (prefsEditor != nullptr) {
delete prefsEditor; delete prefsEditor;
} }
prefsEditor = new wxPreferencesEditor("Preferences"); prefsEditor = new wxPreferencesEditor("Preferences");
@ -213,7 +213,7 @@ void MainWindow::ApplyPreferences() {
} }
void MainWindow::OnClose(wxCloseEvent &e) { void MainWindow::OnClose(wxCloseEvent &e) {
if (prefsEditor != NULL) { if (prefsEditor != nullptr) {
prefsEditor->Dismiss(); prefsEditor->Dismiss();
} }
e.Skip(); e.Skip();

View file

@ -82,7 +82,7 @@ void BaseGameTab::Reset(std::shared_ptr<GameBase> base){
// Load all games (for now :) // Load all games (for now :)
SHOW_DIALOG_BUSY("Loading database..."); SHOW_DIALOG_BUSY("Loading database...");
this->base=base; this->base=base;
if (base != NULL) { if (base != nullptr) {
while (base->NextGame()) { while (base->NextGame()) {
glm->AddGame( glm->AddGame(
base->GetTag("White"), base->GetTag("White"),

View file

@ -25,6 +25,6 @@ public:
std::vector<std::uint32_t> GetDeletedGameIds() {return(deleted);}; std::vector<std::uint32_t> GetDeletedGameIds() {return(deleted);};
std::shared_ptr<Game> OpenGame(long gameid, long item); std::shared_ptr<Game> OpenGame(long gameid, long item);
std::shared_ptr<Game> GetGame() { return (std::shared_ptr<Game>(NULL)); } std::shared_ptr<Game> GetGame() { return nullptr; }
std::shared_ptr<GameBase> GetBase() { return (std::shared_ptr<GameBase>(base)); }; std::shared_ptr<GameBase> GetBase() { return (std::shared_ptr<GameBase>(base)); };
}; };

View file

@ -75,7 +75,7 @@ std::shared_ptr<Game> PGNGameBase::GetGame(std::uint32_t id) {
} }
curid++; curid++;
} }
return (std::shared_ptr<Game>(NULL)); return nullptr;
} }
void PGNGameBase::Save(std::vector<std::uint32_t> to_delete, void PGNGameBase::Save(std::vector<std::uint32_t> to_delete,
@ -155,7 +155,7 @@ std::string PGNGameBase::GetPGN(std::shared_ptr<Game> g) {
pgn += '[' + element + " \"" + g->GetTag(element) + "\"]\n"; pgn += '[' + element + " \"" + g->GetTag(element) + "\"]\n";
} }
if(m !=NULL){ if(m !=nullptr){
pgn += GetMovesPGN(m,m->IsABlackMove()); pgn += GetMovesPGN(m,m->IsABlackMove());
pgn += " "; pgn += " ";
} }
@ -192,7 +192,7 @@ std::string PGNGameBase::GetMovesPGN(HalfMove *m, bool needDots) {
} }
} }
if (m->GetMainline() != NULL) { if (m->GetMainline() != nullptr) {
part += " " + GetMovesPGN(m->GetMainline(), !m->IsABlackMove() && newNeedDots); part += " " + GetMovesPGN(m->GetMainline(), !m->IsABlackMove() && newNeedDots);
} }

View file

@ -30,7 +30,7 @@ EngineTab::EngineTab(wxWindow *parent, uciadapter::UCI *engine,
} }
EngineTab::EngineTab(wxWindow *parent, std::string name) EngineTab::EngineTab(wxWindow *parent, std::string name)
: TabEngine(parent), TabInfos(TabInfos::ENGINE), engine(NULL) { : TabEngine(parent), TabInfos(TabInfos::ENGINE), engine(nullptr) {
SetLabel(name); SetLabel(name);
engineName = name; engineName = name;
confGroup = "engines/" + engineName; confGroup = "engines/" + engineName;
@ -45,7 +45,7 @@ EngineTab::EngineTab(wxWindow *parent, std::string name)
} }
EngineTab::~EngineTab() { EngineTab::~EngineTab() {
if (engine != NULL) { if (engine != nullptr) {
wxLogDebug("EngineTab destructor: destroying engine!"); wxLogDebug("EngineTab destructor: destroying engine!");
engine->quit(); engine->quit();
delete engine; delete engine;

View file

@ -18,8 +18,8 @@ public:
EngineTab(wxWindow *parent, std::string name); EngineTab(wxWindow *parent, std::string name);
~EngineTab(); ~EngineTab();
void ApplyPreferences() {} void ApplyPreferences() {}
std::shared_ptr<Game> GetGame() { return (std::shared_ptr<Game>(NULL)); } std::shared_ptr<Game> GetGame() { return nullptr; }
std::shared_ptr<GameBase> GetBase() { return (std::shared_ptr<GameBase>(NULL)); } std::shared_ptr<GameBase> GetBase() { return nullptr; }
void OnSave(wxCommandEvent &event); void OnSave(wxCommandEvent &event);
void OnDelete(wxCommandEvent &event); void OnDelete(wxCommandEvent &event);
}; };

View file

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

View file

@ -27,7 +27,7 @@ public:
GameTab(wxFrame *parent, std::shared_ptr<Game> game); GameTab(wxFrame *parent, std::shared_ptr<Game> game);
void ApplyPreferences(); void ApplyPreferences();
std::shared_ptr<Game> GetGame() { return (std::shared_ptr<Game>(game)); } std::shared_ptr<Game> GetGame() { return (std::shared_ptr<Game>(game)); }
std::shared_ptr<GameBase> GetBase() { return (std::shared_ptr<GameBase>(NULL)); }; std::shared_ptr<GameBase> GetBase() { return nullptr; };
void OnToolClick(wxCommandEvent &event); void OnToolClick(wxCommandEvent &event);
void OnLink(){board_panel->DisableSaveTool();}; void OnLink(){board_panel->DisableSaveTool();};
}; };

View file

@ -12,7 +12,7 @@ HalfMove::HalfMove(std::string move_absolute, std::string move_san, std::string
} }
HalfMove::~HalfMove() { HalfMove::~HalfMove() {
if (mainline != NULL) { if (mainline != nullptr) {
delete mainline; delete mainline;
} }
for (HalfMove *m : variations) { for (HalfMove *m : variations) {
@ -29,7 +29,7 @@ HalfMove::HalfMove(HalfMove *m){
Number = m->Number; Number = m->Number;
nag = m->nag; nag = m->nag;
comment=m->comment; comment=m->comment;
if(m->mainline != NULL){ if(m->mainline != nullptr){
SetMainline(new HalfMove(m->mainline)); SetMainline(new HalfMove(m->mainline));
} }
for (int i=0; i < m->variations.size(); i++) { for (int i=0; i < m->variations.size(); i++) {
@ -56,17 +56,17 @@ std::map<char, std::uint8_t> HalfMove::GetLineCaptures() {
captures[c] = 1; captures[c] = 1;
} }
m = m->parent; m = m->parent;
} while (m != NULL); } while (m != nullptr);
return (captures); return (captures);
} }
void HalfMove::SetCapture(char c) { capture = c; } void HalfMove::SetCapture(char c) { capture = c; }
void HalfMove::AddMove(HalfMove *m) { void HalfMove::AddMove(HalfMove *m) {
if (this->mainline == NULL) { if (this->mainline == nullptr) {
SetMainline(m); SetMainline(m);
} else { } else {
if (mainline != NULL) { if (mainline != nullptr) {
mainline->AddVariation(m); mainline->AddVariation(m);
} }
} }
@ -82,7 +82,7 @@ void HalfMove::SetMainline(HalfMove *m) {
} }
HalfMove::mainline = m; HalfMove::mainline = m;
cgeditor::CGEHalfMove::MainLine = m; cgeditor::CGEHalfMove::MainLine = m;
if (m != NULL) { if (m != nullptr) {
m->SetParent(this); m->SetParent(this);
} }
} }
@ -105,7 +105,7 @@ void HalfMove::RemoveChild(HalfMove *m) {
HalfMove::variations.erase(HalfMove::variations.begin() + i); HalfMove::variations.erase(HalfMove::variations.begin() + i);
} }
if (HalfMove::mainline == m) { if (HalfMove::mainline == m) {
HalfMove::mainline = NULL; HalfMove::mainline = nullptr;
} }
cgeditor::CGEHalfMove::RemoveChild((CGEHalfMove *)m); cgeditor::CGEHalfMove::RemoveChild((CGEHalfMove *)m);
} }
@ -115,7 +115,7 @@ HalfMove *HalfMove::GetParent() { return (parent); }
HalfMove *HalfMove::GetRoot() { HalfMove *HalfMove::GetRoot() {
HalfMove *m = this; HalfMove *m = this;
HalfMove *p = HalfMove::parent; HalfMove *p = HalfMove::parent;
while (p != NULL) { while (p != nullptr) {
if (p->mainline != m) { if (p->mainline != m) {
return (m); return (m);
} }
@ -143,7 +143,7 @@ HalfMove::HalfMove(pgnp::HalfMove *m) : capture(' ') {
this->IsBlack = m->isBlack; this->IsBlack = m->isBlack;
this->comment=m->comment; this->comment=m->comment;
this->Number = m->count; this->Number = m->count;
if (m->MainLine != NULL) { if (m->MainLine != nullptr) {
this->SetMainline(new HalfMove(m->MainLine)); this->SetMainline(new HalfMove(m->MainLine));
} }
for (pgnp::HalfMove *v : m->variations) { for (pgnp::HalfMove *v : m->variations) {
@ -155,10 +155,10 @@ void HalfMove::SetFen(std::string fen) { this->fen = fen; }
void HalfMove::Promote() { void HalfMove::Promote() {
HalfMove *root = GetRoot(); HalfMove *root = GetRoot();
if (root->parent != NULL) { if (root->parent != nullptr) {
HalfMove *p = root->parent; HalfMove *p = root->parent;
if (p->HalfMove::mainline != root) { if (p->HalfMove::mainline != root) {
if (root->parent->HalfMove::parent != NULL) { if (root->parent->HalfMove::parent != nullptr) {
HalfMove *pp = root->parent->HalfMove::parent; HalfMove *pp = root->parent->HalfMove::parent;
if (pp->HalfMove::mainline == p) { if (pp->HalfMove::mainline == p) {
pp->HalfMove::SetMainline(root); pp->HalfMove::SetMainline(root);
@ -168,7 +168,7 @@ void HalfMove::Promote() {
} }
} }
if (p->HalfMove::mainline == root) { if (p->HalfMove::mainline == root) {
p->HalfMove::SetMainline(NULL); p->HalfMove::SetMainline(nullptr);
} else { } else {
p->HalfMove::RemoveChild(root); p->HalfMove::RemoveChild(root);
} }
@ -180,7 +180,7 @@ void HalfMove::Promote() {
bool HalfMove::IsVariation() { bool HalfMove::IsVariation() {
HalfMove *m = this; HalfMove *m = this;
HalfMove *p = HalfMove::parent; HalfMove *p = HalfMove::parent;
while (p != NULL) { while (p != nullptr) {
if (p->mainline != m) { if (p->mainline != m) {
return (true); return (true);
} }
@ -208,7 +208,7 @@ void HalfMove::BuildAndVerify(HalfMove *m, std::string fen) {
m->capture = capture; m->capture = capture;
} }
m->fen = arbiter.GetFEN(); m->fen = arbiter.GetFEN();
if (m->mainline != NULL) { if (m->mainline != nullptr) {
BuildAndVerify(m->mainline, arbiter.GetFEN()); BuildAndVerify(m->mainline, arbiter.GetFEN());
} }
for (HalfMove *v : m->variations) { for (HalfMove *v : m->variations) {

View file

@ -14,8 +14,8 @@
* *
*/ */
class HalfMove : public cgeditor::CGEHalfMove { class HalfMove : public cgeditor::CGEHalfMove {
HalfMove *parent = NULL; HalfMove *parent = nullptr;
HalfMove *mainline = NULL; HalfMove *mainline = nullptr;
chessarbiter::ChessArbiter arbiter; chessarbiter::ChessArbiter arbiter;
std::vector<HalfMove *> variations; std::vector<HalfMove *> variations;
std::string fen; std::string fen;

View file

@ -80,7 +80,7 @@ void GameTabLeftPanel::OnPlay(wxCommandEvent &event) {
std::string fen = game->GetFen(); std::string fen = game->GetFen();
std::map<char, std::uint8_t> captures; std::map<char, std::uint8_t> captures;
HalfMove *m = game->GetCurrentMove(); HalfMove *m = game->GetCurrentMove();
if (m != NULL) { if (m != nullptr) {
captures = m->GetLineCaptures(); captures = m->GetLineCaptures();
} }
} }
@ -89,7 +89,7 @@ void GameTabLeftPanel::Notify(bool animate, bool backward) {
std::string fen = game->GetFen(); std::string fen = game->GetFen();
std::map<char, std::uint8_t> captures; std::map<char, std::uint8_t> captures;
HalfMove *m = game->GetCurrentMove(); HalfMove *m = game->GetCurrentMove();
if (m != NULL) { if (m != nullptr) {
captures = m->GetLineCaptures(); captures = m->GetLineCaptures();
} }

View file

@ -81,9 +81,9 @@ void BoardCanvas::OnPaint(wxPaintEvent &event) {
} }
void BoardCanvas::ApplyPreferences() { void BoardCanvas::ApplyPreferences() {
if (t != NULL) if (t != nullptr)
delete t; delete t;
if (t_captures != NULL) if (t_captures != nullptr)
delete t_captures; delete t_captures;
t = new Theme(); t = new Theme();
t_captures = new Theme(); t_captures = new Theme();

View file

@ -9,7 +9,7 @@ wxDEFINE_EVENT(NEXT_MOVE_EVENT, wxCommandEvent);
GameTabRightPanel::GameTabRightPanel(wxFrame *parent, std::shared_ptr<Game> game) GameTabRightPanel::GameTabRightPanel(wxFrame *parent, std::shared_ptr<Game> game)
: TabGameRightPanel(parent), game(game), selected_item(-1), : TabGameRightPanel(parent), game(game), selected_item(-1),
live_engine(NULL) { live_engine(nullptr) {
editor_canvas = new EditorCanvas((wxFrame *)editor_page); editor_canvas = new EditorCanvas((wxFrame *)editor_page);
editor_canvas_sizer->Add(editor_canvas, 1, wxEXPAND); editor_canvas_sizer->Add(editor_canvas, 1, wxEXPAND);
tags_list->InsertColumn(0, L"Name", wxLIST_FORMAT_LEFT, 200); tags_list->InsertColumn(0, L"Name", wxLIST_FORMAT_LEFT, 200);
@ -42,7 +42,7 @@ GameTabRightPanel::GameTabRightPanel(wxFrame *parent, std::shared_ptr<Game> game
LIVE_ANALYSIS_GAME_BUTTON); LIVE_ANALYSIS_GAME_BUTTON);
nag_panel->Bind(wxEVT_BUTTON, [p=this](wxCommandEvent &e){ nag_panel->Bind(wxEVT_BUTTON, [p=this](wxCommandEvent &e){
HalfMove *m = p->game->GetCurrentMove(); HalfMove *m = p->game->GetCurrentMove();
if (m != NULL) { if (m != nullptr) {
m->nag=p->GetNagFromStr(((wxButton*)e.GetEventObject())->GetLabel().ToStdString()); m->nag=p->GetNagFromStr(((wxButton*)e.GetEventObject())->GetLabel().ToStdString());
p->editor_canvas->Refresh(); p->editor_canvas->Refresh();
} }
@ -60,7 +60,7 @@ GameTabRightPanel::GameTabRightPanel(wxFrame *parent, std::shared_ptr<Game> game
} }
void GameTabRightPanel::OnLiveAnalysis(wxCommandEvent &event) { void GameTabRightPanel::OnLiveAnalysis(wxCommandEvent &event) {
if (live_engine == NULL) { if (live_engine == nullptr) {
int selection = engine_list->GetSelection(); int selection = engine_list->GetSelection();
if (selection != wxNOT_FOUND) { if (selection != wxNOT_FOUND) {
live_engine = new LiveEngineDialog( live_engine = new LiveEngineDialog(
@ -97,14 +97,14 @@ void GameTabRightPanel::NotifyBoard() {
} }
void GameTabRightPanel::OnLiveEngineClose(wxCloseEvent &e) { void GameTabRightPanel::OnLiveEngineClose(wxCloseEvent &e) {
live_engine = NULL; live_engine = nullptr;
e.Skip(); e.Skip();
} }
void GameTabRightPanel::OnCommentChange(wxCommandEvent &event) { void GameTabRightPanel::OnCommentChange(wxCommandEvent &event) {
wxLogDebug("GameTabRightPanel: comment input change"); wxLogDebug("GameTabRightPanel: comment input change");
HalfMove *m = game->GetCurrentMove(); HalfMove *m = game->GetCurrentMove();
if (m != NULL) { if (m != nullptr) {
m->comment=event.GetString().ToStdString(); m->comment=event.GetString().ToStdString();
} }
editor_canvas->Refresh(); editor_canvas->Refresh();
@ -172,13 +172,13 @@ void GameTabRightPanel::OnMoveSetAsMainline(wxCommandEvent &event) {
void GameTabRightPanel::Notify() { void GameTabRightPanel::Notify() {
HalfMove *m = game->GetCurrentMove(); HalfMove *m = game->GetCurrentMove();
if (m != NULL) { if (m != nullptr) {
comment_input->ChangeValue( comment_input->ChangeValue(
m->comment); // ChangeValue do not raise events m->comment); // ChangeValue do not raise events
} }
editor_canvas->SetMoves(game->GetMoves(), m); editor_canvas->SetMoves(game->GetMoves(), m);
// Put it here for now: // Put it here for now:
if (live_engine != NULL) { if (live_engine != nullptr) {
live_engine->SetFEN(game->GetFen()); live_engine->SetFEN(game->GetFen());
} }
} }

View file

@ -2,7 +2,7 @@
LiveEngineDialog::LiveEngineDialog(wxWindow *parent, std::string engine_name) LiveEngineDialog::LiveEngineDialog(wxWindow *parent, std::string engine_name)
: DialogLiveEngine(parent), engine_name(engine_name), interval(1000), : DialogLiveEngine(parent), engine_name(engine_name), interval(1000),
engine(NULL) { engine(nullptr) {
lines_list->InsertColumn(0, "#", wxLIST_FORMAT_LEFT, 50); lines_list->InsertColumn(0, "#", wxLIST_FORMAT_LEFT, 50);
lines_list->InsertColumn(1, "CP", wxLIST_FORMAT_LEFT, 70); lines_list->InsertColumn(1, "CP", wxLIST_FORMAT_LEFT, 70);
lines_list->InsertColumn(2, "Line", wxLIST_FORMAT_LEFT, 300); lines_list->InsertColumn(2, "Line", wxLIST_FORMAT_LEFT, 300);
@ -14,14 +14,14 @@ LiveEngineDialog::LiveEngineDialog(wxWindow *parent, std::string engine_name)
} }
LiveEngineDialog::~LiveEngineDialog() { LiveEngineDialog::~LiveEngineDialog() {
if (engine != NULL) { if (engine != nullptr) {
wxLogDebug("LiveEngineDialog destructor: delete engine"); wxLogDebug("LiveEngineDialog destructor: delete engine");
delete engine; delete engine;
} }
} }
void LiveEngineDialog::InitEngine() { void LiveEngineDialog::InitEngine() {
if (engine == NULL) { if (engine == nullptr) {
wxLogDebug("Start engine: %s", engine_name); wxLogDebug("Start engine: %s", engine_name);
CONFIG_OPEN(conf); CONFIG_OPEN(conf);
engine = new uciadapter::UCI( engine = new uciadapter::UCI(
@ -53,7 +53,7 @@ void LiveEngineDialog::InitEngine() {
} }
void LiveEngineDialog::OnClose(wxCloseEvent &e) { void LiveEngineDialog::OnClose(wxCloseEvent &e) {
if (engine != NULL) { if (engine != nullptr) {
wxLogDebug("Close live engine!!"); wxLogDebug("Close live engine!!");
timer.Stop(); timer.Stop();
engine->stop(); engine->stop();