aboutsummaryrefslogtreecommitdiff
path: root/src/MainWindow.cpp
diff options
context:
space:
mode:
authorLoic Guegan <manzerbredes@mailbox.org>2022-02-23 18:47:18 +0100
committerLoic Guegan <manzerbredes@mailbox.org>2022-02-23 18:47:18 +0100
commita3c24f27f081e49b9a814aba61d298f1d0a5d0fa (patch)
tree668fbefe38925fe750fee3323f03f8d42d2215f5 /src/MainWindow.cpp
parentce941c146aea7925bded6b9d2a0d0559d3156ad3 (diff)
Debug PGN import
Diffstat (limited to 'src/MainWindow.cpp')
-rw-r--r--src/MainWindow.cpp10
1 files changed, 7 insertions, 3 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()));
}
}
}