aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/MainWindow.cpp8
-rw-r--r--src/Openings.cpp2
-rw-r--r--src/base_tab/BaseGameTab.cpp2
-rw-r--r--src/base_tab/BaseImportTab.cpp4
-rw-r--r--src/base_tab/BaseTab.cpp2
-rw-r--r--src/base_tab/GameListManager.cpp4
-rw-r--r--src/base_tab/GameListManager.hpp2
-rw-r--r--src/binres/binres.cpp10
-rw-r--r--src/binres/binres.hpp8
-rw-r--r--src/binres/cburnett_png.hpp2
-rw-r--r--src/binres/chesscom_8bits_png.hpp2
-rw-r--r--src/binres/hide_png.hpp2
-rw-r--r--src/binres/mat_png.hpp2
-rw-r--r--src/binres/swap_png.hpp2
-rw-r--r--src/binres/zoomin_png.hpp2
-rw-r--r--src/binres/zoomout_png.hpp2
-rw-r--r--src/engine_tab/EngineTab.cpp6
-rw-r--r--src/engine_tab/EngineTab.hpp2
-rw-r--r--src/game_tab/Game.hpp4
-rw-r--r--src/game_tab/GameTab.cpp4
-rw-r--r--src/game_tab/HalfMove.cpp2
-rw-r--r--src/game_tab/left_panel/GameTabLeftPanel.cpp8
-rw-r--r--src/game_tab/left_panel/board/BoardCanvas.cpp16
-rw-r--r--src/game_tab/left_panel/board/BoardCanvas.hpp4
-rw-r--r--src/game_tab/right_panel/GameTabRightPanel.cpp4
-rw-r--r--src/game_tab/right_panel/LiveEngineDialog.cpp6
-rw-r--r--src/game_tab/right_panel/editor/EditorCanvas.cpp1
-rw-r--r--src/ochess.cpp4
-rw-r--r--src/ochess.hpp1
-rw-r--r--src/preferences/BoardPrefs.hpp1
-rw-r--r--src/preferences/EditorPrefs.hpp1
31 files changed, 72 insertions, 48 deletions
diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp
index 55f35f5..ea20fd5 100644
--- a/src/MainWindow.cpp
+++ b/src/MainWindow.cpp
@@ -89,11 +89,13 @@ void MainWindow::AddPage(wxWindow* window, TabInfos* infos){
}
void MainWindow::OnAuiNotebookPageClosed(wxAuiNotebookEvent& event){
+ UNUSED(event);
// Refresh tab that require knowledge on other tabs
for(auto i: wxGetApp().ListTabInfos()){i->Refresh();}
}
void MainWindow::OnCloseTabEvent(wxCommandEvent &event) {
+ UNUSED(event);
notebook->DeletePage(notebook->GetSelection());
// Refresh tab that require knowledge on other tabs
for(auto i: wxGetApp().ListTabInfos()){i->Refresh();}
@@ -102,7 +104,7 @@ void MainWindow::OnCloseTabEvent(wxCommandEvent &event) {
void MainWindow::OnCloseTabLinkedTo(wxCommandEvent &event){
TabInfos *infosEvent=(TabInfos*)event.GetClientData();
// Now close all tabs in the notebook related to the one in the event
- int i=0;
+ std::size_t i=0;
while(i<notebook->GetPageCount()){
wxWindow *page=notebook->GetPage(i);
TabInfos* infos=(TabInfos*)page->GetClientData();
@@ -180,6 +182,7 @@ void MainWindow::OnMenuItemClick(wxCommandEvent &event) {
}
void MainWindow::OnRefreshEngineList(wxCommandEvent &event) {
+ UNUSED(event);
// Delete all items
wxMenuItemList items = manageMenu->GetMenuItems();
for (wxMenuItem *item : items) {
@@ -230,7 +233,7 @@ void MainWindow::OpenSettings() {
}
void MainWindow::ApplyPreferences() {
- for (int i = 0; i < notebook->GetPageCount(); i++) {
+ for (std::size_t i = 0; i < notebook->GetPageCount(); i++) {
TabInfos *infos = (TabInfos*)(notebook->GetPage(i))->GetClientData();
infos->ApplyPreferences();
}
@@ -261,6 +264,7 @@ void MainWindow::NewGame(bool useFen) {
}
void MainWindow::OnPageChange(wxAuiNotebookEvent &event) {
+ UNUSED(event);
TabInfos *infos = (TabInfos*)(notebook->GetCurrentPage())->GetClientData();
if (infos->type != TabInfos::GAME) {
for (short i = 10; i < 20; i++) {
diff --git a/src/Openings.cpp b/src/Openings.cpp
index 02a0ba5..d3b6bcc 100644
--- a/src/Openings.cpp
+++ b/src/Openings.cpp
@@ -88,7 +88,7 @@ void Openings::LoadVolume(const std::string &tsv, Volume *vol){
std::string line;
while (std::getline(f, line)) {
int eco=-1,name=-1,pgn=-1;
- for(int i=0;i<line.size();i++){
+ for(std::size_t i=0;i<line.size();i++){
if(line[i]=='\t'){
if(eco == -1)
eco=i-1;
diff --git a/src/base_tab/BaseGameTab.cpp b/src/base_tab/BaseGameTab.cpp
index dfa5a0a..b14f160 100644
--- a/src/base_tab/BaseGameTab.cpp
+++ b/src/base_tab/BaseGameTab.cpp
@@ -26,6 +26,7 @@ BaseGameTab::BaseGameTab(wxFrame *parent, std::shared_ptr<GameBase> base)
void BaseGameTab::OnApplyFilter(wxCommandEvent &event){
+ UNUSED(event);
wxString terms=search_terms->GetValue();
if(terms.length()>0){
glm->Filter(terms.ToStdString());
@@ -35,6 +36,7 @@ void BaseGameTab::OnApplyFilter(wxCommandEvent &event){
}
void BaseGameTab::OnDelete(wxCommandEvent &event) {
+ UNUSED(event);
for(auto i: glm->GetSelectedItems()){
game_list->SetItemState(i, 0, wxLIST_STATE_SELECTED); // First deselect
long gameid=glm->GetItemGameId(i);
diff --git a/src/base_tab/BaseImportTab.cpp b/src/base_tab/BaseImportTab.cpp
index 3e93633..13ded29 100644
--- a/src/base_tab/BaseImportTab.cpp
+++ b/src/base_tab/BaseImportTab.cpp
@@ -26,6 +26,7 @@ TabBase_TabImport(parent), main_tab(main_tab), base(db)
}
void BaseImportTab::OnImportDatabase(wxCommandEvent &event){
+ UNUSED(event);
if(std::find(databases_to_import.begin(), databases_to_import.end(), selected_base->GetFilePath()) == databases_to_import.end()){
databases_to_import.push_back(selected_base->GetFilePath());
selected_games_to_import.erase(selected_base->GetFilePath());
@@ -72,6 +73,7 @@ void BaseImportTab::RefreshImportLists(){
}
void BaseImportTab::OnImportSelection(wxCommandEvent &event){
+ UNUSED(event);
if(std::find(databases_to_import.begin(), databases_to_import.end(), selected_base->GetFilePath()) == databases_to_import.end()){
long selected = -1;
while ((selected = game_list->GetNextItem(selected, wxLIST_NEXT_ALL,
@@ -96,6 +98,7 @@ void BaseImportTab::OnImportSelection(wxCommandEvent &event){
}
void BaseImportTab::OnImportGame(wxCommandEvent &event){
+ UNUSED(event);
TabInfos *game_tab=(TabInfos*)opened_game_list->GetClientData(opened_game_list->GetSelection());
std::shared_ptr<Game> g=game_tab->GetGame();
if(std::find(games_to_import.begin(), games_to_import.end(), g) == games_to_import.end()){ wxLogDebug("Import!");
@@ -106,6 +109,7 @@ void BaseImportTab::OnImportGame(wxCommandEvent &event){
}
void BaseImportTab::OnLoad(wxCommandEvent &event){
+ UNUSED(event);
TabInfos *game_tab=(TabInfos*)opened_db_list->GetClientData(opened_db_list->GetSelection());
// Load all games (for now :)
diff --git a/src/base_tab/BaseTab.cpp b/src/base_tab/BaseTab.cpp
index 1342c49..466c523 100644
--- a/src/base_tab/BaseTab.cpp
+++ b/src/base_tab/BaseTab.cpp
@@ -26,6 +26,7 @@ BaseTab::BaseTab(wxFrame *parent, std::string base_file)
this->Bind(wxEVT_BUTTON, &BaseTab::OnSave, this, ID_SAVE_BUTTON);
this->Bind(wxEVT_LIST_ITEM_ACTIVATED, &BaseTab::OnOpenGame, this, ID_TABGAMES_GAME_LIST);
Bind(REFRESH_MANAGE_TAB,[p=this](wxCommandEvent &e){
+ UNUSED(e);
p->manage_tab->RefreshInformations();
p->is_dirty=p->manage_tab->HasPendingEvents(); // Refresh tab dirty flag
},wxID_ANY);
@@ -46,6 +47,7 @@ void BaseTab::Refresh(){
}
void BaseTab::OnSave(wxCommandEvent &event) {
+ UNUSED(event);
SHOW_DIALOG_BUSY("Apply all changes. Take a coffee, this process can takes time...");
// First import games
std::vector<std::shared_ptr<Game>> new_games=games_tab->GetEditedGames();
diff --git a/src/base_tab/GameListManager.cpp b/src/base_tab/GameListManager.cpp
index 971e486..22630ec 100644
--- a/src/base_tab/GameListManager.cpp
+++ b/src/base_tab/GameListManager.cpp
@@ -1,7 +1,7 @@
#include "GameListManager.hpp"
-GameListManager::GameListManager(wxListCtrl *game_list): game_list(game_list), game_counter(0) {
+GameListManager::GameListManager(wxListCtrl *game_list): game_counter(0), game_list(game_list) {
game_list->InsertColumn(0, L"Id", wxLIST_FORMAT_LEFT, 50);
game_list->InsertColumn(1, L"White", wxLIST_FORMAT_LEFT, 200);
game_list->InsertColumn(2, L"Black", wxLIST_FORMAT_LEFT, 200);
@@ -117,7 +117,7 @@ long GameListManager::GetItemGameId(long item){
void GameListManager::Filter(std::string terms){
ClearDisplayedRow();
- for(int i=0;i<rows.size();i++){
+ for(std::size_t i=0;i<rows.size();i++){
RType row=rows[i];
if(TERMS_IN(White) ||
TERMS_IN(Black) ||
diff --git a/src/base_tab/GameListManager.hpp b/src/base_tab/GameListManager.hpp
index 3499aac..d48ac36 100644
--- a/src/base_tab/GameListManager.hpp
+++ b/src/base_tab/GameListManager.hpp
@@ -8,7 +8,7 @@
#define BG_OPEN(INDEX) game_list->SetItemBackgroundColour(INDEX, *wxGREEN)
#define BG_DELETE(INDEX) game_list->SetItemBackgroundColour(INDEX, *wxRED)
#define BG_IMPORT(INDEX) game_list->SetItemBackgroundColour(INDEX, *wxBLUE)
-#define DISPLAY_ALL_ROWS() {for(int i=0;i<rows.size();i++){DisplayRow(i);}}
+#define DISPLAY_ALL_ROWS() {for(std::size_t i=0;i<rows.size();i++){DisplayRow(i);}}
///@brief Column content type
typedef std::string CType;
diff --git a/src/binres/binres.cpp b/src/binres/binres.cpp
index f6153f6..9661b08 100644
--- a/src/binres/binres.cpp
+++ b/src/binres/binres.cpp
@@ -1,5 +1,15 @@
#include "binres.hpp"
+// Embedded PGNs:
+#include "swap_png.hpp"
+#include "zoomin_png.hpp"
+#include "zoomout_png.hpp"
+#include "cburnett_png.hpp"
+#include "chesscom_8bits_png.hpp"
+#include "hide_png.hpp"
+#include "mat_png.hpp"
+#include "ochess_png.hpp"
+
wxBitmap LoadPNG(std::string icon, wxSize size) {
wxImage img = LoadPNG(icon).ConvertToImage();
return (wxBitmap(
diff --git a/src/binres/binres.hpp b/src/binres/binres.hpp
index 338e0bc..9d2ef85 100644
--- a/src/binres/binres.hpp
+++ b/src/binres/binres.hpp
@@ -1,14 +1,6 @@
#pragma once
#include "ochess.hpp"
-#include "swap_png.hpp"
-#include "zoomin_png.hpp"
-#include "zoomout_png.hpp"
-#include "cburnett_png.hpp"
-#include "chesscom_8bits_png.hpp"
-#include "hide_png.hpp"
-#include "mat_png.hpp"
-#include "ochess_png.hpp"
wxBitmap LoadPNG(std::string icon, wxSize size);
wxBitmap LoadPNG(std::string icon);
diff --git a/src/binres/cburnett_png.hpp b/src/binres/cburnett_png.hpp
index 4939d0d..a4b8abe 100644
--- a/src/binres/cburnett_png.hpp
+++ b/src/binres/cburnett_png.hpp
@@ -1,4 +1,4 @@
-static unsigned char cburnett_png[] = {
+unsigned char cburnett_png[] = {
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d,
0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x01, 0x90, 0x00, 0x00, 0x04, 0xb0,
0x08, 0x04, 0x00, 0x00, 0x00, 0x7f, 0x22, 0xd4, 0xd6, 0x00, 0x00, 0x00,
diff --git a/src/binres/chesscom_8bits_png.hpp b/src/binres/chesscom_8bits_png.hpp
index 683a27f..e10633c 100644
--- a/src/binres/chesscom_8bits_png.hpp
+++ b/src/binres/chesscom_8bits_png.hpp
@@ -1,4 +1,4 @@
-static unsigned char chesscom_8bits_png[] = {
+unsigned char chesscom_8bits_png[] = {
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d,
0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x01, 0x90, 0x00, 0x00, 0x00, 0xc8,
0x02, 0x03, 0x00, 0x00, 0x00, 0xbb, 0x7b, 0x5f, 0x71, 0x00, 0x00, 0x03,
diff --git a/src/binres/hide_png.hpp b/src/binres/hide_png.hpp
index e43104d..6b45088 100644
--- a/src/binres/hide_png.hpp
+++ b/src/binres/hide_png.hpp
@@ -1,4 +1,4 @@
-static unsigned char hide_png[] = {
+unsigned char hide_png[] = {
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d,
0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00, 0x32,
0x08, 0x06, 0x00, 0x00, 0x00, 0x1e, 0x3f, 0x88, 0xb1, 0x00, 0x00, 0x01,
diff --git a/src/binres/mat_png.hpp b/src/binres/mat_png.hpp
index c00391c..e4a6cc3 100644
--- a/src/binres/mat_png.hpp
+++ b/src/binres/mat_png.hpp
@@ -1,4 +1,4 @@
-static unsigned char mat_png[] = {
+unsigned char mat_png[] = {
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d,
0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00, 0x32,
0x08, 0x06, 0x00, 0x00, 0x00, 0x1e, 0x3f, 0x88, 0xb1, 0x00, 0x00, 0x00,
diff --git a/src/binres/swap_png.hpp b/src/binres/swap_png.hpp
index 514027e..2417208 100644
--- a/src/binres/swap_png.hpp
+++ b/src/binres/swap_png.hpp
@@ -1,4 +1,4 @@
-static unsigned char swap_png[] = {
+unsigned char swap_png[] = {
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d,
0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00, 0x32,
0x08, 0x06, 0x00, 0x00, 0x00, 0x1e, 0x3f, 0x88, 0xb1, 0x00, 0x00, 0x10,
diff --git a/src/binres/zoomin_png.hpp b/src/binres/zoomin_png.hpp
index 6583a8e..8ca3874 100644
--- a/src/binres/zoomin_png.hpp
+++ b/src/binres/zoomin_png.hpp
@@ -1,4 +1,4 @@
-static unsigned char zoomin_png[] = {
+unsigned char zoomin_png[] = {
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d,
0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00, 0x32,
0x08, 0x06, 0x00, 0x00, 0x00, 0x1e, 0x3f, 0x88, 0xb1, 0x00, 0x00, 0x13,
diff --git a/src/binres/zoomout_png.hpp b/src/binres/zoomout_png.hpp
index 7440a45..e13bd67 100644
--- a/src/binres/zoomout_png.hpp
+++ b/src/binres/zoomout_png.hpp
@@ -1,4 +1,4 @@
-static unsigned char zoomout_png[] = {
+unsigned char zoomout_png[] = {
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d,
0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00, 0x32,
0x08, 0x06, 0x00, 0x00, 0x00, 0x1e, 0x3f, 0x88, 0xb1, 0x00, 0x00, 0x11,
diff --git a/src/engine_tab/EngineTab.cpp b/src/engine_tab/EngineTab.cpp
index 4c3f82d..6389983 100644
--- a/src/engine_tab/EngineTab.cpp
+++ b/src/engine_tab/EngineTab.cpp
@@ -23,7 +23,7 @@ EngineTab::EngineTab(wxWindow *parent, uciadapter::UCI *engine,
Bind(wxEVT_BUTTON, &EngineTab::OnSave, this, ENGINE_SAVE_CONF_BUTTON);
Bind(wxEVT_BUTTON, &EngineTab::OnDelete, this, ENGINE_DELETE_CONF_BUTTON);
- Bind(wxEVT_PG_CHANGED, [p=this](wxPropertyGridEvent& event){p->is_dirty=true;});
+ Bind(wxEVT_PG_CHANGED, [p=this](wxPropertyGridEvent& event){ UNUSED(event); p->is_dirty=true;});
}
EngineTab::EngineTab(wxWindow *parent, std::uint32_t id)
@@ -46,7 +46,7 @@ EngineTab::EngineTab(wxWindow *parent, std::uint32_t id)
Bind(wxEVT_BUTTON, &EngineTab::OnSave, this, ENGINE_SAVE_CONF_BUTTON);
Bind(wxEVT_BUTTON, &EngineTab::OnDelete, this, ENGINE_DELETE_CONF_BUTTON);
- Bind(wxEVT_PG_CHANGED, [p=this](wxPropertyGridEvent& event){p->is_dirty=true;});
+ Bind(wxEVT_PG_CHANGED, [p=this](wxPropertyGridEvent& event){ UNUSED(event); p->is_dirty=true;});
}
EngineTab::~EngineTab() {
@@ -58,6 +58,7 @@ EngineTab::~EngineTab() {
}
void EngineTab::OnDelete(wxCommandEvent &event) {
+ UNUSED(event);
CONFIG_OPEN(conf);
conf->DeleteGroup(confGroup);
CONFIG_CLOSE(conf);
@@ -103,6 +104,7 @@ void EngineTab::LoadConfiguration() {
}
void EngineTab::OnSave(wxCommandEvent &event) {
+ UNUSED(event);
CONFIG_OPEN(conf2);
// Update engine name:
conf2->Write(confGroup + "/name", engine_name->GetValue());
diff --git a/src/engine_tab/EngineTab.hpp b/src/engine_tab/EngineTab.hpp
index fc90436..065d7f5 100644
--- a/src/engine_tab/EngineTab.hpp
+++ b/src/engine_tab/EngineTab.hpp
@@ -7,8 +7,8 @@ wxDECLARE_EVENT(REFRESH_ENGINE_LIST, wxCommandEvent);
wxDECLARE_EVENT(REFRESH_TAB_TITLE, wxCommandEvent);
class EngineTab : public TabEngine, public TabInfos {
- uciadapter::UCI *engine;
std::string confGroup, enginePath;
+ uciadapter::UCI *engine;
std::uint32_t engine_id;
void InitConfiguration();
void LoadConfiguration();
diff --git a/src/game_tab/Game.hpp b/src/game_tab/Game.hpp
index d6e1582..94f49fc 100644
--- a/src/game_tab/Game.hpp
+++ b/src/game_tab/Game.hpp
@@ -11,12 +11,12 @@
*/
class Game {
/// @brief 64 char string that contains all the pieces on the board (used in BoardCanvas)
+ HalfMove *current;
+ HalfMove *moves;
std::string board;
std::string initial_fen;
std::string result;
std::unordered_map<std::string, std::string> tags;
- HalfMove *moves;
- HalfMove *current;
/// @brief Used by various methods of the class
chessarbiter::ChessArbiter arbiter;
diff --git a/src/game_tab/GameTab.cpp b/src/game_tab/GameTab.cpp
index e9ce482..2b98415 100644
--- a/src/game_tab/GameTab.cpp
+++ b/src/game_tab/GameTab.cpp
@@ -5,7 +5,7 @@ wxDEFINE_EVENT(GAME_CHANGE, wxCommandEvent);
wxDEFINE_EVENT(SHOW_ENGINE_EVALUATION, wxCommandEvent);
GameTab::GameTab(wxFrame *parent, std::shared_ptr<Game> game)
- : wxPanel(parent), game(game), TabInfos(TabInfos::GAME) {
+ : wxPanel(parent), TabInfos(TabInfos::GAME), game(game) {
// Splitter
wxSplitterWindow *splitter = new wxSplitterWindow(this, wxID_ANY);
splitter->SetSashGravity(0.8);
@@ -41,7 +41,7 @@ GameTab::GameTab(wxFrame *parent, std::shared_ptr<Game> game)
void GameTab::OnToolClick(wxCommandEvent &event){
short id=event.GetId();
if(id==0){
- if(!related_file.size()>0){
+ if(!(related_file.size()>0)){
wxFileDialog
newFileDialog(this, _("Save Game"), "", "",
"PGN files (*.pgn)|*.pgn", wxFD_SAVE|wxFD_OVERWRITE_PROMPT);
diff --git a/src/game_tab/HalfMove.cpp b/src/game_tab/HalfMove.cpp
index e1c2926..e7850ff 100644
--- a/src/game_tab/HalfMove.cpp
+++ b/src/game_tab/HalfMove.cpp
@@ -50,7 +50,7 @@ std::string HalfMove::GetLineAsSAN(){
auto line=GetLine(); // Vector of HalfMove
std::string pgn;
int count=1;
- for(int i=0;i<line.size();i++){
+ for(std::size_t i=0;i<line.size();i++){
if(i%2==0){
pgn+=std::to_string(count)+".";
count+=1;
diff --git a/src/game_tab/left_panel/GameTabLeftPanel.cpp b/src/game_tab/left_panel/GameTabLeftPanel.cpp
index 6a8deec..e51febc 100644
--- a/src/game_tab/left_panel/GameTabLeftPanel.cpp
+++ b/src/game_tab/left_panel/GameTabLeftPanel.cpp
@@ -25,10 +25,10 @@ GameTabLeftPanel::GameTabLeftPanel(wxFrame *parent, std::shared_ptr<Game> game)
// Bind events:
Bind(PLAY_MOVE_EVENT, &GameTabLeftPanel::OnPlay, this, wxID_ANY);
- Bind(wxEVT_BUTTON, [bc=board_canvas](wxCommandEvent &event){bc->Zoom(10);}, ZOOM_IN_BTN);
- Bind(wxEVT_BUTTON, [bc=board_canvas](wxCommandEvent &event){bc->Zoom(-10);}, ZOOM_OUT_BTN);
- Bind(wxEVT_BUTTON, [bc=board_canvas](wxCommandEvent &event){bc->Swap();}, SWAP_BTN);
- Bind(wxEVT_KEY_UP, [p=this](wxKeyEvent &e){p->repeat=false;});
+ Bind(wxEVT_BUTTON, [bc=board_canvas](wxCommandEvent &event){UNUSED(event);bc->Zoom(10);}, ZOOM_IN_BTN);
+ Bind(wxEVT_BUTTON, [bc=board_canvas](wxCommandEvent &event){UNUSED(event);bc->Zoom(-10);}, ZOOM_OUT_BTN);
+ Bind(wxEVT_BUTTON, [bc=board_canvas](wxCommandEvent &event){UNUSED(event);bc->Swap();}, SWAP_BTN);
+ Bind(wxEVT_KEY_UP, [p=this](wxKeyEvent &e){UNUSED(e);p->repeat=false;});
Bind(wxEVT_KEY_DOWN, [p=this](wxKeyEvent &e){
if(e.GetKeyCode() == WXK_RIGHT){
p->game->Next();
diff --git a/src/game_tab/left_panel/board/BoardCanvas.cpp b/src/game_tab/left_panel/board/BoardCanvas.cpp
index 027015b..f4bda90 100644
--- a/src/game_tab/left_panel/board/BoardCanvas.cpp
+++ b/src/game_tab/left_panel/board/BoardCanvas.cpp
@@ -11,8 +11,8 @@ tmp=rot_m.TransformPoint(tmp); \
wxDEFINE_EVENT(PLAY_MOVE_EVENT, wxCommandEvent);
BoardCanvas::BoardCanvas(wxFrame *parent)
- : wxPanel(parent), black_side(false), frozen(false),
- lock_square_size(false), t(new Theme()), t_captures(new Theme()) {
+ : wxPanel(parent), t(new Theme()), t_captures(new Theme()), black_side(false), frozen(false),
+ lock_square_size(false) {
color_arrows=wxColour(145, 233, 255);
is_dragging = false;
valid_drag = false;
@@ -64,11 +64,12 @@ BoardCanvas::BoardCanvas(wxFrame *parent, std::uint32_t square_width,
: BoardCanvas(parent) {
t->ResizeSquaresAndPieces(square_width);
t_captures->ResizePieces(t->GetPiecesSizes() * CAPTURE_FACTOR);
- this->frozen = true;
+ this->frozen = frozen;
lock_square_size = true;
}
void BoardCanvas::OnPaint(wxPaintEvent &event) {
+ UNUSED(event);
wxBufferedPaintDC dc(this);
dc.SetBackground(*wxWHITE_BRUSH);
dc.Clear();
@@ -90,7 +91,6 @@ void BoardCanvas::OnPaint(wxPaintEvent &event) {
else {
// Reuse buffer and animate
dc.DrawBitmap(*adata.buffer, 0, 0, true);
- double percent=adata.frame/adata.frames;
// Draw moving piece
dc.DrawBitmap(*t->Get(adata.piece_moved),
adata.src.x + adata.frame*(adata.transVect.x/adata.frames),
@@ -174,7 +174,6 @@ void BoardCanvas::Animate(const GameState &new_gs, const std::string &src, const
int frame_duration=(1000/adata.fps);
adata.frame=0;
adata.frames=adata.duration/frame_duration; // total number of frames
- int time_per_frame=adata.duration/adata.frames;
wxStopWatch sw;
for(int i=adata.frames;i>0;i--){
Refresh();
@@ -220,7 +219,7 @@ void BoardCanvas::DrawBoard(wxDC &dc) {
}
// Draw highlighted squares
- for(int i=0;i<(gs.squares_hl.size()+squares_hl.size());i++){
+ for(std::size_t i=0;i<(gs.squares_hl.size()+squares_hl.size());i++){
const GameState::Square &s=i<gs.squares_hl.size() ? gs.squares_hl[i] : squares_hl[i-gs.squares_hl.size()];
std::uint8_t sfile = s.square[0]-'a';
std::uint8_t srank = s.square[1]-'1';
@@ -357,7 +356,7 @@ void BoardCanvas::DrawBoard(wxDC &dc) {
boardY + square_width * 8 + numbers_size.y*2));
}
// Draw arrows
- for(int i=0;i<(gs.arrows.size()+arrows.size());i++){
+ for(std::size_t i=0;i<(gs.arrows.size()+arrows.size());i++){
const GameState::Arrow &arrow= i<gs.arrows.size() ? gs.arrows[i] : arrows[i-gs.arrows.size()];
std::uint8_t sfile = arrow.src[0]-'a';
std::uint8_t srank = arrow.src[1]-'1';
@@ -404,7 +403,6 @@ void BoardCanvas::DrawBoard(wxDC &dc) {
std::uint32_t PY = boardY + srank * square_width;
short offset=0,border=5;
- char s=is_black_promotion ? 's' : 'S';
for (char p : {'q', 'r', 'b', 'n'}) {
p=is_black_promotion ? p : std::toupper(p);
@@ -612,7 +610,7 @@ void BoardCanvas::DrawArrow(wxDC &dc, int xsrc, int ysrc, int xdst, int ydst, st
wxPoint vect(xdst-xsrc,ydst-ysrc);
double length=ceil(sqrt(pow(vect.x,2)+pow(vect.y,2)));
double angle=acos(vect.x/length);
- angle= (vect.y>0) ? angle=angle : -angle;
+ angle= (vect.y>0) ? angle : -angle;
// Translate starting point (xsrc,ysrc) about arrows_offset px to not start on the center of the square (less confusing visually)
double k=arrows_offset/length;
diff --git a/src/game_tab/left_panel/board/BoardCanvas.hpp b/src/game_tab/left_panel/board/BoardCanvas.hpp
index e7f28dd..cd8ace9 100644
--- a/src/game_tab/left_panel/board/BoardCanvas.hpp
+++ b/src/game_tab/left_panel/board/BoardCanvas.hpp
@@ -27,7 +27,7 @@ wxDECLARE_EVENT(PLAY_MOVE_EVENT, wxCommandEvent);
file = 7 - file; \
rank = 7 - rank; \
} \
- bool IsCurrentSquareValid = file >= 0 && file <= 7 && rank >= 0 && rank <= 7;
+ bool IsCurrentSquareValid = file <= 7 && rank <= 7; // Do not need to check rank>=0 and file>=0 since unsigned int
#define MOUSE_ON(x, y, width, height) \
(mouseX >= (x) && mouseX <= ((x) + (width)) && mouseY >= (y) && \
@@ -100,7 +100,7 @@ class BoardCanvas : public wxPanel {
// Various canvas state variables
bool black_side, is_dragging, valid_drag, arrow_drag, is_black_turn;
- std::uint32_t boardX, boardY, square_width, piece_width, mouseX, mouseY, lastClickX,
+ std::int32_t boardX, boardY, square_width, piece_width, mouseX, mouseY, lastClickX,
lastClickY;
wxSize canvas_size;
wxPoint active_square;
diff --git a/src/game_tab/right_panel/GameTabRightPanel.cpp b/src/game_tab/right_panel/GameTabRightPanel.cpp
index ff9576d..3a9d2b7 100644
--- a/src/game_tab/right_panel/GameTabRightPanel.cpp
+++ b/src/game_tab/right_panel/GameTabRightPanel.cpp
@@ -46,6 +46,7 @@ GameTabRightPanel::GameTabRightPanel(wxFrame *parent, std::shared_ptr<Game> game
}
void GameTabRightPanel::OnLiveAnalysis(wxCommandEvent &event) {
+ UNUSED(event);
if (live_engine == nullptr) {
int selection = engine_list->GetSelection();
if (selection != wxNOT_FOUND) {
@@ -84,6 +85,7 @@ void GameTabRightPanel::OnTagSelected(wxListEvent &event) {
}
void GameTabRightPanel::OnTagDeselected(wxListEvent &event) {
+ UNUSED(event);
selected_item = -1;
delete_button->Enable(false);
}
@@ -114,6 +116,7 @@ void GameTabRightPanel::OnCommentChange(wxCommandEvent &event) {
}
void GameTabRightPanel::OnApply(wxCommandEvent &event) {
+ UNUSED(event);
std::string key = tagTextCtrl->GetValue().ToStdString();
if (key == "FEN") {
SHOW_DIALOG_ERROR("Editing the FEN tag is forbidden");
@@ -130,6 +133,7 @@ void GameTabRightPanel::OnApply(wxCommandEvent &event) {
}
void GameTabRightPanel::OnDelete(wxCommandEvent &event) {
+ UNUSED(event);
if (selected_item >= 0) {
wxListItem item;
item.SetColumn(0);
diff --git a/src/game_tab/right_panel/LiveEngineDialog.cpp b/src/game_tab/right_panel/LiveEngineDialog.cpp
index 4e86c63..e3f4951 100644
--- a/src/game_tab/right_panel/LiveEngineDialog.cpp
+++ b/src/game_tab/right_panel/LiveEngineDialog.cpp
@@ -1,8 +1,7 @@
#include "LiveEngineDialog.hpp"
LiveEngineDialog::LiveEngineDialog(wxWindow *parent, std::uint32_t engine_id)
- : DialogLiveEngine(parent), interval(1000),
- engine(nullptr) {
+ : DialogLiveEngine(parent), engine(nullptr), interval(1000) {
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);
@@ -63,6 +62,7 @@ void LiveEngineDialog::InitEngine() {
}
void LiveEngineDialog::OnClose(wxCloseEvent &e) {
+ UNUSED(e);
if (engine != nullptr) {
wxLogDebug("Close live engine!!");
timer.Stop();
@@ -83,6 +83,7 @@ void LiveEngineDialog::SetFEN(std::string fen) {
}
void LiveEngineDialog::TogglePauseEngine(wxCommandEvent &event) {
+ UNUSED(event);
if (timer.IsRunning()) {
StopEngine();
engine_stop_button->SetLabel("Restart");
@@ -115,6 +116,7 @@ void LiveEngineDialog::StartEngine() {
}
void LiveEngineDialog::OnTimerTick(wxTimerEvent &event) {
+ UNUSED(event);
lines_list->DeleteAllItems(); // Clear lines_list
engine->SyncAfter(0);
EngineEvaluation *eval=new EngineEvaluation();
diff --git a/src/game_tab/right_panel/editor/EditorCanvas.cpp b/src/game_tab/right_panel/editor/EditorCanvas.cpp
index 9f9c2e3..1df39b9 100644
--- a/src/game_tab/right_panel/editor/EditorCanvas.cpp
+++ b/src/game_tab/right_panel/editor/EditorCanvas.cpp
@@ -22,6 +22,7 @@ EditorCanvas::EditorCanvas(wxFrame *parent, std::shared_ptr<Game> game)
}
void EditorCanvas::OnPaint(wxPaintEvent &event) {
+ UNUSED(event);
wxPaintDC current_dc(this);
current_dc.SetBackground(*wxWHITE_BRUSH);
current_dc.Clear();
diff --git a/src/ochess.cpp b/src/ochess.cpp
index 62a5c04..6e93821 100644
--- a/src/ochess.cpp
+++ b/src/ochess.cpp
@@ -45,7 +45,7 @@ bool MyApp::OnInit() {
std::vector<TabInfos *> MyApp::ListTabInfos() {
std::vector<TabInfos *> tinfos;
wxAuiNotebook *notebook = ((MainWindow *)this->GetTopWindow())->notebook;
- for (int i = 0; i < notebook->GetPageCount(); i++) {
+ for (std::size_t i = 0; i < notebook->GetPageCount(); i++) {
tinfos.push_back(dynamic_cast<TabInfos *>(notebook->GetPage(i)));
}
return (tinfos);
@@ -53,7 +53,7 @@ std::vector<TabInfos *> MyApp::ListTabInfos() {
void MyApp::FocusOnTab(TabInfos * toFocus){
wxAuiNotebook *notebook = ((MainWindow *)this->GetTopWindow())->notebook;
- for (int i = 0; i < notebook->GetPageCount(); i++) {
+ for (std::size_t i = 0; i < notebook->GetPageCount(); i++) {
if(dynamic_cast<TabInfos *>(notebook->GetPage(i))->id== toFocus->id)
notebook->SetSelection(i);
}
diff --git a/src/ochess.hpp b/src/ochess.hpp
index 6317c2f..f810b7d 100644
--- a/src/ochess.hpp
+++ b/src/ochess.hpp
@@ -36,6 +36,7 @@
#define CONFIG_OPEN(name) wxConfig *name = new wxConfig("ochess")
#define CONFIG_CLOSE(name) delete name
#define CONFIG_VERSION "1.0"
+#define UNUSED(symbol) (void)(symbol);
class Game;
class GameBase;
diff --git a/src/preferences/BoardPrefs.hpp b/src/preferences/BoardPrefs.hpp
index 6169d22..f801817 100644
--- a/src/preferences/BoardPrefs.hpp
+++ b/src/preferences/BoardPrefs.hpp
@@ -30,6 +30,7 @@ public:
Bind(wxEVT_SPINCTRL, &BoardPrefsPanel::OnConfChange, this, wxID_ANY);
}
void OnConfChange(wxCommandEvent &event) {
+ UNUSED(event);
ApplyPreferences();
real_board_canvas->ApplyPreferences();
}
diff --git a/src/preferences/EditorPrefs.hpp b/src/preferences/EditorPrefs.hpp
index d1c48d9..6958519 100644
--- a/src/preferences/EditorPrefs.hpp
+++ b/src/preferences/EditorPrefs.hpp
@@ -14,6 +14,7 @@ public:
// Bind(wxEVT_SPINCTRL, &BoardPrefsPanel::OnConfChange, this, wxID_ANY);
}
void OnConfChange(wxCommandEvent &event) {
+ UNUSED(event);
}
virtual bool TransferDataToWindow() {