A modern Music Player Daemon based on Rockbox open source high quality audio player
libadwaita audio rust zig deno mpris rockbox mpd
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

FS#9930 by Joshua Simmons: Code clean up the goban plugin a bit, mostly by improving comments. No functional changes.


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20060 a1c6a512-1295-4272-9138-f99709370657

+30 -22
+9 -6
apps/plugins/goban/board.c
··· 55 55 56 56 /* these aren't "board marks" in the marks on the SGF sense, they are used 57 57 internally to mark already visited points and the like (such as when 58 - doing liberty counting for groups) */ 58 + doing liberty counting for groups) 59 + 60 + We avoid having to clear the entire array every time by storing the 61 + "current_mark" number and defining marked as "== current_mark". We 62 + still need to clear the whole array once per "cycle" though, or we'd get 63 + false positives sometimes 64 + */ 59 65 static void 60 66 setup_marks (void) 61 67 { ··· 92 98 void 93 99 clear_board (void) 94 100 { 95 - unsigned int i, x, y; 101 + unsigned int x, y; 96 102 97 103 /* for the borders */ 98 - for (i = 0; i < (2 + MAX_BOARD_SIZE) * (2 + MAX_BOARD_SIZE); ++i) 99 - { 100 - board_data[i] = INVALID; 101 - } 104 + rb->memset(board_data, INVALID, sizeof(board_data)); 102 105 103 106 /* now make the actual board part */ 104 107 for (y = 0; y < board_height; ++y)
+7 -9
apps/plugins/goban/display.c
··· 146 146 char to_display[2]; 147 147 int width, height; 148 148 149 - if (intersection_size < 7) 150 - { 151 - DEBUGF ("screen too small to draw labels\n"); 152 - } 153 - 154 149 to_display[0] = 155 150 display_marks[x + y * board_width] & (~(1 << 7)); 156 151 to_display[1] = '\0'; ··· 188 183 189 184 switch (display_marks[x + y * board_width]) 190 185 { 191 - // moves, 'mark', 'square' 186 + /* moves, 'mark', 'square' */ 192 187 case 'b': 193 188 case 'w': 194 189 if (intersection_size <= 5) ··· 886 881 setup_display (void) 887 882 { 888 883 set_zoom_display (0); /* 0 means set to default */ 889 - /* cursor starts on tengen (middle of the board) */ 884 + 885 + /* The cursor starts out in the top right of the board 886 + * (on the hoshi point for most board sizes), unless the board 887 + * is really small in which case the cursor starts at the center 888 + * of the board. 889 + */ 890 890 int start_x, start_y; 891 891 if (board_width >= 7) 892 892 { ··· 915 915 static void 916 916 draw_cursor (unsigned short pos) 917 917 { 918 - /* int saved_draw_mode = rb->lcd_get_drawmode(); */ 919 - 920 918 if (!on_board (pos)) 921 919 { 922 920 return;
+4 -3
apps/plugins/goban/game.c
··· 32 32 static void pre_game_setup (void); 33 33 34 34 char save_file[SAVE_FILE_LENGTH]; 35 - bool game_dirty = false; 36 - bool autosave_dirty = false; 35 + bool game_dirty = false; /* flag for unsaved changes */ 36 + bool autosave_dirty = false; /* flag for unsaved changes which haven't even 37 + been autosaved yet */ 37 38 38 39 int move_num = 0; 39 40 40 41 unsigned char current_player = BLACK; 41 42 42 - struct header_t header; 43 + struct header_t header; /* game metadata header info */ 43 44 44 45 void 45 46 set_game_modified (void)
+7 -1
apps/plugins/goban/goban.c
··· 45 45 46 46 #endif 47 47 48 + /* the stack that uses this buffer is used for both storing intersections 49 + * in board algorithms (could store one short for each board location), and 50 + * for parsing (could store an indefinite number of ints, related to how 51 + * many levels deep branches go (in other words, how many branches off of 52 + * branches there are). 50 should take care of any reasonable file. 53 + */ 48 54 #define PARSE_STACK_BUFFER_SIZE (max(MAX_BOARD_SIZE * MAX_BOARD_SIZE * sizeof(unsigned short), 50 * sizeof(int))) 49 55 50 56 /* used in SGF file parsing and outputting as well as in liberty counting ··· 243 249 244 250 #ifdef GBN_TEST 245 251 run_tests (); 246 - return 0; 252 + return PLUGIN_OK; 247 253 #endif 248 254 249 255 if (!(parameter && load_game (parameter)))
+1 -1
apps/plugins/goban/goban.h
··· 303 303 #define LCD_BOARD_WIDTH LCD_WIDTH 304 304 #define LCD_BOARD_HEIGHT (LCD_HEIGHT - FOOTER_RESERVE) 305 305 306 - #endif // LCD_WIDTH > LCD_HEIGHT 306 + #endif /* LCD_WIDTH > LCD_HEIGHT */ 307 307 308 308 309 309 /* The directory we default to for saving crap */
+1 -1
apps/plugins/goban/sgf_output.c
··· 422 422 } 423 423 else 424 424 { 425 - // variations are at the beginning of the prop list 425 + /* variations are at the beginning of the prop list */ 426 426 break; 427 427 } 428 428
+1
apps/plugins/goban/sgf_parse.c
··· 288 288 } 289 289 } 290 290 } 291 + 291 292 static enum prop_type_t 292 293 parse_prop_type (void) 293 294 {
-1
apps/plugins/goban/sgf_storage.c
··· 409 409 } 410 410 411 411 /* same as temp = size / (sizeof(union storage_t) + 1/8) 412 - 413 412 (we need 1 bit extra for each union storage_t, for the free list) */ 414 413 temp = 415 414 (8 * (size - ALIGNMENT_VAL - 1)) / (8 * sizeof (union storage_t) + 1);