mirror of
https://github.com/gwenhael-le-moine/c-urs_-toil-s.git
synced 2025-01-14 08:01:19 +01:00
comment hairy conditional + remove debug print
This commit is contained in:
parent
9b190a3bd5
commit
4fcfc251a1
1 changed files with 5 additions and 2 deletions
7
star.c
7
star.c
|
@ -116,10 +116,13 @@ void move( state *s, int direction )
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Calculating arrival coordinates */
|
/* Calculating arrival coordinates */
|
||||||
while (
|
while ( /* Hairy conditions ahead */
|
||||||
|
/* target cell is within level's boundaries */
|
||||||
( ( tmpx + dx >= 0 ) && ( tmpx + dx < LEVEL_WIDTH ) ) &&
|
( ( tmpx + dx >= 0 ) && ( tmpx + dx < LEVEL_WIDTH ) ) &&
|
||||||
( ( tmpy + dy >= 0 ) && ( tmpy + dy < LEVEL_HEIGHT ) ) &&
|
( ( tmpy + dy >= 0 ) && ( tmpy + dy < LEVEL_HEIGHT ) ) &&
|
||||||
|
/* and target cell is empty */
|
||||||
( get_cell( s, tmpx + dx, tmpy + dy ) == VOID )
|
( get_cell( s, tmpx + dx, tmpy + dy ) == VOID )
|
||||||
|
/* or, in case the ball is moving, target cell can be a gift (which we'll eat) */
|
||||||
|| ( s->moving == BALL && ( get_cell( s, tmpx + dx, tmpy + dy ) == GIFT ) )
|
|| ( s->moving == BALL && ( get_cell( s, tmpx + dx, tmpy + dy ) == GIFT ) )
|
||||||
) {
|
) {
|
||||||
tmpx += dx;
|
tmpx += dx;
|
||||||
|
@ -182,7 +185,7 @@ int main( int argc, char* argv[] )
|
||||||
load_level( s, levels[ 0 ] );
|
load_level( s, levels[ 0 ] );
|
||||||
|
|
||||||
display_level( s );
|
display_level( s );
|
||||||
fprintf( stderr, "starting to move\n" );
|
|
||||||
char* moves = "drdluruldrdlrulurudlurdul";
|
char* moves = "drdluruldrdlrulurudlurdul";
|
||||||
do {
|
do {
|
||||||
fprintf( stderr, "move %c\n", moves[ i ]);
|
fprintf( stderr, "move %c\n", moves[ i ]);
|
||||||
|
|
Loading…
Reference in a new issue