int parse_config_file(void) { int max_hosts; if (access(command_line_option.config_file, R_OK) != 0) { fprintf(stderr, _("Configuration file `%s' is not found.\n"), command_line_option.config_file); fprintf(stderr, _("Running weex setup wizard...\n\n")); setup_wizard(); exit(0); } max_hosts = cfgParse(command_line_option.config_file, config_table, CFG_INI); if (max_hosts == 0) { fprintf(stderr, _("There is no section in configuration file `%s'.\n"), command_line_option.config_file); exit(1); } if (max_hosts == -1) { fprintf(stderr, _("\nAn error has occured while parsing configuration file `%s'.\n"), command_line_option.config_file); exit(1); } set_default(max_hosts); check_and_convert_string_value(max_hosts); check_permission(command_line_option.config_file); return (max_hosts); }
static void chaos_setup(game_t * game, int number_of_opponents) { static color_t available_colors[] = { color_yellow, color_blue, color_red, color_green, color_cyan, color_magenta }; size_t number_of_colors = sizeof(available_colors) / sizeof(color_t); shuffle_colors(available_colors, number_of_colors); game->board_offset.x = 1; game->board_offset.y = 1; for(int i = 0; i < MAX_WIZARDS_PER_GAME; i += 1) { game->wizards[i].is_free = true; game->wizards[i].moves_per_round = 1; game->wizards[i].color = available_colors[i % number_of_colors]; } for(int i = 0; i < number_of_opponents + 1; i += 1) { setup_wizard(&game->wizards[i]); } game->wizards[0].is_computer = false; game->wizards[0].name = "Player"; place_wizards(game, number_of_opponents + 1); for(int i = 0; i < MAX_MONSTERS_PER_GAME; i += 1) { game->monsters[i].is_free = true; } return; }