diff options
author | P. J. McDermott <pjm@nac.net> | 2013-05-23 12:34:41 (EDT) |
---|---|---|
committer | P. J. McDermott <pjm@nac.net> | 2013-05-23 12:34:41 (EDT) |
commit | 68ed91597d150efaeca9f14d85eaa0c11f81b508 (patch) | |
tree | 3dc6a79f6150c0f8623a7d15967b4541cd5aa4b1 | |
parent | 7914bae789029ca775ebb182831746e1d60dedc3 (diff) | |
download | cursespong-68ed91597d150efaeca9f14d85eaa0c11f81b508.zip cursespong-68ed91597d150efaeca9f14d85eaa0c11f81b508.tar.gz cursespong-68ed91597d150efaeca9f14d85eaa0c11f81b508.tar.bz2 |
src/player.c: Better organize assignments.
-rw-r--r-- | src/player.c | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/src/player.c b/src/player.c index 8e9f07c..5d8c7b0 100644 --- a/src/player.c +++ b/src/player.c @@ -17,31 +17,24 @@ new_player(int id) p->score = 0; p->paddle_h.x = PADDLE_H_POS_START; - p->paddle_v.y = PADDLE_V_POS_START; - if (id == 0) { - p->paddle_h.y = BOARD_HEIGHT - 2; - p->paddle_v.x = 2; - } else { - p->paddle_h.y = 1; - p->paddle_v.x = BOARD_WIDTH - 2; - } + p->paddle_h.y = (id == 0) ? BOARD_HEIGHT - 2 : 1; p->paddle_h.width = PADDLE_H_SIZE_NORMAL; p->paddle_h.height = 1; - p->paddle_v.height = PADDLE_V_SIZE_NORMAL; - p->paddle_v.width = 1; - p->paddle_h.pos = &p->paddle_h.x; - p->paddle_v.pos = &p->paddle_v.y; p->paddle_h.size = &p->paddle_h.width; - p->paddle_v.size = &p->paddle_v.height; - p->paddle_h.speed = PADDLE_H_SPEED_NORMAL; - p->paddle_v.speed = PADDLE_V_SPEED_NORMAL; p->paddle_h.dir = 0; - p->paddle_v.dir = 0; - p->paddle_h.min_pos = 3; p->paddle_h.max_pos = BOARD_WIDTH - 2; + + p->paddle_v.x = (id == 0) ? 2 : BOARD_WIDTH - 2; + p->paddle_v.y = PADDLE_V_POS_START; + p->paddle_v.width = 1; + p->paddle_v.height = PADDLE_V_SIZE_NORMAL; + p->paddle_v.pos = &p->paddle_v.y; + p->paddle_v.size = &p->paddle_v.height; + p->paddle_v.speed = PADDLE_V_SPEED_NORMAL; + p->paddle_v.dir = 0; p->paddle_v.min_pos = 2; p->paddle_v.max_pos = BOARD_HEIGHT - 2; |