mirror of
https://github.com/gwenhael-le-moine/c-urs_-toil-s.git
synced 2025-01-14 08:01:19 +01:00
add next/prev level and reload functionalities
This commit is contained in:
parent
37f02c757d
commit
6a36c45a6e
1 changed files with 19 additions and 1 deletions
20
star.c
20
star.c
|
@ -419,7 +419,7 @@ void display_level( struct state *s )
|
||||||
|
|
||||||
int main( int argc, char* argv[] )
|
int main( int argc, char* argv[] )
|
||||||
{
|
{
|
||||||
int i = 0, lvl = 0, key;
|
int i = 0, lvl = 0, key, load_requested = 0;
|
||||||
struct state *s = malloc( sizeof( struct state ) );
|
struct state *s = malloc( sizeof( struct state ) );
|
||||||
|
|
||||||
/* trick to count how many levels we have */
|
/* trick to count how many levels we have */
|
||||||
|
@ -439,6 +439,9 @@ int main( int argc, char* argv[] )
|
||||||
do {
|
do {
|
||||||
if ( won_or_not( s ) ) {
|
if ( won_or_not( s ) ) {
|
||||||
lvl++;
|
lvl++;
|
||||||
|
}
|
||||||
|
if ( load_requested == 1 ) {
|
||||||
|
load_requested = 0;
|
||||||
load_level( s, levels[ lvl ] );
|
load_level( s, levels[ lvl ] );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -460,6 +463,21 @@ int main( int argc, char* argv[] )
|
||||||
case ' ':
|
case ' ':
|
||||||
switch_actor( s );
|
switch_actor( s );
|
||||||
break;
|
break;
|
||||||
|
case 'n':
|
||||||
|
if ( lvl < nb_levels - 1 ) {
|
||||||
|
lvl++;
|
||||||
|
load_requested = 1;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'p':
|
||||||
|
if ( lvl > 0 ) {
|
||||||
|
lvl--;
|
||||||
|
load_requested = 1;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'r':
|
||||||
|
load_requested = 1;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue