summaryrefslogtreecommitdiff
path: root/apps/plugins/chessbox/chessbox.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/chessbox/chessbox.c')
-rw-r--r--apps/plugins/chessbox/chessbox.c29
1 files changed, 14 insertions, 15 deletions
diff --git a/apps/plugins/chessbox/chessbox.c b/apps/plugins/chessbox/chessbox.c
index f8db7d9b7f..64f8965947 100644
--- a/apps/plugins/chessbox/chessbox.c
+++ b/apps/plugins/chessbox/chessbox.c
@@ -450,19 +450,19 @@ void cb_start_viewer(char* filename){
450 bool exit_viewer = false; 450 bool exit_viewer = false;
451 struct cb_command command; 451 struct cb_command command;
452 452
453 first_game = pgn_list_games(rb, filename); 453 first_game = pgn_list_games(filename);
454 if (first_game == NULL){ 454 if (first_game == NULL){
455 rb->splash ( HZ*2 , "No games found !" ); 455 rb->splash ( HZ*2 , "No games found !" );
456 return; 456 return;
457 } 457 }
458 458
459 do { 459 do {
460 selected_game = pgn_show_game_list(rb, first_game); 460 selected_game = pgn_show_game_list(first_game);
461 if (selected_game == NULL){ 461 if (selected_game == NULL){
462 break; 462 break;
463 } 463 }
464 464
465 pgn_parse_game(rb, filename, selected_game); 465 pgn_parse_game(filename, selected_game);
466 if (selected_game->first_ply != NULL) { 466 if (selected_game->first_ply != NULL) {
467 467
468 /* init board */ 468 /* init board */
@@ -769,7 +769,7 @@ void cb_play_game(void) {
769 GNUChess_Initialize(); 769 GNUChess_Initialize();
770 770
771 /* init PGN history data structures */ 771 /* init PGN history data structures */
772 game = pgn_init_game(rb); 772 game = pgn_init_game();
773 773
774 /* restore saved position, if saved */ 774 /* restore saved position, if saved */
775 cb_restoreposition(); 775 cb_restoreposition();
@@ -783,9 +783,9 @@ void cb_play_game(void) {
783 if ( mate ) { 783 if ( mate ) {
784 rb->splash ( HZ*3 , "Checkmate!" ); 784 rb->splash ( HZ*3 , "Checkmate!" );
785 rb->button_get(true); 785 rb->button_get(true);
786 pgn_store_game(rb, game); 786 pgn_store_game(game);
787 GNUChess_Initialize(); 787 GNUChess_Initialize();
788 game = pgn_init_game(rb); 788 game = pgn_init_game();
789 cb_drawboard(); 789 cb_drawboard();
790 } 790 }
791 command = cb_getcommand (); 791 command = cb_getcommand ();
@@ -798,7 +798,7 @@ void cb_play_game(void) {
798 cb_drawboard(); 798 cb_drawboard();
799 799
800 /* Add the ply to the PGN history (in algebraic notation) */ 800 /* Add the ply to the PGN history (in algebraic notation) */
801 pgn_append_ply(rb, game, opponent, move_buffer, mate); 801 pgn_append_ply(game, opponent, move_buffer, mate);
802 802
803 rb->splash ( 0 , "Thinking..." ); 803 rb->splash ( 0 , "Thinking..." );
804#ifdef HAVE_ADJUSTABLE_CPU_FREQ 804#ifdef HAVE_ADJUSTABLE_CPU_FREQ
@@ -812,9 +812,9 @@ void cb_play_game(void) {
812 * for the result of the game which is only calculated in SelectMove 812 * for the result of the game which is only calculated in SelectMove
813 */ 813 */
814 if (move_buffer[0] != '\0'){ 814 if (move_buffer[0] != '\0'){
815 pgn_append_ply(rb, game, computer, move_buffer, mate); 815 pgn_append_ply(game, computer, move_buffer, mate);
816 } else { 816 } else {
817 pgn_set_result(rb, game, mate); 817 pgn_set_result(game, mate);
818 } 818 }
819 819
820 if ( wt_command == COMMAND_QUIT ) { 820 if ( wt_command == COMMAND_QUIT ) {
@@ -827,7 +827,7 @@ void cb_play_game(void) {
827#ifdef COMMAND_RESTART 827#ifdef COMMAND_RESTART
828 case COMMAND_RESTART: 828 case COMMAND_RESTART:
829 GNUChess_Initialize(); 829 GNUChess_Initialize();
830 game = pgn_init_game(rb); 830 game = pgn_init_game();
831 cb_drawboard(); 831 cb_drawboard();
832 break; 832 break;
833#endif 833#endif
@@ -845,7 +845,7 @@ void cb_play_game(void) {
845 GNUChess_Initialize(); 845 GNUChess_Initialize();
846 846
847 /* init PGN history data structures */ 847 /* init PGN history data structures */
848 game = pgn_init_game(rb); 848 game = pgn_init_game();
849 849
850 /* restore saved position, if saved */ 850 /* restore saved position, if saved */
851 cb_restoreposition(); 851 cb_restoreposition();
@@ -874,9 +874,9 @@ void cb_play_game(void) {
874 * for the result of the game which is only calculated in SelectMove 874 * for the result of the game which is only calculated in SelectMove
875 */ 875 */
876 if (move_buffer[0] != '\0'){ 876 if (move_buffer[0] != '\0'){
877 pgn_append_ply(rb, game, computer, move_buffer, mate); 877 pgn_append_ply(game, computer, move_buffer, mate);
878 } else { 878 } else {
879 pgn_set_result(rb, game, mate); 879 pgn_set_result(game, mate);
880 } 880 }
881 881
882 if ( wt_command == COMMAND_QUIT ) { 882 if ( wt_command == COMMAND_QUIT ) {
@@ -904,11 +904,10 @@ void cb_play_game(void) {
904/***************************************************************************** 904/*****************************************************************************
905* plugin entry point. 905* plugin entry point.
906******************************************************************************/ 906******************************************************************************/
907enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) { 907enum plugin_status plugin_start(const void* parameter) {
908 908
909 /* plugin init */ 909 /* plugin init */
910 910
911 rb = api;
912#if LCD_DEPTH > 1 911#if LCD_DEPTH > 1
913 rb->lcd_set_backdrop(NULL); 912 rb->lcd_set_backdrop(NULL);
914#endif 913#endif