Beispiel #1
0
void CLI::apply_option(int option) {
    switch (option) {
        case HUMAN_VS_CPU:
        case CPU_VS_HUMAN:
        case HUMAN_VS_HUMAN:
        case CPU_VS_CPU:
            init_game(option);
            start_game();
            end_game();
            break;
        case LOAD:
            read_load();
            break;
        case SHOW_HELP:
            print_help();
            break;
        case BENCHMARK:
            run_benchmark();
            break;
        case WAC:
            run_wac_test();
            break;
        case SETTINGS:
            read_settings();
            break;
        case QUIT:
            cout << "Thanks for playing...!! Have fun..\n";
            break;
    }
}
Beispiel #2
0
ERR_VALUE read_set_load(FILE *Stream, PONE_READ *ReadSet, size_t *Count)
{
	uint32_t count32 = 0;
	ERR_VALUE ret = ERR_INTERNAL_ERROR;
	PONE_READ tmpReadSet = NULL;

	ret = utils_fread(&count32, sizeof(count32), 1, Stream);
	if (ret == ERR_SUCCESS) {
		ret = utils_calloc(count32, sizeof(ONE_READ), &tmpReadSet);
		if (ret == ERR_SUCCESS) {
			for (uint32_t i = 0; i < count32; ++i) {
				ret = read_load(Stream, tmpReadSet + i);
				if (ret != ERR_SUCCESS) {
					for (uint32_t j = 0; j < i; ++j)
						_read_destroy_structure(tmpReadSet + j);
					
					break;
				}
			}

			if (ret == ERR_SUCCESS) {
				*ReadSet = tmpReadSet;
				*Count = count32;
			}

			if (ret != ERR_SUCCESS)
				utils_free(tmpReadSet);
		}
	}

	return ret;
}