示例#1
0
文件: ordem.c 项目: ataliba/codes
linha_t *last_linha(linha_t *lin, linha_t *last, unsigned int num){

  if(lin == NULL)
    return last;

  if(last == NULL)
    last = lin; 

  if(compara(field_get(lin->fie, num), field_get(last->fie, num)) == 1)
    last = lin;

  return last_linha(lin->next, last, num);
}
示例#2
0
文件: block.c 项目: yjerem/tetrellis
int collision(Block * block, Field field) {
  int i, j;

  // first check for field boundaries
  if (block->x < 0 || block->x + real_shape_width(block->shape, block->rot) > FIELD_WIDTH || block->y >= FIELD_HEIGHT) {
    return 1;
  }

  // now for tiles
  for (i = 0; i < SHAPE_HEIGHT; i++) {
    for (j = 0; j < SHAPE_WIDTH; j++) {
      if (shapes[block->shape][block->rot][i][j]) {
        if (! NULL_SHAPE(field_get(field, block->x + j, block->y + i))) {
          return 1;
        }
      }
    }
  }

  return 0;
}