Removed some worthless input cruft
git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@228 db0b04b0-f4d1-0310-9a6d-de3e77497b0e
This commit is contained in:
parent
e541cf9a6f
commit
ccd503105e
|
@ -1,5 +1,6 @@
|
|||
1.5 (???)
|
||||
* Allow user to change his or her email address in the console.
|
||||
* Remove some useless cruft in ttywait() [ttyplay.c]
|
||||
|
||||
1.4 (2004/02/03)
|
||||
* Major cleanups - remove most uses of strcpy() and strcat()
|
||||
|
|
24
ttyplay.c
24
ttyplay.c
|
@ -84,32 +84,12 @@ double
|
|||
ttywait (struct timeval prev, struct timeval cur, double speed)
|
||||
{
|
||||
struct timeval diff = timeval_diff (prev, cur);
|
||||
fd_set readfs;
|
||||
|
||||
assert (speed != 0);
|
||||
diff = timeval_div (diff, speed);
|
||||
|
||||
FD_SET (STDIN_FILENO, &readfs);
|
||||
select (1, &readfs, NULL, NULL, &diff); /* skip if a user hits any key */
|
||||
if (FD_ISSET (0, &readfs))
|
||||
{ /* a user hits a character? */
|
||||
char c;
|
||||
read (STDIN_FILENO, &c, 1); /* drain the character */
|
||||
switch (c)
|
||||
{
|
||||
case '+':
|
||||
case 'f':
|
||||
speed *= 2;
|
||||
break;
|
||||
case '-':
|
||||
case 's':
|
||||
speed /= 2;
|
||||
break;
|
||||
case '1':
|
||||
speed = 1.0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
select (1, NULL, NULL, NULL, &diff); /* skip if a user hits any key */
|
||||
|
||||
return speed;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue