···55555656/* these aren't "board marks" in the marks on the SGF sense, they are used
5757 internally to mark already visited points and the like (such as when
5858- doing liberty counting for groups) */
5858+ doing liberty counting for groups)
5959+6060+ We avoid having to clear the entire array every time by storing the
6161+ "current_mark" number and defining marked as "== current_mark". We
6262+ still need to clear the whole array once per "cycle" though, or we'd get
6363+ false positives sometimes
6464+ */
5965static void
6066setup_marks (void)
6167{
···9298void
9399clear_board (void)
94100{
9595- unsigned int i, x, y;
101101+ unsigned int x, y;
9610297103 /* for the borders */
9898- for (i = 0; i < (2 + MAX_BOARD_SIZE) * (2 + MAX_BOARD_SIZE); ++i)
9999- {
100100- board_data[i] = INVALID;
101101- }
104104+ rb->memset(board_data, INVALID, sizeof(board_data));
102105103106 /* now make the actual board part */
104107 for (y = 0; y < board_height; ++y)
+7-9
apps/plugins/goban/display.c
···146146 char to_display[2];
147147 int width, height;
148148149149- if (intersection_size < 7)
150150- {
151151- DEBUGF ("screen too small to draw labels\n");
152152- }
153153-154149 to_display[0] =
155150 display_marks[x + y * board_width] & (~(1 << 7));
156151 to_display[1] = '\0';
···188183189184 switch (display_marks[x + y * board_width])
190185 {
191191- // moves, 'mark', 'square'
186186+ /* moves, 'mark', 'square' */
192187 case 'b':
193188 case 'w':
194189 if (intersection_size <= 5)
···886881setup_display (void)
887882{
888883 set_zoom_display (0); /* 0 means set to default */
889889- /* cursor starts on tengen (middle of the board) */
884884+885885+ /* The cursor starts out in the top right of the board
886886+ * (on the hoshi point for most board sizes), unless the board
887887+ * is really small in which case the cursor starts at the center
888888+ * of the board.
889889+ */
890890 int start_x, start_y;
891891 if (board_width >= 7)
892892 {
···915915static void
916916draw_cursor (unsigned short pos)
917917{
918918- /* int saved_draw_mode = rb->lcd_get_drawmode(); */
919919-920918 if (!on_board (pos))
921919 {
922920 return;
+4-3
apps/plugins/goban/game.c
···3232static void pre_game_setup (void);
33333434char save_file[SAVE_FILE_LENGTH];
3535-bool game_dirty = false;
3636-bool autosave_dirty = false;
3535+bool game_dirty = false; /* flag for unsaved changes */
3636+bool autosave_dirty = false; /* flag for unsaved changes which haven't even
3737+ been autosaved yet */
37383839int move_num = 0;
39404041unsigned char current_player = BLACK;
41424242-struct header_t header;
4343+struct header_t header; /* game metadata header info */
43444445void
4546set_game_modified (void)
+7-1
apps/plugins/goban/goban.c
···45454646#endif
47474848+/* the stack that uses this buffer is used for both storing intersections
4949+ * in board algorithms (could store one short for each board location), and
5050+ * for parsing (could store an indefinite number of ints, related to how
5151+ * many levels deep branches go (in other words, how many branches off of
5252+ * branches there are). 50 should take care of any reasonable file.
5353+ */
4854#define PARSE_STACK_BUFFER_SIZE (max(MAX_BOARD_SIZE * MAX_BOARD_SIZE * sizeof(unsigned short), 50 * sizeof(int)))
49555056/* used in SGF file parsing and outputting as well as in liberty counting
···243249244250#ifdef GBN_TEST
245251 run_tests ();
246246- return 0;
252252+ return PLUGIN_OK;
247253#endif
248254249255 if (!(parameter && load_game (parameter)))
+1-1
apps/plugins/goban/goban.h
···303303#define LCD_BOARD_WIDTH LCD_WIDTH
304304#define LCD_BOARD_HEIGHT (LCD_HEIGHT - FOOTER_RESERVE)
305305306306-#endif // LCD_WIDTH > LCD_HEIGHT
306306+#endif /* LCD_WIDTH > LCD_HEIGHT */
307307308308309309/* The directory we default to for saving crap */
+1-1
apps/plugins/goban/sgf_output.c
···422422 }
423423 else
424424 {
425425- // variations are at the beginning of the prop list
425425+ /* variations are at the beginning of the prop list */
426426 break;
427427 }
428428
···409409 }
410410411411 /* same as temp = size / (sizeof(union storage_t) + 1/8)
412412-413412 (we need 1 bit extra for each union storage_t, for the free list) */
414413 temp =
415414 (8 * (size - ALIGNMENT_VAL - 1)) / (8 * sizeof (union storage_t) + 1);