View Single Post
Old April 17, 2018, 01:03   #2
Gordon
Scout
 
Join Date: Jan 2010
Posts: 31
Gordon is on a distinguished road
A bit more information on this. It seems to be a feature of the run command as it happens when I press '.' also. The problem occurs because function run_step() sets up a call to do_cmd_run() and then sets the direction to zero at the end:

Code:
	/* Move the player; running straight into a trap == trying to disarm */
	move_player(run_cur_dir, dir ? TRUE : FALSE);

	/* Prepare the next step */
	if (player->upkeep->running) {
		cmdq_push(CMD_RUN);
		cmd_set_arg_direction(cmdq_peek(), "direction", 0);
	}
}
When do_cmd_run() is called, it calls cmd_get_direction():

Code:
void do_cmd_run(struct command *cmd)
{
	int x, y, dir;

	/* Get arguments */
	if (cmd_get_direction(cmd, "direction", &dir, FALSE) != CMD_OK)
		return;

	if (player_confuse_dir(player, &dir, TRUE))
		return;

	/* Get location */
	if (dir) {
		y = player->py + ddy[dir];
		x = player->px + ddx[dir];
		if (!do_cmd_walk_test(y, x))
			return;
	}

	/* Start run */
	run_step(dir);
}
Then since dir is now zero, the validity check fails and get_rep_dir() prompts for a direction again. This repeats over and over since do_cmd_run() calls run_step() again.
Gordon is offline   Reply With Quote