From 7835fd73af4718920d77e4a425046802b8c9cc56 Mon Sep 17 00:00:00 2001 From: Racoonicorn Date: Fri, 6 Jan 2017 18:14:10 +0100 Subject: [PATCH] Bugfixes --- IcePath.c | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/IcePath.c b/IcePath.c index 62da78f..312bf59 100644 --- a/IcePath.c +++ b/IcePath.c @@ -1,7 +1,7 @@ -#define VERSION "0.10" +#define VERSION "0.11" #define N 512 -#define SPEED 30000 // less is more +#define DELAY 25 // milliseconds #include #include @@ -12,7 +12,6 @@ void printm(); void play(); void move_ptr(int direction); -void waitfor(int delay); void menu(); void readfiles(); void ranking(); @@ -164,6 +163,7 @@ void play() { ptr.x = level[selected.pos].start.x; ptr.y = level[selected.pos].start.y; do { + flushinp(); printm(); refresh(); direction = getch(); @@ -222,7 +222,7 @@ void move_ptr(int direction) { if (checkwin() == 1) { break; } else { - waitfor(SPEED); + napms(DELAY); } } break; case KEY_RIGHT: @@ -234,7 +234,7 @@ void move_ptr(int direction) { if (checkwin() == 1) { break; } else { - waitfor(SPEED); + napms(DELAY); } } break; case KEY_UP: @@ -246,7 +246,7 @@ void move_ptr(int direction) { if (checkwin() == 1) { break; } else { - waitfor(SPEED); + napms(DELAY); } } break; case KEY_DOWN: @@ -258,7 +258,7 @@ void move_ptr(int direction) { if (checkwin() == 1) { break; } else { - waitfor(SPEED); + napms(DELAY); } } break; default: return; @@ -377,7 +377,7 @@ void ranking() { struct dataresult temp; char *time_string[N]; readfiles(); - // reord data + // sort data for (i = 0; data[i].moves != 0; i++) { for (j = i + 1; data[j].moves != 0; j++) { if (data[i].moves > data[j].moves) { @@ -432,11 +432,3 @@ int checkwin() { } else return 0; } - -void waitfor(int delay) { - int time_a, time_b; - time_a = clock(); - do { - time_b = clock(); - } while (time_b < time_a + delay); -}