Browse Source

inlined getter functions

feature/2015
Christian Kroll 14 years ago
parent
commit
fd016d9950
  1. 20
      games/tetris/piece.c
  2. 20
      games/tetris/piece.h

20
games/tetris/piece.c

@ -66,26 +66,6 @@ void tetris_piece_rotate(tetris_piece_t *pPc,
}
void tetris_piece_setShape(tetris_piece_t *pPc,
tetris_piece_shape_t shape)
{
assert(pPc != NULL);
assert((shape >= 0) && (shape <= TETRIS_PC_Z));
pPc->shape = shape;
}
void tetris_piece_setAngle(tetris_piece_t *pPc,
tetris_piece_angle_t angle)
{
assert(pPc != NULL);
assert((angle >= TETRIS_PC_ANGLE_0) && (angle <= TETRIS_PC_ANGLE_270));
pPc->angle = angle;
}
int8_t tetris_piece_getAngleCount(tetris_piece_t *pPc)
{
assert(pPc != NULL);

20
games/tetris/piece.h

@ -112,8 +112,14 @@ void tetris_piece_rotate(tetris_piece_t *pPc,
* @param pPc piece to change
* @param shape the shape of interest
*/
void tetris_piece_setShape(tetris_piece_t *pPc,
tetris_piece_shape_t shape);
inline static void tetris_piece_setShape(tetris_piece_t *pPc,
tetris_piece_shape_t shape)
{
assert(pPc != NULL);
assert((shape >= 0) && (shape <= TETRIS_PC_Z));
pPc->shape = shape;
}
/**
@ -121,8 +127,14 @@ void tetris_piece_setShape(tetris_piece_t *pPc,
* @param pPc piece to change
* @param angle the angle of interest
*/
void tetris_piece_setAngle(tetris_piece_t *pPc,
tetris_piece_angle_t angle);
inline static void tetris_piece_setAngle(tetris_piece_t *pPc,
tetris_piece_angle_t angle)
{
assert(pPc != NULL);
assert((angle >= TETRIS_PC_ANGLE_0) && (angle <= TETRIS_PC_ANGLE_270));
pPc->angle = angle;
}
/**

Loading…
Cancel
Save