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 @@
[binaries]
c = '/usr/bin/x86_64-w64-mingw32-gcc'
ar = '/usr/x86_64-w64-mingw32/bin/ar'
strip = '/usr/bin/x86_64-w64-mingw32-strip'
exe_wrapper = 'wine'
[properties]
c_args = ['-std=c11', '-Wall', '-Wextra', '-Wpedantic']
c_link_args = []
needs_exe_wrapper = true
[host_machine]
system = 'windows'
cpu_family = 'x86_64'
cpu = 'x86_64'
endian = 'little'
▾Minclude/simple-go/simple-gtp-func.h
@@ -8,9 +8,6 @@
#include <simple-go/simple-go.h>
#include <cutils/cutils.h>
extern const char* const known_commands_string ;
extern const char* known_commands_array[];
char* unkown_command_func(const Vector* arguments, const char* id, game_state* game);
char* protocol_version_func(const Vector* arguments, const char* id, game_state* game);
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)
{
current = vector_at(ret->white_groups, i);
if(get_board_at(current, y, x) == GROUP)
continue;
goto next_loop;
}
for(go_coordinate i = 0; i < ret->black_groups->length; i++)
{
current = vector_at(ret->black_groups, i);
if(get_board_at(current, y, x) == GROUP)
continue;
goto next_loop;
}
go_board* overlay = create_board(board->size);
find_group(board, overlay, y, x);
@@ -382,6 +383,7 @@ go_score* score_game(const game_state* game)
} else {
delete_board(overlay);
}
next_loop:;
}
}
}
▾Msrc/simple-gtp-func.c
@@ -172,12 +172,14 @@ char* show_board_func(const Vector* arguments, const char* id, game_state* game)
char* final_score_func(const Vector* arguments, const char* id, game_state* game)
{
go_score* score = score_game(game);
char* result = calloc(10,1);
char* result = calloc(20,1);
if(score->white_points > score->black_points)
sprintf(result,"%c%c%.1f", 'W', '+', score->white_points-score->black_points);
sprintf(result,"%c%c%.1lf", 'W', '+', score->white_points-score->black_points);
else if(score->black_points > score->white_points)
sprintf(result,"%c%c%.1lf", 'B', '+', score->black_points-score->white_points);
else
sprintf(result,"%c%c%.1f", 'B', '+', score->black_points-score->white_points);
sprintf(result,"0");
char* tmp = cmd_success(result, id);