Ejemplo n.º 1
0
void GobGame::add_planet_and_station ( SpaceSprite *planet_sprite, int planet_index, SpaceSprite *station_sprite, const char *builds, const char *background)
{
	STACKTRACE;

	Planet *p = new GobPlanet (size/2, planet_sprite, planet_index);
	if (num_planets) while (true) {
		SpaceLocation *n;
		n = p->nearest_planet();
		if (!n || (p->distance(n) > 1900)) break;
		p->translate(random(size));
	}
	add ( p );

	GobStation *gs = new GobStation(station_sprite, p, builds, background);
	gs->collide_flag_sameship = ALL_LAYERS;
	gs->collide_flag_sameteam = ALL_LAYERS;
	gs->collide_flag_anyone = ALL_LAYERS;
	gs->change_owner(station_team);
	add ( gs );

	gobgame->planet[gobgame->num_planets] = p;
	gobgame->station[gobgame->num_planets] = gs;
	gobgame->num_planets += 1;
}