fixed final_score_func(), fixed score_game(), removed extern declarations of commands

AuthorKonata <konata@posteo.jp>
Date
Commit3f0120c72b9cced570ae533fa3fb3fecebcbe2f7
Parent6ab83b9
4 files changed, 26 insertions(+), 8 deletions(-)
Across_file.txt
@@ -0,0 +1,17 @@
1+[binaries]
2+c = '/usr/bin/x86_64-w64-mingw32-gcc'
3+ar = '/usr/x86_64-w64-mingw32/bin/ar'
4+strip = '/usr/bin/x86_64-w64-mingw32-strip'
5+exe_wrapper = 'wine'
6+
7+[properties]
8+
9+c_args = ['-std=c11', '-Wall', '-Wextra', '-Wpedantic']
10+c_link_args = []
11+needs_exe_wrapper = true
12+
13+[host_machine]
14+system = 'windows'
15+cpu_family = 'x86_64'
16+cpu = 'x86_64'
17+endian = 'little'
Minclude/simple-go/simple-gtp-func.h
@@ -8,9 +8,6 @@
88 #include <simple-go/simple-go.h>
99 #include <cutils/cutils.h>
1010
11-extern const char* const known_commands_string ;
12-extern const char* known_commands_array[];
13-
1411 char* unkown_command_func(const Vector* arguments, const char* id, game_state* game);
1512 char* protocol_version_func(const Vector* arguments, const char* id, game_state* game);
1613 char* name_func(const Vector* arguments, const char* id, game_state* game);
Msrc/simple-go.c
@@ -360,14 +360,15 @@ go_score* score_game(const game_state* game)
360360 {
361361 current = vector_at(ret->white_groups, i);
362362 if(get_board_at(current, y, x) == GROUP)
363- continue;
363+ goto next_loop;
364364 }
365365 for(go_coordinate i = 0; i < ret->black_groups->length; i++)
366366 {
367367 current = vector_at(ret->black_groups, i);
368368 if(get_board_at(current, y, x) == GROUP)
369- continue;
369+ goto next_loop;
370370 }
371+
371372 go_board* overlay = create_board(board->size);
372373 find_group(board, overlay, y, x);
373374
@@ -382,6 +383,7 @@ go_score* score_game(const game_state* game)
382383 } else {
383384 delete_board(overlay);
384385 }
386+ next_loop:;
385387 }
386388 }
387389 }
Msrc/simple-gtp-func.c
@@ -172,12 +172,14 @@ char* show_board_func(const Vector* arguments, const char* id, game_state* game)
172172 char* final_score_func(const Vector* arguments, const char* id, game_state* game)
173173 {
174174 go_score* score = score_game(game);
175- char* result = calloc(10,1);
175+ char* result = calloc(20,1);
176176
177177 if(score->white_points > score->black_points)
178- sprintf(result,"%c%c%.1f", 'W', '+', score->white_points-score->black_points);
178+ sprintf(result,"%c%c%.1lf", 'W', '+', score->white_points-score->black_points);
179+ else if(score->black_points > score->white_points)
180+ sprintf(result,"%c%c%.1lf", 'B', '+', score->black_points-score->white_points);
179181 else
180- sprintf(result,"%c%c%.1f", 'B', '+', score->black_points-score->white_points);
182+ sprintf(result,"0");
181183
182184 char* tmp = cmd_success(result, id);
183185