summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorP. J. McDermott <pjm@nac.net>2013-05-21 18:22:53 (EDT)
committer P. J. McDermott <pjm@nac.net>2013-05-21 18:23:27 (EDT)
commit4e6e4ab53d3d43725f117c0dbf613b2bd9c7794c (patch)
treeea6cbf42c49cddfae32841d0108c1fc357aace47
parent456372dc946a7562126047b5e179da32a6cee4be (diff)
downloadcursespong-4e6e4ab53d3d43725f117c0dbf613b2bd9c7794c.zip
cursespong-4e6e4ab53d3d43725f117c0dbf613b2bd9c7794c.tar.gz
cursespong-4e6e4ab53d3d43725f117c0dbf613b2bd9c7794c.tar.bz2
Write a stub update_ball().
-rw-r--r--src/ball.c6
-rw-r--r--src/ball.h1
-rw-r--r--src/game.c4
3 files changed, 11 insertions, 0 deletions
diff --git a/src/ball.c b/src/ball.c
index b0361cc..e816057 100644
--- a/src/ball.c
+++ b/src/ball.c
@@ -26,6 +26,12 @@ free_ball(struct ball *b)
}
void
+update_ball(struct ball *b)
+{
+ ++b;
+}
+
+void
draw_ball(struct ball *b)
{
mvprintw(b->y, b->x, "o");
diff --git a/src/ball.h b/src/ball.h
index 9f30a83..6090c8e 100644
--- a/src/ball.h
+++ b/src/ball.h
@@ -14,6 +14,7 @@ struct ball {
struct ball *new_ball(int x, int y);
void free_ball(struct ball *b);
+void update_ball(struct ball *b);
void draw_ball(struct ball *b);
#endif
diff --git a/src/game.c b/src/game.c
index 56774af..c12d731 100644
--- a/src/game.c
+++ b/src/game.c
@@ -100,6 +100,10 @@ update(struct game *g)
update_paddle(&g->players[1]->paddle_h);
update_paddle(&g->players[1]->paddle_v);
+ for (b = g->balls_head; b != NULL; b = b->next) {
+ update_ball(b);
+ }
+
while (g->cur_balls < g->min_balls) {
b = new_ball(BALL_START_X_NORMAL, BALL_START_Y_NORMAL);
b->next = g->balls_head;