fixed final_score_func(), fixed score_game(), removed extern declarations of commands
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 @@ | |||
|---|---|---|---|
| 8 | 8 | #include <simple-go/simple-go.h> | |
| 9 | 9 | #include <cutils/cutils.h> | |
| 10 | 10 | ||
| 11 | - | extern const char* const known_commands_string ; | |
| 12 | - | extern const char* known_commands_array[]; | |
| 13 | - | ||
| 14 | 11 | char* unkown_command_func(const Vector* arguments, const char* id, game_state* game); | |
| 15 | 12 | char* protocol_version_func(const Vector* arguments, const char* id, game_state* game); | |
| 16 | 13 | 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) | |||
|---|---|---|---|
| 360 | 360 | { | |
| 361 | 361 | current = vector_at(ret->white_groups, i); | |
| 362 | 362 | if(get_board_at(current, y, x) == GROUP) | |
| 363 | - | continue; | |
| 363 | + | goto next_loop; | |
| 364 | 364 | } | |
| 365 | 365 | for(go_coordinate i = 0; i < ret->black_groups->length; i++) | |
| 366 | 366 | { | |
| 367 | 367 | current = vector_at(ret->black_groups, i); | |
| 368 | 368 | if(get_board_at(current, y, x) == GROUP) | |
| 369 | - | continue; | |
| 369 | + | goto next_loop; | |
| 370 | 370 | } | |
| 371 | + | ||
| 371 | 372 | go_board* overlay = create_board(board->size); | |
| 372 | 373 | find_group(board, overlay, y, x); | |
| 373 | 374 | ||
| @@ -382,6 +383,7 @@ go_score* score_game(const game_state* game) | |||
|---|---|---|---|
| 382 | 383 | } else { | |
| 383 | 384 | delete_board(overlay); | |
| 384 | 385 | } | |
| 386 | + | next_loop:; | |
| 385 | 387 | } | |
| 386 | 388 | } | |
| 387 | 389 | } | |
Msrc/simple-gtp-func.c
| @@ -172,12 +172,14 @@ char* show_board_func(const Vector* arguments, const char* id, game_state* game) | |||
|---|---|---|---|
| 172 | 172 | char* final_score_func(const Vector* arguments, const char* id, game_state* game) | |
| 173 | 173 | { | |
| 174 | 174 | go_score* score = score_game(game); | |
| 175 | - | char* result = calloc(10,1); | |
| 175 | + | char* result = calloc(20,1); | |
| 176 | 176 | ||
| 177 | 177 | 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); | |
| 179 | 181 | else | |
| 180 | - | sprintf(result,"%c%c%.1f", 'B', '+', score->black_points-score->white_points); | |
| 182 | + | sprintf(result,"0"); | |
| 181 | 183 | ||
| 182 | 184 | char* tmp = cmd_success(result, id); | |
| 183 | 185 | ||