diff options
author | Solomon Peachy <pizza@shaftnet.org> | 2019-07-15 10:49:55 -0400 |
---|---|---|
committer | Solomon Peachy <pizza@shaftnet.org> | 2019-07-28 18:39:41 -0400 |
commit | 55729048876a63cbb6d264e074cbd754e4125080 (patch) | |
tree | 4df092a385aaa97358874cd47089684cba58c28b /apps/plugins/chessbox/chessbox_pgn.c | |
parent | c5ed45d8c76322700b1855bffb1c18b646f424f2 (diff) | |
download | rockbox-55729048876a63cbb6d264e074cbd754e4125080.tar.gz rockbox-55729048876a63cbb6d264e074cbd754e4125080.zip |
chessbox: Fixes and enhancements
- Unfinished game is now saved along with current position.
- All savings are automatically done on shutdown.
- Implemented facility to view played games.
- Fixed bug that prevented program from the very first move.
Patch by Igor Poretsky
Change-Id: I997b97752e4362ed953309bea985d071f9db229b
Diffstat (limited to 'apps/plugins/chessbox/chessbox_pgn.c')
-rw-r--r-- | apps/plugins/chessbox/chessbox_pgn.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/apps/plugins/chessbox/chessbox_pgn.c b/apps/plugins/chessbox/chessbox_pgn.c index 39a24d6fa1..40e88e500b 100644 --- a/apps/plugins/chessbox/chessbox_pgn.c +++ b/apps/plugins/chessbox/chessbox_pgn.c | |||
@@ -22,9 +22,9 @@ | |||
22 | #include "plugin.h" | 22 | #include "plugin.h" |
23 | #include "chessbox_pgn.h" | 23 | #include "chessbox_pgn.h" |
24 | 24 | ||
25 | #define PGN_FILE PLUGIN_GAMES_DATA_DIR "/chessbox.pgn" | ||
26 | #define LOG_FILE PLUGIN_GAMES_DATA_DIR "/chessbox.log" | 25 | #define LOG_FILE PLUGIN_GAMES_DATA_DIR "/chessbox.log" |
27 | int loghandler; | 26 | int loghandler; |
27 | const char *pgn_file = PLUGIN_GAMES_DATA_DIR "/chessbox.pgn"; | ||
28 | 28 | ||
29 | short kn_offs[8][2] = {{2,1},{2,-1},{-2,1},{-2,-1},{1,2},{1,-2},{-1,2},{-1,-2}}; | 29 | short kn_offs[8][2] = {{2,1},{2,-1},{-2,1},{-2,-1},{1,2},{1,-2},{-1,2},{-1,-2}}; |
30 | short rk_offs[4][2] = {{1,0},{-1,0},{0,1},{0,-1}}; | 30 | short rk_offs[4][2] = {{1,0},{-1,0},{0,1},{0,-1}}; |
@@ -889,7 +889,7 @@ void pgn_store_game(struct pgn_game_node* game){ | |||
889 | ply_count++; | 889 | ply_count++; |
890 | } | 890 | } |
891 | 891 | ||
892 | fhandler = rb->open(PGN_FILE, O_WRONLY|O_CREAT|O_APPEND, 0666); | 892 | fhandler = rb->open(pgn_file, O_WRONLY|O_CREAT|O_APPEND, 0666); |
893 | 893 | ||
894 | 894 | ||
895 | /* the first 7 tags are mandatory according to the PGN specification so we | 895 | /* the first 7 tags are mandatory according to the PGN specification so we |