Ejemplo n.º 1
0
int		Map::addSnake(Snake &player)
{
  std::vector<int>::iterator	it;

  this->_map.assign((this->_x * this->_y), '.');
  for (it = player.getHead(); it != player.getTail(); ++it)
    {
      if (this->_map[*it] == '.')
	it == player.getTail() - 1 ? this->_map[*it] = 'H'
	  : this->_map[*it] = 'o';
      else if (this->_map[*it] == 'H' || this->_map[*it] == 'o')
	{
	  player.setCrash();
	  return (1);
	}
    }
  return (0);
}