aboutsummaryrefslogtreecommitdiff
path: root/src/game_tab/right_panel
diff options
context:
space:
mode:
authorLoic Guegan <manzerbredes@mailbox.org>2022-12-31 20:45:03 +0100
committerLoic Guegan <manzerbredes@mailbox.org>2022-12-31 20:45:03 +0100
commit8a14abe007fb7b265e875c99aef7f53d5d185f39 (patch)
treef3ab19082038c4ca0a6c96d5f17a58e66b2471e0 /src/game_tab/right_panel
parent21a5b3df8ac01d723d447d94b681ee329ee6b072 (diff)
Cleaning pointers related code
Diffstat (limited to 'src/game_tab/right_panel')
-rw-r--r--src/game_tab/right_panel/GameTabRightPanel.cpp14
-rw-r--r--src/game_tab/right_panel/LiveEngineDialog.cpp8
2 files changed, 11 insertions, 11 deletions
diff --git a/src/game_tab/right_panel/GameTabRightPanel.cpp b/src/game_tab/right_panel/GameTabRightPanel.cpp
index 9bdc29c..1b53c83 100644
--- a/src/game_tab/right_panel/GameTabRightPanel.cpp
+++ b/src/game_tab/right_panel/GameTabRightPanel.cpp
@@ -9,7 +9,7 @@ wxDEFINE_EVENT(NEXT_MOVE_EVENT, wxCommandEvent);
GameTabRightPanel::GameTabRightPanel(wxFrame *parent, std::shared_ptr<Game> game)
: TabGameRightPanel(parent), game(game), selected_item(-1),
- live_engine(NULL) {
+ live_engine(nullptr) {
editor_canvas = new EditorCanvas((wxFrame *)editor_page);
editor_canvas_sizer->Add(editor_canvas, 1, wxEXPAND);
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);
nag_panel->Bind(wxEVT_BUTTON, [p=this](wxCommandEvent &e){
HalfMove *m = p->game->GetCurrentMove();
- if (m != NULL) {
+ if (m != nullptr) {
m->nag=p->GetNagFromStr(((wxButton*)e.GetEventObject())->GetLabel().ToStdString());
p->editor_canvas->Refresh();
}
@@ -60,7 +60,7 @@ GameTabRightPanel::GameTabRightPanel(wxFrame *parent, std::shared_ptr<Game> game
}
void GameTabRightPanel::OnLiveAnalysis(wxCommandEvent &event) {
- if (live_engine == NULL) {
+ if (live_engine == nullptr) {
int selection = engine_list->GetSelection();
if (selection != wxNOT_FOUND) {
live_engine = new LiveEngineDialog(
@@ -97,14 +97,14 @@ void GameTabRightPanel::NotifyBoard() {
}
void GameTabRightPanel::OnLiveEngineClose(wxCloseEvent &e) {
- live_engine = NULL;
+ live_engine = nullptr;
e.Skip();
}
void GameTabRightPanel::OnCommentChange(wxCommandEvent &event) {
wxLogDebug("GameTabRightPanel: comment input change");
HalfMove *m = game->GetCurrentMove();
- if (m != NULL) {
+ if (m != nullptr) {
m->comment=event.GetString().ToStdString();
}
editor_canvas->Refresh();
@@ -172,13 +172,13 @@ void GameTabRightPanel::OnMoveSetAsMainline(wxCommandEvent &event) {
void GameTabRightPanel::Notify() {
HalfMove *m = game->GetCurrentMove();
- if (m != NULL) {
+ if (m != nullptr) {
comment_input->ChangeValue(
m->comment); // ChangeValue do not raise events
}
editor_canvas->SetMoves(game->GetMoves(), m);
// Put it here for now:
- if (live_engine != NULL) {
+ if (live_engine != nullptr) {
live_engine->SetFEN(game->GetFen());
}
}
diff --git a/src/game_tab/right_panel/LiveEngineDialog.cpp b/src/game_tab/right_panel/LiveEngineDialog.cpp
index dd24096..9184216 100644
--- a/src/game_tab/right_panel/LiveEngineDialog.cpp
+++ b/src/game_tab/right_panel/LiveEngineDialog.cpp
@@ -2,7 +2,7 @@
LiveEngineDialog::LiveEngineDialog(wxWindow *parent, std::string engine_name)
: DialogLiveEngine(parent), engine_name(engine_name), interval(1000),
- engine(NULL) {
+ engine(nullptr) {
lines_list->InsertColumn(0, "#", wxLIST_FORMAT_LEFT, 50);
lines_list->InsertColumn(1, "CP", wxLIST_FORMAT_LEFT, 70);
lines_list->InsertColumn(2, "Line", wxLIST_FORMAT_LEFT, 300);
@@ -14,14 +14,14 @@ LiveEngineDialog::LiveEngineDialog(wxWindow *parent, std::string engine_name)
}
LiveEngineDialog::~LiveEngineDialog() {
- if (engine != NULL) {
+ if (engine != nullptr) {
wxLogDebug("LiveEngineDialog destructor: delete engine");
delete engine;
}
}
void LiveEngineDialog::InitEngine() {
- if (engine == NULL) {
+ if (engine == nullptr) {
wxLogDebug("Start engine: %s", engine_name);
CONFIG_OPEN(conf);
engine = new uciadapter::UCI(
@@ -53,7 +53,7 @@ void LiveEngineDialog::InitEngine() {
}
void LiveEngineDialog::OnClose(wxCloseEvent &e) {
- if (engine != NULL) {
+ if (engine != nullptr) {
wxLogDebug("Close live engine!!");
timer.Stop();
engine->stop();