View Single Post
Old April 17, 2018, 01:32   #3
Gordon
Scout
 
Join Date: Jan 2010
Posts: 31
Gordon is on a distinguished road
Since everything works fine with the validity check disabled, perhaps the best solution here is to remove the validity check entirely:

Code:
/**
 * Get a direction, first from command or prompt otherwise
 */
int cmd_get_direction(struct command *cmd, const char *arg, int *dir,
					  bool allow_5)
{
	if (cmd_get_arg_direction(cmd, arg, dir) == CMD_OK) 
		return CMD_OK;
	

	/* We need to do extra work */
	if (get_rep_dir(dir, allow_5)) {
		cmd_set_arg_direction(cmd, arg, *dir);
		return CMD_OK;
	}

	cmd_cancel_repeat();
	return CMD_ARG_ABORTED;
}
Gordon is offline   Reply With Quote