Example #1
0
void Game :: add_team (char * source_filename, int tanks_n)
{
	
	Team * team;
	
	int x;
	int y;
	
	int tank_i;
	
	team = new Team(this, source_filename, this->teams.size());
	
	this->teams.push_back(team);
	
	for (tank_i = 0; tank_i < tanks_n; tank_i++)
	{
		x = rand() % GAME_WIDTH;
		y = rand() % GAME_HEIGHT;
		while (this->location_free(x, y, true) == false)
		{
			x = rand() % GAME_WIDTH;
			y = rand() % GAME_HEIGHT;
		}
		
		team->add_tank(x, y);
	}
	
	team->place_flag_randomly();
	
}