mirror of
https://github.com/gwenhael-le-moine/c-urs_-toil-s.git
synced 2024-12-26 09:58:48 +01:00
flexible count of levels
This commit is contained in:
parent
524e4d223d
commit
10f64607e8
1 changed files with 4 additions and 1 deletions
5
star.c
5
star.c
|
@ -422,6 +422,9 @@ int main( int argc, char* argv[] )
|
|||
int i = 0, lvl = 0, key;
|
||||
struct state *s = malloc( sizeof( struct state ) );
|
||||
|
||||
/* trick to count how many levels we have */
|
||||
int nb_levels = sizeof( levels ) / sizeof( levels[ 0 ] );
|
||||
|
||||
/* ncurses */
|
||||
WINDOW *w_main = initscr( );
|
||||
cbreak();
|
||||
|
@ -459,7 +462,7 @@ int main( int argc, char* argv[] )
|
|||
default:
|
||||
break;
|
||||
}
|
||||
} while( lvl < 25 && (( key != 'q' ) && ( key != 'Q' )) );
|
||||
} while( lvl < nb_levels && (( key != 'q' ) && ( key != 'Q' )) );
|
||||
display_level( s );
|
||||
|
||||
free( s );
|
||||
|
|
Loading…
Reference in a new issue