summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/plugins/goban/board.c15
-rw-r--r--apps/plugins/goban/display.c16
-rw-r--r--apps/plugins/goban/game.c7
-rw-r--r--apps/plugins/goban/goban.c8
-rw-r--r--apps/plugins/goban/goban.h2
-rw-r--r--apps/plugins/goban/sgf_output.c2
-rw-r--r--apps/plugins/goban/sgf_parse.c1
-rw-r--r--apps/plugins/goban/sgf_storage.c1
8 files changed, 30 insertions, 22 deletions
diff --git a/apps/plugins/goban/board.c b/apps/plugins/goban/board.c
index bc6c5347dc..c36fcc56e9 100644
--- a/apps/plugins/goban/board.c
+++ b/apps/plugins/goban/board.c
@@ -55,7 +55,13 @@ static int flood_fill_helper (unsigned short pos, unsigned char orig_color,
/* these aren't "board marks" in the marks on the SGF sense, they are used
internally to mark already visited points and the like (such as when
- doing liberty counting for groups) */
+ doing liberty counting for groups)
+
+ We avoid having to clear the entire array every time by storing the
+ "current_mark" number and defining marked as "== current_mark". We
+ still need to clear the whole array once per "cycle" though, or we'd get
+ false positives sometimes
+ */
static void
setup_marks (void)
{
@@ -92,13 +98,10 @@ is_marked (unsigned short pos)
void
clear_board (void)
{
- unsigned int i, x, y;
+ unsigned int x, y;
/* for the borders */
- for (i = 0; i < (2 + MAX_BOARD_SIZE) * (2 + MAX_BOARD_SIZE); ++i)
- {
- board_data[i] = INVALID;
- }
+ rb->memset(board_data, INVALID, sizeof(board_data));
/* now make the actual board part */
for (y = 0; y < board_height; ++y)
diff --git a/apps/plugins/goban/display.c b/apps/plugins/goban/display.c
index 35a5de45f6..55ea0d6a4a 100644
--- a/apps/plugins/goban/display.c
+++ b/apps/plugins/goban/display.c
@@ -146,11 +146,6 @@ draw_all_marks (void)
char to_display[2];
int width, height;
- if (intersection_size < 7)
- {
- DEBUGF ("screen too small to draw labels\n");
- }
-
to_display[0] =
display_marks[x + y * board_width] & (~(1 << 7));
to_display[1] = '\0';
@@ -188,7 +183,7 @@ draw_all_marks (void)
switch (display_marks[x + y * board_width])
{
- // moves, 'mark', 'square'
+ /* moves, 'mark', 'square' */
case 'b':
case 'w':
if (intersection_size <= 5)
@@ -886,7 +881,12 @@ void
setup_display (void)
{
set_zoom_display (0); /* 0 means set to default */
- /* cursor starts on tengen (middle of the board) */
+
+ /* The cursor starts out in the top right of the board
+ * (on the hoshi point for most board sizes), unless the board
+ * is really small in which case the cursor starts at the center
+ * of the board.
+ */
int start_x, start_y;
if (board_width >= 7)
{
@@ -915,8 +915,6 @@ setup_display (void)
static void
draw_cursor (unsigned short pos)
{
- /* int saved_draw_mode = rb->lcd_get_drawmode(); */
-
if (!on_board (pos))
{
return;
diff --git a/apps/plugins/goban/game.c b/apps/plugins/goban/game.c
index 9ecf836f5b..1971a5b15c 100644
--- a/apps/plugins/goban/game.c
+++ b/apps/plugins/goban/game.c
@@ -32,14 +32,15 @@
static void pre_game_setup (void);
char save_file[SAVE_FILE_LENGTH];
-bool game_dirty = false;
-bool autosave_dirty = false;
+bool game_dirty = false; /* flag for unsaved changes */
+bool autosave_dirty = false; /* flag for unsaved changes which haven't even
+ been autosaved yet */
int move_num = 0;
unsigned char current_player = BLACK;
-struct header_t header;
+struct header_t header; /* game metadata header info */
void
set_game_modified (void)
diff --git a/apps/plugins/goban/goban.c b/apps/plugins/goban/goban.c
index d00f0d9ab2..04b74b7f59 100644
--- a/apps/plugins/goban/goban.c
+++ b/apps/plugins/goban/goban.c
@@ -45,6 +45,12 @@ int nav_mode = NAV_MODE_BOARD;
#endif
+/* the stack that uses this buffer is used for both storing intersections
+ * in board algorithms (could store one short for each board location), and
+ * for parsing (could store an indefinite number of ints, related to how
+ * many levels deep branches go (in other words, how many branches off of
+ * branches there are). 50 should take care of any reasonable file.
+ */
#define PARSE_STACK_BUFFER_SIZE (max(MAX_BOARD_SIZE * MAX_BOARD_SIZE * sizeof(unsigned short), 50 * sizeof(int)))
/* used in SGF file parsing and outputting as well as in liberty counting
@@ -243,7 +249,7 @@ plugin_start (const void *parameter)
#ifdef GBN_TEST
run_tests ();
- return 0;
+ return PLUGIN_OK;
#endif
if (!(parameter && load_game (parameter)))
diff --git a/apps/plugins/goban/goban.h b/apps/plugins/goban/goban.h
index 9e9dc73d91..8c7ca9a603 100644
--- a/apps/plugins/goban/goban.h
+++ b/apps/plugins/goban/goban.h
@@ -303,7 +303,7 @@
#define LCD_BOARD_WIDTH LCD_WIDTH
#define LCD_BOARD_HEIGHT (LCD_HEIGHT - FOOTER_RESERVE)
-#endif // LCD_WIDTH > LCD_HEIGHT
+#endif /* LCD_WIDTH > LCD_HEIGHT */
/* The directory we default to for saving crap */
diff --git a/apps/plugins/goban/sgf_output.c b/apps/plugins/goban/sgf_output.c
index e798dcd510..c1ac052be7 100644
--- a/apps/plugins/goban/sgf_output.c
+++ b/apps/plugins/goban/sgf_output.c
@@ -422,7 +422,7 @@ stupid_num_variations (void)
}
else
{
- // variations are at the beginning of the prop list
+ /* variations are at the beginning of the prop list */
break;
}
diff --git a/apps/plugins/goban/sgf_parse.c b/apps/plugins/goban/sgf_parse.c
index e0fa8fd2df..a2b11cf490 100644
--- a/apps/plugins/goban/sgf_parse.c
+++ b/apps/plugins/goban/sgf_parse.c
@@ -288,6 +288,7 @@ parse_prop (void)
}
}
}
+
static enum prop_type_t
parse_prop_type (void)
{
diff --git a/apps/plugins/goban/sgf_storage.c b/apps/plugins/goban/sgf_storage.c
index 1c92625f7d..8afc3ea80f 100644
--- a/apps/plugins/goban/sgf_storage.c
+++ b/apps/plugins/goban/sgf_storage.c
@@ -409,7 +409,6 @@ setup_storage_buffer (char *temp_buffer, size_t size)
}
/* same as temp = size / (sizeof(union storage_t) + 1/8)
-
(we need 1 bit extra for each union storage_t, for the free list) */
temp =
(8 * (size - ALIGNMENT_VAL - 1)) / (8 * sizeof (union storage_t) + 1);