return isempty;
}
+block_t *drawblock (board_t *board, block_t *blocks, int nb_blocks, block_t *cblock, int *current, int *xblock, int *yblock, int *next)
+{
+ freeblock (cblock);
+
+ /* if not restarting a saved game */
+ if (cblock == NULL) {
+ if (*current == -1) {
+ *current = rand () % nb_blocks;
+ }
+ if (*next == -1) {
+ *next = rand () % nb_blocks;
+ }
+ } else {
+ *current = *next;
+ *next = rand () % nb_blocks;
+ }
+
+ cblock = copyblock (blocks + *current);
+ *xblock = board->width / 2;
+ *yblock = 0;
+
+ return cblock;
+}
+
/* vim: set ts=4 sw=4 et: */
void stackboard (board_t *board);
-int addline (board_t *board, int nbholes);
+int addline (board_t *board, int nbholes);
+
+block_t *drawblock (board_t *board, block_t *blocks, int nb_blocks, block_t *cblock, int *current, int *xblock, int *yblock, int *next);
#endif /* __FUNCTION_H__ */
return ret;
}
-block_t *drawblock (board_t *board, block_t *blocks, int nb_blocks, block_t *cblock, int *current, int *xblock, int *yblock, int *next)
-{
- freeblock (cblock);
-
- /* if not restarting a saved game */
- if (cblock == NULL) {
- if (*current == -1) {
- *current = rand () % nb_blocks;
- }
- if (*next == -1) {
- *next = rand () % nb_blocks;
- }
- } else {
- *current = *next;
- *next = rand () % nb_blocks;
- }
-
- cblock = copyblock (blocks + *current);
- *xblock = board->width / 2;
- *yblock = 0;
-
- return cblock;
-}
-
/* main function */
int main (int argc, char *argv[])
{