view arogue5/command.c @ 88:07c4d4883ef2

rogue3: begin porting to autoconf. Rogue V3 can now be built with './configure && make'. This is preliminary: 'make install' does not work yet.
author John "Elwin" Edwards
date Sat, 24 Aug 2013 13:36:13 -0700
parents ad2cb9a07aaa
children dfeed24bb616
line wrap: on
line source

/*
 * Read and execute the user commands
 *
 * Advanced Rogue
 * Copyright (C) 1984, 1985 Michael Morgan, Ken Dalka and AT&T
 * All rights reserved.
 *
 * Based on "Rogue: Exploring the Dungeons of Doom"
 * Copyright (C) 1980, 1981 Michael Toy, Ken Arnold and Glenn Wichman
 * All rights reserved.
 *
 * See the file LICENSE.TXT for full copyright and licensing information.
 */

#include "curses.h"
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <ctype.h>
#include <signal.h>
#include "mach_dep.h"
#include "rogue.h"

/*
 * command:
 *	Process the user commands
 */

command()
{
    register char ch;
    register int ntimes = 1;			/* Number of player moves */
    static char countch, direction, newcount = FALSE;
    struct linked_list *item;
    bool an_after = FALSE;

    if (on(player, ISHASTE)) {
	ntimes++;
	turns--;	/* correct for later */
    }
    if (on(player, ISSLOW) || on(player, ISDANCE)) {
	if (player.t_turn != TRUE) {
	    ntimes--;
	    turns++;
	    an_after = TRUE;
	}
	player.t_turn ^= TRUE;
    }

    /*
     * Let the daemons start up
     */
    do_daemons(BEFORE);
    do_fuses(BEFORE);
    while (ntimes-- > 0)
    {	
	/* One more tick of the clock. */
	if ((++turns % DAYLENGTH) == 0) {