Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fixed bug in easter_egg2

  • Loading branch information...
commit 2a710b08d07999abaecdbed792123b01250da9c2 1 parent 46ee487
@stocyr authored
Showing with 7 additions and 2 deletions.
  1. +7 −2 src/LaserChess.c
View
9 src/LaserChess.c
@@ -692,8 +692,13 @@ void easter_egg2(void)
draw_playground();
// Food generieren: dazu position in sein struct geschrieben, dann wird er gezeichnet.
- food.Pos.x = PLAYGROUND_X_MAX * rand() / RAND_MAX;
- food.Pos.y = PLAYGROUND_Y_MAX * rand() / RAND_MAX;
+ do
+ {
+ food.Pos.x = PLAYGROUND_X_MAX * rand() / RAND_MAX;
+ food.Pos.y = PLAYGROUND_Y_MAX * rand() / RAND_MAX;
+ }
+ while(food.Pos.x == snake[head].x && food.Pos.y == snake[head].y); // solange, bis food auf leerem feld
+
map[food.Pos.x][food.Pos.y] = &food;
draw_figure(&food);
Please sign in to comment.
Something went wrong with that request. Please try again.