diff options
Diffstat (limited to 'apps/plugins')
-rw-r--r-- | apps/plugins/goban/display.c | 67 |
1 files changed, 41 insertions, 26 deletions
diff --git a/apps/plugins/goban/display.c b/apps/plugins/goban/display.c index 64b3adebb4..f701dbb315 100644 --- a/apps/plugins/goban/display.c +++ b/apps/plugins/goban/display.c | |||
@@ -1041,44 +1041,59 @@ draw_hoshi (unsigned short pos) | |||
1041 | static void | 1041 | static void |
1042 | draw_all_hoshi (void) | 1042 | draw_all_hoshi (void) |
1043 | { | 1043 | { |
1044 | if (board_width != board_height) | 1044 | if (board_width != board_height || |
1045 | board_width <= 2 || | ||
1046 | board_width == 4 || | ||
1047 | board_width == 6) | ||
1045 | { | 1048 | { |
1046 | return; | 1049 | return; |
1047 | } | 1050 | } |
1048 | 1051 | ||
1049 | if (board_width == 19) | 1052 | if (board_width == 3) |
1050 | { | 1053 | { |
1051 | draw_hoshi (POS (3, 3)); | 1054 | draw_hoshi (POS (1, 1)); |
1052 | draw_hoshi (POS (3, 9)); | 1055 | return; |
1053 | draw_hoshi (POS (3, 15)); | ||
1054 | |||
1055 | draw_hoshi (POS (9, 3)); | ||
1056 | draw_hoshi (POS (9, 9)); | ||
1057 | draw_hoshi (POS (9, 15)); | ||
1058 | |||
1059 | draw_hoshi (POS (15, 3)); | ||
1060 | draw_hoshi (POS (15, 9)); | ||
1061 | draw_hoshi (POS (15, 15)); | ||
1062 | } | 1056 | } |
1063 | else if (board_width == 9) | 1057 | |
1058 | if (board_width == 5) | ||
1064 | { | 1059 | { |
1060 | draw_hoshi (POS (1, 1)); | ||
1061 | draw_hoshi (POS (1, 3)); | ||
1065 | draw_hoshi (POS (2, 2)); | 1062 | draw_hoshi (POS (2, 2)); |
1066 | draw_hoshi (POS (2, 6)); | 1063 | draw_hoshi (POS (3, 1)); |
1064 | draw_hoshi (POS (3, 3)); | ||
1065 | return; | ||
1066 | } | ||
1067 | 1067 | ||
1068 | draw_hoshi (POS (4, 4)); | 1068 | /* special case boards taken care of, handle the general case |
1069 | * | ||
1070 | * Note: board_width == board_height here (or we bailed out) so the two | ||
1071 | * are interchangeable */ | ||
1072 | int low_edge = (board_width < 12) ? 2 : 3; | ||
1073 | int high_edge = board_width - low_edge - 1; | ||
1074 | int mid = board_width / 2; | ||
1069 | 1075 | ||
1070 | draw_hoshi (POS (6, 2)); | 1076 | /* corner hoshi, for big enough boards */ |
1071 | draw_hoshi (POS (6, 6)); | 1077 | if (board_width > 7) |
1072 | } | ||
1073 | else if (board_width == 13) | ||
1074 | { | 1078 | { |
1075 | draw_hoshi (POS (3, 3)); | 1079 | draw_hoshi (POS (low_edge, low_edge)); |
1076 | draw_hoshi (POS (3, 9)); | 1080 | draw_hoshi (POS (low_edge, high_edge)); |
1077 | 1081 | draw_hoshi (POS (high_edge, low_edge)); | |
1078 | draw_hoshi (POS (6, 6)); | 1082 | draw_hoshi (POS (high_edge, high_edge)); |
1083 | } | ||
1079 | 1084 | ||
1080 | draw_hoshi (POS (9, 3)); | 1085 | /* side hoshi, for big enough boards (only makes sense on odd) */ |
1081 | draw_hoshi (POS (9, 9)); | 1086 | if (board_width > 12 && board_width % 2 == 1) |
1087 | { | ||
1088 | draw_hoshi (POS (low_edge, mid)); | ||
1089 | draw_hoshi (POS (mid, low_edge)); | ||
1090 | draw_hoshi (POS (high_edge, mid)); | ||
1091 | draw_hoshi (POS (mid, high_edge)); | ||
1092 | } | ||
1082 | 1093 | ||
1094 | /* center hoshi */ | ||
1095 | if (board_width % 2 == 1) | ||
1096 | { | ||
1097 | draw_hoshi (POS (mid, mid)); | ||
1083 | } | 1098 | } |
1084 | } | 1099 | } |