aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/MainWindow.cpp10
-rw-r--r--src/game_tab/Game.cpp6
-rw-r--r--src/game_tab/Game.hpp2
-rw-r--r--src/game_tab/editor/EditorPanel.cpp2
4 files changed, 12 insertions, 8 deletions
diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp
index 09d42df..a1afc7b 100644
--- a/src/MainWindow.cpp
+++ b/src/MainWindow.cpp
@@ -97,9 +97,13 @@ void MainWindow::OnOpen(wxCommandEvent &event) {
fen = pgn.GetTagValue("FEN");
}
HalfMove *m = new HalfMove(pgnp_moves, fen);
- NewGame(new Game(m));
- } catch (...) {
- SHOW_DIALOG_ERROR("Invalid PGN file");
+ Game *g=new Game(m,fen);
+ for(std::string &s:pgn.GetTagList()){
+ g->SetTag(s,pgn.GetTagValue(s));
+ }
+ NewGame(g);
+ } catch (std::exception &e) {
+ SHOW_DIALOG_ERROR("Invalid PGN file: " + std::string(e.what()));
}
}
}
diff --git a/src/game_tab/Game.cpp b/src/game_tab/Game.cpp
index ad712bb..b9181a9 100644
--- a/src/game_tab/Game.cpp
+++ b/src/game_tab/Game.cpp
@@ -15,10 +15,10 @@ Game::Game(std::string fen) : current(NULL), moves(NULL) {
board = chessarbiter::FENParser::Parse(fen).board;
}
-Game::Game(HalfMove *m) {
+Game::Game(HalfMove *m, std::string initial_fen) {
moves = m;
current = m;
- initial_fen = m->GetFen();
+ this->initial_fen = initial_fen;
board = chessarbiter::FENParser::Parse(initial_fen).board;
}
@@ -91,7 +91,7 @@ bool Game::Play(std::string move) {
if (moves == NULL) {
moves = m;
}
- wxLogDebug("%s",GetPGN());
+ wxLogDebug("%s", GetPGN());
return (true);
}
return (false);
diff --git a/src/game_tab/Game.hpp b/src/game_tab/Game.hpp
index 790d18c..7cad269 100644
--- a/src/game_tab/Game.hpp
+++ b/src/game_tab/Game.hpp
@@ -16,7 +16,7 @@ class Game {
public:
Game();
Game(std::string fen);
- Game(HalfMove *m);
+ Game(HalfMove *m, std::string initial_fen);
std::string GetBoard();
std::string GetTag(std::string tagname);
diff --git a/src/game_tab/editor/EditorPanel.cpp b/src/game_tab/editor/EditorPanel.cpp
index 7abe09a..ffc5499 100644
--- a/src/game_tab/editor/EditorPanel.cpp
+++ b/src/game_tab/editor/EditorPanel.cpp
@@ -48,7 +48,7 @@ EditorPanel::EditorPanel(wxFrame *parent, Game *game)
tag_panel_sizer->Add(tag_edit_panel, 0, wxEXPAND);
tags_list = new wxListCtrl(tag_panel, wxID_ANY, wxDefaultPosition,
wxDefaultSize, wxLC_REPORT);
- tags_list->InsertColumn(0, L"Name");
+ tags_list->InsertColumn(0, L"Name", wxLIST_FORMAT_LEFT, 200);
tags_list->InsertColumn(1, L"Value", wxLIST_FORMAT_LEFT, 500);
RefreshTagsList();
tag_panel_sizer->Add(tags_list, 1, wxEXPAND);