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); -}